author | Darkvater |
Sun, 03 Sep 2006 23:27:38 +0000 | |
changeset 4542 | f42ecc669275 |
parent 4520 | 98f1b167d0ca |
child 4547 | d37c2d172ad4 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#ifndef WINDOW_H |
4 |
#define WINDOW_H |
|
5 |
||
4299
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
6 |
#include "string.h" |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
7 |
|
0 | 8 |
typedef union WindowEvent WindowEvent; |
9 |
||
10 |
typedef void WindowProc(Window *w, WindowEvent *e); |
|
11 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
12 |
/* How the resize system works: |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
13 |
First, you need to add a WWT_RESIZEBOX to the widgets, and you need |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
14 |
to add the flag WDF_RESIZABLE to the window. Now the window is ready |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
15 |
to resize itself. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
16 |
As you may have noticed, all widgets have a RESIZE_XXX in their line. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
17 |
This lines controls how the widgets behave on resize. RESIZE_NONE means |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
18 |
it doesn't do anything. Any other option let's one of the borders |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
19 |
move with the changed width/height. So if a widget has |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
20 |
RESIZE_RIGHT, and the window is made 5 pixels wider by the user, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
21 |
the right of the window will also be made 5 pixels wider. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
22 |
Now, what if you want to clamp a widget to the bottom? Give it the flag |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
23 |
RESIZE_TB. This is RESIZE_TOP + RESIZE_BOTTOM. Now if the window gets |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
24 |
5 pixels bigger, both the top and bottom gets 5 bigger, so the whole |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
25 |
widgets moves downwards without resizing, and appears to be clamped |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
26 |
to the bottom. Nice aint it? |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
27 |
You should know one more thing about this system. Most windows can't |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
28 |
handle an increase of 1 pixel. So there is a step function, which |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
29 |
let the windowsize only be changed by X pixels. You configure this |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
30 |
after making the window, like this: |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
31 |
w->resize.step_height = 10; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
32 |
Now the window will only change in height in steps of 10. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
33 |
You can also give a minimum width and height. The default value is |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
34 |
the default height/width of the window itself. You can change this |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
35 |
AFTER window-creation, with: |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
36 |
w->resize.width or w->resize.height. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
37 |
That was all.. good luck, and enjoy :) -- TrueLight */ |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
38 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
39 |
enum { |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
40 |
RESIZE_NONE = 0, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
41 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
42 |
RESIZE_LEFT = 1, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
43 |
RESIZE_RIGHT = 2, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
44 |
RESIZE_TOP = 4, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
45 |
RESIZE_BOTTOM = 8, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
46 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
47 |
RESIZE_LR = RESIZE_LEFT | RESIZE_RIGHT, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
48 |
RESIZE_RB = RESIZE_RIGHT | RESIZE_BOTTOM, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
49 |
RESIZE_TB = RESIZE_TOP | RESIZE_BOTTOM, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
50 |
RESIZE_LRB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_BOTTOM, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
51 |
RESIZE_LRTB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
52 |
RESIZE_RTB = RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
53 |
}; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
54 |
|
0 | 55 |
typedef struct Widget { |
56 |
byte type; |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
57 |
byte resize_flag; |
0 | 58 |
byte color; |
59 |
uint16 left, right, top, bottom; |
|
60 |
uint16 unkA; |
|
2634
0df9396b0067
(svn r3176) Use proper types, not some variants of int
tron
parents:
2622
diff
changeset
|
61 |
StringID tooltips; |
0 | 62 |
} Widget; |
63 |
||
4437
49e79e135539
(svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents:
4434
diff
changeset
|
64 |
typedef enum FrameFlags { |
1938
70baf462aff1
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
65 |
FR_TRANSPARENT = 0x01, ///< Makes the background transparent if set |
70baf462aff1
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
66 |
FR_BORDERONLY = 0x10, ///< Draw border only, no background |
70baf462aff1
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
67 |
FR_LOWERED = 0x20, ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed) |
70baf462aff1
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
68 |
FR_DARKENED = 0x40, ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes) |
4437
49e79e135539
(svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents:
4434
diff
changeset
|
69 |
} FrameFlags; |
49e79e135539
(svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents:
4434
diff
changeset
|
70 |
|
49e79e135539
(svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents:
4434
diff
changeset
|
71 |
void DrawFrameRect(int left, int top, int right, int bottom, int color, FrameFlags flags); |
1938
70baf462aff1
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
72 |
|
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
73 |
/* XXX - outside "byte event" so you can set event directly without going into |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
74 |
* the union elements at first. Because of this every first element of the union |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
75 |
* MUST BE 'byte event'. Whoever did this must get shot! Scheduled for immediate |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
76 |
* rewrite after 0.4.0 */ |
0 | 77 |
union WindowEvent { |
78 |
byte event; |
|
79 |
struct { |
|
80 |
byte event; |
|
81 |
Point pt; |
|
82 |
int widget; |
|
83 |
} click; |
|
84 |
||
85 |
struct { |
|
86 |
byte event; |
|
87 |
Point pt; |
|
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1938
diff
changeset
|
88 |
TileIndex tile; |
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1938
diff
changeset
|
89 |
TileIndex starttile; |
0 | 90 |
int userdata; |
91 |
} place; |
|
92 |
||
93 |
struct { |
|
94 |
byte event; |
|
95 |
Point pt; |
|
96 |
int widget; |
|
97 |
} dragdrop; |
|
98 |
||
99 |
struct { |
|
100 |
byte event; |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
101 |
Point size; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
102 |
Point diff; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
103 |
} sizing; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
104 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
105 |
struct { |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
106 |
byte event; |
1323
bac2e38e8b60
(svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents:
1178
diff
changeset
|
107 |
char *str; |
0 | 108 |
} edittext; |
109 |
||
110 |
struct { |
|
111 |
byte event; |
|
112 |
Point pt; |
|
113 |
} popupmenu; |
|
114 |
||
115 |
struct { |
|
116 |
byte event; |
|
117 |
int button; |
|
118 |
int index; |
|
119 |
} dropdown; |
|
120 |
||
121 |
struct { |
|
122 |
byte event; |
|
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
123 |
Point pt; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
124 |
int widget; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
125 |
} mouseover; |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
126 |
|
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
127 |
struct { |
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
128 |
byte event; |
0 | 129 |
bool cont; // continue the search? (default true) |
130 |
byte ascii; // 8-bit ASCII-value of the key |
|
131 |
uint16 keycode;// untranslated key (including shift-state) |
|
132 |
} keypress; |
|
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
133 |
|
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
134 |
struct { |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
135 |
byte event; |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
136 |
uint msg; // message to be sent |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
137 |
uint wparam; // additional message-specific information |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
138 |
uint lparam; // additional message-specific information |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
139 |
} message; |
4335
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4318
diff
changeset
|
140 |
|
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4318
diff
changeset
|
141 |
struct { |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4318
diff
changeset
|
142 |
byte event; |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4318
diff
changeset
|
143 |
Point delta; // delta position against position of last call |
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4318
diff
changeset
|
144 |
} scroll; |
4337
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
145 |
|
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
146 |
struct { |
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
147 |
byte event; |
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
148 |
int wheel; // how much was 'wheel'd' |
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
149 |
} wheel; |
0 | 150 |
}; |
151 |
||
152 |
enum WindowKeyCodes { |
|
153 |
WKC_SHIFT = 0x8000, |
|
154 |
WKC_CTRL = 0x4000, |
|
155 |
WKC_ALT = 0x2000, |
|
156 |
WKC_META = 0x1000, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
157 |
|
0 | 158 |
// Special ones |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
159 |
WKC_NONE = 0, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
160 |
WKC_ESC = 1, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
161 |
WKC_BACKSPACE = 2, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
162 |
WKC_INSERT = 3, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
163 |
WKC_DELETE = 4, |
0 | 164 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
165 |
WKC_PAGEUP = 5, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
166 |
WKC_PAGEDOWN = 6, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
167 |
WKC_END = 7, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
168 |
WKC_HOME = 8, |
0 | 169 |
|
170 |
// Arrow keys |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
171 |
WKC_LEFT = 9, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
172 |
WKC_UP = 10, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
173 |
WKC_RIGHT = 11, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
174 |
WKC_DOWN = 12, |
0 | 175 |
|
176 |
// Return & tab |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
177 |
WKC_RETURN = 13, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
178 |
WKC_TAB = 14, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
179 |
|
0 | 180 |
// Numerical keyboard |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
181 |
WKC_NUM_0 = 16, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
182 |
WKC_NUM_1 = 17, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
183 |
WKC_NUM_2 = 18, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
184 |
WKC_NUM_3 = 19, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
185 |
WKC_NUM_4 = 20, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
186 |
WKC_NUM_5 = 21, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
187 |
WKC_NUM_6 = 22, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
188 |
WKC_NUM_7 = 23, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
189 |
WKC_NUM_8 = 24, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
190 |
WKC_NUM_9 = 25, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
191 |
WKC_NUM_DIV = 26, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
192 |
WKC_NUM_MUL = 27, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
193 |
WKC_NUM_MINUS = 28, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
194 |
WKC_NUM_PLUS = 29, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
195 |
WKC_NUM_ENTER = 30, |
0 | 196 |
WKC_NUM_DECIMAL = 31, |
197 |
||
198 |
// Space |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
199 |
WKC_SPACE = 32, |
0 | 200 |
|
201 |
// Function keys |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
202 |
WKC_F1 = 33, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
203 |
WKC_F2 = 34, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
204 |
WKC_F3 = 35, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
205 |
WKC_F4 = 36, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
206 |
WKC_F5 = 37, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
207 |
WKC_F6 = 38, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
208 |
WKC_F7 = 39, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
209 |
WKC_F8 = 40, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
210 |
WKC_F9 = 41, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
211 |
WKC_F10 = 42, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
212 |
WKC_F11 = 43, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
213 |
WKC_F12 = 44, |
0 | 214 |
|
129
df1a60bc0d70
(svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents:
116
diff
changeset
|
215 |
// 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
|
216 |
// 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
|
217 |
// on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
218 |
WKC_BACKQUOTE = 45, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
219 |
WKC_PAUSE = 46, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
220 |
|
0 | 221 |
// 0-9 are mapped to 48-57 |
222 |
// A-Z are mapped to 65-90 |
|
223 |
// a-z are mapped to 97-122 |
|
224 |
}; |
|
225 |
||
226 |
typedef struct WindowDesc { |
|
227 |
int16 left, top, width, height; |
|
2788
0187c588107e
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2757
diff
changeset
|
228 |
WindowClass cls; |
0187c588107e
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2757
diff
changeset
|
229 |
WindowClass parent_cls; |
0 | 230 |
uint32 flags; |
231 |
const Widget *widgets; |
|
232 |
WindowProc *proc; |
|
233 |
} WindowDesc; |
|
234 |
||
235 |
enum { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
236 |
WDF_STD_TOOLTIPS = 1, /* use standard routine when displaying tooltips */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
237 |
WDF_DEF_WIDGET = 2, /* default widget control for some widgets in the on click event */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
238 |
WDF_STD_BTN = 4, /* default handling for close and drag widgets (widget no 0 and 1) */ |
2064
e6a2b42d0b15
(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents:
2021
diff
changeset
|
239 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
240 |
WDF_UNCLICK_BUTTONS = 16, /* Unclick buttons when the window event times out */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
241 |
WDF_STICKY_BUTTON = 32, /* Set window to sticky mode; they are not closed unless closed with 'X' (widget 2) */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
242 |
WDF_RESIZABLE = 64, /* A window can be resized */ |
0 | 243 |
}; |
244 |
||
245 |
/* can be used as x or y coordinates to cause a specific placement */ |
|
246 |
enum { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
247 |
WDP_AUTO = -1, |
0 | 248 |
WDP_CENTER = -2, |
249 |
}; |
|
250 |
||
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
251 |
typedef struct Textbuf { |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
252 |
char *buf; /* buffer in which text is saved */ |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
253 |
uint16 maxlength, maxwidth; /* the maximum size of the buffer. Maxwidth specifies screensize in pixels */ |
3458
26360c9a3743
(svn r4301) - Fix: the maxlength parameter of Textbuf is supposed to be the size of the buffer (so length of string + '\0'), but in the code it was a mix of both. It didn't cause any problems though, only an occasionaly one-less character than allowed. (thanks Tron for noticing)
Darkvater
parents:
3344
diff
changeset
|
254 |
uint16 length, width; /* the current size of the string. Width specifies screensize in pixels */ |
1390
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
255 |
bool caret; /* is the caret ("_") visible or not */ |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
256 |
uint16 caretpos; /* the current position of the caret in the buffer */ |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
257 |
uint16 caretxoffs; /* the current position of the caret in pixels */ |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
258 |
} Textbuf; |
e7cdf3ce0fb6
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
259 |
|
0 | 260 |
#define WP(ptr,str) (*(str*)(ptr)->custom) |
2906
ac54fefb84e7
(svn r3461) - Fix: Increase window-size as for 64-bit machines it wasn't enough
Darkvater
parents:
2888
diff
changeset
|
261 |
/* You cannot 100% reliably calculate the biggest custom struct as |
ac54fefb84e7
(svn r3461) - Fix: Increase window-size as for 64-bit machines it wasn't enough
Darkvater
parents:
2888
diff
changeset
|
262 |
* the number of pointers in it and alignment will have a huge impact. |
4299
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
263 |
* 96 is the largest window-size for 64-bit machines currently */ |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
264 |
#define WINDOW_CUSTOM_SIZE 96 |
0 | 265 |
|
2596 | 266 |
typedef struct Scrollbar { |
62
2bdd81b8adcc
(svn r63) Fix: [ 1009385 ] Too many save games prevented loading
dominik
parents:
0
diff
changeset
|
267 |
uint16 count, cap, pos; |
0 | 268 |
} Scrollbar; |
269 |
||
2596 | 270 |
typedef struct ResizeInfo { |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
271 |
uint width; /* Minimum width and height */ |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
272 |
uint height; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
273 |
|
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
274 |
uint step_width; /* In how big steps the width and height go */ |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
275 |
uint step_height; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
276 |
} ResizeInfo; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
277 |
|
2622
73167d7e30c7
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
278 |
typedef struct WindowMessage { |
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
279 |
int msg; |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
280 |
int wparam; |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
281 |
int lparam; |
2622
73167d7e30c7
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
282 |
} WindowMessage; |
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
283 |
|
0 | 284 |
struct Window { |
285 |
uint16 flags4; |
|
286 |
WindowClass window_class; |
|
287 |
WindowNumber window_number; |
|
288 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
289 |
int left, top; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
290 |
int width, height; |
0 | 291 |
|
842 | 292 |
Scrollbar hscroll, vscroll, vscroll2; |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
293 |
ResizeInfo resize; |
0 | 294 |
|
295 |
byte caption_color; |
|
296 |
||
297 |
uint32 click_state, disabled_state, hidden_state; |
|
298 |
WindowProc *wndproc; |
|
299 |
ViewPort *viewport; |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
300 |
const Widget *original_widget; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3812
diff
changeset
|
301 |
Widget *widget; |
0 | 302 |
uint32 desc_flags; |
303 |
||
2622
73167d7e30c7
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
304 |
WindowMessage message; |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
305 |
byte custom[WINDOW_CUSTOM_SIZE]; |
0 | 306 |
}; |
307 |
||
4299
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
308 |
typedef struct querystr_d { |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
309 |
StringID caption; |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
310 |
WindowClass wnd_class; |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
311 |
WindowNumber wnd_num; |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
312 |
Textbuf text; |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
313 |
const char *orig; |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
314 |
CharSetFilter afilter; |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
315 |
} querystr_d; |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
316 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d)); |
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
317 |
|
4300
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
318 |
typedef struct query_d { |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
319 |
StringID caption; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
320 |
StringID message; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
321 |
WindowClass wnd_class; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
322 |
WindowNumber wnd_num; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
323 |
void (*ok_cancel_callback)(bool ok_clicked); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
324 |
bool calledback; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
325 |
} query_d; |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
326 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(query_d)); |
c7e43c47a2b9
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
327 |
|
0 | 328 |
typedef struct { |
4171 | 329 |
byte item_count; /* follow_vehicle */ |
330 |
byte sel_index; /* scrollpos_x */ |
|
331 |
byte main_button; /* scrollpos_y */ |
|
0 | 332 |
byte action_id; |
4171 | 333 |
StringID string_id; /* unk30 */ |
0 | 334 |
uint16 checked_items; /* unk32 */ |
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2187
diff
changeset
|
335 |
byte disabled_items; |
0 | 336 |
} menu_d; |
1004 | 337 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d)); |
0 | 338 |
|
339 |
typedef struct { |
|
340 |
int16 data_1, data_2, data_3; |
|
341 |
int16 data_4, data_5; |
|
2596 | 342 |
bool close; |
0 | 343 |
byte byte_1; |
344 |
} def_d; |
|
1004 | 345 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d)); |
0 | 346 |
|
347 |
typedef struct { |
|
348 |
void *data; |
|
349 |
} void_d; |
|
1004 | 350 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d)); |
0 | 351 |
|
352 |
typedef struct { |
|
2596 | 353 |
uint16 base; |
354 |
uint16 count; |
|
0 | 355 |
} tree_d; |
1004 | 356 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d)); |
0 | 357 |
|
358 |
typedef struct { |
|
359 |
StringID string_id; |
|
360 |
} tooltips_d; |
|
1004 | 361 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d)); |
0 | 362 |
|
363 |
typedef struct { |
|
364 |
byte railtype; |
|
365 |
byte sel_index; |
|
2498
3ed05caa4449
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2448
diff
changeset
|
366 |
EngineID sel_engine; |
3ed05caa4449
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2448
diff
changeset
|
367 |
EngineID rename_engine; |
0 | 368 |
} buildtrain_d; |
1004 | 369 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildtrain_d)); |
0 | 370 |
|
371 |
typedef struct { |
|
842 | 372 |
byte vehicletype; |
373 |
byte sel_index[2]; |
|
2746
47c6e734556e
(svn r3291) - Codechange, Autoreplace: Replace int with EngineID and -1 with INVALID_ENGINE, as appropriate.
peter1138
parents:
2683
diff
changeset
|
374 |
EngineID sel_engine[2]; |
842 | 375 |
uint16 count[2]; |
4434
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
376 |
bool wagon_btnstate; // true means engine is selected |
842 | 377 |
} replaceveh_d; |
1004 | 378 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d)); |
842 | 379 |
|
380 |
typedef struct { |
|
0 | 381 |
VehicleID sel; |
382 |
} traindepot_d; |
|
1004 | 383 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindepot_d)); |
0 | 384 |
|
385 |
typedef struct { |
|
386 |
int sel; |
|
387 |
} order_d; |
|
1004 | 388 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d)); |
0 | 389 |
|
390 |
typedef struct { |
|
391 |
byte tab; |
|
392 |
} traindetails_d; |
|
1004 | 393 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d)); |
0 | 394 |
|
395 |
typedef struct { |
|
849
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
396 |
int32 scroll_x; |
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
397 |
int32 scroll_y; |
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
398 |
int32 subscroll; |
0 | 399 |
} smallmap_d; |
4318
8ca2db000c2a
(svn r5971) -Fix: wrong struct in assert_compile (thomasdev)
truelight
parents:
4300
diff
changeset
|
400 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d)); |
0 | 401 |
|
402 |
typedef struct { |
|
403 |
uint32 face; |
|
404 |
byte gender; |
|
405 |
} facesel_d; |
|
1004 | 406 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d)); |
0 | 407 |
|
408 |
typedef struct { |
|
409 |
int sel; |
|
3344
fc86351d4641
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents:
2970
diff
changeset
|
410 |
CargoID cargo; |
0 | 411 |
} refit_d; |
1004 | 412 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d)); |
0 | 413 |
|
414 |
typedef struct { |
|
2116 | 415 |
VehicleID follow_vehicle; |
849
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
416 |
int32 scrollpos_x; |
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
417 |
int32 scrollpos_y; |
0 | 418 |
} vp_d; |
1004 | 419 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d) + 3 * sizeof(byte)); // + 3 * byte is a hack from Miham |
420 |
||
421 |
// vp2_d is the same as vp_d, except for the data_# values.. |
|
422 |
typedef struct { |
|
423 |
uint16 follow_vehicle; |
|
424 |
int32 scrollpos_x; |
|
425 |
int32 scrollpos_y; |
|
426 |
byte data_1; |
|
427 |
byte data_2; |
|
428 |
byte data_3; |
|
429 |
} vp2_d; |
|
430 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d)); |
|
0 | 431 |
|
432 |
typedef struct { |
|
433 |
uint16 follow_vehicle; |
|
849
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
434 |
int32 scrollpos_x; |
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
435 |
int32 scrollpos_y; |
0 | 436 |
NewsItem *ni; |
437 |
} news_d; |
|
1004 | 438 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d)); |
0 | 439 |
|
859
611a03925f9a
(svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents:
849
diff
changeset
|
440 |
typedef struct { |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
441 |
uint32 background_img; |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
442 |
int8 rank; |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
443 |
} highscore_d; |
1004 | 444 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d)); |
998
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
445 |
|
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
446 |
typedef struct { |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
447 |
int height; |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
448 |
uint16 counter; |
c90459c24842
(svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents:
983
diff
changeset
|
449 |
} scroller_d; |
1004 | 450 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d)); |
859
611a03925f9a
(svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents:
849
diff
changeset
|
451 |
|
4542
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
452 |
typedef enum SortListFlags { |
2888
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
453 |
VL_DESC = 0x01, // sort descending or ascending |
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
454 |
VL_RESORT = 0x02, // instruct the code to resort the list in the next loop |
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
455 |
VL_REBUILD = 0x04 // create sort-listing to use for qsort and friends |
4542
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
456 |
} SortListFlags; |
588 | 457 |
|
4542
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
458 |
typedef struct Listing { |
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
459 |
bool order; // Ascending/descending |
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
460 |
byte criteria; // Sorting criteria |
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
461 |
} Listing; |
588 | 462 |
|
2888
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
463 |
typedef struct list_d { |
4542
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
464 |
uint16 list_length; // length of the list being sorted |
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
465 |
byte sort_type; // what criteria to sort on |
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
466 |
SortListFlags flags; // used to control sorting/resorting/etc. |
f42ecc669275
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
467 |
uint16 resort_timer; // resort list after a given amount of ticks if set |
2888
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
468 |
} list_d; |
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
469 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(list_d)); |
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
470 |
|
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
471 |
typedef struct message_d { |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
472 |
int msg; |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
473 |
int wparam; |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
474 |
int lparam; |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
475 |
} message_d; |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
476 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d)); |
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
477 |
|
2636
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
478 |
typedef struct dropdown_d { |
2683
ca9645a21734
(svn r3225) - Fix for "[ 1359165 ] Autoreplace problem with r3171 and later" -- Move the disabled/hidden bits to custom data in window struct.
peter1138
parents:
2636
diff
changeset
|
479 |
uint32 disabled_state; |
ca9645a21734
(svn r3225) - Fix for "[ 1359165 ] Autoreplace problem with r3171 and later" -- Move the disabled/hidden bits to custom data in window struct.
peter1138
parents:
2636
diff
changeset
|
480 |
uint32 hidden_state; |
2636
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
481 |
WindowClass parent_wnd_class; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
482 |
WindowNumber parent_wnd_num; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
483 |
byte parent_button; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
484 |
byte num_items; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
485 |
byte selected_index; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
486 |
const StringID *items; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
487 |
byte click_delay; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
488 |
bool drag_mode; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
489 |
} dropdown_d; |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
490 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(dropdown_d)); |
bdff7da76aa2
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
491 |
|
0 | 492 |
enum WindowEvents { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
493 |
WE_CLICK = 0, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
494 |
WE_PAINT = 1, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
495 |
WE_MOUSELOOP = 2, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
496 |
WE_TICK = 3, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
497 |
WE_4 = 4, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
498 |
WE_TIMEOUT = 5, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
499 |
WE_PLACE_OBJ = 6, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
500 |
WE_ABORT_PLACE_OBJ = 7, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
501 |
WE_DESTROY = 8, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
502 |
WE_ON_EDIT_TEXT = 9, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
503 |
WE_POPUPMENU_SELECT = 10, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
504 |
WE_POPUPMENU_OVER = 11, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
505 |
WE_DRAGDROP = 12, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
506 |
WE_PLACE_DRAG = 13, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
507 |
WE_PLACE_MOUSEUP = 14, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
508 |
WE_PLACE_PRESIZE = 15, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
509 |
WE_DROPDOWN_SELECT = 16, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
510 |
WE_RCLICK = 17, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
511 |
WE_KEYPRESS = 18, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
512 |
WE_CREATE = 19, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
513 |
WE_MOUSEOVER = 20, |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
514 |
WE_ON_EDIT_TEXT_CANCEL = 21, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
515 |
WE_RESIZE = 22, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
516 |
WE_MESSAGE = 23, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
517 |
WE_SCROLL = 24, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
518 |
WE_MOUSEWHEEL = 25, |
0 | 519 |
}; |
520 |
||
521 |
||
522 |
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/ |
|
523 |
enum WindowWidgetBehaviours { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
524 |
WWB_PUSHBUTTON = 1 << 5, |
0 | 525 |
WWB_NODISBUTTON = 2 << 5, |
526 |
}; |
|
527 |
||
528 |
||
529 |
enum WindowWidgetTypes { |
|
530 |
WWT_EMPTY = 0, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
531 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
532 |
WWT_IMGBTN = 1, /* button with image */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
533 |
WWT_PANEL = WWT_IMGBTN, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
534 |
WWT_PANEL_2 = 2, /* button with diff image when clicked */ |
0 | 535 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
536 |
WWT_TEXTBTN = 3, /* button with text */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
537 |
WWT_4 = 4, /* button with diff text when clicked */ |
4345
1da147230c79
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
538 |
WWT_LABEL = 5, /* centered label */ |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
539 |
WWT_6 = 6, /* combo box text area */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
540 |
WWT_MATRIX = 7, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
541 |
WWT_SCROLLBAR = 8, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
542 |
WWT_FRAME = 9, /* frame */ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
543 |
WWT_CAPTION = 10, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
544 |
|
0 | 545 |
WWT_HSCROLLBAR = 11, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
546 |
WWT_STICKYBOX = 12, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
547 |
WWT_SCROLL2BAR = 13, /* 2nd vertical scrollbar*/ |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
548 |
WWT_RESIZEBOX = 14, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
549 |
WWT_CLOSEBOX = 15, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
550 |
WWT_LAST = 16, /* Last Item. use WIDGETS_END to fill up padding!! */ |
0 | 551 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
552 |
WWT_MASK = 31, |
0 | 553 |
|
4434
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
554 |
WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON, |
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
555 |
WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON, |
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
556 |
WWT_NODISTXTBTN = WWT_TEXTBTN | WWB_NODISBUTTON, |
0 | 557 |
}; |
558 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
559 |
#define WIDGETS_END WWT_LAST, RESIZE_NONE, 0, 0, 0, 0, 0, 0, STR_NULL |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
560 |
|
0 | 561 |
enum WindowFlags { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
562 |
WF_TIMEOUT_SHL = 0, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
563 |
WF_TIMEOUT_MASK = 7, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
564 |
WF_DRAGGING = 1 << 3, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
565 |
WF_SCROLL_UP = 1 << 4, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
566 |
WF_SCROLL_DOWN = 1 << 5, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
567 |
WF_SCROLL_MIDDLE = 1 << 6, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
568 |
WF_HSCROLL = 1 << 7, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
569 |
WF_SIZING = 1 << 8, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
570 |
WF_STICKY = 1 << 9, |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
571 |
|
0 | 572 |
WF_DISABLE_VP_SCROLL = 1 << 10, |
573 |
||
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
574 |
WF_WHITE_BORDER_ONE = 1 << 11, |
0 | 575 |
WF_WHITE_BORDER_MASK = 3 << 11, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
576 |
WF_SCROLL2 = 1 << 13, |
0 | 577 |
}; |
578 |
||
579 |
/* window.c */ |
|
580 |
void CallWindowEventNP(Window *w, int event); |
|
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
581 |
void CallWindowTickEvent(void); |
4171 | 582 |
void SetWindowDirty(const Window *w); |
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
583 |
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam); |
0 | 584 |
|
585 |
Window *FindWindowById(WindowClass cls, WindowNumber number); |
|
586 |
void DeleteWindow(Window *w); |
|
587 |
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number); |
|
588 |
Window *FindWindowFromPt(int x, int y); |
|
589 |
||
4171 | 590 |
bool IsWindowOfPrototype(const Window *w, const Widget *widget); |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
591 |
void AssignWidgetToWindow(Window *w, const Widget *widget); |
0 | 592 |
Window *AllocateWindow( |
593 |
int x, |
|
594 |
int y, |
|
595 |
int width, |
|
596 |
int height, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
597 |
WindowProc *proc, |
0 | 598 |
WindowClass cls, |
599 |
const Widget *widget); |
|
600 |
||
601 |
Window *AllocateWindowDesc(const WindowDesc *desc); |
|
4520
98f1b167d0ca
(svn r6345) -Codechange: AllocateWindowDescFront() now ensures that window_number is set before calling the WE_CREATE event
bjarni
parents:
4438
diff
changeset
|
602 |
Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number); |
0 | 603 |
|
604 |
void DrawWindowViewport(Window *w); |
|
605 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
606 |
void InitWindowSystem(void); |
1474
a26a21fa10ef
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents:
1390
diff
changeset
|
607 |
void UnInitWindowSystem(void); |
a26a21fa10ef
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents:
1390
diff
changeset
|
608 |
void ResetWindowSystem(void); |
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
609 |
int GetMenuItemIndex(const Window *w, int x, int y); |
1570
c9b6cf44ce53
(svn r2074) MouseLoop -> InputLoop(), factor out a real mouse-specific MouseLoop from the new InitLoop() (more in the spirit of HandleKeypress()).
pasky
parents:
1474
diff
changeset
|
610 |
void InputLoop(void); |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
611 |
void UpdateWindows(void); |
4171 | 612 |
void InvalidateWidget(const Window *w, byte widget_index); |
0 | 613 |
|
2187
a0e206ce9fbf
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
614 |
void GuiShowTooltips(StringID string_id); |
0 | 615 |
|
616 |
void UnclickWindowButtons(Window *w); |
|
617 |
void UnclickSomeWindowButtons(Window *w, uint32 mask); |
|
618 |
void RelocateAllWindows(int neww, int newh); |
|
380 | 619 |
int PositionMainToolbar(Window *w); |
0 | 620 |
|
621 |
/* widget.c */ |
|
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
622 |
int GetWidgetFromPos(const Window *w, int x, int y); |
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
623 |
void DrawWindowWidgets(const Window *w); |
2448
1a07657c9f9a
(svn r2974) -Fix: Drag and drop selection on drop down boxes didn't select correct item when some items were hidden.
peter1138
parents:
2436
diff
changeset
|
624 |
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask); |
0 | 625 |
|
626 |
void HandleButtonClick(Window *w, byte widget); |
|
627 |
||
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
628 |
Window *GetCallbackWnd(void); |
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
629 |
void DeleteNonVitalWindows(void); |
763
ced9fcae239d
(svn r1225) -Feature: SHIFT+DEL now deletes all non-vital windows (only status bar and main bar remain)
darkvater
parents:
682
diff
changeset
|
630 |
void DeleteAllNonVitalWindows(void); |
983
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
631 |
void HideVitalWindows(void); |
4765bf636f6b
(svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents:
982
diff
changeset
|
632 |
void ShowVitalWindows(void); |
0 | 633 |
|
634 |
/* window.c */ |
|
682
74c70f645d95
(svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents:
588
diff
changeset
|
635 |
VARDEF Window _windows[25]; |
0 | 636 |
VARDEF Window *_last_window; |
637 |
||
638 |
VARDEF Point _cursorpos_drag_start; |
|
639 |
||
640 |
VARDEF bool _left_button_down; |
|
641 |
VARDEF bool _left_button_clicked; |
|
642 |
||
643 |
VARDEF bool _right_button_down; |
|
644 |
VARDEF bool _right_button_clicked; |
|
645 |
||
646 |
VARDEF int _alloc_wnd_parent_num; |
|
647 |
||
648 |
VARDEF int _scrollbar_start_pos; |
|
649 |
VARDEF int _scrollbar_size; |
|
650 |
VARDEF byte _scroller_click_timeout; |
|
651 |
||
652 |
VARDEF bool _scrolling_scrollbar; |
|
653 |
VARDEF bool _scrolling_viewport; |
|
654 |
VARDEF bool _popup_menu_active; |
|
655 |
||
656 |
VARDEF byte _special_mouse_mode; |
|
657 |
enum SpecialMouseMode { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
658 |
WSM_NONE = 0, |
0 | 659 |
WSM_DRAGDROP = 1, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
660 |
WSM_SIZING = 2, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
661 |
WSM_PRESIZE = 3, |
0 | 662 |
}; |
663 |
||
664 |
void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y); |
|
665 |
||
666 |
#endif /* WINDOW_H */ |