1 /* GemRB - Infinity Engine Emulator
2 * Copyright (C) 2003 The GemRB Project
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * Declares TextEdit widget for displaying single line text input field
24 * @author The GemRB Project
32 #include "RGBAColor.h"
37 // !!! Keep these synchronized with GUIDefines.py
38 #define IE_GUI_EDIT_ON_CHANGE 0x03000000
39 #define IE_GUI_EDIT_ON_DONE 0x03000001
40 #define IE_GUI_EDIT_ON_CANCEL 0x03000002
42 //this is stored in 'Value' of Control class
43 #define IE_GUI_EDIT_NUMBER 1
47 * Widget displaying single line text input field
50 class GEM_EXPORT TextEdit
: public Control
{
52 TextEdit(unsigned short maxLength
, unsigned short x
, unsigned short y
);
54 /** Draws the Control on the Output Display */
55 void Draw(unsigned short x
, unsigned short y
);
57 void SetFont(Font
* f
);
60 void SetCursor(Sprite2D
* cur
);
62 void SetBackGround(Sprite2D
* back
);
63 /** Sets the Text of the current control */
64 int SetText(const char* string
, int pos
= 0);
65 /** Sets the Text of the current control */
66 const char* QueryText();
67 /** Sets the buffer length */
68 void SetBufferLength(ieWord buflen
);
70 /** Text Editing Cursor Sprite */
76 /** Max Edit Text Length */
78 /** Client area position */
79 unsigned short FontPosX
, FontPosY
;
81 unsigned char* Buffer
;
82 /** Cursor Position */
83 unsigned short CurPos
;
87 /** Key Press Event */
88 void OnKeyPress(unsigned char Key
, unsigned short Mod
);
89 /** Special Key Press */
90 void OnSpecialKeyPress(unsigned char Key
);
91 /** Set handler for specified event */
92 bool SetEvent(int eventType
, const char *handler
);
93 /** OnChange Scripted Event Function Name */
94 EventHandler EditOnChange
;
95 EventHandler EditOnDone
;
96 EventHandler EditOnCancel
;