author | KUDr |
Tue, 13 Feb 2007 22:47:05 +0000 | |
branch | cpp_gui |
changeset 6248 | 24583caadfee |
parent 6247 | 67e881450cf3 |
child 6249 | abafebc2fbce |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#ifndef WINDOW_H |
4 |
#define WINDOW_H |
|
5 |
||
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
6 |
#include <list> |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
7 |
#include "macros.h" |
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
8 |
#include "string.h" |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4695
diff
changeset
|
9 |
#include "order.h" |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
10 |
#include "rail.h" |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
11 |
#include "airport.h" |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
12 |
#include "misc/countedptr.hpp" |
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
13 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
14 |
typedef struct WindowEvent WindowEvent; |
0 | 15 |
|
16 |
typedef void WindowProc(Window *w, WindowEvent *e); |
|
17 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
18 |
/* 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
|
19 |
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
|
20 |
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
|
21 |
to resize itself. |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
22 |
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
|
23 |
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
|
24 |
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
|
25 |
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
|
26 |
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
|
27 |
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
|
28 |
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
|
29 |
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
|
30 |
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
|
31 |
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
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
|
41 |
AFTER window-creation, with: |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
42 |
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
|
43 |
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
|
44 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
45 |
typedef enum ResizeFlags { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
46 |
RESIZE_NONE = 0, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
47 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
48 |
RESIZE_LEFT = 1, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
49 |
RESIZE_RIGHT = 2, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
50 |
RESIZE_TOP = 4, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
51 |
RESIZE_BOTTOM = 8, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
52 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
53 |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
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
|
58 |
RESIZE_RTB = RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, |
4749
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
59 |
|
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
60 |
/* The following flags are used by the system to specify what is disabled, hidden, or clicked |
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
61 |
* They are used in the same place as the above RESIZE_x flags, Widget visual_flags. |
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
62 |
* These states are used in exceptions. If nothing is specified, they will indicate |
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
63 |
* Enabled, visible or unclicked widgets*/ |
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
64 |
WIDG_DISABLED = 4, // widget is greyed out, not available |
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
65 |
WIDG_HIDDEN = 5, // widget is made invisible |
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
66 |
WIDG_LOWERED = 6, // widget is paint lowered, a pressed button in fact |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
67 |
} ResizeFlag; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
68 |
|
6242
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
69 |
enum WindowFlags { |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
70 |
//WF_TIMEOUT_SHL = 0, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
71 |
//WF_TIMEOUT_MASK = 7, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
72 |
WF_DRAGGING = 1 << 3, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
73 |
WF_SCROLL_UP = 1 << 4, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
74 |
WF_SCROLL_DOWN = 1 << 5, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
75 |
WF_SCROLL_MIDDLE = 1 << 6, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
76 |
WF_HSCROLL = 1 << 7, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
77 |
WF_SIZING = 1 << 8, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
78 |
WF_STICKY = 1 << 9, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
79 |
|
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
80 |
WF_DISABLE_VP_SCROLL = 1 << 10, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
81 |
|
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
82 |
//WF_WHITE_BORDER_ONE = 1 << 11, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
83 |
//WF_WHITE_BORDER_MASK = 1 << 12 | WF_WHITE_BORDER_ONE, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
84 |
WF_SCROLL2 = 1 << 13, |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
85 |
}; |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
86 |
|
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
87 |
DECLARE_ENUM_AS_BIT_SET(WindowFlags); |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
88 |
|
4755
4a3564952554
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
89 |
/* used to indicate the end of widgets' list for vararg functions */ |
4a3564952554
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
90 |
enum { |
4a3564952554
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
91 |
WIDGET_LIST_END = -1, |
4a3564952554
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
92 |
}; |
4a3564952554
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
93 |
|
0 | 94 |
typedef struct Widget { |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
95 |
byte type; ///< Widget type, see @WindowWidgetTypes |
4749
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
96 |
byte display_flags; ///< Resize direction, alignment, etc. during resizing, see @ResizeFlags |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
97 |
byte color; ///< Widget colour, see docs/ottd-colourtext-palette.png |
6224
5eec2dfd13af
(svn r8662) -Fix r8661: don't try to put negative values in unsigned vars
bjarni
parents:
6195
diff
changeset
|
98 |
int16 left, right, top, bottom; ///< The position offsets inside the window |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
99 |
uint16 data; ///< The String/Image or special code (list-matrixes) of a widget |
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
100 |
StringID tooltips; ///< Tooltips that are shown when rightclicking on a widget |
0 | 101 |
} Widget; |
102 |
||
4437
d06bb548e48d
(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
|
103 |
typedef enum FrameFlags { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
104 |
FR_NONE = 0x00, |
1938
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
105 |
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
|
106 |
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
|
107 |
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
|
108 |
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
d06bb548e48d
(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
|
109 |
} FrameFlags; |
d06bb548e48d
(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
|
110 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
111 |
DECLARE_ENUM_AS_BIT_SET(FrameFlags); |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
112 |
|
4437
d06bb548e48d
(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
|
113 |
void DrawFrameRect(int left, int top, int right, int bottom, int color, FrameFlags flags); |
1938
21bd6ef5f85e
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
114 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
115 |
enum WindowEventCodes { |
5664 | 116 |
WE_CREATE, |
117 |
WE_DESTROY, |
|
118 |
WE_PAINT, |
|
119 |
WE_KEYPRESS, |
|
120 |
WE_CLICK, |
|
121 |
WE_RCLICK, |
|
122 |
WE_MOUSEOVER, |
|
123 |
WE_MOUSELOOP, |
|
124 |
WE_MOUSEWHEEL, |
|
125 |
WE_TICK, |
|
126 |
WE_4, |
|
127 |
WE_TIMEOUT, |
|
128 |
WE_PLACE_OBJ, |
|
129 |
WE_ABORT_PLACE_OBJ, |
|
130 |
WE_ON_EDIT_TEXT, |
|
131 |
WE_ON_EDIT_TEXT_CANCEL, |
|
132 |
WE_POPUPMENU_SELECT, |
|
133 |
WE_POPUPMENU_OVER, |
|
134 |
WE_DRAGDROP, |
|
135 |
WE_PLACE_DRAG, |
|
136 |
WE_PLACE_MOUSEUP, |
|
137 |
WE_PLACE_PRESIZE, |
|
138 |
WE_DROPDOWN_SELECT, |
|
139 |
WE_RESIZE, |
|
140 |
WE_MESSAGE, |
|
141 |
WE_SCROLL, |
|
142 |
WE_INVALIDATE_DATA, |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
143 |
}; |
0 | 144 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
145 |
struct WindowEvent { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
146 |
byte event; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
147 |
union { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
148 |
struct{ |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
149 |
Point pt; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
150 |
int widget; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
151 |
} click; |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
152 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
153 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
154 |
Point pt; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
155 |
TileIndex tile; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
156 |
TileIndex starttile; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
157 |
int userdata; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
158 |
} place; |
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
159 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
160 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
161 |
Point pt; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
162 |
int widget; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
163 |
} dragdrop; |
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
|
164 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
165 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
166 |
Point size; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
167 |
Point diff; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
168 |
} sizing; |
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
|
169 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
170 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
171 |
char *str; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
172 |
} edittext; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
173 |
|
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
174 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
175 |
Point pt; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
176 |
} popupmenu; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
177 |
|
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
178 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
179 |
int button; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
180 |
int index; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
181 |
} dropdown; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
182 |
|
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
183 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
184 |
Point pt; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
185 |
int widget; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
186 |
} mouseover; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
187 |
|
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
188 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
189 |
bool cont; // continue the search? (default true) |
5108
dc67d70b5a45
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5090
diff
changeset
|
190 |
uint16 key; // 16-bit Unicode value of the key |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
191 |
uint16 keycode;// untranslated key (including shift-state) |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
192 |
} keypress; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
193 |
|
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
194 |
struct { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
195 |
int msg; // message to be sent |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
196 |
int wparam; // additional message-specific information |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
197 |
int lparam; // additional message-specific information |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
198 |
} message; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
199 |
|
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
200 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
201 |
Point delta; // delta position against position of last call |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
202 |
} scroll; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
203 |
|
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
204 |
struct { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
205 |
int wheel; // how much was 'wheel'd' |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
206 |
} wheel; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
207 |
} we; |
0 | 208 |
}; |
209 |
||
210 |
typedef struct WindowDesc { |
|
211 |
int16 left, top, width, height; |
|
2788
db2896482939
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2757
diff
changeset
|
212 |
WindowClass cls; |
db2896482939
(svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents:
2757
diff
changeset
|
213 |
WindowClass parent_cls; |
0 | 214 |
uint32 flags; |
215 |
const Widget *widgets; |
|
216 |
WindowProc *proc; |
|
217 |
} WindowDesc; |
|
218 |
||
5664 | 219 |
enum WindowDefaultFlag { |
5667
248a3234d2e2
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5666
diff
changeset
|
220 |
WDF_STD_TOOLTIPS = 1, /* use standard routine when displaying tooltips */ |
248a3234d2e2
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5666
diff
changeset
|
221 |
WDF_DEF_WIDGET = 2, /* default widget control for some widgets in the on click event */ |
248a3234d2e2
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5666
diff
changeset
|
222 |
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
|
223 |
|
5667
248a3234d2e2
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5666
diff
changeset
|
224 |
WDF_UNCLICK_BUTTONS = 16, /* Unclick buttons when the window event times out */ |
248a3234d2e2
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5666
diff
changeset
|
225 |
WDF_STICKY_BUTTON = 32, /* Set window to sticky mode; they are not closed unless closed with 'X' (widget 2) */ |
248a3234d2e2
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5666
diff
changeset
|
226 |
WDF_RESIZABLE = 64, /* A window can be resized */ |
248a3234d2e2
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5666
diff
changeset
|
227 |
WDF_MODAL = 128, /* The window is a modal child of some other window, meaning the parent is 'inactive' */ |
0 | 228 |
}; |
229 |
||
230 |
/* can be used as x or y coordinates to cause a specific placement */ |
|
5664 | 231 |
enum WindowDefaultPosition { |
5072
df5bde83a4bc
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
232 |
WDP_AUTO = -1, ///< Find a place automatically |
df5bde83a4bc
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
233 |
WDP_CENTER = -2, ///< Center the window (left/right or top/bottom) |
df5bde83a4bc
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
234 |
WDP_ALIGN_TBR = -3, ///< Align the right side of the window with the right side of the main toolbar |
df5bde83a4bc
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
235 |
WDP_ALIGN_TBL = -4, ///< Align the left side of the window with the left side of the main toolbar |
0 | 236 |
}; |
237 |
||
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
|
238 |
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
|
239 |
char *buf; /* buffer in which text is saved */ |
5698
6697ee90a195
(svn r7700) -Fix (r7182): the caret 'randomly' jumped back and forth when getting a new randomised seed in the Generation World GUI.
rubidium
parents:
5682
diff
changeset
|
240 |
uint16 maxlength, maxwidth; /* the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes */ |
6697ee90a195
(svn r7700) -Fix (r7182): the caret 'randomly' jumped back and forth when getting a new randomised seed in the Generation World GUI.
rubidium
parents:
5682
diff
changeset
|
241 |
uint16 length, width; /* the current size of the string. Width specifies screensize in pixels, length is in bytes */ |
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
|
242 |
bool caret; /* is the caret ("_") visible or not */ |
5698
6697ee90a195
(svn r7700) -Fix (r7182): the caret 'randomly' jumped back and forth when getting a new randomised seed in the Generation World GUI.
rubidium
parents:
5682
diff
changeset
|
243 |
uint16 caretpos; /* the current position of the caret in the buffer, in bytes */ |
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
|
244 |
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
|
245 |
} 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
|
246 |
|
0 | 247 |
#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
|
248 |
/* 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
|
249 |
* 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
|
250 |
* 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
|
251 |
#define WINDOW_CUSTOM_SIZE 96 |
0 | 252 |
|
2596 | 253 |
typedef struct Scrollbar { |
62
2bdd81b8adcc
(svn r63) Fix: [ 1009385 ] Too many save games prevented loading
dominik
parents:
0
diff
changeset
|
254 |
uint16 count, cap, pos; |
0 | 255 |
} Scrollbar; |
256 |
||
2596 | 257 |
typedef struct ResizeInfo { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
258 |
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
|
259 |
uint height; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
260 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
261 |
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
|
262 |
uint step_height; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
263 |
} ResizeInfo; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
264 |
|
2622
1219c6a5bef3
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
265 |
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
|
266 |
int msg; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
267 |
int wparam; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
268 |
int lparam; |
2622
1219c6a5bef3
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
269 |
} WindowMessage; |
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
270 |
|
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
271 |
struct CountedObject { |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
272 |
int32 m_ref_cnt; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
273 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
274 |
CountedObject() |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
275 |
: m_ref_cnt(0) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
276 |
{} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
277 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
278 |
virtual ~CountedObject() |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
279 |
{}; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
280 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
281 |
virtual int32 AddRef(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
282 |
virtual int32 Release(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
283 |
virtual void FinalRelease() {}; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
284 |
}; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
285 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
286 |
struct Window; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
287 |
typedef CCountedPtr<Window> WindowPtr; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
288 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
289 |
struct WindowList { |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
290 |
struct Item { |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
291 |
WindowPtr w; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
292 |
Item(Window *v = NULL) : w(v) {} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
293 |
Item(const Item &src) : w(src.w) {} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
294 |
~Item() |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
295 |
{} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
296 |
}; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
297 |
typedef std::list<Item> List; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
298 |
typedef List::iterator Iterator; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
299 |
typedef List::reverse_iterator ReverseIterator; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
300 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
301 |
List m_list; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
302 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
303 |
void Add(Window *w); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
304 |
void Remove(Window *w); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
305 |
Iterator Find(Window *w); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
306 |
Iterator FindFirstVitalWindow(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
307 |
Iterator FindByClass(WindowClass cls); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
308 |
Iterator FindById(WindowClass cls, WindowNumber num); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
309 |
|
6236
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
310 |
Iterator EnumT(bool (*enum_proc)(Iterator)) |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
311 |
{ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
312 |
for (Iterator it = m_list.begin(); it != m_list.end(); ++it) { |
6236
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
313 |
if (enum_proc(it)) return it; |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
314 |
} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
315 |
return m_list.end(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
316 |
} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
317 |
|
6236
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
318 |
template <class Tmatch_1> Iterator EnumT(bool (*enum_proc)(Iterator, Tmatch_1), Tmatch_1 match) |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
319 |
{ |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
320 |
for (Iterator it = m_list.begin(); it != m_list.end(); ++it) { |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
321 |
if (enum_proc(it, match)) return it; |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
322 |
} |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
323 |
return m_list.end(); |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
324 |
} |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
325 |
|
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
326 |
template <class Tmatch_1, class Tmatch_2> Iterator EnumT(bool (*enum_proc)(Iterator, Tmatch_1, Tmatch_2), Tmatch_1 match_1, Tmatch_2 match_2) |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
327 |
{ |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
328 |
for (Iterator it = m_list.begin(); it != m_list.end(); ++it) { |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
329 |
if (enum_proc(it, match_1, match_2)) return it; |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
330 |
} |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
331 |
return m_list.end(); |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
332 |
} |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
333 |
|
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
334 |
Iterator ReverseEnumT(bool (*enum_proc)(Iterator)) |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
335 |
{ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
336 |
for (Iterator it = m_list.end(); it != m_list.begin(); ) { |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
337 |
--it; |
6236
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
338 |
if (enum_proc(it)) return it; |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
339 |
} |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
340 |
return m_list.end(); |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
341 |
} |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
342 |
|
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
343 |
template <class Tmatch_1> Iterator ReverseEnumT(bool (*enum_proc)(Iterator, Tmatch_1), Tmatch_1 match) |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
344 |
{ |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
345 |
for (Iterator it = m_list.end(); it != m_list.begin(); ) { |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
346 |
--it; |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
347 |
if (enum_proc(it, match)) return it; |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
348 |
} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
349 |
return m_list.end(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
350 |
} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
351 |
}; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
352 |
|
6246
2a4c2c4d66f0
(svn r8713) [cpp_gui] -Codechange: SetWindowWidgetDisabledState turned into Window method
KUDr
parents:
6245
diff
changeset
|
353 |
struct Window : public CountedObject { |
6245
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
354 |
public: |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
355 |
static WindowList s_list; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
356 |
|
6242
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
357 |
WindowFlags flags4; |
0 | 358 |
WindowClass window_class; |
359 |
WindowNumber window_number; |
|
360 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
361 |
int left, top; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
362 |
int width, height; |
0 | 363 |
|
842 | 364 |
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
|
365 |
ResizeInfo resize; |
0 | 366 |
|
367 |
byte caption_color; |
|
6242
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
368 |
byte autorepeat_timeout; ///< timer for scroll (spin) click autorepeat |
17609af8a1d1
(svn r8704) [cpp_gui] -Codechange: flash_timeout and autorepeat_timeout extracted from Window::flags4
KUDr
parents:
6241
diff
changeset
|
369 |
byte flash_timeout; ///< timer for flashing white border |
0 | 370 |
|
371 |
WindowProc *wndproc; |
|
372 |
ViewPort *viewport; |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
373 |
const Widget *original_widget; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3812
diff
changeset
|
374 |
Widget *widget; |
5232
0ba6acdc527f
(svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents:
5199
diff
changeset
|
375 |
uint widget_count; |
0 | 376 |
uint32 desc_flags; |
377 |
||
2622
1219c6a5bef3
(svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents:
2596
diff
changeset
|
378 |
WindowMessage message; |
5666
1af12f02bf17
(svn r7618) -Feature: Add support for a parent<>child relationship in Window terms. A child
Darkvater
parents:
5664
diff
changeset
|
379 |
Window *parent; |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
380 |
byte custom[WINDOW_CUSTOM_SIZE]; |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
381 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
382 |
Window(int x, int y, int w, int h, WindowProc *proc, WindowClass cls, const Widget *widget, int wnd_number); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
383 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
384 |
void ZeroInit() |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
385 |
{ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
386 |
memset(&flags4, 0, sizeof(*this) - cpp_offsetof(Window, flags4)); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
387 |
} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
388 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
389 |
Window* FindChild() const; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
390 |
void SetDirty() const; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
391 |
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
392 |
void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
393 |
void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
394 |
void RaiseButtons(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
395 |
void HandleButtonClick(byte widget); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
396 |
void BringToFront(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
397 |
static Window* BringToFrontById(WindowClass cls, WindowNumber number); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
398 |
void StartDrag(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
399 |
bool ContinueDrag(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
400 |
void StartSizing(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
401 |
bool ContinueSizing(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
402 |
static bool HandleWindowDragging(void); |
6243
8f231ee779cb
(svn r8706) [cpp_gui] -Codechange: few more functions turned into Window methods
KUDr
parents:
6242
diff
changeset
|
403 |
void DispatchLeftClickEvent(int x, int y); |
8f231ee779cb
(svn r8706) [cpp_gui] -Codechange: few more functions turned into Window methods
KUDr
parents:
6242
diff
changeset
|
404 |
void DispatchRightClickEvent(int x, int y); |
8f231ee779cb
(svn r8706) [cpp_gui] -Codechange: few more functions turned into Window methods
KUDr
parents:
6242
diff
changeset
|
405 |
void DispatchMouseWheelEvent(int widget, int wheel); |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
406 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
407 |
/*virtual*/ void FinalRelease(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
408 |
virtual void Close(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
409 |
virtual bool IsVital(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
410 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
411 |
static Window* Allocate(int x, int y, int width, int height, WindowProc *proc, WindowClass cls, const Widget *widget); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
412 |
static Window* Get(WindowList::Iterator it); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
413 |
static Window* FindById(WindowClass cls, WindowNumber num); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
414 |
static void SetDirtyById(WindowClass cls, WindowNumber num); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
415 |
|
6240
8d4ea2d6befc
(svn r8699) [cpp_gui] -Cleanup: removed the word Window from some Window method names as just being Winddow methods indicates that it's working on a window
bjarni
parents:
6239
diff
changeset
|
416 |
bool IsOfPrototype(const Widget *widgets) const; |
6238
1ff56ccccbb5
(svn r8696) [cpp_gui] -Codechange: changed GetMenuItemIndex() and ResizeWindow() into Window methods
bjarni
parents:
6237
diff
changeset
|
417 |
int GetMenuItemIndex(int x, int y) const; |
6240
8d4ea2d6befc
(svn r8699) [cpp_gui] -Cleanup: removed the word Window from some Window method names as just being Winddow methods indicates that it's working on a window
bjarni
parents:
6239
diff
changeset
|
418 |
void Resize(int x, int y); |
6238
1ff56ccccbb5
(svn r8696) [cpp_gui] -Codechange: changed GetMenuItemIndex() and ResizeWindow() into Window methods
bjarni
parents:
6237
diff
changeset
|
419 |
|
6245
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
420 |
void CallEventNP(int event); |
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
421 |
|
6240
8d4ea2d6befc
(svn r8699) [cpp_gui] -Cleanup: removed the word Window from some Window method names as just being Winddow methods indicates that it's working on a window
bjarni
parents:
6239
diff
changeset
|
422 |
void AssignWidget(const Widget *widget); |
6237
bce32e54c993
(svn r8695) [cpp_gui] -Codechange: changed AssignWidgetToWindow() and InvalidateWidget() into Window methods
bjarni
parents:
6236
diff
changeset
|
423 |
|
6244
4b42fb40e6d2
(svn r8710) [cpp_gui] -Codechange: yet another two functions are turned into Window methods
bjarni
parents:
6243
diff
changeset
|
424 |
void InvalidateData(); |
6237
bce32e54c993
(svn r8695) [cpp_gui] -Codechange: changed AssignWidgetToWindow() and InvalidateWidget() into Window methods
bjarni
parents:
6236
diff
changeset
|
425 |
void InvalidateWidget(byte widget_index) const; |
bce32e54c993
(svn r8695) [cpp_gui] -Codechange: changed AssignWidgetToWindow() and InvalidateWidget() into Window methods
bjarni
parents:
6236
diff
changeset
|
426 |
|
6244
4b42fb40e6d2
(svn r8710) [cpp_gui] -Codechange: yet another two functions are turned into Window methods
bjarni
parents:
6243
diff
changeset
|
427 |
/* viewport.cpp */ |
4b42fb40e6d2
(svn r8710) [cpp_gui] -Codechange: yet another two functions are turned into Window methods
bjarni
parents:
6243
diff
changeset
|
428 |
void DrawViewport() const; |
4b42fb40e6d2
(svn r8710) [cpp_gui] -Codechange: yet another two functions are turned into Window methods
bjarni
parents:
6243
diff
changeset
|
429 |
|
6241
6a7a41b0cd32
(svn r8702) [cpp_gui] -Codechange: changed the 3 window functions in widget.cpp into Window methods
bjarni
parents:
6240
diff
changeset
|
430 |
/* widget.cpp */ |
6a7a41b0cd32
(svn r8702) [cpp_gui] -Codechange: changed the 3 window functions in widget.cpp into Window methods
bjarni
parents:
6240
diff
changeset
|
431 |
int GetWidgetFromPos(int x, int y) const; |
6a7a41b0cd32
(svn r8702) [cpp_gui] -Codechange: changed the 3 window functions in widget.cpp into Window methods
bjarni
parents:
6240
diff
changeset
|
432 |
void DrawWidgets() const; |
6a7a41b0cd32
(svn r8702) [cpp_gui] -Codechange: changed the 3 window functions in widget.cpp into Window methods
bjarni
parents:
6240
diff
changeset
|
433 |
void ShowDropDownMenu(const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask); |
6245
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
434 |
void ResizeButtons(byte left, byte right); |
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
435 |
|
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
436 |
private: |
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
437 |
void ScrollbarClickHandler(const Widget *wi, int x, int y); |
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
438 |
public: |
6241
6a7a41b0cd32
(svn r8702) [cpp_gui] -Codechange: changed the 3 window functions in widget.cpp into Window methods
bjarni
parents:
6240
diff
changeset
|
439 |
|
6248
24583caadfee
(svn r8716) [cpp_gui] -Codechange: IsWindowWidgetDisabled() turned into Window method
KUDr
parents:
6247
diff
changeset
|
440 |
/*inline*/ void SetWidgetDisabledState(byte widget_index, bool disab_stat); |
24583caadfee
(svn r8716) [cpp_gui] -Codechange: IsWindowWidgetDisabled() turned into Window method
KUDr
parents:
6247
diff
changeset
|
441 |
/*inline*/ void DisableWidget(byte widget_index); |
24583caadfee
(svn r8716) [cpp_gui] -Codechange: IsWindowWidgetDisabled() turned into Window method
KUDr
parents:
6247
diff
changeset
|
442 |
/*inline*/ void EnableWidget(byte widget_index); |
24583caadfee
(svn r8716) [cpp_gui] -Codechange: IsWindowWidgetDisabled() turned into Window method
KUDr
parents:
6247
diff
changeset
|
443 |
/*inline*/ bool IsWidgetDisabled(byte widget_index) const; |
6246
2a4c2c4d66f0
(svn r8713) [cpp_gui] -Codechange: SetWindowWidgetDisabledState turned into Window method
KUDr
parents:
6245
diff
changeset
|
444 |
|
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
445 |
//int32 AddRef() |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
446 |
//{ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
447 |
// const char *name = NULL; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
448 |
// switch (window_class) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
449 |
// { |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
450 |
// case WC_MAIN_WINDOW: name = "mw"; break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
451 |
// case WC_SELECT_GAME: name = "sg"; break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
452 |
// case WC_INDUSTRY_VIEW: name = "iw"; break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
453 |
// default: break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
454 |
// } |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
455 |
// if (name != NULL) printf("%s+\n", name); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
456 |
// return CountedObject::AddRef(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
457 |
//} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
458 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
459 |
//int32 Release() |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
460 |
//{ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
461 |
// const char *name = NULL; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
462 |
// switch (window_class) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
463 |
// { |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
464 |
// case WC_MAIN_WINDOW: name = "mw"; break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
465 |
// case WC_SELECT_GAME: name = "sg"; break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
466 |
// case WC_INDUSTRY_VIEW: name = "iw"; break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
467 |
// default: break; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
468 |
// } |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
469 |
// if (name != NULL) printf("%s-\n", name); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
470 |
// return CountedObject::Release(); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
471 |
//} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
472 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
473 |
template <class Tmatch> struct EnumMatch { |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
474 |
Tmatch &m_match; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
475 |
EnumMatch(Tmatch &m) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
476 |
: m_match(m) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
477 |
{} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
478 |
bool EnumProc(WindowList::Iterator it) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
479 |
{ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
480 |
return m_match->EnumProc((*it).w); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
481 |
} |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
482 |
}; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
483 |
|
6236
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
484 |
//template <class Tmatch> Window* EnumT(Tmatch m) |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
485 |
//{ |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
486 |
// WindowList::Iterator it = Window::s_list.EnumT(EnumMatch<Tmatch>(m)); |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
487 |
// return (it == Window::s_list.m_list.end()) ? NULL : (*it).w; |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
488 |
//} |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
489 |
|
6236
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
490 |
//template <class Tmatch> Window* ReverseEnumT(Tmatch m) |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
491 |
//{ |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
492 |
// WindowList::Iterator it = Window::s_list.ReverseEnumT(EnumMatch<Tmatch>(m)); |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
493 |
// return (it == Window::s_list.m_list.end()) ? NULL : (*it).w; |
ec056d324811
(svn r8693) [cpp_gui] -Fix: g++ compilation errors 'non-local function A uses local type B' (template arguments must have external linkage while local type has no linkage)
KUDr
parents:
6235
diff
changeset
|
494 |
//} |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
495 |
|
0 | 496 |
}; |
497 |
||
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
498 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
499 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
500 |
#define FOR_ALL_WINDOWS(wz) \ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
501 |
for (WindowList::Iterator it = Window::s_list.m_list.begin(); it != Window::s_list.m_list.end() && (wz = (*it).w) != NULL; it++) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
502 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
503 |
#define REVERSED_FOR_ALL_WINDOWS(wz) \ |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
504 |
for (WindowList::ReverseIterator it = Window::s_list.m_list.rbegin(); it != Window::s_list.m_list.rend() && (wz = (*it).w) != NULL; it++) |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
505 |
|
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
506 |
|
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
507 |
typedef struct querystr_d { |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
508 |
StringID caption; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
509 |
Textbuf text; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
510 |
const char *orig; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
511 |
CharSetFilter afilter; |
5682
eeddbbacd4ac
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents:
5669
diff
changeset
|
512 |
bool handled; |
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
513 |
} querystr_d; |
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
514 |
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
|
515 |
|
0 | 516 |
typedef struct { |
4171 | 517 |
byte item_count; /* follow_vehicle */ |
518 |
byte sel_index; /* scrollpos_x */ |
|
519 |
byte main_button; /* scrollpos_y */ |
|
0 | 520 |
byte action_id; |
4171 | 521 |
StringID string_id; /* unk30 */ |
0 | 522 |
uint16 checked_items; /* unk32 */ |
2216
51a715447fc4
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2187
diff
changeset
|
523 |
byte disabled_items; |
0 | 524 |
} menu_d; |
1004 | 525 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d)); |
0 | 526 |
|
527 |
typedef struct { |
|
528 |
int16 data_1, data_2, data_3; |
|
529 |
int16 data_4, data_5; |
|
2596 | 530 |
bool close; |
0 | 531 |
byte byte_1; |
532 |
} def_d; |
|
1004 | 533 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d)); |
0 | 534 |
|
535 |
typedef struct { |
|
536 |
void *data; |
|
537 |
} void_d; |
|
1004 | 538 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d)); |
0 | 539 |
|
540 |
typedef struct { |
|
2596 | 541 |
uint16 base; |
542 |
uint16 count; |
|
0 | 543 |
} tree_d; |
1004 | 544 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d)); |
0 | 545 |
|
546 |
typedef struct { |
|
547 |
StringID string_id; |
|
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
548 |
byte paramcount; |
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
549 |
uint32 params[5]; |
0 | 550 |
} tooltips_d; |
1004 | 551 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d)); |
0 | 552 |
|
553 |
typedef struct { |
|
4800
009e3c6cea8a
(svn r6722) -Codechange: [aircraft build window] moved aircraft build window to a file of it's own
bjarni
parents:
4790
diff
changeset
|
554 |
byte vehicle_type; |
5187
d1f4e447a7eb
(svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents:
5124
diff
changeset
|
555 |
union { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
556 |
RailTypeByte railtype; |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
557 |
AcceptPlanesByte acc_planes; // AIRCRAFT_ONLY, ALL, HELICOPTERS_ONLY |
5187
d1f4e447a7eb
(svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents:
5124
diff
changeset
|
558 |
} filter; |
5199
523e7025d979
(svn r7314) -Cleanup: const, whitespace, coding style and variable usage.
Darkvater
parents:
5187
diff
changeset
|
559 |
byte sel_index; // deprecated value, used for 'unified' ship and road |
5187
d1f4e447a7eb
(svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents:
5124
diff
changeset
|
560 |
bool descending_sort_order; |
4770
987ef30e5b45
(svn r6684) -Feature: [train build window] added sorting options for the engines
bjarni
parents:
4766
diff
changeset
|
561 |
byte sort_criteria; |
6032
cc75c53d40e9
(svn r8333) -Codechange: when invalidating a build window list, set a flag instead of rebuilding the list and then rebuild it the next time it's redrawn
bjarni
parents:
5838
diff
changeset
|
562 |
bool regenerate_list; |
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
|
563 |
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
|
564 |
EngineID rename_engine; |
5187
d1f4e447a7eb
(svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents:
5124
diff
changeset
|
565 |
EngineList eng_list; |
4790
04df6a3f9b31
(svn r6712) -Code cleanup: renamed buildtrain_d to buildvehicle_d as it's used for all vehicle types
bjarni
parents:
4786
diff
changeset
|
566 |
} buildvehicle_d; |
04df6a3f9b31
(svn r6712) -Code cleanup: renamed buildtrain_d to buildvehicle_d as it's used for all vehicle types
bjarni
parents:
4786
diff
changeset
|
567 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildvehicle_d)); |
0 | 568 |
|
569 |
typedef struct { |
|
842 | 570 |
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
|
571 |
EngineID sel_engine[2]; |
842 | 572 |
uint16 count[2]; |
4434
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
573 |
bool wagon_btnstate; // true means engine is selected |
6195
b90cf92697b9
(svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents:
6075
diff
changeset
|
574 |
EngineList list[2]; |
b90cf92697b9
(svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents:
6075
diff
changeset
|
575 |
bool update_left; |
b90cf92697b9
(svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents:
6075
diff
changeset
|
576 |
bool update_right; |
b90cf92697b9
(svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents:
6075
diff
changeset
|
577 |
bool init_lists; |
842 | 578 |
} replaceveh_d; |
1004 | 579 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d)); |
842 | 580 |
|
581 |
typedef struct { |
|
0 | 582 |
VehicleID sel; |
4638
8abe4f10b94b
(svn r6513) -Codechange: unified the code to draw depot windows
bjarni
parents:
4635
diff
changeset
|
583 |
byte type; |
4739
bd535b408617
(svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
bjarni
parents:
4730
diff
changeset
|
584 |
bool generate_list; |
4635
b9fb2f19eb64
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
585 |
uint16 engine_list_length; |
b9fb2f19eb64
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
586 |
uint16 wagon_list_length; |
b9fb2f19eb64
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
587 |
uint16 engine_count; |
b9fb2f19eb64
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
588 |
uint16 wagon_count; |
b9fb2f19eb64
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
589 |
Vehicle **vehicle_list; |
b9fb2f19eb64
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
590 |
Vehicle **wagon_list; |
4638
8abe4f10b94b
(svn r6513) -Codechange: unified the code to draw depot windows
bjarni
parents:
4635
diff
changeset
|
591 |
} depot_d; |
8abe4f10b94b
(svn r6513) -Codechange: unified the code to draw depot windows
bjarni
parents:
4635
diff
changeset
|
592 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(depot_d)); |
0 | 593 |
|
594 |
typedef struct { |
|
595 |
int sel; |
|
596 |
} order_d; |
|
1004 | 597 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d)); |
0 | 598 |
|
599 |
typedef struct { |
|
600 |
byte tab; |
|
601 |
} traindetails_d; |
|
1004 | 602 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d)); |
0 | 603 |
|
604 |
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
|
605 |
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
|
606 |
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
|
607 |
int32 subscroll; |
0 | 608 |
} smallmap_d; |
4318
fe085a1dd0ad
(svn r5971) -Fix: wrong struct in assert_compile (thomasdev)
truelight
parents:
4300
diff
changeset
|
609 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d)); |
0 | 610 |
|
611 |
typedef struct { |
|
612 |
uint32 face; |
|
613 |
byte gender; |
|
614 |
} facesel_d; |
|
1004 | 615 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d)); |
0 | 616 |
|
617 |
typedef struct { |
|
618 |
int sel; |
|
4695
52419a88345d
(svn r6602) - Feature: we now support NewGRF livery refits, as used by DBsetXL, amongst others. This requires a savegame bump to save the cargo subtype.
peter1138
parents:
4694
diff
changeset
|
619 |
struct RefitOption *cargo; |
4694
a4d2a3abe75c
(svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch)
peter1138
parents:
4692
diff
changeset
|
620 |
struct RefitList *list; |
a4d2a3abe75c
(svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch)
peter1138
parents:
4692
diff
changeset
|
621 |
uint length; |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4695
diff
changeset
|
622 |
VehicleOrderID order; |
0 | 623 |
} refit_d; |
1004 | 624 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d)); |
0 | 625 |
|
626 |
typedef struct { |
|
2116 | 627 |
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
|
628 |
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
|
629 |
int32 scrollpos_y; |
0 | 630 |
} vp_d; |
5123
9eb435a37492
(svn r7203) -Cleanup: Donnu what Miham was smoking there, but removed it (assert_compile + 3)
Darkvater
parents:
5120
diff
changeset
|
631 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d)); |
1004 | 632 |
|
633 |
// vp2_d is the same as vp_d, except for the data_# values.. |
|
634 |
typedef struct { |
|
5123
9eb435a37492
(svn r7203) -Cleanup: Donnu what Miham was smoking there, but removed it (assert_compile + 3)
Darkvater
parents:
5120
diff
changeset
|
635 |
VehicleID follow_vehicle; |
1004 | 636 |
int32 scrollpos_x; |
637 |
int32 scrollpos_y; |
|
638 |
byte data_1; |
|
639 |
byte data_2; |
|
640 |
byte data_3; |
|
641 |
} vp2_d; |
|
642 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d)); |
|
0 | 643 |
|
644 |
typedef struct { |
|
645 |
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
|
646 |
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
|
647 |
int32 scrollpos_y; |
0 | 648 |
NewsItem *ni; |
649 |
} news_d; |
|
1004 | 650 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d)); |
0 | 651 |
|
859
46839573bed8
(svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents:
849
diff
changeset
|
652 |
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
|
653 |
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
|
654 |
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
|
655 |
} highscore_d; |
1004 | 656 |
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
|
657 |
|
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
|
658 |
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
|
659 |
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
|
660 |
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
|
661 |
} scroller_d; |
1004 | 662 |
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
|
663 |
|
4542
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
664 |
typedef enum SortListFlags { |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
665 |
VL_NONE = 0x00, |
2888
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
666 |
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
|
667 |
VL_RESORT = 0x02, // instruct the code to resort the list in the next loop |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
668 |
VL_REBUILD = 0x04, // create sort-listing to use for qsort and friends |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
669 |
VL_END = 0x08 |
4542
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
670 |
} SortListFlags; |
588 | 671 |
|
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
672 |
DECLARE_ENUM_AS_BIT_SET(SortListFlags); |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
673 |
|
4542
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
674 |
typedef struct Listing { |
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
675 |
bool order; // Ascending/descending |
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
676 |
byte criteria; // Sorting criteria |
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
677 |
} Listing; |
588 | 678 |
|
2888
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
679 |
typedef struct list_d { |
4542
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
680 |
uint16 list_length; // length of the list being sorted |
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
681 |
byte sort_type; // what criteria to sort on |
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
682 |
SortListFlags flags; // used to control sorting/resorting/etc. |
24f60077489a
(svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents:
4520
diff
changeset
|
683 |
uint16 resort_timer; // resort list after a given amount of ticks if set |
2888
0972346d11a8
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
684 |
} 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
|
685 |
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
|
686 |
|
1648
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
687 |
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
|
688 |
int msg; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
689 |
int wparam; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
690 |
int lparam; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
691 |
} message_d; |
747061dca705
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
692 |
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
|
693 |
|
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
|
694 |
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
|
695 |
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
|
696 |
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
|
697 |
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
|
698 |
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
|
699 |
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
|
700 |
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
|
701 |
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
|
702 |
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
|
703 |
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
|
704 |
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
|
705 |
} 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
|
706 |
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
|
707 |
|
0 | 708 |
|
709 |
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/ |
|
710 |
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
|
711 |
WWB_PUSHBUTTON = 1 << 5, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
712 |
|
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
713 |
WWB_MASK = 0xE0, |
0 | 714 |
}; |
715 |
||
716 |
||
717 |
enum WindowWidgetTypes { |
|
4939
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
718 |
WWT_EMPTY, |
158
b1a821f84250
(svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents:
129
diff
changeset
|
719 |
|
4939
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
720 |
WWT_PANEL, /* simple depressed panel */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
721 |
WWT_INSET, /* pressed (inset) panel, most commonly used as combo box _text_ area */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
722 |
WWT_IMGBTN, /* button with image */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
723 |
WWT_IMGBTN_2, /* button with diff image when clicked */ |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
724 |
|
4939
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
725 |
WWT_TEXTBTN, /* button with text */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
726 |
WWT_TEXTBTN_2, /* button with diff text when clicked */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
727 |
WWT_LABEL, /* centered label */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
728 |
WWT_MATRIX, |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
729 |
WWT_SCROLLBAR, |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
730 |
WWT_FRAME, /* frame */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
731 |
WWT_CAPTION, |
0 | 732 |
|
4939
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
733 |
WWT_HSCROLLBAR, |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
734 |
WWT_STICKYBOX, |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
735 |
WWT_SCROLL2BAR, /* 2nd vertical scrollbar*/ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
736 |
WWT_RESIZEBOX, |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
737 |
WWT_CLOSEBOX, |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
738 |
WWT_LAST, /* Last Item. use WIDGETS_END to fill up padding!! */ |
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
739 |
|
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
740 |
WWT_MASK = 0x1F, |
0 | 741 |
|
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
742 |
WWT_PUSHBTN = WWT_PANEL | WWB_PUSHBUTTON, |
4434
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
743 |
WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON, |
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
744 |
WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON, |
0 | 745 |
}; |
746 |
||
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
747 |
#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
|
748 |
|
0 | 749 |
/* window.c */ |
6245
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
750 |
//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
|
751 |
void CallWindowTickEvent(void); |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
752 |
//void SetWindowDirty(const Window *w); |
5838
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
753 |
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, int msg, int wparam, int lparam); |
9c3129cb019b
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5726
diff
changeset
|
754 |
void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lparam); |
0 | 755 |
|
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
756 |
//Window *FindWindowById(WindowClass cls, WindowNumber number); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
757 |
//void DeleteWindow(Window *w); |
5077
587701a06b6a
(svn r7138) -Fix: [vehicle list windows] fixed a rare crash where having some (not all) vehicle list windows open for a player, that goes bankrupt would crash the game
bjarni
parents:
5072
diff
changeset
|
758 |
void DeletePlayerWindows(PlayerID pi); |
587701a06b6a
(svn r7138) -Fix: [vehicle list windows] fixed a rare crash where having some (not all) vehicle list windows open for a player, that goes bankrupt would crash the game
bjarni
parents:
5072
diff
changeset
|
759 |
void ChangeWindowOwner(PlayerID old_player, PlayerID new_player); |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
760 |
//Window *BringWindowToFrontById(WindowClass cls, WindowNumber number); |
0 | 761 |
Window *FindWindowFromPt(int x, int y); |
762 |
||
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
763 |
//Window *AllocateWindow( |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
764 |
// int x, |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
765 |
// int y, |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
766 |
// int width, |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
767 |
// int height, |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
768 |
// WindowProc *proc, |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
769 |
// WindowClass cls, |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
770 |
// const Widget *widget); |
0 | 771 |
|
772 |
Window *AllocateWindowDesc(const WindowDesc *desc); |
|
4520
d5f94a18a68c
(svn r6345) -Codechange: AllocateWindowDescFront() now ensures that window_number is set before calling the WE_CREATE event
bjarni
parents:
4438
diff
changeset
|
773 |
Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number); |
0 | 774 |
|
6244
4b42fb40e6d2
(svn r8710) [cpp_gui] -Codechange: yet another two functions are turned into Window methods
bjarni
parents:
6243
diff
changeset
|
775 |
//void DrawWindowViewport(const Window *w); |
0 | 776 |
|
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
777 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
778 |
* Sets the enabled/disabled status of a widget. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
779 |
* By default, widgets are enabled. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
780 |
* On certain conditions, they have to be disabled. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
781 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
782 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
783 |
* @param disab_stat : status to use ie: disabled = true, enabled = false |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
784 |
*/ |
6246
2a4c2c4d66f0
(svn r8713) [cpp_gui] -Codechange: SetWindowWidgetDisabledState turned into Window method
KUDr
parents:
6245
diff
changeset
|
785 |
inline void Window::SetWidgetDisabledState(byte widget_index, bool disab_stat) |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
786 |
{ |
6246
2a4c2c4d66f0
(svn r8713) [cpp_gui] -Codechange: SetWindowWidgetDisabledState turned into Window method
KUDr
parents:
6245
diff
changeset
|
787 |
assert(widget_index < widget_count); |
2a4c2c4d66f0
(svn r8713) [cpp_gui] -Codechange: SetWindowWidgetDisabledState turned into Window method
KUDr
parents:
6245
diff
changeset
|
788 |
SB(widget[widget_index].display_flags, WIDG_DISABLED, 1, !!disab_stat); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
789 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
790 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
791 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
792 |
* Sets a widget to disabled. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
793 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
794 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
795 |
*/ |
6247
67e881450cf3
(svn r8714) [cpp_gui] -Codechange: DisableWindowWidget() and EnableWindowWidget() turned into Window methods
KUDr
parents:
6246
diff
changeset
|
796 |
inline void Window::DisableWidget(byte widget_index) |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
797 |
{ |
6247
67e881450cf3
(svn r8714) [cpp_gui] -Codechange: DisableWindowWidget() and EnableWindowWidget() turned into Window methods
KUDr
parents:
6246
diff
changeset
|
798 |
SetWidgetDisabledState(widget_index, true); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
799 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
800 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
801 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
802 |
* Sets a widget to Enabled. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
803 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
804 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
805 |
*/ |
6247
67e881450cf3
(svn r8714) [cpp_gui] -Codechange: DisableWindowWidget() and EnableWindowWidget() turned into Window methods
KUDr
parents:
6246
diff
changeset
|
806 |
inline void Window::EnableWidget(byte widget_index) |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
807 |
{ |
6247
67e881450cf3
(svn r8714) [cpp_gui] -Codechange: DisableWindowWidget() and EnableWindowWidget() turned into Window methods
KUDr
parents:
6246
diff
changeset
|
808 |
SetWidgetDisabledState(widget_index, false); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
809 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
810 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
811 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
812 |
* Gets the enabled/disabled status of a widget. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
813 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
814 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
815 |
* @return status of the widget ie: disabled = true, enabled = false |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
816 |
*/ |
6248
24583caadfee
(svn r8716) [cpp_gui] -Codechange: IsWindowWidgetDisabled() turned into Window method
KUDr
parents:
6247
diff
changeset
|
817 |
inline bool Window::IsWidgetDisabled(byte widget_index) const |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
818 |
{ |
6248
24583caadfee
(svn r8716) [cpp_gui] -Codechange: IsWindowWidgetDisabled() turned into Window method
KUDr
parents:
6247
diff
changeset
|
819 |
assert(widget_index < widget_count); |
24583caadfee
(svn r8716) [cpp_gui] -Codechange: IsWindowWidgetDisabled() turned into Window method
KUDr
parents:
6247
diff
changeset
|
820 |
return HASBIT(widget[widget_index].display_flags, WIDG_DISABLED); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
821 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
822 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
823 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
824 |
* Sets the hidden/shown status of a widget. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
825 |
* By default, widgets are visible. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
826 |
* On certain conditions, they have to be hidden. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
827 |
* @param w Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
828 |
* @param widget_index index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
829 |
* @param hidden_stat status to use ie. hidden = true, visible = false |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
830 |
*/ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
831 |
static inline void SetWindowWidgetHiddenState(Window *w, byte widget_index, bool hidden_stat) |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
832 |
{ |
5232
0ba6acdc527f
(svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents:
5199
diff
changeset
|
833 |
assert(widget_index < w->widget_count); |
4749
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
834 |
SB(w->widget[widget_index].display_flags, WIDG_HIDDEN, 1, !!hidden_stat); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
835 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
836 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
837 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
838 |
* Sets a widget hidden. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
839 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
840 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
841 |
*/ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
842 |
static inline void HideWindowWidget(Window *w, byte widget_index) |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
843 |
{ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
844 |
SetWindowWidgetHiddenState(w, widget_index, true); |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
845 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
846 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
847 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
848 |
* Sets a widget visible. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
849 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
850 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
851 |
*/ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
852 |
static inline void ShowWindowWidget(Window *w, byte widget_index) |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
853 |
{ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
854 |
SetWindowWidgetHiddenState(w, widget_index, false); |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
855 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
856 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
857 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
858 |
* Gets the visibility of a widget. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
859 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
860 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
861 |
* @return status of the widget ie: hidden = true, visible = false |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
862 |
*/ |
5233
3ff623971cd1
(svn r7353) -Codechange: constify Window* in IsWindowWidget(Lowered|Hidden|Disabled)
rubidium
parents:
5232
diff
changeset
|
863 |
static inline bool IsWindowWidgetHidden(const Window *w, byte widget_index) |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
864 |
{ |
5232
0ba6acdc527f
(svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents:
5199
diff
changeset
|
865 |
assert(widget_index < w->widget_count); |
5236
e959e132a78e
(svn r7356) -Codechange: replace 'for (i = 0, wi = w->widget; wi->type != WWT_LAST; i++, wi++)' type for loops with 'for (i = 0; i < w->window_count; i++) { wi = &w->widget[i];'-type for loops for better readability.
rubidium
parents:
5233
diff
changeset
|
866 |
return HASBIT(w->widget[widget_index].display_flags, WIDG_HIDDEN); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
867 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
868 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
869 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
870 |
* Sets the lowered/raised status of a widget. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
871 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
872 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
873 |
* @param hidden_stat : status to use ie: lowered = true, raised = false |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
874 |
*/ |
4727
ba5bae41b004
(svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents:
4719
diff
changeset
|
875 |
static inline void SetWindowWidgetLoweredState(Window *w, byte widget_index, bool lowered_stat) |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
876 |
{ |
5232
0ba6acdc527f
(svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents:
5199
diff
changeset
|
877 |
assert(widget_index < w->widget_count); |
4749
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
878 |
SB(w->widget[widget_index].display_flags, WIDG_LOWERED, 1, !!lowered_stat); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
879 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
880 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
881 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
882 |
* Invert the lowered/raised status of a widget. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
883 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
884 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
885 |
*/ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
886 |
static inline void ToggleWidgetLoweredState(Window *w, byte widget_index) |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
887 |
{ |
5232
0ba6acdc527f
(svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents:
5199
diff
changeset
|
888 |
assert(widget_index < w->widget_count); |
4749
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
889 |
TOGGLEBIT(w->widget[widget_index].display_flags, WIDG_LOWERED); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
890 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
891 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
892 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
893 |
* Marks a widget as lowered. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
894 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
895 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
896 |
*/ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
897 |
static inline void LowerWindowWidget(Window *w, byte widget_index) |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
898 |
{ |
4730 | 899 |
SetWindowWidgetLoweredState(w, widget_index, true); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
900 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
901 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
902 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
903 |
* Marks a widget as raised. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
904 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
905 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
906 |
*/ |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
907 |
static inline void RaiseWindowWidget(Window *w, byte widget_index) |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
908 |
{ |
4730 | 909 |
SetWindowWidgetLoweredState(w, widget_index, false); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
910 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
911 |
|
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
912 |
/** |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
913 |
* Gets the lowered state of a widget. |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
914 |
* @param w : Window on which the widget is located |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
915 |
* @param widget_index : index of this widget in the window |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
916 |
* @return status of the widget ie: lowered = true, raised= false |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
917 |
*/ |
5233
3ff623971cd1
(svn r7353) -Codechange: constify Window* in IsWindowWidget(Lowered|Hidden|Disabled)
rubidium
parents:
5232
diff
changeset
|
918 |
static inline bool IsWindowWidgetLowered(const Window *w, byte widget_index) |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
919 |
{ |
5232
0ba6acdc527f
(svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents:
5199
diff
changeset
|
920 |
assert(widget_index < w->widget_count); |
4749
9490e643f23f
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
921 |
return HASBIT(w->widget[widget_index].display_flags, WIDG_LOWERED); |
4692
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
922 |
} |
fdccb9b2dbcd
(svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents:
4638
diff
changeset
|
923 |
|
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
|
924 |
void InitWindowSystem(void); |
1474
d83520edcda6
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents:
1390
diff
changeset
|
925 |
void UnInitWindowSystem(void); |
d83520edcda6
(svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents:
1390
diff
changeset
|
926 |
void ResetWindowSystem(void); |
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
|
927 |
void InputLoop(void); |
6244
4b42fb40e6d2
(svn r8710) [cpp_gui] -Codechange: yet another two functions are turned into Window methods
bjarni
parents:
6243
diff
changeset
|
928 |
//void InvalidateThisWindowData(Window *w); |
4739
bd535b408617
(svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
bjarni
parents:
4730
diff
changeset
|
929 |
void InvalidateWindowData(WindowClass cls, WindowNumber number); |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
930 |
//void RaiseWindowButtons(Window *w); |
0 | 931 |
void RelocateAllWindows(int neww, int newh); |
380 | 932 |
int PositionMainToolbar(Window *w); |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
933 |
//void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
934 |
//void CDECL SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets, ...); |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
935 |
//void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...); |
0 | 936 |
|
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4712
diff
changeset
|
937 |
/* misc_gui.c*/ |
4884
895f06b87934
(svn r6821) -Codechange: For the measurement tool do not show the tooltip when the selection
Darkvater
parents:
4834
diff
changeset
|
938 |
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint params[]); |
4834
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
939 |
static inline void GuiShowTooltips(StringID str) |
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
940 |
{ |
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
941 |
GuiShowTooltipsWithArgs(str, 0, NULL); |
ddcf440d0ffd
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
942 |
} |
4719
413b21513ef7
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4712
diff
changeset
|
943 |
|
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
944 |
//void HandleButtonClick(Window *w, byte widget); |
0 | 945 |
|
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
|
946 |
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
|
947 |
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
|
948 |
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
|
949 |
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
|
950 |
void ShowVitalWindows(void); |
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
951 |
//WindowList::Iterator FindWindowZPosition(const Window *w); |
0 | 952 |
|
953 |
/* window.c */ |
|
6235
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
954 |
//extern Window *_z_windows[]; |
5077e6ed3788
(svn r8683) [cpp_gui] -Codechange: first steps towards OO GUI (together with Bjarni) without changes in the logic
KUDr
parents:
6224
diff
changeset
|
955 |
//extern Window **_last_z_window; |
0 | 956 |
|
957 |
VARDEF Point _cursorpos_drag_start; |
|
958 |
||
959 |
VARDEF int _scrollbar_start_pos; |
|
960 |
VARDEF int _scrollbar_size; |
|
961 |
VARDEF byte _scroller_click_timeout; |
|
962 |
||
963 |
VARDEF bool _scrolling_scrollbar; |
|
964 |
VARDEF bool _scrolling_viewport; |
|
965 |
VARDEF bool _popup_menu_active; |
|
966 |
||
967 |
VARDEF byte _special_mouse_mode; |
|
968 |
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
|
969 |
WSM_NONE = 0, |
0 | 970 |
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
|
971 |
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
|
972 |
WSM_PRESIZE = 3, |
0 | 973 |
}; |
974 |
||
975 |
||
6073
d8dae377c879
(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents:
6032
diff
changeset
|
976 |
/** Evenly distribute some widgets when resizing horizontally (often a button row) |
6075
33cdb35f9af5
(svn r8390) -Codechange (r8384): Rewrote ResizeButtons()
bjarni
parents:
6073
diff
changeset
|
977 |
* The widgets are presumed to be in a line and numberef from left to right (without gaps) |
6073
d8dae377c879
(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents:
6032
diff
changeset
|
978 |
* @param w widow to modify |
d8dae377c879
(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents:
6032
diff
changeset
|
979 |
* @param left The leftmost widget to resize |
6075
33cdb35f9af5
(svn r8390) -Codechange (r8384): Rewrote ResizeButtons()
bjarni
parents:
6073
diff
changeset
|
980 |
* @param right The rightmost widget to resize. Since right side of it is used, remember to set it to RESIZE_RIGHT |
6073
d8dae377c879
(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents:
6032
diff
changeset
|
981 |
*/ |
6245
6fa82c6ee8ca
(svn r8711) [cpp_gui] -Codechange: even more funktion->method conversions
bjarni
parents:
6244
diff
changeset
|
982 |
//void ResizeButtons(Window *w, byte left, byte right); |
6073
d8dae377c879
(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents:
6032
diff
changeset
|
983 |
|
0 | 984 |
#endif /* WINDOW_H */ |