Switch to using -I to find includes, rather than relative paths.
[gemrb.git] / gemrb / plugins / Core / TextEdit.h
blobcaf25fb1c9dd19e669a2f2d784d3b0a744aad20f
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.
21 /**
22 * @file TextEdit.h
23 * Declares TextEdit widget for displaying single line text input field
24 * @author The GemRB Project
27 #ifndef TEXTEDIT_H
28 #define TEXTEDIT_H
30 #include "exports.h"
31 #include "Control.h"
32 #include "RGBAColor.h"
33 #include "Font.h"
35 class Palette;
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
45 /**
46 * @class TextEdit
47 * Widget displaying single line text input field
50 class GEM_EXPORT TextEdit : public Control {
51 public:
52 TextEdit(unsigned short maxLength, unsigned short x, unsigned short y);
53 ~TextEdit(void);
54 /** Draws the Control on the Output Display */
55 void Draw(unsigned short x, unsigned short y);
56 /** Set Font */
57 void SetFont(Font* f);
58 Font *GetFont();
59 /** Set Cursor */
60 void SetCursor(Sprite2D* cur);
61 /** Set BackGround */
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);
69 private:
70 /** Text Editing Cursor Sprite */
71 Sprite2D* Cursor;
72 /** Text Font */
73 Font* font;
74 /** Background */
75 Sprite2D* Back;
76 /** Max Edit Text Length */
77 unsigned short max;
78 /** Client area position */
79 unsigned short FontPosX, FontPosY;
80 /** Text Buffer */
81 unsigned char* Buffer;
82 /** Cursor Position */
83 unsigned short CurPos;
84 /** Color Palette */
85 Palette* palette;
86 public: //Events
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;
99 #endif