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 MapControl, widget for displaying current area map
33 #include "Interface.h"
35 // !!! Keep these synchronized with GUIDefines.py !!!
36 #define IE_GUI_MAP_ON_PRESS 0x09000000
37 #define IE_GUI_MAP_ON_RIGHT_PRESS 0x09000005
38 #define IE_GUI_MAP_ON_DOUBLE_PRESS 0x09000008
43 * Widget displaying current area map, with a viewport rectangle
44 * and PCs' ground circles
47 class GEM_EXPORT MapControl
: public Control
{
50 int NotePosX
, NotePosY
;
51 unsigned short lastMouseX
, lastMouseY
;
61 // The MapControl can set the text of this label directly
63 // Size of big map (area) in pixels
64 short MapWidth
, MapHeight
;
65 // Size of area viewport. FIXME: hack!
66 short ViewWidth
, ViewHeight
;
67 short XCenter
, YCenter
;
68 EventHandler MapControlOnPress
;
69 EventHandler MapControlOnRightPress
;
70 EventHandler MapControlOnDoublePress
;
74 /** redraws the control after its associated variable has changed */
75 void RedrawMapControl(const char *VariableName
, unsigned int Sum
);
76 /** Draws the Control on the Output Display */
77 void Draw(unsigned short XWin
, unsigned short YWin
);
78 void DrawFog(unsigned short XWin
, unsigned short YWin
);
79 /** Compute parameters after changes in control's or screen geometry */
81 /** Sets the Text of the current control */
82 int SetText(const char* /*string*/, int /*pos*/) { return 0; }
84 /** Key Press Event */
85 void OnKeyPress(unsigned char Key
, unsigned short Mod
);
86 /** Mouse Over Event */
87 void OnMouseOver(unsigned short x
, unsigned short y
);
88 /** Mouse Leave Event */
89 void OnMouseLeave(unsigned short x
, unsigned short y
);
90 /** Mouse Button Down */
91 void OnMouseDown(unsigned short x
, unsigned short y
, unsigned short Button
,
93 /** Mouse Button Up */
94 void OnMouseUp(unsigned short x
, unsigned short y
, unsigned short Button
,
96 /** Key Release Event */
97 void OnKeyRelease(unsigned char Key
, unsigned short Mod
);
98 /** Special Key Press */
99 void OnSpecialKeyPress(unsigned char Key
);
100 /** Set handler for specified event */
101 bool SetEvent(int eventType
, const char *handler
);
103 /** Call event handler on click */
104 void ClickHandle(unsigned short Button
);
106 void ViewHandle(unsigned short x
, unsigned short y
);