diff options
author | Douglas Boffey <DougABoffey@netscape.net> | 2008-09-04 16:56:10 +0000 |
---|---|---|
committer | Douglas Boffey <DougABoffey@netscape.net> | 2008-09-04 16:56:10 +0000 |
commit | 7946cd875877870e7cab002cba099d21cf9fc063 (patch) | |
tree | 38dd4c1c4a766edda7b3156e2bc1af08dbd94a6a /src/gui/textfield.h | |
parent | 27e8d20ad8b5590995d1d4af3563f8956f180373 (diff) | |
download | mana-7946cd875877870e7cab002cba099d21cf9fc063.tar.gz mana-7946cd875877870e7cab002cba099d21cf9fc063.tar.bz2 mana-7946cd875877870e7cab002cba099d21cf9fc063.tar.xz mana-7946cd875877870e7cab002cba099d21cf9fc063.zip |
Added code to change text colouring
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 |