diff options
Diffstat (limited to 'src/gui/textfield.h')
-rw-r--r-- | src/gui/textfield.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/gui/textfield.h b/src/gui/textfield.h index 39bcbf85..0fc53f39 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -28,6 +28,14 @@ class ImageRect; +class TextField; + +class TextFieldListener +{ + public: + virtual void listen(const TextField *value) = 0; +}; + /** * A text field. * @@ -55,9 +63,48 @@ class TextField : public gcn::TextField { */ void drawFrame(gcn::Graphics *graphics); + /** + * Determine whether the field should be numeric or not + */ + void setNumeric(bool numeric); + + /** + * Set the range on the field if it is numeric + */ + void setRange(int min, int max) {mMinimum = min; mMaximum = max; } + + /** + * Restrict keyboard input if numeric + */ + void keyPressed(gcn::KeyEvent &keyEvent); + + /** + * Set the minimum value for a range + */ + void setMinimum(int min) {mMinimum = min; } + + /** + * Set the maximum value for a range + */ + void setMaximum(int max) {mMaximum = max; } + + /** + * Return the value for a numeric field + */ + int getValue() const; + + /** + * Add a listener + */ + void addListener(TextFieldListener *listener) {mListener = listener; } + private: static int instances; static ImageRect skin; + bool mNumeric; + int mMinimum; + int mMaximum; + TextFieldListener *mListener; }; #endif |