author | darkvater |
Tue, 07 Sep 2004 21:48:09 +0000 | |
changeset 176 | 84990c4b9212 |
parent 164 | 0cbdf3c9bde1 |
child 380 | 03dd36311cc1 |
permissions | -rw-r--r-- |
0 | 1 |
#ifndef WINDOW_H |
2 |
#define WINDOW_H |
|
3 |
||
4 |
typedef union WindowEvent WindowEvent; |
|
5 |
||
6 |
//typedef void WindowProc(Window *w, int event, int wparam, long lparam); |
|
7 |
||
8 |
typedef void WindowProc(Window *w, WindowEvent *e); |
|
9 |
||
10 |
typedef struct Widget { |
|
11 |
byte type; |
|
12 |
byte color; |
|
13 |
uint16 left, right, top, bottom; |
|
14 |
uint16 unkA; |
|
15 |
uint16 tooltips; |
|
16 |
} Widget; |
|
17 |
||
18 |
union WindowEvent { |
|
19 |
byte event; |
|
20 |
struct { |
|
21 |
byte event; |
|
22 |
Point pt; |
|
23 |
int widget; |
|
24 |
} click; |
|
25 |
||
26 |
struct { |
|
27 |
byte event; |
|
28 |
Point pt; |
|
29 |
uint tile; |
|
30 |
uint starttile; |
|
31 |
int userdata; |
|
32 |
} place; |
|
33 |
||
34 |
struct { |
|
35 |
byte event; |
|
36 |
Point pt; |
|
37 |
int widget; |
|
38 |
} dragdrop; |
|
39 |
||
40 |
struct { |
|
41 |
byte event; |
|
42 |
byte *str; |
|
43 |
} edittext; |
|
44 |
||
45 |
struct { |
|
46 |
byte event; |
|
47 |
Point pt; |
|
48 |
} popupmenu; |
|
49 |
||
50 |
struct { |
|
51 |
byte event; |
|
52 |
int button; |
|
53 |
int index; |
|
54 |
} dropdown; |
|
55 |
||
56 |
struct { |
|
57 |
byte event; |
|
58 |
bool cont; // continue the search? (default true) |
|
59 |
byte ascii; // 8-bit ASCII-value of the key |
|
60 |
uint16 keycode;// untranslated key (including shift-state) |
|
61 |
} keypress; |
|
62 |
}; |
|
63 |
||
64 |
enum WindowKeyCodes { |
|
65 |
WKC_SHIFT = 0x8000, |
|
66 |
WKC_CTRL = 0x4000, |
|
67 |
WKC_ALT = 0x2000, |
|
68 |
WKC_META = 0x1000, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
69 |
|
0 | 70 |
// Special ones |
71 |
WKC_NONE = 0, |
|
72 |
WKC_ESC=1, |
|
73 |
WKC_BACKSPACE = 2, |
|
74 |
WKC_INSERT = 3, |
|
75 |
WKC_DELETE = 4, |
|
76 |
||
77 |
WKC_PAGEUP = 5, |
|
78 |
WKC_PAGEDOWN = 6, |
|
79 |
WKC_END = 7, |
|
80 |
WKC_HOME = 8, |
|
81 |
||
82 |
// Arrow keys |
|
83 |
WKC_LEFT = 9, |
|
84 |
WKC_UP = 10, |
|
85 |
WKC_RIGHT = 11, |
|
86 |
WKC_DOWN = 12, |
|
87 |
||
88 |
// Return & tab |
|
89 |
WKC_RETURN = 13, |
|
90 |
WKC_TAB = 14, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
91 |
|
0 | 92 |
// Numerical keyboard |
93 |
WKC_NUM_0 = 16, |
|
94 |
WKC_NUM_1 = 17, |
|
95 |
WKC_NUM_2 = 18, |
|
96 |
WKC_NUM_3 = 19, |
|
97 |
WKC_NUM_4 = 20, |
|
98 |
WKC_NUM_5 = 21, |
|
99 |
WKC_NUM_6 = 22, |
|
100 |
WKC_NUM_7 = 23, |
|
101 |
WKC_NUM_8 = 24, |
|
102 |
WKC_NUM_9 = 25, |
|
103 |
WKC_NUM_DIV = 26, |
|
104 |
WKC_NUM_MUL = 27, |
|
105 |
WKC_NUM_MINUS = 28, |
|
106 |
WKC_NUM_PLUS = 29, |
|
107 |
WKC_NUM_ENTER = 30, |
|
108 |
WKC_NUM_DECIMAL = 31, |
|
109 |
||
110 |
// Space |
|
111 |
WKC_SPACE = 32, |
|
112 |
||
113 |
// Function keys |
|
114 |
WKC_F1 = 33, |
|
115 |
WKC_F2 = 34, |
|
116 |
WKC_F3 = 35, |
|
117 |
WKC_F4 = 36, |
|
118 |
WKC_F5 = 37, |
|
119 |
WKC_F6 = 38, |
|
120 |
WKC_F7 = 39, |
|
121 |
WKC_F8 = 40, |
|
122 |
WKC_F9 = 41, |
|
123 |
WKC_F10 = 42, |
|
124 |
WKC_F11 = 43, |
|
125 |
WKC_F12 = 44, |
|
126 |
||
129
df1a60bc0d70
(svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents:
116
diff
changeset
|
127 |
// backquote is the key left of "1" |
df1a60bc0d70
(svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents:
116
diff
changeset
|
128 |
// we only store this key here, no matter what character is really mapped to it |
df1a60bc0d70
(svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents:
116
diff
changeset
|
129 |
// on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) |
df1a60bc0d70
(svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents:
116
diff
changeset
|
130 |
WKC_BACKQUOTE = 45, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
131 |
|
0 | 132 |
// 0-9 are mapped to 48-57 |
133 |
// A-Z are mapped to 65-90 |
|
134 |
// a-z are mapped to 97-122 |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
135 |
|
0 | 136 |
|
137 |
//WKC_UNKNOWN = 0xFF, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
138 |
|
0 | 139 |
}; |
140 |
||
141 |
typedef struct WindowDesc { |
|
142 |
int16 left, top, width, height; |
|
143 |
byte cls; |
|
144 |
byte parent_cls; |
|
145 |
uint32 flags; |
|
146 |
const Widget *widgets; |
|
147 |
WindowProc *proc; |
|
148 |
} WindowDesc; |
|
149 |
||
150 |
enum { |
|
151 |
WDF_STD_TOOLTIPS = 1, /* use standard routine when displaying tooltips */ |
|
152 |
WDF_DEF_WIDGET = 2, /* default widget control for some widgets in the on click event */ |
|
153 |
WDF_STD_BTN = 4, /* default handling for close and drag widgets (widget no 0 and 1) */ |
|
154 |
WDF_RESTORE_DPARAM = 8, /* when drawing widgets, restore the dparam so all widgets recieve the same set of them */ |
|
155 |
WDF_UNCLICK_BUTTONS=16, /* Unclick buttons when the window event times out */ |
|
156 |
}; |
|
157 |
||
158 |
/* can be used as x or y coordinates to cause a specific placement */ |
|
159 |
enum { |
|
160 |
WDP_AUTO = -1, |
|
161 |
WDP_CENTER = -2, |
|
162 |
}; |
|
163 |
||
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
164 |
typedef struct { |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
165 |
StringID caption; |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
166 |
bool caret; |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
167 |
WindowClass wnd_class; |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
168 |
WindowNumber wnd_num; |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
169 |
uint16 maxlen, maxwidth; |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
170 |
byte *buf; |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
171 |
} querystr_d; |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
172 |
|
0 | 173 |
#define WP(ptr,str) (*(str*)(ptr)->custom) |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
174 |
// querystr_d is the bigest struct that comes in w->custom |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
175 |
// because 64-bit systems use 64-bit pointers, it is bigger on a 64-bit system |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
176 |
// then on a 32-bit system. Therefor the size is calculated from querystr_d |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
177 |
// instead of a hardcoded number. |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
178 |
// if any struct becomes bigger the querystr_d, it should be replaced. |
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
179 |
#define WINDOW_CUSTOM_SIZE sizeof(querystr_d) |
0 | 180 |
|
181 |
typedef struct { |
|
62
2bdd81b8adcc
(svn r63) Fix: [ 1009385 ] Too many save games prevented loading
dominik
parents:
0
diff
changeset
|
182 |
uint16 count, cap, pos; |
0 | 183 |
} Scrollbar; |
184 |
||
185 |
struct Window { |
|
186 |
uint16 flags4; |
|
187 |
WindowClass window_class; |
|
188 |
WindowNumber window_number; |
|
189 |
||
190 |
int left,top; |
|
191 |
int width,height; |
|
192 |
||
193 |
Scrollbar hscroll, vscroll; |
|
194 |
||
195 |
byte caption_color; |
|
196 |
||
197 |
uint32 click_state, disabled_state, hidden_state; |
|
198 |
WindowProc *wndproc; |
|
199 |
ViewPort *viewport; |
|
200 |
const Widget *widget; |
|
201 |
//const WindowDesc *desc; |
|
202 |
uint32 desc_flags; |
|
203 |
||
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
204 |
byte custom[WINDOW_CUSTOM_SIZE]; |
0 | 205 |
}; |
206 |
||
207 |
typedef struct { |
|
208 |
byte item_count; /* follow_vehicle */ |
|
209 |
byte sel_index; /* scrollpos_x */ |
|
210 |
byte main_button; /* scrollpos_y */ |
|
211 |
byte action_id; |
|
212 |
StringID string_id; /* unk30 */ |
|
213 |
uint16 checked_items; /* unk32 */ |
|
214 |
} menu_d; |
|
215 |
||
216 |
typedef struct { |
|
217 |
int16 data_1, data_2, data_3; |
|
218 |
int16 data_4, data_5; |
|
219 |
bool close; /* scrollpos_y */ |
|
220 |
byte byte_1; |
|
221 |
} def_d; |
|
222 |
||
223 |
typedef struct { |
|
224 |
void *data; |
|
225 |
} void_d; |
|
226 |
||
227 |
typedef struct { |
|
228 |
uint16 base; /* follow_vehicle */ |
|
229 |
uint16 count;/* scrollpos_x */ |
|
230 |
} tree_d; |
|
231 |
||
232 |
typedef struct { |
|
233 |
byte refresh_counter; /* follow_vehicle */ |
|
234 |
} plstations_d; |
|
235 |
||
236 |
typedef struct { |
|
237 |
StringID string_id; |
|
238 |
} tooltips_d; |
|
239 |
||
240 |
typedef struct { |
|
241 |
byte railtype; |
|
242 |
byte sel_index; |
|
243 |
int16 sel_engine; |
|
244 |
int16 rename_engine; |
|
245 |
} buildtrain_d; |
|
246 |
||
247 |
typedef struct { |
|
248 |
VehicleID sel; |
|
249 |
} traindepot_d; |
|
250 |
||
251 |
typedef struct { |
|
252 |
int sel; |
|
253 |
} order_d; |
|
254 |
||
255 |
typedef struct { |
|
256 |
byte tab; |
|
257 |
} traindetails_d; |
|
258 |
||
259 |
typedef struct { |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
260 |
int16 scroll_x, scroll_y, subscroll; |
0 | 261 |
} smallmap_d; |
262 |
||
263 |
typedef struct { |
|
264 |
uint32 face; |
|
265 |
byte gender; |
|
266 |
} facesel_d; |
|
267 |
||
268 |
typedef struct { |
|
269 |
int sel; |
|
270 |
byte cargo; |
|
271 |
} refit_d; |
|
272 |
||
273 |
typedef struct { |
|
274 |
uint16 follow_vehicle; |
|
275 |
int16 scrollpos_x, scrollpos_y; |
|
276 |
} vp_d; |
|
277 |
||
278 |
typedef struct { |
|
279 |
uint16 follow_vehicle; |
|
280 |
int16 scrollpos_x, scrollpos_y; |
|
281 |
NewsItem *ni; |
|
282 |
} news_d; |
|
283 |
||
284 |
enum WindowEvents { |
|
285 |
WE_CLICK = 0, |
|
286 |
WE_PAINT = 1, |
|
287 |
WE_MOUSELOOP = 2, |
|
288 |
WE_TICK = 3, |
|
289 |
WE_4 = 4, |
|
290 |
WE_TIMEOUT = 5, |
|
291 |
WE_PLACE_OBJ = 6, |
|
292 |
WE_ABORT_PLACE_OBJ = 7, |
|
293 |
WE_DESTROY = 8, |
|
294 |
WE_ON_EDIT_TEXT = 9, |
|
295 |
WE_POPUPMENU_SELECT = 10, |
|
296 |
WE_POPUPMENU_OVER = 11, |
|
297 |
WE_DRAGDROP = 12, |
|
298 |
WE_PLACE_DRAG = 13, |
|
299 |
WE_PLACE_MOUSEUP = 14, |
|
300 |
WE_PLACE_PRESIZE = 15, |
|
301 |
WE_DROPDOWN_SELECT = 16, |
|
302 |
WE_RCLICK = 17, |
|
303 |
WE_KEYPRESS = 18, |
|
116
ca4332a9ec1d
(svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents:
68
diff
changeset
|
304 |
WE_CREATE = 19, |
0 | 305 |
}; |
306 |
||
307 |
||
308 |
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/ |
|
309 |
enum WindowWidgetBehaviours { |
|
310 |
WWB_PUSHBUTTON = 1 << 5, |
|
311 |
WWB_NODISBUTTON = 2 << 5, |
|
312 |
}; |
|
313 |
||
314 |
||
315 |
enum WindowWidgetTypes { |
|
316 |
WWT_EMPTY = 0, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
317 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
318 |
WWT_IMGBTN = 1, /* button with image */ |
0 | 319 |
WWT_PANEL = WWT_IMGBTN, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
320 |
WWT_PANEL_2 = 2, /* button with diff image when clicked */ |
0 | 321 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
322 |
WWT_TEXTBTN = 3, /* button with text */ |
0 | 323 |
WWT_CLOSEBOX = WWT_TEXTBTN, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
324 |
WWT_4 = 4, /* button with diff text when clicked */ |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
325 |
WWT_5 = 5, /* label */ |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
326 |
WWT_6 = 6, /* combo box text area */ |
0 | 327 |
WWT_MATRIX = 7, |
328 |
WWT_SCROLLBAR = 8, |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
329 |
WWT_FRAME = 9, /* frame */ |
0 | 330 |
WWT_CAPTION = 10, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
331 |
|
0 | 332 |
WWT_HSCROLLBAR = 11, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
333 |
WWT_LAST = 12, /* Last Item. use WIDGETS_END to fill up padding!! */ |
0 | 334 |
|
335 |
WWT_MASK = 31, |
|
336 |
||
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
337 |
WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
338 |
WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
339 |
WWT_NODISTXTBTN = WWT_TEXTBTN | WWB_NODISBUTTON, |
0 | 340 |
}; |
341 |
||
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
342 |
#define WIDGETS_END WWT_LAST, 0, 0, 0, 0, 0, 0, STR_NULL |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
343 |
|
0 | 344 |
enum WindowFlags { |
345 |
WF_TIMEOUT_SHL = 0, |
|
346 |
WF_TIMEOUT_MASK = 7, |
|
347 |
WF_DRAGGING = 1 << 3, |
|
348 |
WF_SCROLL_UP = 1 << 4, |
|
349 |
WF_SCROLL_DOWN = 1 << 5, |
|
350 |
WF_SCROLL_MIDDLE = 1 << 6, |
|
351 |
WF_HSCROLL = 1 << 7, |
|
352 |
WF_SIZING = 1 << 8, |
|
353 |
||
354 |
WF_DISABLE_VP_SCROLL = 1 << 10, |
|
355 |
||
356 |
WF_WHITE_BORDER_ONE = 1 << 11, |
|
357 |
WF_WHITE_BORDER_MASK = 3 << 11, |
|
358 |
}; |
|
359 |
||
360 |
||
361 |
void DispatchLeftClickEvent(Window *w, int x, int y); |
|
362 |
void DispatchRightClickEvent(Window *w, int x, int y); |
|
363 |
void DispatchMouseWheelEvent(Window *w, int wheel); |
|
364 |
||
365 |
/* window.c */ |
|
366 |
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom); |
|
367 |
void CallWindowEventNP(Window *w, int event); |
|
368 |
void CallWindowTickEvent(); |
|
369 |
void DrawDirtyBlocks(); |
|
370 |
void SetDirtyBlocks(int left, int top, int right, int bottom); |
|
371 |
void SetWindowDirty(Window *w); |
|
372 |
||
373 |
Window *FindWindowById(WindowClass cls, WindowNumber number); |
|
374 |
void DeleteWindow(Window *w); |
|
375 |
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number); |
|
376 |
Window *BringWindowToFront(Window *w); |
|
377 |
Window *StartWindowDrag(Window *w); |
|
378 |
Window *StartWindowSizing(Window *w); |
|
379 |
Window *FindWindowFromPt(int x, int y); |
|
380 |
||
381 |
Window *AllocateWindow( |
|
382 |
int x, |
|
383 |
int y, |
|
384 |
int width, |
|
385 |
int height, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
386 |
WindowProc *proc, |
0 | 387 |
WindowClass cls, |
388 |
const Widget *widget); |
|
389 |
||
390 |
Window *AllocateWindowDesc(const WindowDesc *desc); |
|
391 |
Window *AllocateWindowDescFront(const WindowDesc *desc, int value); |
|
392 |
||
393 |
Window *AllocateWindowAutoPlace( |
|
394 |
int width, |
|
395 |
int height, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
396 |
WindowProc *proc, |
0 | 397 |
WindowClass cls, |
398 |
const Widget *widget); |
|
399 |
||
400 |
Window *AllocateWindowAutoPlace2( |
|
401 |
WindowClass exist_class, |
|
402 |
WindowNumber exist_num, |
|
403 |
int width, |
|
404 |
int height, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
405 |
WindowProc *proc, |
0 | 406 |
WindowClass cls, |
407 |
const Widget *widget); |
|
408 |
||
409 |
void DrawWindowViewport(Window *w); |
|
410 |
||
411 |
void InitWindowSystem(); |
|
412 |
int GetMenuItemIndex(Window *w, int x, int y); |
|
413 |
void MouseLoop(); |
|
414 |
void UpdateWindows(); |
|
415 |
void InvalidateWidget(Window *w, byte widget_index); |
|
416 |
||
417 |
void GuiShowTooltips(uint16 string_id); |
|
418 |
||
419 |
void UnclickWindowButtons(Window *w); |
|
420 |
void UnclickSomeWindowButtons(Window *w, uint32 mask); |
|
421 |
void RelocateAllWindows(int neww, int newh); |
|
68
4051f3c8efa2
(svn r69) -Feature: align toolbar left/center/right patch (TrueLight)
darkvater
parents:
62
diff
changeset
|
422 |
int32 PositionMainToolbar(Window *w); |
0 | 423 |
|
424 |
/* widget.c */ |
|
425 |
int GetWidgetFromPos(Window *w, int x, int y); |
|
426 |
void DrawWindowWidgets(Window *w); |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
158
diff
changeset
|
427 |
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask); |
0 | 428 |
|
429 |
void HandleButtonClick(Window *w, byte widget); |
|
430 |
||
431 |
Window *GetCallbackWnd(); |
|
432 |
void DeleteNonVitalWindows(); |
|
433 |
||
434 |
/* window.c */ |
|
435 |
VARDEF Window _windows[20]; |
|
436 |
VARDEF Window *_last_window; |
|
437 |
||
438 |
VARDEF Point _cursorpos_drag_start; |
|
439 |
||
440 |
VARDEF bool _left_button_down; |
|
441 |
VARDEF bool _left_button_clicked; |
|
442 |
||
443 |
VARDEF bool _right_button_down; |
|
444 |
VARDEF bool _right_button_clicked; |
|
445 |
||
446 |
VARDEF int _alloc_wnd_parent_num; |
|
447 |
||
448 |
VARDEF int _scrollbar_start_pos; |
|
449 |
VARDEF int _scrollbar_size; |
|
450 |
VARDEF bool _demo_mode; |
|
451 |
VARDEF byte _scroller_click_timeout; |
|
452 |
||
453 |
VARDEF bool _dragging_window; |
|
454 |
VARDEF bool _scrolling_scrollbar; |
|
455 |
VARDEF bool _scrolling_viewport; |
|
456 |
VARDEF bool _popup_menu_active; |
|
457 |
//VARDEF bool _dragdrop_active; |
|
458 |
||
459 |
VARDEF Point _fix_mouse_at; |
|
460 |
||
461 |
VARDEF byte _special_mouse_mode; |
|
462 |
enum SpecialMouseMode { |
|
463 |
WSM_NONE = 0, |
|
464 |
WSM_DRAGDROP = 1, |
|
465 |
WSM_SIZING = 2, |
|
466 |
WSM_PRESIZE = 3, |
|
467 |
}; |
|
468 |
||
469 |
void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y); |
|
470 |
||
471 |
#endif /* WINDOW_H */ |