Sort include order.
[gemrb.git] / gemrb / core / MapControl.h
blob866bdf64b7bf72e8fcc0d97f98b20216a3a4cc5f
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 MapControl.h
23 * Declares MapControl, widget for displaying current area map
26 class MapControl;
28 #ifndef MAPCONTROL_H
29 #define MAPCONTROL_H
31 #include "exports.h"
32 #include "Control.h"
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
41 /**
42 * @class MapControl
43 * Widget displaying current area map, with a viewport rectangle
44 * and PCs' ground circles
47 class GEM_EXPORT MapControl : public Control {
48 public:
49 int ScrollX, ScrollY;
50 int NotePosX, NotePosY;
51 unsigned short lastMouseX, lastMouseY;
52 bool mouseIsDown;
53 bool mouseIsDragging;
54 bool convertToGame;
55 // Small map bitmap
56 Sprite2D* MapMOS;
57 // current map
58 Map *MyMap;
59 // map flags
60 Sprite2D *Flag[8];
61 // The MapControl can set the text of this label directly
62 Control *LinkedLabel;
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;
72 MapControl(void);
73 ~MapControl(void);
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 */
80 void Realize();
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,
92 unsigned short Mod);
93 /** Mouse Button Up */
94 void OnMouseUp(unsigned short x, unsigned short y, unsigned short Button,
95 unsigned short Mod);
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);
102 private:
103 /** Call event handler on click */
104 void ClickHandle(unsigned short Button);
105 /** Move viewport */
106 void ViewHandle(unsigned short x, unsigned short y);
109 #endif