[4838] | 1 | /*! |
---|
[7892] | 2 | * @file glgui_inputline.h |
---|
| 3 | * The gl_INPUTLINE widget of th openglGUI |
---|
[5360] | 4 | * |
---|
| 5 | */ |
---|
[1853] | 6 | |
---|
[7892] | 7 | #ifndef _GLGUI_INPUTLINE_H |
---|
| 8 | #define _GLGUI_INPUTLINE_H |
---|
[1853] | 9 | |
---|
[5365] | 10 | #include "glgui_widget.h" |
---|
[7892] | 11 | #include "text.h" |
---|
[7893] | 12 | #include "event.h" |
---|
[1853] | 13 | |
---|
[4838] | 14 | // FORWARD DECLARATION |
---|
[7779] | 15 | namespace OrxGui |
---|
| 16 | { |
---|
[3543] | 17 | |
---|
[8035] | 18 | //! This is InputLine part of the openglGUI class |
---|
[7779] | 19 | /** |
---|
[8035] | 20 | * The InputLine is a Widget, that displays a Line, that can be manipulated through |
---|
| 21 | * Writing Text on it. |
---|
[7779] | 22 | * |
---|
[8035] | 23 | * Whenever the Text is changed the textChanged signal is emitted. |
---|
[7779] | 24 | */ |
---|
[7892] | 25 | class GLGuiInputLine : public OrxGui::GLGuiWidget |
---|
[7779] | 26 | { |
---|
[3543] | 27 | |
---|
[7779] | 28 | public: |
---|
[7892] | 29 | GLGuiInputLine(); |
---|
| 30 | virtual ~GLGuiInputLine(); |
---|
[2036] | 31 | |
---|
[1853] | 32 | |
---|
[8035] | 33 | /** @returns the text of the inputLine */ |
---|
| 34 | const std::string& getText() const { return this->text.getText(); }; |
---|
| 35 | |
---|
[7892] | 36 | void setText(const std::string& text); |
---|
| 37 | void append(const std::string& appendText); |
---|
[7893] | 38 | void appendCharacter(char character); |
---|
[7892] | 39 | void removeCharacters(unsigned int chars); |
---|
[1853] | 40 | |
---|
[7896] | 41 | virtual void removedFocus(); |
---|
| 42 | |
---|
[7894] | 43 | virtual void tick(float dt); |
---|
[7892] | 44 | virtual void draw() const; |
---|
| 45 | |
---|
[7893] | 46 | virtual bool processEvent(const Event& event); |
---|
| 47 | |
---|
[8035] | 48 | DeclareSignal1(textChanged, const std::string&); |
---|
[7894] | 49 | |
---|
[8035] | 50 | private: |
---|
| 51 | void init(); |
---|
| 52 | void resize(); |
---|
[8116] | 53 | virtual void hiding(); |
---|
| 54 | virtual void showing(); |
---|
[7894] | 55 | |
---|
[7779] | 56 | private: |
---|
[7894] | 57 | Text text; //!< The Text to display inside of the InputLine. |
---|
| 58 | |
---|
| 59 | Uint16 pressedKey; //!< the pressed key that will be repeated. |
---|
| 60 | Uint16 pressedKeyName; //!< The Name of the Key, that was pressed. |
---|
| 61 | |
---|
| 62 | float delayNext; //!< How much time must pass before next output. |
---|
| 63 | |
---|
[8035] | 64 | static float repeatDelay; //!< Repead Delay. |
---|
| 65 | static float repeatRate; //!< Repeat Rate. |
---|
[7779] | 66 | }; |
---|
| 67 | } |
---|
[1853] | 68 | |
---|
[7892] | 69 | #endif /* _GLGUI_INPUTLINE_H */ |
---|