author | rubidium |
Thu, 08 May 2008 14:14:16 +0000 | |
changeset 9153 | d1d16656129b |
parent 9148 | ba0f18cfc795 |
child 9161 | fda175383e87 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
8106
e6790dd9e750
(svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
rubidium
parents:
8102
diff
changeset
|
3 |
/** @file window_gui.h Functions, definitions and such used only by the GUI. */ |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
4 |
|
8106
e6790dd9e750
(svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
rubidium
parents:
8102
diff
changeset
|
5 |
#ifndef WINDOW_GUI_H |
e6790dd9e750
(svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
rubidium
parents:
8102
diff
changeset
|
6 |
#define WINDOW_GUI_H |
0 | 7 |
|
8222
ce0457729295
(svn r11785) -Codechange: remove some unneeded includes.
rubidium
parents:
8214
diff
changeset
|
8 |
#include "core/bitmath_func.hpp" |
9127
14f21c5954ee
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
9117
diff
changeset
|
9 |
#include "core/geometry_type.hpp" |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8113
diff
changeset
|
10 |
#include "vehicle_type.h" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8223
diff
changeset
|
11 |
#include "viewport_type.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8224
diff
changeset
|
12 |
#include "player_type.h" |
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
13 |
#include "strings_type.h" |
8925
e0d37ce1eba8
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
8923
diff
changeset
|
14 |
#include "core/alloc_type.hpp" |
9127
14f21c5954ee
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
9117
diff
changeset
|
15 |
#include "window_type.h" |
14f21c5954ee
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
9117
diff
changeset
|
16 |
#include "tile_type.h" |
4299
91f5d2bedcff
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4266
diff
changeset
|
17 |
|
8068
41569ce2d1d9
(svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents:
8036
diff
changeset
|
18 |
/** |
41569ce2d1d9
(svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents:
8036
diff
changeset
|
19 |
* The maximum number of windows that can be opened. |
41569ce2d1d9
(svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents:
8036
diff
changeset
|
20 |
*/ |
41569ce2d1d9
(svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents:
8036
diff
changeset
|
21 |
static const int MAX_NUMBER_OF_WINDOWS = 25; |
41569ce2d1d9
(svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents:
8036
diff
changeset
|
22 |
|
0 | 23 |
typedef void WindowProc(Window *w, WindowEvent *e); |
24 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
25 |
/* How the resize system works: |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
26 |
First, you need to add a WWT_RESIZEBOX to the widgets, and you need |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
27 |
to add the flag WDF_RESIZABLE to the window. Now the window is ready |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
28 |
to resize itself. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
29 |
As you may have noticed, all widgets have a RESIZE_XXX in their line. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
30 |
This lines controls how the widgets behave on resize. RESIZE_NONE means |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
31 |
it doesn't do anything. Any other option let's one of the borders |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
32 |
move with the changed width/height. So if a widget has |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
33 |
RESIZE_RIGHT, and the window is made 5 pixels wider by the user, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
34 |
the right of the window will also be made 5 pixels wider. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
35 |
Now, what if you want to clamp a widget to the bottom? Give it the flag |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
36 |
RESIZE_TB. This is RESIZE_TOP + RESIZE_BOTTOM. Now if the window gets |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
37 |
5 pixels bigger, both the top and bottom gets 5 bigger, so the whole |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
38 |
widgets moves downwards without resizing, and appears to be clamped |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
39 |
to the bottom. Nice aint it? |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
40 |
You should know one more thing about this system. Most windows can't |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
41 |
handle an increase of 1 pixel. So there is a step function, which |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
42 |
let the windowsize only be changed by X pixels. You configure this |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
43 |
after making the window, like this: |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
44 |
w->resize.step_height = 10; |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
45 |
Now the window will only change in height in steps of 10. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
46 |
You can also give a minimum width and height. The default value is |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
47 |
the default height/width of the window itself. You can change this |
8969
6d1c74e0e2cd
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium
parents:
8957
diff
changeset
|
48 |
AFTER window - creation, with: |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
49 |
w->resize.width or w->resize.height. |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
50 |
That was all.. good luck, and enjoy :) -- TrueLight */ |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
51 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
52 |
enum ResizeFlag { |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
53 |
RESIZE_NONE = 0, ///< no resize required |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
54 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
55 |
RESIZE_LEFT = 1, ///< left resize flag |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
56 |
RESIZE_RIGHT = 2, ///< rigth resize flag |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
57 |
RESIZE_TOP = 4, ///< top resize flag |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
58 |
RESIZE_BOTTOM = 8, ///< bottom resize flag |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
59 |
|
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
60 |
RESIZE_LR = RESIZE_LEFT | RESIZE_RIGHT, ///< combination of left and right resize flags |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
61 |
RESIZE_RB = RESIZE_RIGHT | RESIZE_BOTTOM, ///< combination of right and bottom resize flags |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
62 |
RESIZE_TB = RESIZE_TOP | RESIZE_BOTTOM, ///< combination of top and bottom resize flags |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
63 |
RESIZE_LRB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_BOTTOM, ///< combination of left, right and bottom resize flags |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
64 |
RESIZE_LRTB = RESIZE_LEFT | RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, ///< combination of all resize flags |
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
65 |
RESIZE_RTB = RESIZE_RIGHT | RESIZE_TOP | RESIZE_BOTTOM, ///< combination of right, top and bottom resize flag |
4749
65a49cfc922d
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
66 |
|
65a49cfc922d
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
67 |
/* The following flags are used by the system to specify what is disabled, hidden, or clicked |
65a49cfc922d
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
68 |
* They are used in the same place as the above RESIZE_x flags, Widget visual_flags. |
65a49cfc922d
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
69 |
* These states are used in exceptions. If nothing is specified, they will indicate |
65a49cfc922d
(svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents:
4739
diff
changeset
|
70 |
* Enabled, visible or unclicked widgets*/ |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
71 |
WIDG_DISABLED = 4, ///< widget is greyed out, not available |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
72 |
WIDG_HIDDEN = 5, ///< widget is made invisible |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
73 |
WIDG_LOWERED = 6, ///< widget is paint lowered, a pressed button in fact |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
74 |
}; |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
75 |
|
4755
9ebcb0db6c06
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
76 |
enum { |
6179
d19b0137d8e4
(svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents:
6117
diff
changeset
|
77 |
WIDGET_LIST_END = -1, ///< indicate the end of widgets' list for vararg functions |
4755
9ebcb0db6c06
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
78 |
}; |
9ebcb0db6c06
(svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents:
4749
diff
changeset
|
79 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
80 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
81 |
* Window widget data structure |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
82 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
83 |
struct Widget { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
84 |
byte type; ///< Widget type, see WindowWidgetTypes |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
85 |
byte display_flags; ///< Resize direction, alignment, etc. during resizing, see ResizeFlags |
4547
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
86 |
byte color; ///< Widget colour, see docs/ottd-colourtext-palette.png |
5973
b371612e3dbf
(svn r8662) -Fix r8661: don't try to put negative values in unsigned vars
bjarni
parents:
5944
diff
changeset
|
87 |
int16 left, right, top, bottom; ///< The position offsets inside the window |
4547
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
88 |
uint16 data; ///< The String/Image or special code (list-matrixes) of a widget |
d37c2d172ad4
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4542
diff
changeset
|
89 |
StringID tooltips; ///< Tooltips that are shown when rightclicking on a widget |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
90 |
}; |
0 | 91 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
92 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
93 |
* Flags to describe the look of the frame |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
94 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
95 |
enum FrameFlags { |
8008
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
96 |
FR_NONE = 0, |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
97 |
FR_TRANSPARENT = 1 << 0, ///< Makes the background transparent if set |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
98 |
FR_BORDERONLY = 1 << 4, ///< Draw border only, no background |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
99 |
FR_LOWERED = 1 << 5, ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed) |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
100 |
FR_DARKENED = 1 << 6, ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes) |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
101 |
}; |
4437
49e79e135539
(svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents:
4434
diff
changeset
|
102 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5475
diff
changeset
|
103 |
DECLARE_ENUM_AS_BIT_SET(FrameFlags); |
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5475
diff
changeset
|
104 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
105 |
/* wiget.cpp */ |
4437
49e79e135539
(svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents:
4434
diff
changeset
|
106 |
void DrawFrameRect(int left, int top, int right, int bottom, int color, FrameFlags flags); |
1938
70baf462aff1
(svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents:
1648
diff
changeset
|
107 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
108 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
109 |
* Available window events |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
110 |
*/ |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
111 |
enum WindowEventCodes { |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
112 |
WE_CREATE, ///< Initialize the Window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
113 |
WE_DESTROY, ///< Prepare for deletion of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
114 |
WE_PAINT, ///< Repaint the window contents |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
115 |
WE_KEYPRESS, ///< Key pressed |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
116 |
WE_CLICK, ///< Left mouse button click |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
117 |
WE_DOUBLE_CLICK, ///< Left mouse button double click |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
118 |
WE_RCLICK, ///< Right mouse button click |
5413 | 119 |
WE_MOUSEOVER, |
120 |
WE_MOUSELOOP, |
|
121 |
WE_MOUSEWHEEL, |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
122 |
WE_TICK, ///< Regularly occurring event (about once every 20 seconds orso, 10 days) for slowly changing content (typically list sorting) |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
123 |
WE_4, ///< Regularly occurring event for updating continuously changing window content (other than view ports), or timer expiring |
5413 | 124 |
WE_TIMEOUT, |
125 |
WE_PLACE_OBJ, |
|
126 |
WE_ABORT_PLACE_OBJ, |
|
127 |
WE_ON_EDIT_TEXT, |
|
128 |
WE_ON_EDIT_TEXT_CANCEL, |
|
129 |
WE_POPUPMENU_SELECT, |
|
130 |
WE_POPUPMENU_OVER, |
|
131 |
WE_DRAGDROP, |
|
132 |
WE_PLACE_DRAG, |
|
133 |
WE_PLACE_MOUSEUP, |
|
134 |
WE_PLACE_PRESIZE, |
|
135 |
WE_DROPDOWN_SELECT, |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
136 |
WE_RESIZE, ///< Request to resize the window, @see WindowEvent.we.resize |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
137 |
WE_MESSAGE, ///< Receipt of a message from another window. @see WindowEvent.we.message, SendWindowMessage(), SendWindowMessageClass() |
5413 | 138 |
WE_SCROLL, |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
139 |
WE_INVALIDATE_DATA, ///< Notification that data displayed by the window is obsolete |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
140 |
WE_CTRL_CHANGED, ///< CTRL key has changed state |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
141 |
}; |
0 | 142 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
143 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
144 |
* Data structures for additional data associated with a window event |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
145 |
* @see WindowEventCodes |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
146 |
*/ |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
147 |
struct WindowEvent { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
148 |
byte event; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
149 |
union { |
7367
cafca0510781
(svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents:
7341
diff
changeset
|
150 |
struct { |
cafca0510781
(svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents:
7341
diff
changeset
|
151 |
void *data; |
cafca0510781
(svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents:
7341
diff
changeset
|
152 |
} create; |
cafca0510781
(svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents:
7341
diff
changeset
|
153 |
|
cafca0510781
(svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents:
7341
diff
changeset
|
154 |
struct { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
155 |
Point pt; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
156 |
int widget; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
157 |
} click; |
543
946badd71033
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
424
diff
changeset
|
158 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
159 |
struct { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
160 |
Point pt; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
161 |
TileIndex tile; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
162 |
TileIndex starttile; |
7888
a28f4cfff934
(svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents:
7734
diff
changeset
|
163 |
ViewportPlaceMethod select_method; |
6669
bb48a810a509
(svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents:
6666
diff
changeset
|
164 |
byte select_proc; |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
165 |
} place; |
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
166 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
167 |
struct { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
168 |
Point pt; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
169 |
int widget; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
170 |
} dragdrop; |
4335
02934874f33d
(svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents:
4318
diff
changeset
|
171 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
172 |
struct { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
173 |
Point size; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
174 |
Point diff; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
175 |
} sizing; |
4337
e705eef174bf
(svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents:
4335
diff
changeset
|
176 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
177 |
struct { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
178 |
char *str; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
179 |
} edittext; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
180 |
|
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
181 |
struct { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
182 |
Point pt; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
183 |
} popupmenu; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
184 |
|
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
185 |
struct { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
186 |
int button; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
187 |
int index; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
188 |
} dropdown; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
189 |
|
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
190 |
struct { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
191 |
Point pt; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
192 |
int widget; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
193 |
} mouseover; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
194 |
|
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
195 |
struct { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
196 |
bool cont; ///< continue the search? (default true) |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
197 |
uint16 key; ///< 16-bit Unicode value of the key |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
198 |
uint16 keycode; ///< untranslated key (including shift-state) |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
199 |
} keypress; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
200 |
|
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
201 |
struct { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
202 |
int msg; ///< message to be sent |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
203 |
int wparam; ///< additional message-specific information |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
204 |
int lparam; ///< additional message-specific information |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
205 |
} message; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
206 |
|
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
207 |
struct { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
208 |
Point delta; ///< delta position against position of last call |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
209 |
} scroll; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
210 |
|
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
211 |
struct { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
212 |
int wheel; ///< how much was 'wheel'd' |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
213 |
} wheel; |
8586
cb0e7e00f1d2
(svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents:
8418
diff
changeset
|
214 |
|
cb0e7e00f1d2
(svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents:
8418
diff
changeset
|
215 |
struct { |
cb0e7e00f1d2
(svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents:
8418
diff
changeset
|
216 |
bool cont; ///< continue the search? (default true) |
cb0e7e00f1d2
(svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents:
8418
diff
changeset
|
217 |
} ctrl; |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
218 |
} we; |
0 | 219 |
}; |
220 |
||
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
221 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
222 |
* High level window description |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
223 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
224 |
struct WindowDesc { |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
225 |
int16 left; ///< Prefered x position of left edge of the window, @see WindowDefaultPosition() |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
226 |
int16 top; ///< Prefered y position of the top of the window, @see WindowDefaultPosition() |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
227 |
int16 minimum_width; ///< Minimal width of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
228 |
int16 minimum_height; ///< Minimal height of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
229 |
int16 default_width; ///< Prefered initial width of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
230 |
int16 default_height; ///< Prefered initial height of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
231 |
WindowClass cls; ///< Class of the window, @see WindowClass |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
232 |
WindowClass parent_cls; ///< Class of the parent window, @see WindowClass |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
233 |
uint32 flags; ///< Flags, @see WindowDefaultFlags |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
234 |
const Widget *widgets; ///< List of widgets with their position and size for the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
235 |
WindowProc *proc; ///< Window event handler function for the window |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
236 |
}; |
0 | 237 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
238 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
239 |
* Window default widget/window handling flags |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
240 |
*/ |
5413 | 241 |
enum WindowDefaultFlag { |
8008
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
242 |
WDF_STD_TOOLTIPS = 1 << 0, ///< use standard routine when displaying tooltips |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
243 |
WDF_DEF_WIDGET = 1 << 1, ///< Default widget control for some widgets in the on click event, @see DispatchLeftClickEvent() |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
244 |
WDF_STD_BTN = 1 << 2, ///< Default handling for close and titlebar widgets (widget no 0 and 1) |
8019
fc0e94dee165
(svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents:
8018
diff
changeset
|
245 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
246 |
WDF_UNCLICK_BUTTONS = 1 << 4, ///< Unclick buttons when the window event times out |
8008
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
247 |
WDF_STICKY_BUTTON = 1 << 5, ///< Set window to sticky mode; they are not closed unless closed with 'X' (widget 2) |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
248 |
WDF_RESIZABLE = 1 << 6, ///< Window can be resized |
8008
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
249 |
WDF_MODAL = 1 << 7, ///< The window is a modal child of some other window, meaning the parent is 'inactive' |
0 | 250 |
}; |
251 |
||
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
252 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
253 |
* Special values for 'left' and 'top' to cause a specific placement |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
254 |
*/ |
5413 | 255 |
enum WindowDefaultPosition { |
5072
69195f96a23a
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
256 |
WDP_AUTO = -1, ///< Find a place automatically |
69195f96a23a
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
257 |
WDP_CENTER = -2, ///< Center the window (left/right or top/bottom) |
69195f96a23a
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
258 |
WDP_ALIGN_TBR = -3, ///< Align the right side of the window with the right side of the main toolbar |
69195f96a23a
(svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents:
5071
diff
changeset
|
259 |
WDP_ALIGN_TBL = -4, ///< Align the left side of the window with the left side of the main toolbar |
0 | 260 |
}; |
261 |
||
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8068
diff
changeset
|
262 |
#define WP(ptr, str) (*(str*)(ptr)->custom) |
0 | 263 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
264 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
265 |
* Scrollbar data structure |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
266 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
267 |
struct Scrollbar { |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
268 |
uint16 count; ///< Number of elements in the list |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
269 |
uint16 cap; ///< Number of visible elements of the scroll bar |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
270 |
uint16 pos; |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
271 |
}; |
0 | 272 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
273 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
274 |
* Data structure for resizing a window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
275 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
276 |
struct ResizeInfo { |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
277 |
uint width; ///< Minimum allowed width of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
278 |
uint height; ///< Minimum allowed height of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
279 |
uint step_width; ///< Step-size of width resize changes |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
280 |
uint step_height; ///< Step-size of height resize changes |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
281 |
}; |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
282 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
283 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
284 |
* Message data structure for messages sent between winodows |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
285 |
* @see SendWindowMessageW() |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
286 |
*/ |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
287 |
struct WindowMessage { |
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
288 |
int msg; |
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
289 |
int wparam; |
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
290 |
int lparam; |
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
291 |
}; |
1648
41c3d5de9994
(svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents:
1570
diff
changeset
|
292 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
293 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
294 |
* Data structure for an opened window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
295 |
*/ |
8925
e0d37ce1eba8
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
8923
diff
changeset
|
296 |
struct Window : ZeroedMemoryAllocator { |
9082
8a28686aeff2
(svn r12941) -Codechange: don't access wndproc directly. Patch by Alberth.
rubidium
parents:
8995
diff
changeset
|
297 |
private: |
8a28686aeff2
(svn r12941) -Codechange: don't access wndproc directly. Patch by Alberth.
rubidium
parents:
8995
diff
changeset
|
298 |
WindowProc *wndproc; ///< Event handler function for the window. Do not use directly, call HandleWindowEvent() instead. |
8a28686aeff2
(svn r12941) -Codechange: don't access wndproc directly. Patch by Alberth.
rubidium
parents:
8995
diff
changeset
|
299 |
|
9142
858a058aa730
(svn r13004) -Codechange: replace AllocateWindow and AllocateWindowDesc with a Window constructor.
rubidium
parents:
9127
diff
changeset
|
300 |
protected: |
858a058aa730
(svn r13004) -Codechange: replace AllocateWindow and AllocateWindowDesc with a Window constructor.
rubidium
parents:
9127
diff
changeset
|
301 |
void Initialize(int x, int y, int min_width, int min_height, int def_width, int def_height, |
858a058aa730
(svn r13004) -Codechange: replace AllocateWindow and AllocateWindowDesc with a Window constructor.
rubidium
parents:
9127
diff
changeset
|
302 |
WindowProc *proc, WindowClass cls, const Widget *widget, int window_number, void *data); |
858a058aa730
(svn r13004) -Codechange: replace AllocateWindow and AllocateWindowDesc with a Window constructor.
rubidium
parents:
9127
diff
changeset
|
303 |
|
9082
8a28686aeff2
(svn r12941) -Codechange: don't access wndproc directly. Patch by Alberth.
rubidium
parents:
8995
diff
changeset
|
304 |
public: |
9142
858a058aa730
(svn r13004) -Codechange: replace AllocateWindow and AllocateWindowDesc with a Window constructor.
rubidium
parents:
9127
diff
changeset
|
305 |
Window(int x, int y, int width, int height, WindowProc *proc, WindowClass cls, const Widget *widget, void *data = NULL); |
858a058aa730
(svn r13004) -Codechange: replace AllocateWindow and AllocateWindowDesc with a Window constructor.
rubidium
parents:
9127
diff
changeset
|
306 |
Window(const WindowDesc *desc, void *data = NULL, WindowNumber number = 0); |
858a058aa730
(svn r13004) -Codechange: replace AllocateWindow and AllocateWindowDesc with a Window constructor.
rubidium
parents:
9127
diff
changeset
|
307 |
|
9115
47ae980bace3
(svn r12975) -Codechange: replace DeleteWindow(w) with delete w.
rubidium
parents:
9082
diff
changeset
|
308 |
virtual ~Window(); |
9082
8a28686aeff2
(svn r12941) -Codechange: don't access wndproc directly. Patch by Alberth.
rubidium
parents:
8995
diff
changeset
|
309 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
310 |
uint16 flags4; ///< Window flags, @see WindowFlags |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
311 |
WindowClass window_class; ///< Window class |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
312 |
WindowNumber window_number; ///< Window number within the window class |
0 | 313 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
314 |
int left; ///< x position of left edge of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
315 |
int top; ///< y position of top edge of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
316 |
int width; ///< width of the window (number of pixels to the right in x direction) |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
317 |
int height; ///< Height of the window (number of pixels down in y direction) |
0 | 318 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
319 |
Scrollbar hscroll; ///< Horizontal scroll bar |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
320 |
Scrollbar vscroll; ///< First vertical scroll bar |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
321 |
Scrollbar vscroll2; ///< Second vertical scroll bar |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
322 |
ResizeInfo resize; ///< Resize information |
0 | 323 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
324 |
byte caption_color; ///< Background color of the window caption, contains PlayerID |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
325 |
|
8923
145035178dcb
(svn r12693) -Documentation: add some documentation to some window related stuff. Based on a patch by Albert.
rubidium
parents:
8896
diff
changeset
|
326 |
ViewPort *viewport; ///< Pointer to viewport, if present |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
327 |
const Widget *original_widget; ///< Original widget layout, copied from WindowDesc |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
328 |
Widget *widget; ///< Widgets of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
329 |
uint widget_count; ///< Number of widgets of the window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
330 |
uint32 desc_flags; ///< Window/widgets default flags setting, @see WindowDefaultFlag |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
331 |
|
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
332 |
WindowMessage message; ///< Buffer for storing received messages (for communication between different window events) |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
333 |
Window *parent; ///< Parent window |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
334 |
byte custom[WINDOW_CUSTOM_SIZE]; ///< Additional data depending on window type |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
335 |
|
8035
8c76ea0d84ab
(svn r11595) -Codechange: add a new member to Window struct, based on its function counterpart HandleButtonClick.
belugas
parents:
8032
diff
changeset
|
336 |
void HandleButtonClick(byte widget); |
8c76ea0d84ab
(svn r11595) -Codechange: add a new member to Window struct, based on its function counterpart HandleButtonClick.
belugas
parents:
8032
diff
changeset
|
337 |
|
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
338 |
void SetWidgetDisabledState(byte widget_index, bool disab_stat); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
339 |
void DisableWidget(byte widget_index); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
340 |
void EnableWidget(byte widget_index); |
7995
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
341 |
bool IsWidgetDisabled(byte widget_index) const; |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
342 |
void SetWidgetHiddenState(byte widget_index, bool hidden_stat); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
343 |
void HideWidget(byte widget_index); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
344 |
void ShowWidget(byte widget_index); |
7995
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
345 |
bool IsWidgetHidden(byte widget_index) const; |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
346 |
void SetWidgetLoweredState(byte widget_index, bool lowered_stat); |
7996
809895d51e05
(svn r11554) -Codechange: be more consistent with the naming of the widget functions.
rubidium
parents:
7995
diff
changeset
|
347 |
void ToggleWidgetLoweredState(byte widget_index); |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
348 |
void LowerWidget(byte widget_index); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
349 |
void RaiseWidget(byte widget_index); |
7995
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
350 |
bool IsWidgetLowered(byte widget_index) const; |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
351 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
352 |
void RaiseButtons(); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
353 |
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
354 |
void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
355 |
void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...); |
8026
a188ea8201ce
(svn r11586) -Fix: make another widget 'accessor' function const when it should be const.
glx
parents:
8019
diff
changeset
|
356 |
void InvalidateWidget(byte widget_index) const; |
9082
8a28686aeff2
(svn r12941) -Codechange: don't access wndproc directly. Patch by Alberth.
rubidium
parents:
8995
diff
changeset
|
357 |
|
9115
47ae980bace3
(svn r12975) -Codechange: replace DeleteWindow(w) with delete w.
rubidium
parents:
9082
diff
changeset
|
358 |
void SetDirty() const; |
47ae980bace3
(svn r12975) -Codechange: replace DeleteWindow(w) with delete w.
rubidium
parents:
9082
diff
changeset
|
359 |
|
9082
8a28686aeff2
(svn r12941) -Codechange: don't access wndproc directly. Patch by Alberth.
rubidium
parents:
8995
diff
changeset
|
360 |
virtual void HandleWindowEvent(WindowEvent *e); |
0 | 361 |
}; |
362 |
||
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
363 |
struct menu_d { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
364 |
byte item_count; ///< follow_vehicle |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
365 |
byte sel_index; ///< scrollpos_x |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
366 |
byte main_button; ///< scrollpos_y |
0 | 367 |
byte action_id; |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
368 |
StringID string_id; ///< unk30 |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
369 |
uint16 checked_items; ///< unk32 |
2216
cdedee39cc2b
(svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents:
2187
diff
changeset
|
370 |
byte disabled_items; |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
371 |
}; |
1004 | 372 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d)); |
0 | 373 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
374 |
struct def_d { |
0 | 375 |
int16 data_1, data_2, data_3; |
376 |
int16 data_4, data_5; |
|
2596 | 377 |
bool close; |
0 | 378 |
byte byte_1; |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
379 |
}; |
1004 | 380 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d)); |
0 | 381 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
382 |
struct depot_d { |
0 | 383 |
VehicleID sel; |
6638
09c5d7bf69a5
(svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents:
6531
diff
changeset
|
384 |
VehicleType type; |
4739
e626ef1b522e
(svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
bjarni
parents:
4730
diff
changeset
|
385 |
bool generate_list; |
4635
1b35cdc018ee
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
386 |
uint16 engine_list_length; |
1b35cdc018ee
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
387 |
uint16 wagon_list_length; |
1b35cdc018ee
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
388 |
uint16 engine_count; |
1b35cdc018ee
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
389 |
uint16 wagon_count; |
1b35cdc018ee
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
390 |
Vehicle **vehicle_list; |
1b35cdc018ee
(svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents:
4634
diff
changeset
|
391 |
Vehicle **wagon_list; |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
392 |
}; |
4638
05955c6cb536
(svn r6513) -Codechange: unified the code to draw depot windows
bjarni
parents:
4635
diff
changeset
|
393 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(depot_d)); |
0 | 394 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
395 |
struct vp_d { |
2116 | 396 |
VehicleID follow_vehicle; |
849
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
397 |
int32 scrollpos_x; |
c3407041774f
(svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents:
842
diff
changeset
|
398 |
int32 scrollpos_y; |
6730
9311a208f8f7
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
6669
diff
changeset
|
399 |
int32 dest_scrollpos_x; |
9311a208f8f7
(svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents:
6669
diff
changeset
|
400 |
int32 dest_scrollpos_y; |
8957
ef3f499ff423
(svn r12749) -Codechange: store the viewport information in the windows that have a viewport instead of one global array with a viewport for each window, even when they do not use the viewport.
rubidium
parents:
8925
diff
changeset
|
401 |
ViewPort vp_data; ///< Screen position and zoom of the viewport |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
402 |
}; |
5123
291651cb3a18
(svn r7203) -Cleanup: Donnu what Miham was smoking there, but removed it (assert_compile + 3)
Darkvater
parents:
5120
diff
changeset
|
403 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d)); |
1004 | 404 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
405 |
enum SortListFlags { |
8008
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
406 |
VL_NONE = 0, ///< no sort |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
407 |
VL_DESC = 1 << 0, ///< sort descending or ascending |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
408 |
VL_RESORT = 1 << 1, ///< instruct the code to resort the list in the next loop |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
409 |
VL_REBUILD = 1 << 2, ///< create sort-listing to use for qsort and friends |
4cc180fe96ab
(svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents:
7996
diff
changeset
|
410 |
VL_END = 1 << 3, |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
411 |
}; |
588 | 412 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5475
diff
changeset
|
413 |
DECLARE_ENUM_AS_BIT_SET(SortListFlags); |
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5475
diff
changeset
|
414 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
415 |
struct Listing { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
416 |
bool order; ///< Ascending/descending |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
417 |
byte criteria; ///< Sorting criteria |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
418 |
}; |
588 | 419 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
420 |
struct list_d { |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
421 |
uint16 list_length; ///< length of the list being sorted |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
422 |
byte sort_type; ///< what criteria to sort on |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
423 |
SortListFlags flags; ///< used to control sorting/resorting/etc. |
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
424 |
uint16 resort_timer; ///< resort list after a given amount of ticks if set |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
425 |
}; |
2888
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
426 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(list_d)); |
79da960a5372
(svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents:
2887
diff
changeset
|
427 |
|
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
428 |
struct vehiclelist_d { |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
429 |
const Vehicle** sort_list; // List of vehicles (sorted) |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
430 |
Listing *_sorting; // pointer to the appropiate subcategory of _sorting |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
431 |
uint16 length_of_sort_list; // Keeps track of how many vehicle pointers sort list got space for |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
432 |
VehicleType vehicle_type; // The vehicle type that is sorted |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
433 |
list_d l; // General list struct |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
434 |
}; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
435 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d)); |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6638
diff
changeset
|
436 |
|
0 | 437 |
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/ |
438 |
enum WindowWidgetBehaviours { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
439 |
WWB_PUSHBUTTON = 1 << 5, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
440 |
|
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
441 |
WWB_MASK = 0xE0, |
0 | 442 |
}; |
443 |
||
444 |
||
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
445 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
446 |
* Window widget types |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
447 |
*/ |
0 | 448 |
enum WindowWidgetTypes { |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
449 |
WWT_EMPTY, ///< Empty widget, place holder to reserve space in widget array |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
450 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
451 |
WWT_PANEL, ///< Simple depressed panel |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
452 |
WWT_INSET, ///< Pressed (inset) panel, most commonly used as combo box _text_ area |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
453 |
WWT_IMGBTN, ///< Button with image |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
454 |
WWT_IMGBTN_2, ///< Button with diff image when clicked |
0 | 455 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
456 |
WWT_TEXTBTN, ///< Button with text |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
457 |
WWT_TEXTBTN_2, ///< Button with diff text when clicked |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
458 |
WWT_LABEL, ///< Centered label |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
459 |
WWT_TEXT, ///< Pure simple text |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
460 |
WWT_MATRIX, ///< List of items underneath each other |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
461 |
WWT_SCROLLBAR, ///< Vertical scrollbar |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
462 |
WWT_FRAME, ///< Frame |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
463 |
WWT_CAPTION, ///< Window caption (window title between closebox and stickybox) |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
464 |
|
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
465 |
WWT_HSCROLLBAR, ///< Horizontal scrollbar |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
466 |
WWT_STICKYBOX, ///< Sticky box (normally at top-right of a window) |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
467 |
WWT_SCROLL2BAR, ///< 2nd vertical scrollbar |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
468 |
WWT_RESIZEBOX, ///< Resize box (normally at bottom-right of a window) |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
469 |
WWT_CLOSEBOX, ///< Close box (at top-left of a window) |
8335
09a2e049b3a8
(svn r11901) -Add: add two widgets for dropdowns, one raised and one inset, to eventually replace use of two widgets for each dropdown control.
peter1138
parents:
8284
diff
changeset
|
470 |
WWT_DROPDOWN, ///< Raised drop down list (regular) |
09a2e049b3a8
(svn r11901) -Add: add two widgets for dropdowns, one raised and one inset, to eventually replace use of two widgets for each dropdown control.
peter1138
parents:
8284
diff
changeset
|
471 |
WWT_DROPDOWNIN, ///< Inset drop down list (used on game options only) |
8737
4405e2e80db6
(svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents:
8586
diff
changeset
|
472 |
WWT_EDITBOX, ///< a textbox for typing (don't forget to call ShowOnScreenKeyboard() when clicked) |
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
473 |
WWT_LAST, ///< Last Item. use WIDGETS_END to fill up padding!! |
4939
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
474 |
|
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
475 |
WWT_MASK = 0x1F, |
0 | 476 |
|
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4884
diff
changeset
|
477 |
WWT_PUSHBTN = WWT_PANEL | WWB_PUSHBUTTON, |
4434
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
478 |
WWT_PUSHTXTBTN = WWT_TEXTBTN | WWB_PUSHBUTTON, |
a08cb4b5c179
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4345
diff
changeset
|
479 |
WWT_PUSHIMGBTN = WWT_IMGBTN | WWB_PUSHBUTTON, |
0 | 480 |
}; |
481 |
||
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
482 |
#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
|
483 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
484 |
/** |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
485 |
* Window flags |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
486 |
*/ |
0 | 487 |
enum WindowFlags { |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
488 |
WF_TIMEOUT_SHL = 0, ///< Window timeout counter shift |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
489 |
WF_TIMEOUT_MASK = 7, ///< Window timeout counter bit mask (3 bits), @see WF_TIMEOUT_SHL |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
490 |
WF_DRAGGING = 1 << 3, ///< Window is being dragged |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
491 |
WF_SCROLL_UP = 1 << 4, ///< Upper scroll button has been pressed, @see ScrollbarClickHandler() |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
492 |
WF_SCROLL_DOWN = 1 << 5, ///< Lower scroll button has been pressed, @see ScrollbarClickHandler() |
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
493 |
WF_SCROLL_MIDDLE = 1 << 6, ///< Scrollbar scrolling, @see ScrollbarClickHandler() |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
494 |
WF_HSCROLL = 1 << 7, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
495 |
WF_SIZING = 1 << 8, |
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
496 |
WF_STICKY = 1 << 9, ///< Window is made sticky by user |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
497 |
|
8857
7593af4962e6
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents:
8771
diff
changeset
|
498 |
WF_DISABLE_VP_SCROLL = 1 << 10, ///< Window does not do autoscroll, @see HandleAutoscroll() |
0 | 499 |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
500 |
WF_WHITE_BORDER_ONE = 1 << 11, |
5416
b9a3326da943
(svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents:
5415
diff
changeset
|
501 |
WF_WHITE_BORDER_MASK = 1 << 12 | WF_WHITE_BORDER_ONE, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
502 |
WF_SCROLL2 = 1 << 13, |
0 | 503 |
}; |
504 |
||
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
505 |
/* window.cpp */ |
0 | 506 |
void CallWindowEventNP(Window *w, int event); |
6247 | 507 |
void CallWindowTickEvent(); |
7545
d44e19c5671e
(svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents:
7530
diff
changeset
|
508 |
|
0 | 509 |
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number); |
510 |
Window *FindWindowFromPt(int x, int y); |
|
511 |
||
4171 | 512 |
bool IsWindowOfPrototype(const Window *w, const Widget *widget); |
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
859
diff
changeset
|
513 |
void AssignWidgetToWindow(Window *w, const Widget *widget); |
0 | 514 |
|
9143
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
515 |
/** |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
516 |
* Open a new window. |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
517 |
* @param *desc The pointer to the WindowDesc to be created |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
518 |
* @param window_number the window number of the new window |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
519 |
* @param data arbitrary data that is send with the WE_CREATE message |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
520 |
* @return see Window pointer of the newly created window |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
521 |
*/ |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
522 |
template <typename Wcls> |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
523 |
Wcls *AllocateWindowDescFront(const WindowDesc *desc, int window_number, void *data = NULL) |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
524 |
{ |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
525 |
if (BringWindowToFrontById(desc->cls, window_number)) return NULL; |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
526 |
return new Wcls(desc, data, window_number); |
029e126e3439
(svn r13005) -Codechange: prepare AllocateWindowDescFront for subclassing of Window.
rubidium
parents:
9142
diff
changeset
|
527 |
} |
0 | 528 |
|
5120
1ff65e874ce3
(svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
Darkvater
parents:
5108
diff
changeset
|
529 |
void DrawWindowViewport(const Window *w); |
0 | 530 |
|
531 |
void RelocateAllWindows(int neww, int newh); |
|
532 |
||
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
533 |
/* misc_gui.cpp */ |
7006
bfa3974da32b
(svn r10262) -Fix (r10258): some places that needed to be changed to uint64 were hidden/forgotten, which caused memory corruptions and that in caused all kinds of assertions to trigger.
rubidium
parents:
6730
diff
changeset
|
534 |
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]); |
4834
3c6e8a547174
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
535 |
static inline void GuiShowTooltips(StringID str) |
3c6e8a547174
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
536 |
{ |
3c6e8a547174
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
537 |
GuiShowTooltipsWithArgs(str, 0, NULL); |
3c6e8a547174
(svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents:
4800
diff
changeset
|
538 |
} |
4719
fc6e14219f72
(svn r6631) -Codechange: Use accessors for click_state.
belugas
parents:
4712
diff
changeset
|
539 |
|
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
540 |
/* widget.cpp */ |
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
541 |
int GetWidgetFromPos(const Window *w, int x, int y); |
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2216
diff
changeset
|
542 |
void DrawWindowWidgets(const Window *w); |
0 | 543 |
|
8349
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
544 |
enum SortButtonState { |
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
545 |
SBS_OFF, |
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
546 |
SBS_DOWN, |
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
547 |
SBS_UP, |
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
548 |
}; |
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
549 |
|
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
550 |
void DrawSortButtonState(const Window *w, int widget, SortButtonState state); |
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8335
diff
changeset
|
551 |
|
0 | 552 |
|
553 |
||
6117
6507b2a7e71d
(svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents:
6024
diff
changeset
|
554 |
/* window.cpp */ |
5124
2ca62776430e
(svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
Darkvater
parents:
5123
diff
changeset
|
555 |
extern Window *_z_windows[]; |
2ca62776430e
(svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
Darkvater
parents:
5123
diff
changeset
|
556 |
extern Window **_last_z_window; |
2ca62776430e
(svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
Darkvater
parents:
5123
diff
changeset
|
557 |
#define FOR_ALL_WINDOWS(wz) for (wz = _z_windows; wz != _last_z_window; wz++) |
0 | 558 |
|
8268
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
559 |
extern Point _cursorpos_drag_start; |
0 | 560 |
|
8268
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
561 |
extern int _scrollbar_start_pos; |
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
562 |
extern int _scrollbar_size; |
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
563 |
extern byte _scroller_click_timeout; |
0 | 564 |
|
8268
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
565 |
extern bool _scrolling_scrollbar; |
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
566 |
extern bool _scrolling_viewport; |
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
567 |
extern bool _popup_menu_active; |
0 | 568 |
|
8268
5027ad5e70a0
(svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents:
8264
diff
changeset
|
569 |
extern byte _special_mouse_mode; |
0 | 570 |
enum SpecialMouseMode { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
571 |
WSM_NONE = 0, |
0 | 572 |
WSM_DRAGDROP = 1, |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
573 |
WSM_SIZING = 2, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4337
diff
changeset
|
574 |
WSM_PRESIZE = 3, |
0 | 575 |
}; |
576 |
||
8995
f6b859375e10
(svn r12790) -Codechange: code style fixes. Patch by Alberth.
rubidium
parents:
8969
diff
changeset
|
577 |
Window *GetCallbackWnd(); |
f6b859375e10
(svn r12790) -Codechange: code style fixes. Patch by Alberth.
rubidium
parents:
8969
diff
changeset
|
578 |
Window **FindWindowZPosition(const Window *w); |
f6b859375e10
(svn r12790) -Codechange: code style fixes. Patch by Alberth.
rubidium
parents:
8969
diff
changeset
|
579 |
|
0 | 580 |
void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y); |
581 |
||
5822
f71317de4ab6
(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents:
5781
diff
changeset
|
582 |
void ResizeButtons(Window *w, byte left, byte right); |
f71317de4ab6
(svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents:
5781
diff
changeset
|
583 |
|
8418
afae92fe35f1
(svn r11988) -Codechange: Add a generic way of changing a widget's size and adjust the widgets around it to suit.
peter1138
parents:
8349
diff
changeset
|
584 |
void ResizeWindowForWidget(Window *w, int widget, int delta_x, int delta_y); |
afae92fe35f1
(svn r11988) -Codechange: Add a generic way of changing a widget's size and adjust the widgets around it to suit.
peter1138
parents:
8349
diff
changeset
|
585 |
|
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
586 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
587 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
588 |
* Sets the enabled/disabled status of a widget. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
589 |
* By default, widgets are enabled. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
590 |
* On certain conditions, they have to be disabled. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
591 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
592 |
* @param disab_stat : status to use ie: disabled = true, enabled = false |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
593 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
594 |
inline void Window::SetWidgetDisabledState(byte widget_index, bool disab_stat) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
595 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
596 |
assert(widget_index < this->widget_count); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
597 |
SB(this->widget[widget_index].display_flags, WIDG_DISABLED, 1, !!disab_stat); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
598 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
599 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
600 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
601 |
* Sets a widget to disabled. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
602 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
603 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
604 |
inline void Window::DisableWidget(byte widget_index) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
605 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
606 |
SetWidgetDisabledState(widget_index, true); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
607 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
608 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
609 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
610 |
* Sets a widget to Enabled. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
611 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
612 |
*/ |
7995
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
613 |
inline void Window::EnableWidget(byte widget_index) |
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
614 |
{ |
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
615 |
SetWidgetDisabledState(widget_index, false); |
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
616 |
} |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
617 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
618 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
619 |
* Gets the enabled/disabled status of a widget. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
620 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
621 |
* @return status of the widget ie: disabled = true, enabled = false |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
622 |
*/ |
7995
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
623 |
inline bool Window::IsWidgetDisabled(byte widget_index) const |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
624 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
625 |
assert(widget_index < this->widget_count); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
626 |
return HasBit(this->widget[widget_index].display_flags, WIDG_DISABLED); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
627 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
628 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
629 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
630 |
* Sets the hidden/shown status of a widget. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
631 |
* By default, widgets are visible. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
632 |
* On certain conditions, they have to be hidden. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
633 |
* @param widget_index index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
634 |
* @param hidden_stat status to use ie. hidden = true, visible = false |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
635 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
636 |
inline void Window::SetWidgetHiddenState(byte widget_index, bool hidden_stat) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
637 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
638 |
assert(widget_index < this->widget_count); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
639 |
SB(this->widget[widget_index].display_flags, WIDG_HIDDEN, 1, !!hidden_stat); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
640 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
641 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
642 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
643 |
* Sets a widget hidden. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
644 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
645 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
646 |
inline void Window::HideWidget(byte widget_index) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
647 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
648 |
SetWidgetHiddenState(widget_index, true); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
649 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
650 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
651 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
652 |
* Sets a widget visible. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
653 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
654 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
655 |
inline void Window::ShowWidget(byte widget_index) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
656 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
657 |
SetWidgetHiddenState(widget_index, false); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
658 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
659 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
660 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
661 |
* Gets the visibility of a widget. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
662 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
663 |
* @return status of the widget ie: hidden = true, visible = false |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
664 |
*/ |
7995
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
665 |
inline bool Window::IsWidgetHidden(byte widget_index) const |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
666 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
667 |
assert(widget_index < this->widget_count); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
668 |
return HasBit(this->widget[widget_index].display_flags, WIDG_HIDDEN); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
669 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
670 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
671 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
672 |
* Sets the lowered/raised status of a widget. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
673 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
674 |
* @param lowered_stat : status to use ie: lowered = true, raised = false |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
675 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
676 |
inline void Window::SetWidgetLoweredState(byte widget_index, bool lowered_stat) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
677 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
678 |
assert(widget_index < this->widget_count); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
679 |
SB(this->widget[widget_index].display_flags, WIDG_LOWERED, 1, !!lowered_stat); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
680 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
681 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
682 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
683 |
* Invert the lowered/raised status of a widget. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
684 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
685 |
*/ |
7996
809895d51e05
(svn r11554) -Codechange: be more consistent with the naming of the widget functions.
rubidium
parents:
7995
diff
changeset
|
686 |
inline void Window::ToggleWidgetLoweredState(byte widget_index) |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
687 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
688 |
assert(widget_index < this->widget_count); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
689 |
ToggleBit(this->widget[widget_index].display_flags, WIDG_LOWERED); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
690 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
691 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
692 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
693 |
* Marks a widget as lowered. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
694 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
695 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
696 |
inline void Window::LowerWidget(byte widget_index) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
697 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
698 |
SetWidgetLoweredState(widget_index, true); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
699 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
700 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
701 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
702 |
* Marks a widget as raised. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
703 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
704 |
*/ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
705 |
inline void Window::RaiseWidget(byte widget_index) |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
706 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
707 |
SetWidgetLoweredState(widget_index, false); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
708 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
709 |
|
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
710 |
/** |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
711 |
* Gets the lowered state of a widget. |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
712 |
* @param widget_index : index of this widget in the window |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
713 |
* @return status of the widget ie: lowered = true, raised= false |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
714 |
*/ |
7995
36f4cc1839fb
(svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents:
7993
diff
changeset
|
715 |
inline bool Window::IsWidgetLowered(byte widget_index) const |
7993
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
716 |
{ |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
717 |
assert(widget_index < this->widget_count); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
718 |
return HasBit(this->widget[widget_index].display_flags, WIDG_LOWERED); |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
719 |
} |
8776e72bf3da
(svn r11551) -Codechange: Introduction of widget control members on struct Window. These "new" members have the exact same functionalities as their pure functions "genitors"
belugas
parents:
7932
diff
changeset
|
720 |
|
8106
e6790dd9e750
(svn r11667) -Codechange: split window.h into a header that defines some 'global' window related types, on that defined 'global' window functions and one that defines functions and types only used by *_gui.cpps.
rubidium
parents:
8102
diff
changeset
|
721 |
#endif /* WINDOW_GUI_H */ |