1 | /*! |
---|
2 | * @file glgui_inputline.h |
---|
3 | * The gl_INPUTLINE widget of th openglGUI |
---|
4 | * |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _GLGUI_INPUTLINE_H |
---|
8 | #define _GLGUI_INPUTLINE_H |
---|
9 | |
---|
10 | #include "glgui_widget.h" |
---|
11 | #include "text.h" |
---|
12 | #include "event.h" |
---|
13 | |
---|
14 | // FORWARD DECLARATION |
---|
15 | namespace OrxGui |
---|
16 | { |
---|
17 | |
---|
18 | //! This is InputLine part of the openglGUI class |
---|
19 | /** |
---|
20 | * The InputLine is a Widget, that displays a Line, that can be manipulated through |
---|
21 | * Writing Text on it. |
---|
22 | * |
---|
23 | * Whenever the Text is changed the textChanged signal is emitted. |
---|
24 | */ |
---|
25 | class GLGuiInputLine : public OrxGui::GLGuiWidget |
---|
26 | { |
---|
27 | |
---|
28 | public: |
---|
29 | GLGuiInputLine(); |
---|
30 | virtual ~GLGuiInputLine(); |
---|
31 | |
---|
32 | |
---|
33 | /** @returns the text of the inputLine */ |
---|
34 | const std::string& getText() const { return this->text.getText(); }; |
---|
35 | |
---|
36 | void setText(const std::string& text); |
---|
37 | void append(const std::string& appendText); |
---|
38 | void appendCharacter(char character); |
---|
39 | void removeCharacters(unsigned int chars); |
---|
40 | |
---|
41 | virtual void removedFocus(); |
---|
42 | |
---|
43 | virtual void tick(float dt); |
---|
44 | virtual void draw() const; |
---|
45 | |
---|
46 | virtual bool processEvent(const Event& event); |
---|
47 | |
---|
48 | DeclareSignal1(textChanged, const std::string&); |
---|
49 | |
---|
50 | private: |
---|
51 | void init(); |
---|
52 | void resize(); |
---|
53 | virtual void hiding(); |
---|
54 | virtual void showing(); |
---|
55 | |
---|
56 | private: |
---|
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 | |
---|
64 | static float repeatDelay; //!< Repead Delay. |
---|
65 | static float repeatRate; //!< Repeat Rate. |
---|
66 | }; |
---|
67 | } |
---|
68 | |
---|
69 | #endif /* _GLGUI_INPUTLINE_H */ |
---|