[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); |
---|
[8518] | 40 | void clear(); |
---|
[1853] | 41 | |
---|
[8518] | 42 | void clearOnEnter(bool clear = true) { this->_clearOnEnter = clear; }; |
---|
| 43 | |
---|
[7896] | 44 | virtual void removedFocus(); |
---|
| 45 | |
---|
[7894] | 46 | virtual void tick(float dt); |
---|
[7892] | 47 | virtual void draw() const; |
---|
| 48 | |
---|
[7893] | 49 | virtual bool processEvent(const Event& event); |
---|
| 50 | |
---|
[8035] | 51 | DeclareSignal1(textChanged, const std::string&); |
---|
[8518] | 52 | DeclareSignal1(enterPushed, const std::string&); |
---|
[7894] | 53 | |
---|
[8448] | 54 | protected: |
---|
| 55 | virtual void updateFrontColor(); |
---|
[8116] | 56 | virtual void hiding(); |
---|
| 57 | virtual void showing(); |
---|
[8448] | 58 | virtual void resize(); |
---|
[7894] | 59 | |
---|
[8448] | 60 | |
---|
[7779] | 61 | private: |
---|
[8448] | 62 | void init(); |
---|
[8518] | 63 | void pushEnter(); |
---|
[8448] | 64 | void changedText(); |
---|
[7894] | 65 | |
---|
[8518] | 66 | |
---|
[8448] | 67 | private: |
---|
| 68 | Text _text; //!< The Text to display inside of the InputLine. |
---|
[8518] | 69 | bool _clearOnEnter; //!< Clear on Enter |
---|
[8448] | 70 | |
---|
[7894] | 71 | Uint16 pressedKey; //!< the pressed key that will be repeated. |
---|
| 72 | Uint16 pressedKeyName; //!< The Name of the Key, that was pressed. |
---|
| 73 | |
---|
| 74 | float delayNext; //!< How much time must pass before next output. |
---|
| 75 | |
---|
[8035] | 76 | static float repeatDelay; //!< Repead Delay. |
---|
| 77 | static float repeatRate; //!< Repeat Rate. |
---|
[7779] | 78 | }; |
---|
| 79 | } |
---|
[1853] | 80 | |
---|
[7892] | 81 | #endif /* _GLGUI_INPUTLINE_H */ |
---|