2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2002-11-21 12:48:50 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-11-21 12:48:50 +00:00
|
|
|
*/
|
|
|
|
|
2010-11-16 10:11:57 +00:00
|
|
|
#ifndef GUI_WIDGETS_EDITTEXT_H
|
|
|
|
#define GUI_WIDGETS_EDITTEXT_H
|
2002-11-21 12:48:50 +00:00
|
|
|
|
2010-11-16 10:11:57 +00:00
|
|
|
#include "gui/widgets/editable.h"
|
2002-11-21 12:48:50 +00:00
|
|
|
#include "common/str.h"
|
|
|
|
|
2003-11-10 23:40:48 +00:00
|
|
|
namespace GUI {
|
|
|
|
|
2002-11-21 12:48:50 +00:00
|
|
|
/* EditTextWidget */
|
2005-01-29 16:30:51 +00:00
|
|
|
class EditTextWidget : public EditableWidget {
|
2002-11-21 12:48:50 +00:00
|
|
|
protected:
|
2005-01-29 16:30:51 +00:00
|
|
|
typedef Common::String String;
|
|
|
|
|
2003-03-06 19:52:54 +00:00
|
|
|
String _backupString;
|
2005-01-29 16:30:51 +00:00
|
|
|
|
2006-05-18 20:53:28 +00:00
|
|
|
int _leftPadding;
|
|
|
|
int _rightPadding;
|
|
|
|
|
2002-11-21 12:48:50 +00:00
|
|
|
public:
|
2011-04-16 13:18:59 +00:00
|
|
|
EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, const char *tooltip = 0, uint32 cmd = 0, uint32 finishCmd = 0);
|
|
|
|
EditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltp = 0, uint32 cmd = 0, uint32 finishCmd = 0);
|
2002-11-21 12:48:50 +00:00
|
|
|
|
2005-01-29 18:04:34 +00:00
|
|
|
void setEditString(const String &str);
|
2005-01-29 16:30:51 +00:00
|
|
|
|
2002-11-21 12:48:50 +00:00
|
|
|
virtual void handleMouseDown(int x, int y, int button, int clickCount);
|
|
|
|
|
2005-04-06 15:21:32 +00:00
|
|
|
virtual bool wantsFocus() { return true; }
|
2002-11-21 12:48:50 +00:00
|
|
|
|
2006-08-04 13:55:53 +00:00
|
|
|
virtual void reflowLayout();
|
2006-05-18 20:53:28 +00:00
|
|
|
|
2002-11-21 12:48:50 +00:00
|
|
|
protected:
|
2007-11-04 03:38:30 +00:00
|
|
|
void drawWidget();
|
2005-01-29 16:30:51 +00:00
|
|
|
void receivedFocusWidget();
|
|
|
|
void lostFocusWidget();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-01-29 16:30:51 +00:00
|
|
|
void startEditMode();
|
|
|
|
void endEditMode();
|
|
|
|
void abortEditMode();
|
2003-05-05 16:10:19 +00:00
|
|
|
|
2005-01-29 16:30:51 +00:00
|
|
|
Common::Rect getEditRect() const;
|
2011-04-16 13:18:59 +00:00
|
|
|
|
|
|
|
uint32 _finishCmd;
|
2002-11-21 12:48:50 +00:00
|
|
|
};
|
|
|
|
|
2003-11-10 23:40:48 +00:00
|
|
|
} // End of namespace GUI
|
|
|
|
|
2002-11-21 12:48:50 +00:00
|
|
|
#endif
|