diff options
Diffstat (limited to 'src/gui/textfield.h')
-rw-r--r-- | src/gui/textfield.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/gui/textfield.h b/src/gui/textfield.h index 3570f89d..73824615 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -25,6 +25,13 @@ #include <guichan/widgets/textfield.hpp> class ImageRect; +class TextField; + +class TextFieldListener +{ + public: + virtual void listen(const TextField *value) = 0; +}; /** * A text field. @@ -54,13 +61,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; } + + /** * Processes one keypress. */ 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 float mAlpha; static ImageRect skin; + bool mNumeric; + int mMinimum; + int mMaximum; + TextFieldListener *mListener; }; #endif |