1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
#ifndef LINE_EDIT_H
#define LINE_EDIT_H
#include <string>
#include <slimsig/slimsig.h>
#include "GuiElement.h"
namespace agui
{
class LineEdit : public GuiElement
{
public:
LineEdit(GuiElement* parent = NULL);
std::string GetContent() const
{
return content;
};
void SetContent(const std::string& line, bool moveCursor = true);
void SetFocus(bool focus);
void SetCrypt(bool focus);
slimsig::signal<void (void)> DefaultAction;
private:
virtual void DrawSelf() override;
virtual bool HandleEventSelf(const SDL_Event& ev) override;
bool hasFocus;
bool crypt;
std::string content;
unsigned cursorPos;
};
}
#endif
|