2002-11-21 12:48:50 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2002-2006 The ScummVM project
|
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
|
|
|
*
|
2006-02-11 10:08:56 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-11-21 12:48:50 +00:00
|
|
|
*/
|
|
|
|
|
2005-01-29 16:30:51 +00:00
|
|
|
#ifndef GUI_EDITTEXTWIDGET_H
|
|
|
|
#define GUI_EDITTEXTWIDGET_H
|
2002-11-21 12:48:50 +00:00
|
|
|
|
2005-01-29 16:30:51 +00:00
|
|
|
#include "gui/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:
|
2006-05-31 12:09:00 +00:00
|
|
|
EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text);
|
2006-06-03 13:33:39 +00:00
|
|
|
EditTextWidget(GuiObject *boss, const String &name, const String &text);
|
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:
|
|
|
|
void drawWidget(bool hilite);
|
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;
|
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
|