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 Console widget, input field for direct poking into GemRB innards.
24 * @author The GemRB Project
37 * Widget displaying debugging console, input field for direct poking
39 * The console accepts and executes python statements and has already
40 * GemRB python module loaded, so almost any command
41 * from GUIScripts can be used.
44 /** the number of remembered lines in the cheat console*/
45 #define HISTORY_SIZE 5
47 class Console
: public Control
{
51 /** Draws the Console on the Output Display */
52 void Draw(unsigned short x
, unsigned short y
);
54 void SetFont(Font
* f
);
56 void SetCursor(Sprite2D
* cur
);
58 void SetBackGround(Sprite2D
* back
);
59 /** Sets the Text of the current control */
60 int SetText(const char* string
, int pos
= 0);
62 /** Text Editing Cursor Sprite */
68 /** Max Edit Text Length */
71 unsigned char* Buffer
;
73 unsigned char* History
[HISTORY_SIZE
];
74 /** Cursor Position */
75 unsigned short CurPos
;
76 /** History Position and size */
77 unsigned short HistPos
, HistMax
;
82 /** Key Press Event */
83 void OnKeyPress(unsigned char Key
, unsigned short Mod
);
84 /** Special Key Press */
85 void OnSpecialKeyPress(unsigned char Key
);
86 bool SetEvent(int eventType
, EventHandler handler
);
89 void HistoryForward();
90 void HistoryAdd(bool force
);