author | truelight |
Thu, 24 Aug 2006 12:08:25 +0000 | |
changeset 4370 | c7bd128b1670 |
parent 4345 | dd12549ad473 |
child 4434 | 4175805666a5 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#ifndef WINDOW_H |
4 |
#define WINDOW_H |
|
5 |
||
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
6 |
#include "string.h" |
b86602eaaff1
(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
581154a08a78
(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: |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
15 |
to resize itself. |
581154a08a78
(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. |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(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, |
581154a08a78
(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. |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(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? |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(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: |
581154a08a78
(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; |
581154a08a78
(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. |
581154a08a78
(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 |
581154a08a78
(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 |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
35 |
AFTER window-creation, with: |
581154a08a78
(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. |
581154a08a78
(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 */ |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
38 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
39 |
enum { |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
40 |
RESIZE_NONE = 0, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
41 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
42 |
RESIZE_LEFT = 1, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
43 |
RESIZE_RIGHT = 2, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
44 |
RESIZE_TOP = 4, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
45 |
RESIZE_BOTTOM = 8, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
46 |
|
581154a08a78
(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, |
581154a08a78
(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, |
581154a08a78
(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, |
581154a08a78
(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, |
581154a08a78
(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, |
581154a08a78
(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, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
53 |
}; |
581154a08a78
(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
581154a08a78
(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
16334e1a4862
(svn r3176) Use proper types, not some variants of int
tron
parents:
2622
diff
changeset
|
61 |
StringID tooltips; |
0 | 62 |
} Widget; |
63 |
||
1938
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
64 |
enum FrameFlags { |
21bd6ef5f85e
(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 |
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
66 |
FR_NOBORDER = 0x08, ///< Hide border (draws just a solid box) |
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
67 |
FR_BORDERONLY = 0x10, ///< Draw border only, no background |
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
68 |
FR_LOWERED = 0x20, ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed) |
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
69 |
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) |
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
70 |
}; |
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
71 |
|
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
72 |
/* XXX - outside "byte event" so you can set event directly without going into |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
73 |
* the union elements at first. Because of this every first element of the union |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
74 |
* MUST BE 'byte event'. Whoever did this must get shot! Scheduled for immediate |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
75 |
* rewrite after 0.4.0 */ |
0 | 76 |
union WindowEvent { |
77 |
byte event; |
|
78 |
struct { |
|
79 |
byte event; |
|
80 |
Point pt; |
|
81 |
int widget; |
|
82 |
} click; |
|
83 |
||
84 |
struct { |
|
85 |
byte event; |
|
86 |
Point pt; |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1938
diff
changeset
|
87 |
TileIndex tile; |
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1938
diff
changeset
|
88 |
TileIndex starttile; |
0 | 89 |
int userdata; |
90 |
} place; |
|
91 |
||
92 |
struct { |
|
93 |
byte event; |
|
94 |
Point pt; |
|
95 |
int widget; |
|
96 |
} dragdrop; |
|
97 |
||
98 |
struct { |
|
99 |
byte event; |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
100 |
Point size; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
101 |
Point diff; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
102 |
} sizing; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
103 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
104 |
struct { |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
105 |
byte event; |
1323
41397685320a
(svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents:
1178
diff
changeset
|
106 |
char *str; |
0 | 107 |
} edittext; |
108 |
||
109 |
struct { |
|
110 |
byte event; |
|
111 |
Point pt; |
|
112 |
} popupmenu; |
|
113 |
||
114 |
struct { |
|
115 |
byte event; |
|
116 |
int button; |
|
117 |
int index; |
|
118 |
} dropdown; |
|
119 |
||
120 |
struct { |
|
121 |
byte event; |
|
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
122 |
Point pt; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
123 |
int widget; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
124 |
} mouseover; |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
125 |
|
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
126 |
struct { |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
127 |
byte event; |
0 | 128 |
bool cont; // continue the search? (default true) |
129 |
byte ascii; // 8-bit ASCII-value of the key |
|
130 |
uint16 keycode;// untranslated key (including shift-state) |
|
131 |
} keypress; |
|
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
132 |
|
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
133 |
struct { |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
134 |
byte event; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
135 |
uint msg; // message to be sent |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
136 |
uint wparam; // additional message-specific information |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
137 |
uint lparam; // additional message-specific information |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
138 |
} message; |
4335
18bc63352a17
(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
|
139 |
|
18bc63352a17
(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 |
struct { |
18bc63352a17
(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 |
byte event; |
18bc63352a17
(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 |
Point delta; // delta position against position of last call |
18bc63352a17
(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 |
} scroll; |
4337
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
144 |
|
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
145 |
struct { |
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
146 |
byte event; |
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
147 |
int wheel; // how much was 'wheel'd' |
f77887bd2634
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
148 |
} wheel; |
0 | 149 |
}; |
150 |
||
151 |
enum WindowKeyCodes { |
|
152 |
WKC_SHIFT = 0x8000, |
|
153 |
WKC_CTRL = 0x4000, |
|
154 |
WKC_ALT = 0x2000, |
|
155 |
WKC_META = 0x1000, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
156 |
|
0 | 157 |
// Special ones |
4344
5d0e40cd67b9
(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
|
158 |
WKC_NONE = 0, |
5d0e40cd67b9
(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_ESC = 1, |
5d0e40cd67b9
(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_BACKSPACE = 2, |
5d0e40cd67b9
(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_INSERT = 3, |
5d0e40cd67b9
(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_DELETE = 4, |
0 | 163 |
|
4344
5d0e40cd67b9
(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
|
164 |
WKC_PAGEUP = 5, |
5d0e40cd67b9
(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_PAGEDOWN = 6, |
5d0e40cd67b9
(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_END = 7, |
5d0e40cd67b9
(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_HOME = 8, |
0 | 168 |
|
169 |
// Arrow keys |
|
4344
5d0e40cd67b9
(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
|
170 |
WKC_LEFT = 9, |
5d0e40cd67b9
(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_UP = 10, |
5d0e40cd67b9
(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_RIGHT = 11, |
5d0e40cd67b9
(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_DOWN = 12, |
0 | 174 |
|
175 |
// Return & tab |
|
4344
5d0e40cd67b9
(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
|
176 |
WKC_RETURN = 13, |
5d0e40cd67b9
(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_TAB = 14, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
178 |
|
0 | 179 |
// Numerical keyboard |
4344
5d0e40cd67b9
(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
|
180 |
WKC_NUM_0 = 16, |
5d0e40cd67b9
(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_1 = 17, |
5d0e40cd67b9
(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_2 = 18, |
5d0e40cd67b9
(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_3 = 19, |
5d0e40cd67b9
(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_4 = 20, |
5d0e40cd67b9
(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_5 = 21, |
5d0e40cd67b9
(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_6 = 22, |
5d0e40cd67b9
(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_7 = 23, |
5d0e40cd67b9
(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_8 = 24, |
5d0e40cd67b9
(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_9 = 25, |
5d0e40cd67b9
(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_DIV = 26, |
5d0e40cd67b9
(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_MUL = 27, |
5d0e40cd67b9
(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_MINUS = 28, |
5d0e40cd67b9
(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_PLUS = 29, |
5d0e40cd67b9
(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_ENTER = 30, |
0 | 195 |
WKC_NUM_DECIMAL = 31, |
196 |
||
197 |
// Space |
|
4344
5d0e40cd67b9
(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
|
198 |
WKC_SPACE = 32, |
0 | 199 |
|
200 |
// Function keys |
|
4344
5d0e40cd67b9
(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
|
201 |
WKC_F1 = 33, |
5d0e40cd67b9
(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_F2 = 34, |
5d0e40cd67b9
(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_F3 = 35, |
5d0e40cd67b9
(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_F4 = 36, |
5d0e40cd67b9
(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_F5 = 37, |
5d0e40cd67b9
(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_F6 = 38, |
5d0e40cd67b9
(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_F7 = 39, |
5d0e40cd67b9
(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_F8 = 40, |
5d0e40cd67b9
(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_F9 = 41, |
5d0e40cd67b9
(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_F10 = 42, |
5d0e40cd67b9
(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_F11 = 43, |
5d0e40cd67b9
(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_F12 = 44, |
0 | 213 |
|
129
df1a60bc0d70
(svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents:
116
diff
changeset
|
214 |
// 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
|
215 |
// 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
|
216 |
// on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °) |
4344
5d0e40cd67b9
(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
|
217 |
WKC_BACKQUOTE = 45, |
5d0e40cd67b9
(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_PAUSE = 46, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
219 |
|
0 | 220 |
// 0-9 are mapped to 48-57 |
221 |
// A-Z are mapped to 65-90 |
|
222 |
// a-z are mapped to 97-122 |
|
223 |
}; |
|
224 |
||
225 |
typedef struct WindowDesc { |
|
226 |
int16 left, top, width, height; |
|
2788
db2896482939
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2757
diff
changeset
|
227 |
WindowClass cls; |
db2896482939
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2757
diff
changeset
|
228 |
WindowClass parent_cls; |
0 | 229 |
uint32 flags; |
230 |
const Widget *widgets; |
|
231 |
WindowProc *proc; |
|
232 |
} WindowDesc; |
|
233 |
||
234 |
enum { |
|
4344
5d0e40cd67b9
(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
|
235 |
WDF_STD_TOOLTIPS = 1, /* use standard routine when displaying tooltips */ |
5d0e40cd67b9
(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_DEF_WIDGET = 2, /* default widget control for some widgets in the on click event */ |
5d0e40cd67b9
(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_STD_BTN = 4, /* default handling for close and drag widgets (widget no 0 and 1) */ |
2064
c889fcc76398
(svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents:
2021
diff
changeset
|
238 |
|
4344
5d0e40cd67b9
(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
|
239 |
WDF_UNCLICK_BUTTONS = 16, /* Unclick buttons when the window event times out */ |
5d0e40cd67b9
(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_STICKY_BUTTON = 32, /* Set window to sticky mode; they are not closed unless closed with 'X' (widget 2) */ |
5d0e40cd67b9
(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_RESIZABLE = 64, /* A window can be resized */ |
0 | 242 |
}; |
243 |
||
244 |
/* can be used as x or y coordinates to cause a specific placement */ |
|
245 |
enum { |
|
4344
5d0e40cd67b9
(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
|
246 |
WDP_AUTO = -1, |
0 | 247 |
WDP_CENTER = -2, |
248 |
}; |
|
249 |
||
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
250 |
typedef struct Textbuf { |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
251 |
char *buf; /* buffer in which text is saved */ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
252 |
uint16 maxlength, maxwidth; /* the maximum size of the buffer. Maxwidth specifies screensize in pixels */ |
3458
d3a6ddfa6784
(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
|
253 |
uint16 length, width; /* the current size of the string. Width specifies screensize in pixels */ |
1390
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
254 |
bool caret; /* is the caret ("_") visible or not */ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
255 |
uint16 caretpos; /* the current position of the caret in the buffer */ |
53a5713cf3f9
(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 caretxoffs; /* the current position of the caret in pixels */ |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
257 |
} Textbuf; |
53a5713cf3f9
(svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents:
1386
diff
changeset
|
258 |
|
0 | 259 |
#define WP(ptr,str) (*(str*)(ptr)->custom) |
2906
18fa7bda750f
(svn r3461) - Fix: Increase window-size as for 64-bit machines it wasn't enough
Darkvater
parents:
2888
diff
changeset
|
260 |
/* You cannot 100% reliably calculate the biggest custom struct as |
18fa7bda750f
(svn r3461) - Fix: Increase window-size as for 64-bit machines it wasn't enough
Darkvater
parents:
2888
diff
changeset
|
261 |
* the number of pointers in it and alignment will have a huge impact. |
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
262 |
* 96 is the largest window-size for 64-bit machines currently */ |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
263 |
#define WINDOW_CUSTOM_SIZE 96 |
0 | 264 |
|
2596 | 265 |
typedef struct Scrollbar { |
62
2bdd81b8adcc
(svn r63) Fix: [ 1009385 ] Too many save games prevented loading
dominik
parents:
0
diff
changeset
|
266 |
uint16 count, cap, pos; |
0 | 267 |
} Scrollbar; |
268 |
||
2596 | 269 |
typedef struct ResizeInfo { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
270 |
uint width; /* Minimum width and height */ |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
271 |
uint height; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
272 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
273 |
uint step_width; /* In how big steps the width and height go */ |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
274 |
uint step_height; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
275 |
} ResizeInfo; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
276 |
|
2622
1219c6a5bef3
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
277 |
typedef struct WindowMessage { |
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
278 |
int msg; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
279 |
int wparam; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
280 |
int lparam; |
2622
1219c6a5bef3
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
281 |
} WindowMessage; |
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
282 |
|
0 | 283 |
struct Window { |
284 |
uint16 flags4; |
|
285 |
WindowClass window_class; |
|
286 |
WindowNumber window_number; |
|
287 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
288 |
int left, top; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
289 |
int width, height; |
0 | 290 |
|
842 | 291 |
Scrollbar hscroll, vscroll, vscroll2; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
292 |
ResizeInfo resize; |
0 | 293 |
|
294 |
byte caption_color; |
|
295 |
||
296 |
uint32 click_state, disabled_state, hidden_state; |
|
297 |
WindowProc *wndproc; |
|
298 |
ViewPort *viewport; |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
299 |
const Widget *original_widget; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3812
diff
changeset
|
300 |
Widget *widget; |
0 | 301 |
uint32 desc_flags; |
302 |
||
2622
1219c6a5bef3
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
303 |
WindowMessage message; |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
304 |
byte custom[WINDOW_CUSTOM_SIZE]; |
0 | 305 |
}; |
306 |
||
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
307 |
typedef struct querystr_d { |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
308 |
StringID caption; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
309 |
WindowClass wnd_class; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
310 |
WindowNumber wnd_num; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
311 |
Textbuf text; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
312 |
const char *orig; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
313 |
CharSetFilter afilter; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
314 |
} querystr_d; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
315 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d)); |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
316 |
|
4300
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
317 |
typedef struct query_d { |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
318 |
StringID caption; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
319 |
StringID message; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
320 |
WindowClass wnd_class; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
321 |
WindowNumber wnd_num; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
322 |
void (*ok_cancel_callback)(bool ok_clicked); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
323 |
bool calledback; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
324 |
} query_d; |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
325 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(query_d)); |
687a17c9c557
(svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents:
4299
diff
changeset
|
326 |
|
0 | 327 |
typedef struct { |
4171 | 328 |
byte item_count; /* follow_vehicle */ |
329 |
byte sel_index; /* scrollpos_x */ |
|
330 |
byte main_button; /* scrollpos_y */ |
|
0 | 331 |
byte action_id; |
4171 | 332 |
StringID string_id; /* unk30 */ |
0 | 333 |
uint16 checked_items; /* unk32 */ |
2216
51a715447fc4
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2187
diff
changeset
|
334 |
byte disabled_items; |
0 | 335 |
} menu_d; |
1004 | 336 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d)); |
0 | 337 |
|
338 |
typedef struct { |
|
339 |
int16 data_1, data_2, data_3; |
|
340 |
int16 data_4, data_5; |
|
2596 | 341 |
bool close; |
0 | 342 |
byte byte_1; |
343 |
} def_d; |
|
1004 | 344 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d)); |
0 | 345 |
|
346 |
typedef struct { |
|
347 |
void *data; |
|
348 |
} void_d; |
|
1004 | 349 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d)); |
0 | 350 |
|
351 |
typedef struct { |
|
2596 | 352 |
uint16 base; |
353 |
uint16 count; |
|
0 | 354 |
} tree_d; |
1004 | 355 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d)); |
0 | 356 |
|
357 |
typedef struct { |
|
358 |
StringID string_id; |
|
359 |
} tooltips_d; |
|
1004 | 360 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d)); |
0 | 361 |
|
362 |
typedef struct { |
|
363 |
byte railtype; |
|
364 |
byte sel_index; |
|
2498
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2448
diff
changeset
|
365 |
EngineID sel_engine; |
befad2fe53d2
(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 rename_engine; |
0 | 367 |
} buildtrain_d; |
1004 | 368 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildtrain_d)); |
0 | 369 |
|
370 |
typedef struct { |
|
842 | 371 |
byte vehicletype; |
372 |
byte sel_index[2]; |
|
2746
d96ce2fdc3e4
(svn r3291) - Codechange, Autoreplace: Replace int with EngineID and -1 with INVALID_ENGINE, as appropriate.
peter1138
parents:
2683
diff
changeset
|
373 |
EngineID sel_engine[2]; |
842 | 374 |
uint16 count[2]; |
2970
77fa46c313c0
(svn r3535) -Feature: [autoreplace] allow autoreplacing of train wagons
bjarni
parents:
2906
diff
changeset
|
375 |
bool wagon_btnstate; // true means engine is selected |
842 | 376 |
} replaceveh_d; |
1004 | 377 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d)); |
842 | 378 |
|
379 |
typedef struct { |
|
0 | 380 |
VehicleID sel; |
381 |
} traindepot_d; |
|
1004 | 382 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindepot_d)); |
0 | 383 |
|
384 |
typedef struct { |
|
385 |
int sel; |
|
386 |
} order_d; |
|
1004 | 387 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d)); |
0 | 388 |
|
389 |
typedef struct { |
|
390 |
byte tab; |
|
391 |
} traindetails_d; |
|
1004 | 392 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d)); |
0 | 393 |
|
394 |
typedef struct { |
|
849
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
395 |
int32 scroll_x; |
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
396 |
int32 scroll_y; |
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
397 |
int32 subscroll; |
0 | 398 |
} smallmap_d; |
4318
fe085a1dd0ad
(svn r5971) -Fix: wrong struct in assert_compile (thomasdev)
truelight
parents:
4300
diff
changeset
|
399 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d)); |
0 | 400 |
|
401 |
typedef struct { |
|
402 |
uint32 face; |
|
403 |
byte gender; |
|
404 |
} facesel_d; |
|
1004 | 405 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d)); |
0 | 406 |
|
407 |
typedef struct { |
|
408 |
int sel; |
|
3344
d86c852715fa
(svn r4128) - CodeChange: Add proper semantics for CargoID for such variables instead of using the general byte-type.
Darkvater
parents:
2970
diff
changeset
|
409 |
CargoID cargo; |
0 | 410 |
} refit_d; |
1004 | 411 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d)); |
0 | 412 |
|
413 |
typedef struct { |
|
2116 | 414 |
VehicleID follow_vehicle; |
849
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
415 |
int32 scrollpos_x; |
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
416 |
int32 scrollpos_y; |
0 | 417 |
} vp_d; |
1004 | 418 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d) + 3 * sizeof(byte)); // + 3 * byte is a hack from Miham |
419 |
||
420 |
// vp2_d is the same as vp_d, except for the data_# values.. |
|
421 |
typedef struct { |
|
422 |
uint16 follow_vehicle; |
|
423 |
int32 scrollpos_x; |
|
424 |
int32 scrollpos_y; |
|
425 |
byte data_1; |
|
426 |
byte data_2; |
|
427 |
byte data_3; |
|
428 |
} vp2_d; |
|
429 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d)); |
|
0 | 430 |
|
431 |
typedef struct { |
|
432 |
uint16 follow_vehicle; |
|
849
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
433 |
int32 scrollpos_x; |
c6223dbdb202
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
434 |
int32 scrollpos_y; |
0 | 435 |
NewsItem *ni; |
436 |
} news_d; |
|
1004 | 437 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d)); |
0 | 438 |
|
859
46839573bed8
(svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents:
849
diff
changeset
|
439 |
typedef struct { |
998
d9dc257b8949
(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
|
440 |
uint32 background_img; |
d9dc257b8949
(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 |
int8 rank; |
d9dc257b8949
(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 |
} highscore_d; |
1004 | 443 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d)); |
998
d9dc257b8949
(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
|
444 |
|
d9dc257b8949
(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 |
typedef struct { |
d9dc257b8949
(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 |
int height; |
d9dc257b8949
(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 |
uint16 counter; |
d9dc257b8949
(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 |
} scroller_d; |
1004 | 449 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d)); |
859
46839573bed8
(svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents:
849
diff
changeset
|
450 |
|
588 | 451 |
typedef enum VehicleListFlags { |
2888
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
452 |
VL_DESC = 0x01, // sort descending or ascending |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
453 |
VL_RESORT = 0x02, // instruct the code to resort the list in the next loop |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
454 |
VL_REBUILD = 0x04 // create sort-listing to use for qsort and friends |
588 | 455 |
} VehicleListFlags; |
456 |
||
457 |
typedef struct vehiclelist_d { |
|
4266
57a72ad31925
(svn r5894) Remove a totally unnecessary indirection in the vehicle sorter code. Less code, less data, simply better
tron
parents:
4171
diff
changeset
|
458 |
const Vehicle** sort_list; |
588 | 459 |
uint16 list_length; |
460 |
byte sort_type; |
|
461 |
VehicleListFlags flags; |
|
462 |
uint16 resort_timer; |
|
463 |
} vehiclelist_d; |
|
1004 | 464 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d)); |
588 | 465 |
|
2888
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
466 |
typedef struct list_d { |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
467 |
uint16 list_length; // length of the list being sorted |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
468 |
byte sort_type; // what criteria to sort on |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
469 |
VehicleListFlags flags;// used to control sorting/resorting/etc. |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
470 |
uint16 resort_timer; // resort list after a given amount of ticks if set |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
471 |
} list_d; |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
472 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(list_d)); |
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
473 |
|
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
474 |
typedef struct message_d { |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
475 |
int msg; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
476 |
int wparam; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
477 |
int lparam; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
478 |
} message_d; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
479 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d)); |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
480 |
|
2636
e2bfdc3e82b6
(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 |
typedef struct dropdown_d { |
2683
6f67fcf73873
(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
|
482 |
uint32 disabled_state; |
6f67fcf73873
(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
|
483 |
uint32 hidden_state; |
2636
e2bfdc3e82b6
(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 |
WindowClass parent_wnd_class; |
e2bfdc3e82b6
(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 |
WindowNumber parent_wnd_num; |
e2bfdc3e82b6
(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 |
byte parent_button; |
e2bfdc3e82b6
(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 num_items; |
e2bfdc3e82b6
(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 |
byte selected_index; |
e2bfdc3e82b6
(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 |
const StringID *items; |
e2bfdc3e82b6
(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 |
byte click_delay; |
e2bfdc3e82b6
(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 |
bool drag_mode; |
e2bfdc3e82b6
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
492 |
} dropdown_d; |
e2bfdc3e82b6
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
493 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(dropdown_d)); |
e2bfdc3e82b6
(svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents:
2634
diff
changeset
|
494 |
|
0 | 495 |
enum WindowEvents { |
4344
5d0e40cd67b9
(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_CLICK = 0, |
5d0e40cd67b9
(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_PAINT = 1, |
5d0e40cd67b9
(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_MOUSELOOP = 2, |
5d0e40cd67b9
(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_TICK = 3, |
5d0e40cd67b9
(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_4 = 4, |
5d0e40cd67b9
(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_TIMEOUT = 5, |
5d0e40cd67b9
(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_PLACE_OBJ = 6, |
5d0e40cd67b9
(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_ABORT_PLACE_OBJ = 7, |
5d0e40cd67b9
(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_DESTROY = 8, |
5d0e40cd67b9
(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_ON_EDIT_TEXT = 9, |
5d0e40cd67b9
(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_POPUPMENU_SELECT = 10, |
5d0e40cd67b9
(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_POPUPMENU_OVER = 11, |
5d0e40cd67b9
(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_DRAGDROP = 12, |
5d0e40cd67b9
(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_PLACE_DRAG = 13, |
5d0e40cd67b9
(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_PLACE_MOUSEUP = 14, |
5d0e40cd67b9
(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_PLACE_PRESIZE = 15, |
5d0e40cd67b9
(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_DROPDOWN_SELECT = 16, |
5d0e40cd67b9
(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_RCLICK = 17, |
5d0e40cd67b9
(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
|
514 |
WE_KEYPRESS = 18, |
5d0e40cd67b9
(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_CREATE = 19, |
5d0e40cd67b9
(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_MOUSEOVER = 20, |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
517 |
WE_ON_EDIT_TEXT_CANCEL = 21, |
4344
5d0e40cd67b9
(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_RESIZE = 22, |
5d0e40cd67b9
(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
|
519 |
WE_MESSAGE = 23, |
5d0e40cd67b9
(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
|
520 |
WE_SCROLL = 24, |
5d0e40cd67b9
(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
|
521 |
WE_MOUSEWHEEL = 25, |
0 | 522 |
}; |
523 |
||
524 |
||
525 |
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/ |
|
526 |
enum WindowWidgetBehaviours { |
|
4344
5d0e40cd67b9
(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
|
527 |
WWB_PUSHBUTTON = 1 << 5, |
0 | 528 |
WWB_NODISBUTTON = 2 << 5, |
529 |
}; |
|
530 |
||
531 |
||
532 |
enum WindowWidgetTypes { |
|
533 |
WWT_EMPTY = 0, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
534 |
|
4344
5d0e40cd67b9
(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
|
535 |
WWT_IMGBTN = 1, /* button with image */ |
5d0e40cd67b9
(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_PANEL = WWT_IMGBTN, |
5d0e40cd67b9
(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_PANEL_2 = 2, /* button with diff image when clicked */ |
0 | 538 |
|
4344
5d0e40cd67b9
(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_TEXTBTN = 3, /* button with text */ |
5d0e40cd67b9
(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_4 = 4, /* button with diff text when clicked */ |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
541 |
WWT_LABEL = 5, /* centered label */ |
4344
5d0e40cd67b9
(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_6 = 6, /* combo box text area */ |
5d0e40cd67b9
(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_MATRIX = 7, |
5d0e40cd67b9
(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
|
544 |
WWT_SCROLLBAR = 8, |
5d0e40cd67b9
(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
|
545 |
WWT_FRAME = 9, /* frame */ |
5d0e40cd67b9
(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_CAPTION = 10, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
547 |
|
0 | 548 |
WWT_HSCROLLBAR = 11, |
4344
5d0e40cd67b9
(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_STICKYBOX = 12, |
5d0e40cd67b9
(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_SCROLL2BAR = 13, /* 2nd vertical scrollbar*/ |
5d0e40cd67b9
(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
|
551 |
WWT_RESIZEBOX = 14, |
5d0e40cd67b9
(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_CLOSEBOX = 15, |
5d0e40cd67b9
(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
|
553 |
WWT_LAST = 16, /* Last Item. use WIDGETS_END to fill up padding!! */ |
0 | 554 |
|
4344
5d0e40cd67b9
(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
|
555 |
WWT_MASK = 31, |
0 | 556 |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
164
diff
changeset
|
557 |
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
|
558 |
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
|
559 |
WWT_NODISTXTBTN = WWT_TEXTBTN | WWB_NODISBUTTON, |
0 | 560 |
}; |
561 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
562 |
#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
|
563 |
|
0 | 564 |
enum WindowFlags { |
4344
5d0e40cd67b9
(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_TIMEOUT_SHL = 0, |
5d0e40cd67b9
(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_TIMEOUT_MASK = 7, |
5d0e40cd67b9
(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_DRAGGING = 1 << 3, |
5d0e40cd67b9
(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_SCROLL_UP = 1 << 4, |
5d0e40cd67b9
(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_SCROLL_DOWN = 1 << 5, |
5d0e40cd67b9
(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_SCROLL_MIDDLE = 1 << 6, |
5d0e40cd67b9
(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
|
571 |
WF_HSCROLL = 1 << 7, |
5d0e40cd67b9
(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
|
572 |
WF_SIZING = 1 << 8, |
5d0e40cd67b9
(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
|
573 |
WF_STICKY = 1 << 9, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
574 |
|
0 | 575 |
WF_DISABLE_VP_SCROLL = 1 << 10, |
576 |
||
4344
5d0e40cd67b9
(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
|
577 |
WF_WHITE_BORDER_ONE = 1 << 11, |
0 | 578 |
WF_WHITE_BORDER_MASK = 3 << 11, |
4344
5d0e40cd67b9
(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
|
579 |
WF_SCROLL2 = 1 << 13, |
0 | 580 |
}; |
581 |
||
582 |
/* window.c */ |
|
583 |
void CallWindowEventNP(Window *w, int event); |
|
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
584 |
void CallWindowTickEvent(void); |
4171 | 585 |
void SetWindowDirty(const Window *w); |
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
586 |
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam); |
0 | 587 |
|
588 |
Window *FindWindowById(WindowClass cls, WindowNumber number); |
|
589 |
void DeleteWindow(Window *w); |
|
590 |
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number); |
|
591 |
Window *FindWindowFromPt(int x, int y); |
|
592 |
||
4171 | 593 |
bool IsWindowOfPrototype(const Window *w, const Widget *widget); |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
594 |
void AssignWidgetToWindow(Window *w, const Widget *widget); |
0 | 595 |
Window *AllocateWindow( |
596 |
int x, |
|
597 |
int y, |
|
598 |
int width, |
|
599 |
int height, |
|
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
600 |
WindowProc *proc, |
0 | 601 |
WindowClass cls, |
602 |
const Widget *widget); |
|
603 |
||
604 |
Window *AllocateWindowDesc(const WindowDesc *desc); |
|
605 |
Window *AllocateWindowDescFront(const WindowDesc *desc, int value); |
|
606 |
||
607 |
void DrawWindowViewport(Window *w); |
|
608 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
609 |
void InitWindowSystem(void); |
1474
d83520edcda6
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents:
1390
diff
changeset
|
610 |
void UnInitWindowSystem(void); |
d83520edcda6
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents:
1390
diff
changeset
|
611 |
void ResetWindowSystem(void); |
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
612 |
int GetMenuItemIndex(const Window *w, int x, int y); |
1570
c470380facb9
(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
|
613 |
void InputLoop(void); |
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
614 |
void UpdateWindows(void); |
4171 | 615 |
void InvalidateWidget(const Window *w, byte widget_index); |
0 | 616 |
|
2187
2a51f8925eeb
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
617 |
void GuiShowTooltips(StringID string_id); |
0 | 618 |
|
619 |
void UnclickWindowButtons(Window *w); |
|
620 |
void UnclickSomeWindowButtons(Window *w, uint32 mask); |
|
621 |
void RelocateAllWindows(int neww, int newh); |
|
380 | 622 |
int PositionMainToolbar(Window *w); |
0 | 623 |
|
624 |
/* widget.c */ |
|
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
625 |
int GetWidgetFromPos(const Window *w, int x, int y); |
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
626 |
void DrawWindowWidgets(const Window *w); |
2448
0a34e90cb31f
(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
|
627 |
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask); |
0 | 628 |
|
629 |
void HandleButtonClick(Window *w, byte widget); |
|
630 |
||
1093
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
631 |
Window *GetCallbackWnd(void); |
e8d26c7dc42f
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1009
diff
changeset
|
632 |
void DeleteNonVitalWindows(void); |
763
8ff348acf75e
(svn r1225) -Feature: SHIFT+DEL now deletes all non-vital windows (only status bar and main bar remain)
darkvater
parents:
682
diff
changeset
|
633 |
void DeleteAllNonVitalWindows(void); |
983
1be852dcdd4c
(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
|
634 |
void HideVitalWindows(void); |
1be852dcdd4c
(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
|
635 |
void ShowVitalWindows(void); |
0 | 636 |
|
637 |
/* window.c */ |
|
682
7f5de4abac85
(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
|
638 |
VARDEF Window _windows[25]; |
0 | 639 |
VARDEF Window *_last_window; |
640 |
||
641 |
VARDEF Point _cursorpos_drag_start; |
|
642 |
||
643 |
VARDEF bool _left_button_down; |
|
644 |
VARDEF bool _left_button_clicked; |
|
645 |
||
646 |
VARDEF bool _right_button_down; |
|
647 |
VARDEF bool _right_button_clicked; |
|
648 |
||
649 |
VARDEF int _alloc_wnd_parent_num; |
|
650 |
||
651 |
VARDEF int _scrollbar_start_pos; |
|
652 |
VARDEF int _scrollbar_size; |
|
653 |
VARDEF byte _scroller_click_timeout; |
|
654 |
||
655 |
VARDEF bool _scrolling_scrollbar; |
|
656 |
VARDEF bool _scrolling_viewport; |
|
657 |
VARDEF bool _popup_menu_active; |
|
658 |
||
659 |
VARDEF byte _special_mouse_mode; |
|
660 |
enum SpecialMouseMode { |
|
4344
5d0e40cd67b9
(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_NONE = 0, |
0 | 662 |
WSM_DRAGDROP = 1, |
4344
5d0e40cd67b9
(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
|
663 |
WSM_SIZING = 2, |
5d0e40cd67b9
(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
|
664 |
WSM_PRESIZE = 3, |
0 | 665 |
}; |
666 |
||
667 |
void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y); |
|
668 |
||
669 |
#endif /* WINDOW_H */ |