[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 */ |
---|
[8448] | 34 | const std::string& _getText() const { return this->_text.getText(); }; |
---|
[8035] | 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 | |
---|
[8448] | 50 | protected: |
---|
| 51 | virtual void updateFrontColor(); |
---|
[8116] | 52 | virtual void hiding(); |
---|
| 53 | virtual void showing(); |
---|
[8448] | 54 | virtual void resize(); |
---|
[7894] | 55 | |
---|
[8448] | 56 | |
---|
[7779] | 57 | private: |
---|
[8448] | 58 | void init(); |
---|
| 59 | void changedText(); |
---|
[7894] | 60 | |
---|
[8448] | 61 | private: |
---|
| 62 | Text _text; //!< The Text to display inside of the InputLine. |
---|
| 63 | |
---|
[7894] | 64 | Uint16 pressedKey; //!< the pressed key that will be repeated. |
---|
| 65 | Uint16 pressedKeyName; //!< The Name of the Key, that was pressed. |
---|
| 66 | |
---|
| 67 | float delayNext; //!< How much time must pass before next output. |
---|
| 68 | |
---|
[8035] | 69 | static float repeatDelay; //!< Repead Delay. |
---|
| 70 | static float repeatRate; //!< Repeat Rate. |
---|
[7779] | 71 | }; |
---|
| 72 | } |
---|
[1853] | 73 | |
---|
[7892] | 74 | #endif /* _GLGUI_INPUTLINE_H */ |
---|