diff options
Diffstat (limited to 'gui/EditTextWidget.h')
-rw-r--r-- | gui/EditTextWidget.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/gui/EditTextWidget.h b/gui/EditTextWidget.h index 9955ad29e8..23410fa0c4 100644 --- a/gui/EditTextWidget.h +++ b/gui/EditTextWidget.h @@ -18,29 +18,27 @@ * $Header$ */ -#ifndef EDITTEXTWIDGET_H -#define EDITTEXTWIDGET_H +#ifndef GUI_EDITTEXTWIDGET_H +#define GUI_EDITTEXTWIDGET_H -#include "gui/widget.h" +#include "gui/editable.h" #include "common/str.h" namespace GUI { /* EditTextWidget */ -class EditTextWidget : public StaticTextWidget { -public: - typedef Common::StringList StringList; - typedef Common::String String; +class EditTextWidget : public EditableWidget { protected: + typedef Common::String String; + String _backupString; - bool _caretVisible; - uint32 _caretTime; - int _pos; - int _labelOffset; + public: EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text); - virtual void handleTickle(); +// void setString(const String &str) { _editString = str; } + const String &getString() const { return _editString; } + virtual void handleMouseDown(int x, int y, int button, int clickCount); virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers); @@ -48,10 +46,16 @@ public: protected: void drawWidget(bool hilite); - void drawCaret(bool erase); - void lostFocusWidget() { _backupString = _label; drawCaret(true); } + void receivedFocusWidget(); + void lostFocusWidget(); + + void startEditMode(); + void endEditMode(); + void abortEditMode(); - int getCaretPos() const; + Common::Rect getEditRect() const; + int getCaretOffset() const; + bool setCaretPos(int newPos); bool adjustOffset(); virtual bool tryInsertChar(char c, int pos); |