ScummVM API documentation
GuiTypes.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_GUI_TYPES_H
29 #define HPL_GUI_TYPES_H
30 
31 #include "common/keyboard.h"
32 #include "common/list.h"
33 #include "hpl1/engine/graphics/GraphicsTypes.h"
34 #include "hpl1/engine/input/InputTypes.h"
35 #include "hpl1/engine/math/MathTypes.h"
36 
37 namespace hpl {
38 
39 //--------------------------------
40 
41 enum eGuiMouseButton {
42  eGuiMouseButton_Left = 0x00000001,
43  eGuiMouseButton_Middle = 0x00000002,
44  eGuiMouseButton_Right = 0x00000004,
45  eGuiMouseButton_LastEnum = 4
46 };
47 
48 //--------------------------------
49 
50 enum eGuiArrowKey {
51  eGuiArrowKey_Left,
52  eGuiArrowKey_Right,
53  eGuiArrowKey_Up,
54  eGuiArrowKey_Down,
55  eGuiArrowKey_LastEnum
56 };
57 
58 //--------------------------------
59 
60 enum eGuiMaterial {
61  eGuiMaterial_Diffuse,
62  eGuiMaterial_Alpha,
63  eGuiMaterial_FontNormal,
64  eGuiMaterial_Additive,
65  eGuiMaterial_Modulative,
66  eGuiMaterial_LastEnum,
67 };
68 
69 //--------------------------------
70 
71 enum eWidgetType {
72  eWidgetType_Root,
73  eWidgetType_Window,
74  eWidgetType_Button,
75  eWidgetType_Frame,
76  eWidgetType_Label,
77  eWidgetType_Slider,
78  eWidgetType_TextBox,
79  eWidgetType_CheckBox,
80  eWidgetType_Image,
81  eWidgetType_ListBox,
82  eWidgetType_ComboBox,
83 
84  eWidgetType_User,
85  eWidgetType_LastEnum,
86 };
87 
88 //--------------------------------
89 
90 enum eGuiSkinFont {
91  eGuiSkinFont_Default,
92  eGuiSkinFont_Disabled,
93  eGuiSkinFont_WindowLabel,
94 
95  eGuiSkinFont_LastEnum
96 };
97 
98 //--------------------------------
99 
100 enum eGuiSkinAttribute {
101  eGuiSkinAttribute_WindowLabelTextOffset,
102 
103  eGuiSkinAttribute_ButtonPressedContentOffset,
104 
105  eGuiSkinAttribute_SliderButtonSize,
106 
107  eGuiSkinAttribute_ListBoxSliderWidth,
108 
109  eGuiSkinAttribute_ComboBoxButtonWidth,
110  eGuiSkinAttribute_ComboBoxSliderWidth,
111 
112  eGuiSkinAttribute_LastEnum
113 };
114 //--------------------------------
115 
116 enum eGuiSkinGfx {
118  // Pointer
119  eGuiSkinGfx_PointerNormal,
120  eGuiSkinGfx_PointerText,
121 
123  // Window
124  eGuiSkinGfx_WindowBorderRight,
125  eGuiSkinGfx_WindowBorderLeft,
126  eGuiSkinGfx_WindowBorderUp,
127  eGuiSkinGfx_WindowBorderDown,
128 
129  eGuiSkinGfx_WindowCornerLU,
130  eGuiSkinGfx_WindowCornerRU,
131  eGuiSkinGfx_WindowCornerRD,
132  eGuiSkinGfx_WindowCornerLD,
133 
134  eGuiSkinGfx_WindowLabel,
135  eGuiSkinGfx_WindowBackground,
136 
138  // Frame
139  eGuiSkinGfx_FrameBorderRight,
140  eGuiSkinGfx_FrameBorderLeft,
141  eGuiSkinGfx_FrameBorderUp,
142  eGuiSkinGfx_FrameBorderDown,
143 
144  eGuiSkinGfx_FrameCornerLU,
145  eGuiSkinGfx_FrameCornerRU,
146  eGuiSkinGfx_FrameCornerRD,
147  eGuiSkinGfx_FrameCornerLD,
148 
149  eGuiSkinGfx_FrameBackground,
150 
152  // Check Box
153  eGuiSkinGfx_CheckBoxEnabledUnchecked,
154  eGuiSkinGfx_CheckBoxEnabledChecked,
155  eGuiSkinGfx_CheckBoxDisabledUnchecked,
156  eGuiSkinGfx_CheckBoxDisabledChecked,
157 
159  // Text Box
160  eGuiSkinGfx_TextBoxBackground,
161  eGuiSkinGfx_TextBoxSelectedTextBack,
162  eGuiSkinGfx_TextBoxMarker,
163 
165  // List Box
166  eGuiSkinGfx_ListBoxBackground,
167 
169  // Combo Box
170  eGuiSkinGfx_ComboBoxButtonIcon,
171 
172  eGuiSkinGfx_ComboBoxBorderRight,
173  eGuiSkinGfx_ComboBoxBorderLeft,
174  eGuiSkinGfx_ComboBoxBorderUp,
175  eGuiSkinGfx_ComboBoxBorderDown,
176 
177  eGuiSkinGfx_ComboBoxCornerLU,
178  eGuiSkinGfx_ComboBoxCornerRU,
179  eGuiSkinGfx_ComboBoxCornerRD,
180  eGuiSkinGfx_ComboBoxCornerLD,
181 
182  eGuiSkinGfx_ComboBoxBackground,
183 
185  // Slider
186  eGuiSkinGfx_SliderVertArrowUp,
187  eGuiSkinGfx_SliderVertArrowDown,
188  eGuiSkinGfx_SliderVertBackground,
189 
190  eGuiSkinGfx_SliderHoriArrowUp,
191  eGuiSkinGfx_SliderHoriArrowDown,
192  eGuiSkinGfx_SliderHoriBackground,
193 
195  // Button
196  eGuiSkinGfx_ButtonUpBorderRight,
197  eGuiSkinGfx_ButtonUpBorderLeft,
198  eGuiSkinGfx_ButtonUpBorderUp,
199  eGuiSkinGfx_ButtonUpBorderDown,
200 
201  eGuiSkinGfx_ButtonUpCornerLU,
202  eGuiSkinGfx_ButtonUpCornerRU,
203  eGuiSkinGfx_ButtonUpCornerRD,
204  eGuiSkinGfx_ButtonUpCornerLD,
205 
206  eGuiSkinGfx_ButtonUpBackground,
207 
208  eGuiSkinGfx_ButtonDownBorderRight,
209  eGuiSkinGfx_ButtonDownBorderLeft,
210  eGuiSkinGfx_ButtonDownBorderUp,
211  eGuiSkinGfx_ButtonDownBorderDown,
212 
213  eGuiSkinGfx_ButtonDownCornerLU,
214  eGuiSkinGfx_ButtonDownCornerRU,
215  eGuiSkinGfx_ButtonDownCornerRD,
216  eGuiSkinGfx_ButtonDownCornerLD,
217 
218  eGuiSkinGfx_ButtonDownBackground,
219 
220  eGuiSkinGfx_LastEnum,
221 };
222 
223 //---------------------------------------------
224 
225 enum eWidgetSliderOrientation {
226  eWidgetSliderOrientation_Horisontal,
227  eWidgetSliderOrientation_Vertical,
228  eWidgetSliderOrientation_LastEnum
229 };
230 
231 //--------------------------------
232 
233 enum eGuiMessage {
234  eGuiMessage_MouseMove, // pos= mouse pos, lVal=buttons down
235  eGuiMessage_MouseDown, // pos= mouse pos, lVal=button
236  eGuiMessage_MouseUp, // pos= mouse pos, lVal=button
237  eGuiMessage_MouseDoubleClick, // pos= mouse pos, lVal=button
238  eGuiMessage_MouseEnter, // pos= mouse pos, lVal=buttons down
239  eGuiMessage_MouseLeave, // pos= mouse pos, lVal=buttons down
240 
241  eGuiMessage_GotFocus, // pos= mouse pos, lVal=buttons down
242  eGuiMessage_LostFocus, // pos= mouse pos, lVal=buttons down
243 
244  eGuiMessage_OnDraw, // fVal = TimeStep, data = clipregion pointer
245 
246  eGuiMessage_ButtonPressed, // pos= mouse pos, lVal=buttons down
247 
248  eGuiMessage_TextChange, // nothing
249 
250  eGuiMessage_CheckChange, // lVal = checked or not.
251 
252  eGuiMessage_KeyPress, // pos= mouse pos, lVal=char code.
253 
254  eGuiMessage_SliderMove, // val=slider value
255 
256  eGuiMessage_SelectionChange, // val=selected val
257 
258  eGuiMessage_LastEnum,
259 };
260 
261 //--------------------------------
262 
264  cGuiMessageData() {}
265  cGuiMessageData(const cVector2f &avPos, const cVector2f &avRel) {
266  mvPos = avPos;
267  mvRel = avRel;
268  }
269  cGuiMessageData(const cVector2f &avPos, const cVector2f &avRel, int alVal) {
270  mvPos = avPos;
271  mvRel = avRel;
272  mlVal = alVal;
273  }
274  cGuiMessageData(int alVal) {
275  mlVal = alVal;
276  }
277  cGuiMessageData(float afVal) {
278  mfVal = afVal;
279  }
280  cGuiMessageData(Common::KeyState aKeyPress) {
281  mKeyPress = aKeyPress;
282  }
283 
284  cVector2f mvPos;
285  cVector2f mvRel;
286  int mlVal;
287  Common::KeyState mKeyPress;
288  float mfVal;
289  void *mpData;
290  eGuiMessage mMessage;
291 };
292 
293 //--------------------------------
294 
295 class iWidget;
296 
297 typedef bool (*tGuiCallbackFunc)(void *, iWidget *, cGuiMessageData &);
298 
299 #define kGuiCalllbackDeclarationEnd(FuncName) \
300  static bool FuncName##_static_gui(void *apObject, iWidget *apWidget, cGuiMessageData &aData)
301 
302 #define kGuiCalllbackDeclaredFuncEnd(ThisClass, FuncName) \
303  bool ThisClass::FuncName##_static_gui(void *apObject, iWidget *apWidget, cGuiMessageData &aData) { \
304  return ((ThisClass *)apObject)->FuncName(apWidget, aData); \
305  }
306 
307 #define kGuiCalllbackFuncEnd(ThisClass, FuncName) \
308  static bool FuncName##_static_gui(void *apObject, iWidget *apWidget, cGuiMessageData &aData) { \
309  return ((ThisClass *)apObject)->FuncName(apWidget, aData); \
310  }
311 
312 #define kGuiCallback(FuncName) &FuncName##_static_gui
313 
314 //--------------------------------
315 
318 
319 //--------------------------------
320 
321 class cGuiGfxElement;
322 
325 
326 //--------------------------------
327 
328 } // namespace hpl
329 
330 #endif // HPL_GAME_TYPES_H
Definition: AI.h:36
Definition: GuiGfxElement.h:72
Definition: GuiTypes.h:263
Definition: Widget.h:65
Definition: keyboard.h:294
Definition: list_intern.h:51