Started to merge the text editing code in ListWidget and EditTextWidget
svn-id: r16692
This commit is contained in:
parent
b6ea449335
commit
04fc9fe6e7
8 changed files with 319 additions and 187 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue