src/window_gui.h
author rubidium
Mon, 07 Apr 2008 20:28:58 +0000
changeset 10083 9fb63cf5cc90
parent 9267 71cf88230dc1
child 10132 797415496aaa
permissions -rw-r--r--
(svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
8602
9e75e594a068 (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: 8598
diff changeset
     3
/** @file window_gui.h Functions, definitions and such used only by the GUI. */
6443
b8f06d8eb7be (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: 6350
diff changeset
     4
8602
9e75e594a068 (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: 8598
diff changeset
     5
#ifndef WINDOW_GUI_H
9e75e594a068 (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: 8598
diff changeset
     6
#define WINDOW_GUI_H
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
8718
1f536d980531 (svn r11785) -Codechange: remove some unneeded includes.
rubidium
parents: 8710
diff changeset
     8
#include "core/bitmath_func.hpp"
8635
3bbb6f87fced (svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents: 8609
diff changeset
     9
#include "vehicle_type.h"
8720
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8719
diff changeset
    10
#include "viewport_type.h"
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8720
diff changeset
    11
#include "player_type.h"
8760
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    12
#include "strings_type.h"
4299
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
    13
8564
f4a063368ba9 (svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents: 8532
diff changeset
    14
/**
f4a063368ba9 (svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents: 8532
diff changeset
    15
 * The maximum number of windows that can be opened.
f4a063368ba9 (svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents: 8532
diff changeset
    16
 */
f4a063368ba9 (svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents: 8532
diff changeset
    17
static const int MAX_NUMBER_OF_WINDOWS = 25;
f4a063368ba9 (svn r11629) -Fix [FS#1527]: many viewports could crash the scenario editor.
rubidium
parents: 8532
diff changeset
    18
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
typedef void WindowProc(Window *w, WindowEvent *e);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    21
/* How the resize system works:
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    22
    First, you need to add a WWT_RESIZEBOX to the widgets, and you need
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    23
     to add the flag WDF_RESIZABLE to the window. Now the window is ready
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    24
     to resize itself.
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    25
    As you may have noticed, all widgets have a RESIZE_XXX in their line.
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    26
     This lines controls how the widgets behave on resize. RESIZE_NONE means
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    27
     it doesn't do anything. Any other option let's one of the borders
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    28
     move with the changed width/height. So if a widget has
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    29
     RESIZE_RIGHT, and the window is made 5 pixels wider by the user,
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    30
     the right of the window will also be made 5 pixels wider.
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    31
    Now, what if you want to clamp a widget to the bottom? Give it the flag
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    32
     RESIZE_TB. This is RESIZE_TOP + RESIZE_BOTTOM. Now if the window gets
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    33
     5 pixels bigger, both the top and bottom gets 5 bigger, so the whole
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    34
     widgets moves downwards without resizing, and appears to be clamped
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    35
     to the bottom. Nice aint it?
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    36
   You should know one more thing about this system. Most windows can't
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    37
    handle an increase of 1 pixel. So there is a step function, which
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    38
    let the windowsize only be changed by X pixels. You configure this
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    39
    after making the window, like this:
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    40
      w->resize.step_height = 10;
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    41
    Now the window will only change in height in steps of 10.
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    42
   You can also give a minimum width and height. The default value is
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    43
    the default height/width of the window itself. You can change this
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    44
    AFTER window-creation, with:
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    45
     w->resize.width or w->resize.height.
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    46
   That was all.. good luck, and enjoy :) -- TrueLight */
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    47
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    48
enum ResizeFlag {
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    49
	RESIZE_NONE   = 0,  ///< no resize required
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    50
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    51
	RESIZE_LEFT   = 1,  ///< left resize flag
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    52
	RESIZE_RIGHT  = 2,  ///< rigth resize flag
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    53
	RESIZE_TOP    = 4,  ///< top resize flag
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    54
	RESIZE_BOTTOM = 8,  ///< bottom resize flag
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    55
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    56
	RESIZE_LR     = RESIZE_LEFT  | RESIZE_RIGHT,   ///<  combination of left and right resize flags
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    57
	RESIZE_RB     = RESIZE_RIGHT | RESIZE_BOTTOM,  ///<  combination of right and bottom resize flags
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    58
	RESIZE_TB     = RESIZE_TOP   | RESIZE_BOTTOM,  ///<  combination of top and bottom resize flags
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    59
	RESIZE_LRB    = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_BOTTOM, ///< combination of left, right and bottom resize flags
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    60
	RESIZE_LRTB   = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_TOP | RESIZE_BOTTOM,  ///<  combination of all resize flags
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    61
	RESIZE_RTB    = RESIZE_RIGHT | RESIZE_TOP    | RESIZE_BOTTOM, ///<  combination of right, top and bottom resize flag
4749
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
    62
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
    63
	/* The following flags are used by the system to specify what is disabled, hidden, or clicked
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
    64
	 * They are used in the same place as the above RESIZE_x flags, Widget visual_flags.
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
    65
	 * These states are used in exceptions. If nothing is specified, they will indicate
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
    66
	 * Enabled, visible or unclicked widgets*/
6443
b8f06d8eb7be (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: 6350
diff changeset
    67
	WIDG_DISABLED = 4,  ///< widget is greyed out, not available
b8f06d8eb7be (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: 6350
diff changeset
    68
	WIDG_HIDDEN   = 5,  ///< widget is made invisible
b8f06d8eb7be (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: 6350
diff changeset
    69
	WIDG_LOWERED  = 6,  ///< widget is paint lowered, a pressed button in fact
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    70
};
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    71
4755
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
    72
enum {
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    73
	WIDGET_LIST_END = -1, ///< indicate the end of widgets' list for vararg functions
4755
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
    74
};
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
    75
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
    76
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
    77
 * Window widget data structure
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
    78
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    79
struct Widget {
6443
b8f06d8eb7be (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: 6350
diff changeset
    80
	byte type;                        ///< Widget type, see WindowWidgetTypes
b8f06d8eb7be (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: 6350
diff changeset
    81
	byte display_flags;               ///< Resize direction, alignment, etc. during resizing, see ResizeFlags
4547
9786a24c4102 (svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents: 4542
diff changeset
    82
	byte color;                       ///< Widget colour, see docs/ottd-colourtext-palette.png
6224
5eec2dfd13af (svn r8662) -Fix r8661: don't try to put negative values in unsigned vars
bjarni
parents: 6195
diff changeset
    83
	int16 left, right, top, bottom;   ///< The position offsets inside the window
4547
9786a24c4102 (svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents: 4542
diff changeset
    84
	uint16 data;                      ///< The String/Image or special code (list-matrixes) of a widget
9786a24c4102 (svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents: 4542
diff changeset
    85
	StringID tooltips;                ///< Tooltips that are shown when rightclicking on a widget
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    86
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
    88
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
    89
 * Flags to describe the look of the frame
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
    90
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    91
enum FrameFlags {
8504
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
    92
	FR_NONE         =  0,
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
    93
	FR_TRANSPARENT  =  1 << 0,  ///< Makes the background transparent if set
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
    94
	FR_BORDERONLY   =  1 << 4,  ///< Draw border only, no background
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
    95
	FR_LOWERED      =  1 << 5,  ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed)
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
    96
	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)
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
    97
};
4437
d06bb548e48d (svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents: 4434
diff changeset
    98
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    99
DECLARE_ENUM_AS_BIT_SET(FrameFlags);
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   100
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   101
/* wiget.cpp */
4437
d06bb548e48d (svn r6209) Move DrawFrameRect() out of gfx.[ch], because it uses data (_color_list) which the renderer shouldn't have know about
tron
parents: 4434
diff changeset
   102
void DrawFrameRect(int left, int top, int right, int bottom, int color, FrameFlags flags);
1938
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
   103
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   104
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   105
 * Available window events
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   106
 */
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   107
enum WindowEventCodes {
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   108
	WE_CREATE,       ///< Initialize the Window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   109
	WE_DESTROY,      ///< Prepare for deletion of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   110
	WE_PAINT,        ///< Repaint the window contents
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   111
	WE_KEYPRESS,     ///< Key pressed
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   112
	WE_CLICK,        ///< Left mouse button click
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   113
	WE_DOUBLE_CLICK, ///< Left mouse button double click
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   114
	WE_RCLICK,       ///< Right mouse button click
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   115
	WE_MOUSEOVER,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   116
	WE_MOUSELOOP,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   117
	WE_MOUSEWHEEL,
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   118
	WE_TICK,         ///< Regularly occurring event (about once every 20 seconds orso, 10 days) for slowly changing content (typically list sorting)
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   119
	WE_4,            ///< Regularly occurring event for updating continuously changing window content (other than view ports), or timer expiring
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   120
	WE_TIMEOUT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   121
	WE_PLACE_OBJ,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   122
	WE_ABORT_PLACE_OBJ,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   123
	WE_ON_EDIT_TEXT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   124
	WE_ON_EDIT_TEXT_CANCEL,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   125
	WE_POPUPMENU_SELECT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   126
	WE_POPUPMENU_OVER,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   127
	WE_DRAGDROP,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   128
	WE_PLACE_DRAG,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   129
	WE_PLACE_MOUSEUP,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   130
	WE_PLACE_PRESIZE,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   131
	WE_DROPDOWN_SELECT,
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   132
	WE_RESIZE,          ///< Request to resize the window, @see WindowEvent.we.resize
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   133
	WE_MESSAGE,         ///< Receipt of a message from another window. @see WindowEvent.we.message, SendWindowMessage(), SendWindowMessageClass()
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   134
	WE_SCROLL,
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   135
	WE_INVALIDATE_DATA, ///< Notification that data displayed by the window is obsolete
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   136
	WE_CTRL_CHANGED,    ///< CTRL key has changed state
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   137
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   139
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   140
 * Data structures for additional data associated with a window event
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   141
 * @see WindowEventCodes
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   142
 */
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   143
struct WindowEvent {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   144
	byte event;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   145
	union {
7863
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   146
		struct {
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   147
			void *data;
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   148
		} create;
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   149
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   150
		struct {
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   151
			Point pt;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   152
			int widget;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   153
		} click;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   154
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   155
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   156
			Point pt;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   157
			TileIndex tile;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   158
			TileIndex starttile;
8384
cda01fb6ec2a (svn r11439) -Codechange: replace some magic numbers by a ViewportPlaceMethod enumified constant. Patch by SmatZ.
rubidium
parents: 8230
diff changeset
   159
			ViewportPlaceMethod select_method;
7165
37eb253f3c06 (svn r9900) -Codechange: Separate the variables for how to highlight a land area and what to do with it afterwards.
maedhros
parents: 7162
diff changeset
   160
			byte select_proc;
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   161
		} place;
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   162
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   163
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   164
			Point pt;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   165
			int widget;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   166
		} dragdrop;
4335
18bc63352a17 (svn r6036) -Codechange: do not handle SCROLL in a central function, but let windows handle them theirself. Added WE_SCROLL for this.
truelight
parents: 4318
diff changeset
   167
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   168
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   169
			Point size;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   170
			Point diff;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   171
		} sizing;
4337
f77887bd2634 (svn r6038) -Codechange: move mousewheel code to event WE_MOUSEWHEEL instead of a general function that handles that
truelight
parents: 4335
diff changeset
   172
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   173
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   174
			char *str;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   175
		} edittext;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   176
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   177
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   178
			Point pt;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   179
		} popupmenu;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   180
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   181
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   182
			int button;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   183
			int index;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   184
		} dropdown;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   185
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   186
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   187
			Point pt;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   188
			int widget;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   189
		} mouseover;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   190
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   191
		struct {
6443
b8f06d8eb7be (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: 6350
diff changeset
   192
			bool cont;      ///< continue the search? (default true)
b8f06d8eb7be (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: 6350
diff changeset
   193
			uint16 key;     ///< 16-bit Unicode value of the key
b8f06d8eb7be (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: 6350
diff changeset
   194
			uint16 keycode; ///< untranslated key (including shift-state)
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   195
		} keypress;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   196
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   197
		struct {
6443
b8f06d8eb7be (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: 6350
diff changeset
   198
			int msg;      ///< message to be sent
b8f06d8eb7be (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: 6350
diff changeset
   199
			int wparam;   ///< additional message-specific information
b8f06d8eb7be (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: 6350
diff changeset
   200
			int lparam;   ///< additional message-specific information
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   201
		} message;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   202
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   203
		struct {
6443
b8f06d8eb7be (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: 6350
diff changeset
   204
			Point delta;   ///< delta position against position of last call
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   205
		} scroll;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   206
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   207
		struct {
6443
b8f06d8eb7be (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: 6350
diff changeset
   208
			int wheel;     ///< how much was 'wheel'd'
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   209
		} wheel;
9082
8217cb013e23 (svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents: 8914
diff changeset
   210
8217cb013e23 (svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents: 8914
diff changeset
   211
		struct {
8217cb013e23 (svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents: 8914
diff changeset
   212
			bool cont;     ///< continue the search? (default true)
8217cb013e23 (svn r12167) -Feature(tte): change colour of autorail and autoroad selection when Ctrl is pressed
smatz
parents: 8914
diff changeset
   213
		} ctrl;
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   214
	} we;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   215
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   216
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   217
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   218
 * High level window description
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   219
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   220
struct WindowDesc {
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   221
	int16 left;             ///< Prefered x position of left edge of the window, @see WindowDefaultPosition()
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   222
	int16 top;              ///< Prefered y position of the top of the window, @see WindowDefaultPosition()
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   223
	int16 minimum_width;    ///< Minimal width of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   224
	int16 minimum_height;   ///< Minimal height of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   225
	int16 default_width;    ///< Prefered initial width of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   226
	int16 default_height;   ///< Prefered initial height of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   227
	WindowClass cls;        ///< Class of the window, @see WindowClass
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   228
	WindowClass parent_cls; ///< Class of the parent window, @see WindowClass
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   229
	uint32 flags;           ///< Flags, @see WindowDefaultFlags
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   230
	const Widget *widgets;  ///< List of widgets with their position and size for the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   231
	WindowProc *proc;       ///< Window event handler function for the window
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   232
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   234
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   235
 * Window default widget/window handling flags
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   236
 */
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   237
enum WindowDefaultFlag {
8504
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   238
	WDF_STD_TOOLTIPS    =   1 << 0, ///< use standard routine when displaying tooltips
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   239
	WDF_DEF_WIDGET      =   1 << 1, ///< Default widget control for some widgets in the on click event, @see DispatchLeftClickEvent()
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   240
	WDF_STD_BTN         =   1 << 2, ///< Default handling for close and titlebar widgets (widget no 0 and 1)
8515
d0401d967e99 (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents: 8514
diff changeset
   241
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   242
	WDF_UNCLICK_BUTTONS =   1 << 4, ///< Unclick buttons when the window event times out
8504
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   243
	WDF_STICKY_BUTTON   =   1 << 5, ///< Set window to sticky mode; they are not closed unless closed with 'X' (widget 2)
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   244
	WDF_RESIZABLE       =   1 << 6, ///< Window can be resized
8504
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   245
	WDF_MODAL           =   1 << 7, ///< The window is a modal child of some other window, meaning the parent is 'inactive'
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   247
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   248
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   249
 * Special values for 'left' and 'top' to cause a specific placement
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   250
 */
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   251
enum WindowDefaultPosition {
5072
df5bde83a4bc (svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents: 5071
diff changeset
   252
	WDP_AUTO      = -1, ///< Find a place automatically
df5bde83a4bc (svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents: 5071
diff changeset
   253
	WDP_CENTER    = -2, ///< Center the window (left/right or top/bottom)
df5bde83a4bc (svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents: 5071
diff changeset
   254
	WDP_ALIGN_TBR = -3, ///< Align the right side of the window with the right side of the main toolbar
df5bde83a4bc (svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents: 5071
diff changeset
   255
	WDP_ALIGN_TBL = -4, ///< Align the left side of the window with the left side of the main toolbar
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   256
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
8578
55218950ce2d (svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents: 8564
diff changeset
   258
#define WP(ptr, str) (*(str*)(ptr)->custom)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   260
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   261
 * Scrollbar data structure
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   262
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   263
struct Scrollbar {
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   264
	uint16 count;  ///< Number of elements in the list
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   265
	uint16 cap;    ///< Number of visible elements of the scroll bar
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   266
	uint16 pos;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   267
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   268
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   269
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   270
 * Data structure for resizing a window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   271
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   272
struct ResizeInfo {
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   273
	uint width;       ///< Minimum allowed width of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   274
	uint height;      ///< Minimum allowed height of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   275
	uint step_width;  ///< Step-size of width resize changes
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   276
	uint step_height; ///< Step-size of height resize changes
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   277
};
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   278
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   279
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   280
 * Message data structure for messages sent between winodows
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   281
 * @see SendWindowMessageW()
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   282
 */
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   283
struct WindowMessage {
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   284
	int msg;
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   285
	int wparam;
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   286
	int lparam;
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   287
};
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   288
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   289
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   290
 * Data structure for an opened window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   291
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   292
struct Window {
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   293
	uint16 flags4;              ///< Window flags, @see WindowFlags
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   294
	WindowClass window_class;   ///< Window class
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   295
	WindowNumber window_number; ///< Window number within the window class
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   296
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   297
	int left;   ///< x position of left edge of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   298
	int top;    ///< y position of top edge of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   299
	int width;  ///< width of the window (number of pixels to the right in x direction)
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   300
	int height; ///< Height of the window (number of pixels down in y direction)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   301
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   302
	Scrollbar hscroll;  ///< Horizontal scroll bar
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   303
	Scrollbar vscroll;  ///< First vertical scroll bar
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   304
	Scrollbar vscroll2; ///< Second vertical scroll bar
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   305
	ResizeInfo resize;  ///< Resize information
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   306
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   307
	byte caption_color; ///< Background color of the window caption, contains PlayerID
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   308
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   309
	WindowProc *wndproc;   ///< Event handler function for the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   310
	ViewPort *viewport;    ///< Pointer to viewport, if present (structure is part of derived class)
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   311
	const Widget *original_widget; ///< Original widget layout, copied from WindowDesc
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   312
	Widget *widget;        ///< Widgets of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   313
	uint widget_count;     ///< Number of widgets of the window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   314
	uint32 desc_flags;     ///< Window/widgets default flags setting, @see WindowDefaultFlag
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   315
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   316
	WindowMessage message; ///< Buffer for storing received messages (for communication between different window events)
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   317
	Window *parent;        ///< Parent window
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   318
	byte custom[WINDOW_CUSTOM_SIZE]; ///< Additional data depending on window type
8489
1e2a5fdb152f (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: 8428
diff changeset
   319
8531
e87a51f162e2 (svn r11595) -Codechange: add a new member to Window struct, based on its function counterpart HandleButtonClick.
belugas
parents: 8528
diff changeset
   320
	void HandleButtonClick(byte widget);
e87a51f162e2 (svn r11595) -Codechange: add a new member to Window struct, based on its function counterpart HandleButtonClick.
belugas
parents: 8528
diff changeset
   321
8489
1e2a5fdb152f (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: 8428
diff changeset
   322
	void SetWidgetDisabledState(byte widget_index, bool disab_stat);
1e2a5fdb152f (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: 8428
diff changeset
   323
	void DisableWidget(byte widget_index);
1e2a5fdb152f (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: 8428
diff changeset
   324
	void EnableWidget(byte widget_index);
8491
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   325
	bool IsWidgetDisabled(byte widget_index) const;
8489
1e2a5fdb152f (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: 8428
diff changeset
   326
	void SetWidgetHiddenState(byte widget_index, bool hidden_stat);
1e2a5fdb152f (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: 8428
diff changeset
   327
	void HideWidget(byte widget_index);
1e2a5fdb152f (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: 8428
diff changeset
   328
	void ShowWidget(byte widget_index);
8491
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   329
	bool IsWidgetHidden(byte widget_index) const;
8489
1e2a5fdb152f (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: 8428
diff changeset
   330
	void SetWidgetLoweredState(byte widget_index, bool lowered_stat);
8492
d61f7a733d19 (svn r11554) -Codechange: be more consistent with the naming of the widget functions.
rubidium
parents: 8491
diff changeset
   331
	void ToggleWidgetLoweredState(byte widget_index);
8489
1e2a5fdb152f (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: 8428
diff changeset
   332
	void LowerWidget(byte widget_index);
1e2a5fdb152f (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: 8428
diff changeset
   333
	void RaiseWidget(byte widget_index);
8491
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   334
	bool IsWidgetLowered(byte widget_index) const;
8489
1e2a5fdb152f (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: 8428
diff changeset
   335
1e2a5fdb152f (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: 8428
diff changeset
   336
	void RaiseButtons();
1e2a5fdb152f (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: 8428
diff changeset
   337
	void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
1e2a5fdb152f (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: 8428
diff changeset
   338
	void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...);
1e2a5fdb152f (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: 8428
diff changeset
   339
	void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
8522
a1c44311e09e (svn r11586) -Fix: make another widget 'accessor' function const when it should be const.
glx
parents: 8515
diff changeset
   340
	void InvalidateWidget(byte widget_index) const;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   341
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   342
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   343
struct menu_d {
6443
b8f06d8eb7be (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: 6350
diff changeset
   344
	byte item_count;      ///< follow_vehicle
b8f06d8eb7be (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: 6350
diff changeset
   345
	byte sel_index;       ///< scrollpos_x
b8f06d8eb7be (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: 6350
diff changeset
   346
	byte main_button;     ///< scrollpos_y
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   347
	byte action_id;
6443
b8f06d8eb7be (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: 6350
diff changeset
   348
	StringID string_id;   ///< unk30
b8f06d8eb7be (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: 6350
diff changeset
   349
	uint16 checked_items; ///< unk32
2216
51a715447fc4 (svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents: 2187
diff changeset
   350
	byte disabled_items;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   351
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   352
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   353
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   354
struct def_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   355
	int16 data_1, data_2, data_3;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   356
	int16 data_4, data_5;
2596
d228e8ce6fcf (svn r3133) - static, const
tron
parents: 2549
diff changeset
   357
	bool close;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   358
	byte byte_1;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   359
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   360
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   361
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   362
struct void_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   363
	void *data;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   364
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   365
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   366
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   367
struct tree_d {
2596
d228e8ce6fcf (svn r3133) - static, const
tron
parents: 2549
diff changeset
   368
	uint16 base;
d228e8ce6fcf (svn r3133) - static, const
tron
parents: 2549
diff changeset
   369
	uint16 count;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   370
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   371
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   372
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   373
struct tooltips_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   374
	StringID string_id;
4834
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   375
	byte paramcount;
7502
71f5d2c6a605 (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: 7226
diff changeset
   376
	uint64 params[5];
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   377
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   378
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   379
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   380
struct depot_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   381
	VehicleID sel;
7134
c5a90dd41166 (svn r9869) -Codechange: replace some bytes with VehicleType, i.e. more type strictness.
rubidium
parents: 7027
diff changeset
   382
	VehicleType type;
4739
bd535b408617 (svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
bjarni
parents: 4730
diff changeset
   383
	bool generate_list;
4635
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   384
	uint16 engine_list_length;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   385
	uint16 wagon_list_length;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   386
	uint16 engine_count;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   387
	uint16 wagon_count;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   388
	Vehicle **vehicle_list;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   389
	Vehicle **wagon_list;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   390
};
4638
8abe4f10b94b (svn r6513) -Codechange: unified the code to draw depot windows
bjarni
parents: 4635
diff changeset
   391
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(depot_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   392
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   393
struct order_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   394
	int sel;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   395
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   396
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   397
8026
269979f5319d (svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents: 7863
diff changeset
   398
struct vehicledetails_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   399
	byte tab;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   400
};
8026
269979f5319d (svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents: 7863
diff changeset
   401
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehicledetails_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   402
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   403
struct smallmap_d {
849
c6223dbdb202 (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   404
	int32 scroll_x;
c6223dbdb202 (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   405
	int32 scroll_y;
c6223dbdb202 (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   406
	int32 subscroll;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   407
};
4318
fe085a1dd0ad (svn r5971) -Fix: wrong struct in assert_compile (thomasdev)
truelight
parents: 4300
diff changeset
   408
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   409
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   410
struct vp_d {
2116
cdfc27b696b7 (svn r2626) static, const, misc.
tron
parents: 2064
diff changeset
   411
	VehicleID follow_vehicle;
849
c6223dbdb202 (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   412
	int32 scrollpos_x;
c6223dbdb202 (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   413
	int32 scrollpos_y;
7226
a8650d6ecb53 (svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents: 7165
diff changeset
   414
	int32 dest_scrollpos_x;
a8650d6ecb53 (svn r9962) -Feature: Add smooth viewport scrolling. This must be enabled with patch setting 'smooth_scroll'
peter1138
parents: 7165
diff changeset
   415
	int32 dest_scrollpos_y;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   416
};
5123
9eb435a37492 (svn r7203) -Cleanup: Donnu what Miham was smoking there, but removed it (assert_compile + 3)
Darkvater
parents: 5120
diff changeset
   417
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d));
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   418
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   419
struct highscore_d {
998
d9dc257b8949 (svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents: 983
diff changeset
   420
	uint32 background_img;
d9dc257b8949 (svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents: 983
diff changeset
   421
	int8 rank;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   422
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   423
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d));
998
d9dc257b8949 (svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents: 983
diff changeset
   424
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   425
struct scroller_d {
998
d9dc257b8949 (svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents: 983
diff changeset
   426
	int height;
d9dc257b8949 (svn r1496) -Fix: highscore no longer crashes in network games with a dedicated server. At the end of the game (can only be set by the server) the highscore is shown for the top5 companies of that game
darkvater
parents: 983
diff changeset
   427
	uint16 counter;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   428
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   429
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d));
859
46839573bed8 (svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents: 849
diff changeset
   430
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   431
enum SortListFlags {
8504
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   432
	VL_NONE    = 0,      ///< no sort
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   433
	VL_DESC    = 1 << 0, ///< sort descending or ascending
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   434
	VL_RESORT  = 1 << 1, ///< instruct the code to resort the list in the next loop
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   435
	VL_REBUILD = 1 << 2, ///< create sort-listing to use for qsort and friends
a258f7640c56 (svn r11568) -Codechange: Use bit shifts instead of values for flags. It helps readability a little bit.
belugas
parents: 8492
diff changeset
   436
	VL_END     = 1 << 3,
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   437
};
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   438
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   439
DECLARE_ENUM_AS_BIT_SET(SortListFlags);
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   440
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   441
struct Listing {
6443
b8f06d8eb7be (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: 6350
diff changeset
   442
	bool order;    ///< Ascending/descending
b8f06d8eb7be (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: 6350
diff changeset
   443
	byte criteria; ///< Sorting criteria
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   444
};
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   445
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   446
struct list_d {
6443
b8f06d8eb7be (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: 6350
diff changeset
   447
	uint16 list_length;  ///< length of the list being sorted
b8f06d8eb7be (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: 6350
diff changeset
   448
	byte sort_type;      ///< what criteria to sort on
b8f06d8eb7be (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: 6350
diff changeset
   449
	SortListFlags flags; ///< used to control sorting/resorting/etc.
b8f06d8eb7be (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: 6350
diff changeset
   450
	uint16 resort_timer; ///< resort list after a given amount of ticks if set
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   451
};
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   452
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(list_d));
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   453
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   454
struct message_d {
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   455
	int msg;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   456
	int wparam;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   457
	int lparam;
6574
e1d1a12faaf7 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6573
diff changeset
   458
};
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   459
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d));
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   460
7139
4ae3ab180d05 (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: 7134
diff changeset
   461
struct vehiclelist_d {
4ae3ab180d05 (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: 7134
diff changeset
   462
	const Vehicle** sort_list;  // List of vehicles (sorted)
4ae3ab180d05 (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: 7134
diff changeset
   463
	Listing *_sorting;          // pointer to the appropiate subcategory of _sorting
4ae3ab180d05 (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: 7134
diff changeset
   464
	uint16 length_of_sort_list; // Keeps track of how many vehicle pointers sort list got space for
4ae3ab180d05 (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: 7134
diff changeset
   465
	VehicleType vehicle_type;   // The vehicle type that is sorted
4ae3ab180d05 (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: 7134
diff changeset
   466
	list_d l;                   // General list struct
4ae3ab180d05 (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: 7134
diff changeset
   467
};
4ae3ab180d05 (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: 7134
diff changeset
   468
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d));
4ae3ab180d05 (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: 7134
diff changeset
   469
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   470
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   471
enum WindowWidgetBehaviours {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   472
	WWB_PUSHBUTTON  = 1 << 5,
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4884
diff changeset
   473
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4884
diff changeset
   474
	WWB_MASK        = 0xE0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   475
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   476
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   477
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   478
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   479
 * Window widget types
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   480
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   481
enum WindowWidgetTypes {
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   482
	WWT_EMPTY,      ///< Empty widget, place holder to reserve space in widget array
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4884
diff changeset
   483
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   484
	WWT_PANEL,      ///< Simple depressed panel
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   485
	WWT_INSET,      ///< Pressed (inset) panel, most commonly used as combo box _text_ area
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   486
	WWT_IMGBTN,     ///< Button with image
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   487
	WWT_IMGBTN_2,   ///< Button with diff image when clicked
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   488
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   489
	WWT_TEXTBTN,    ///< Button with text
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   490
	WWT_TEXTBTN_2,  ///< Button with diff text when clicked
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   491
	WWT_LABEL,      ///< Centered label
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   492
	WWT_TEXT,       ///< Pure simple text
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   493
	WWT_MATRIX,     ///< List of items underneath each other
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   494
	WWT_SCROLLBAR,  ///< Vertical scrollbar
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   495
	WWT_FRAME,      ///< Frame
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   496
	WWT_CAPTION,    ///< Window caption (window title between closebox and stickybox)
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   497
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   498
	WWT_HSCROLLBAR, ///< Horizontal scrollbar
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   499
	WWT_STICKYBOX,  ///< Sticky box (normally at top-right of a window)
6443
b8f06d8eb7be (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: 6350
diff changeset
   500
	WWT_SCROLL2BAR, ///< 2nd vertical scrollbar
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   501
	WWT_RESIZEBOX,  ///< Resize box (normally at bottom-right of a window)
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   502
	WWT_CLOSEBOX,   ///< Close box (at top-left of a window)
8831
c13fdbe2783a (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: 8780
diff changeset
   503
	WWT_DROPDOWN,   ///< Raised drop down list (regular)
c13fdbe2783a (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: 8780
diff changeset
   504
	WWT_DROPDOWNIN, ///< Inset drop down list (used on game options only)
9233
4daa9bb8dbf7 (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: 9082
diff changeset
   505
	WWT_EDITBOX,    ///< a textbox for typing (don't forget to call ShowOnScreenKeyboard() when clicked)
6443
b8f06d8eb7be (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: 6350
diff changeset
   506
	WWT_LAST,       ///< Last Item. use WIDGETS_END to fill up padding!!
4939
ede0f6777b3c (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents: 4938
diff changeset
   507
ede0f6777b3c (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents: 4938
diff changeset
   508
	WWT_MASK = 0x1F,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   509
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4884
diff changeset
   510
	WWT_PUSHBTN     = WWT_PANEL   | WWB_PUSHBUTTON,
4434
4175805666a5 (svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents: 4345
diff changeset
   511
	WWT_PUSHTXTBTN  = WWT_TEXTBTN | WWB_PUSHBUTTON,
4175805666a5 (svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents: 4345
diff changeset
   512
	WWT_PUSHIMGBTN  = WWT_IMGBTN  | WWB_PUSHBUTTON,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   513
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   514
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   515
#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
   516
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   517
/**
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   518
 * Window flags
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   519
 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   520
enum WindowFlags {
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   521
	WF_TIMEOUT_SHL       = 0,       ///< Window timeout counter shift
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   522
	WF_TIMEOUT_MASK      = 7,       ///< Window timeout counter bit mask (3 bits), @see WF_TIMEOUT_SHL
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   523
	WF_DRAGGING          = 1 <<  3, ///< Window is being dragged
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   524
	WF_SCROLL_UP         = 1 <<  4, ///< Upper scroll button has been pressed, @see ScrollbarClickHandler()
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   525
	WF_SCROLL_DOWN       = 1 <<  5, ///< Lower scroll button has been pressed, @see ScrollbarClickHandler()
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   526
	WF_SCROLL_MIDDLE     = 1 <<  6, ///< Scrollbar scrolling, @see ScrollbarClickHandler()
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   527
	WF_HSCROLL           = 1 <<  7,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   528
	WF_SIZING            = 1 <<  8,
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   529
	WF_STICKY            = 1 <<  9, ///< Window is made sticky by user
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   530
10083
9fb63cf5cc90 (svn r12619) -Codechange: lots of documentation about window related stuff. Patch by Alberth.
rubidium
parents: 9267
diff changeset
   531
	WF_DISABLE_VP_SCROLL = 1 << 10, ///< Window does not do autoscroll, @see HandleAutoscroll()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   532
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   533
	WF_WHITE_BORDER_ONE  = 1 << 11,
5667
248a3234d2e2 (svn r7619) -Feature (Internal): Add support for modal children. It's a window-child that
Darkvater
parents: 5666
diff changeset
   534
	WF_WHITE_BORDER_MASK = 1 << 12 | WF_WHITE_BORDER_ONE,
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   535
	WF_SCROLL2           = 1 << 13,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   536
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   537
6443
b8f06d8eb7be (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: 6350
diff changeset
   538
/* window.cpp */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   539
void CallWindowEventNP(Window *w, int event);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   540
void CallWindowTickEvent();
8041
63e760418a15 (svn r11065) -Documentation [FS#1186]: of the dirty marking/repainting subsystem. Patch by Progman.
rubidium
parents: 8026
diff changeset
   541
4171
3fadda3afe70 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
   542
void SetWindowDirty(const Window *w);
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   543
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, int msg, int wparam, int lparam);
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   544
void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lparam);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   545
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   546
Window *FindWindowById(WindowClass cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   547
void DeleteWindow(Window *w);
5077
587701a06b6a (svn r7138) -Fix: [vehicle list windows] fixed a rare crash where having some (not all) vehicle list windows open for a player, that goes bankrupt would crash the game
bjarni
parents: 5072
diff changeset
   548
void DeletePlayerWindows(PlayerID pi);
587701a06b6a (svn r7138) -Fix: [vehicle list windows] fixed a rare crash where having some (not all) vehicle list windows open for a player, that goes bankrupt would crash the game
bjarni
parents: 5072
diff changeset
   549
void ChangeWindowOwner(PlayerID old_player, PlayerID new_player);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   550
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   551
Window *FindWindowFromPt(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   552
4171
3fadda3afe70 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
   553
bool IsWindowOfPrototype(const Window *w, const Widget *widget);
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   554
void AssignWidgetToWindow(Window *w, const Widget *widget);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   555
Window *AllocateWindow(
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   556
							int x,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   557
							int y,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   558
							int width,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   559
							int height,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   560
							WindowProc *proc,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   561
							WindowClass cls,
7863
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   562
							const Widget *widget,
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   563
							void *data = NULL);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   564
7863
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   565
Window *AllocateWindowDesc(const WindowDesc *desc, void *data = NULL);
cc5dcf5c8ed4 (svn r10730) -Codechange: allow (some) arbitrary data to be send to the WE_CREATE event.
rubidium
parents: 7837
diff changeset
   566
Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number, void *data = NULL);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   567
5120
e12dfc67761f (svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
Darkvater
parents: 5108
diff changeset
   568
void DrawWindowViewport(const Window *w);
5268
cbff87066429 (svn r7409) -Codechange: Make the ResizeWindow function also available outside of window.c. This makes
Darkvater
parents: 5236
diff changeset
   569
void ResizeWindow(Window *w, int x, int y);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   570
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   571
void InitWindowSystem();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   572
void UnInitWindowSystem();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   573
void ResetWindowSystem();
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2216
diff changeset
   574
int GetMenuItemIndex(const Window *w, int x, int y);
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   575
void InputLoop();
4766
a23183d868d1 (svn r6680) -Codechange r6679: [train build window] only generate the list when the window data is invalidated or the window is generated, not on each redraw
bjarni
parents: 4765
diff changeset
   576
void InvalidateThisWindowData(Window *w);
4739
bd535b408617 (svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
bjarni
parents: 4730
diff changeset
   577
void InvalidateWindowData(WindowClass cls, WindowNumber number);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   578
void RelocateAllWindows(int neww, int newh);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   579
6443
b8f06d8eb7be (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: 6350
diff changeset
   580
/* misc_gui.cpp */
7502
71f5d2c6a605 (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: 7226
diff changeset
   581
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]);
4834
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   582
static inline void GuiShowTooltips(StringID str)
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   583
{
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   584
	GuiShowTooltipsWithArgs(str, 0, NULL);
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   585
}
4719
413b21513ef7 (svn r6631) -Codechange: Use accessors for click_state.
belugas
parents: 4712
diff changeset
   586
6443
b8f06d8eb7be (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: 6350
diff changeset
   587
/* widget.cpp */
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2216
diff changeset
   588
int GetWidgetFromPos(const Window *w, int x, int y);
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2216
diff changeset
   589
void DrawWindowWidgets(const Window *w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   590
8845
e0eac76d3d16 (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: 8831
diff changeset
   591
enum SortButtonState {
e0eac76d3d16 (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: 8831
diff changeset
   592
	SBS_OFF,
e0eac76d3d16 (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: 8831
diff changeset
   593
	SBS_DOWN,
e0eac76d3d16 (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: 8831
diff changeset
   594
	SBS_UP,
e0eac76d3d16 (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: 8831
diff changeset
   595
};
e0eac76d3d16 (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: 8831
diff changeset
   596
e0eac76d3d16 (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: 8831
diff changeset
   597
void DrawSortButtonState(const Window *w, int widget, SortButtonState state);
e0eac76d3d16 (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: 8831
diff changeset
   598
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   599
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   600
Window *GetCallbackWnd();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   601
void DeleteNonVitalWindows();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   602
void DeleteAllNonVitalWindows();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   603
void HideVitalWindows();
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6505
diff changeset
   604
void ShowVitalWindows();
5124
d30772d0e9e1 (svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
Darkvater
parents: 5123
diff changeset
   605
Window **FindWindowZPosition(const Window *w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   606
6443
b8f06d8eb7be (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: 6350
diff changeset
   607
/* window.cpp */
5124
d30772d0e9e1 (svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
Darkvater
parents: 5123
diff changeset
   608
extern Window *_z_windows[];
d30772d0e9e1 (svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
Darkvater
parents: 5123
diff changeset
   609
extern Window **_last_z_window;
d30772d0e9e1 (svn r7205) -Fix [FS#350, SF#1560913]: Window allocation and deletion messed with the actual window
Darkvater
parents: 5123
diff changeset
   610
#define FOR_ALL_WINDOWS(wz) for (wz = _z_windows; wz != _last_z_window; wz++)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   611
8764
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   612
extern Point _cursorpos_drag_start;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   613
8764
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   614
extern int _scrollbar_start_pos;
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   615
extern int _scrollbar_size;
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   616
extern byte _scroller_click_timeout;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   617
8764
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   618
extern bool _scrolling_scrollbar;
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   619
extern bool _scrolling_viewport;
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   620
extern bool _popup_menu_active;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   621
8764
65746a5248ec (svn r11832) -Codechange: get rid of (quite) some VARDEFs.
rubidium
parents: 8760
diff changeset
   622
extern byte _special_mouse_mode;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   623
enum SpecialMouseMode {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   624
	WSM_NONE     = 0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   625
	WSM_DRAGDROP = 1,
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   626
	WSM_SIZING   = 2,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   627
	WSM_PRESIZE  = 3,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   628
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   629
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   630
void ScrollbarClickHandler(Window *w, const Widget *wi, int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   631
6073
d8dae377c879 (svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents: 6032
diff changeset
   632
void ResizeButtons(Window *w, byte left, byte right);
d8dae377c879 (svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents: 6032
diff changeset
   633
8914
6ebaa4b4eb2b (svn r11988) -Codechange: Add a generic way of changing a widget's size and adjust the widgets around it to suit.
peter1138
parents: 8845
diff changeset
   634
void ResizeWindowForWidget(Window *w, int widget, int delta_x, int delta_y);
6ebaa4b4eb2b (svn r11988) -Codechange: Add a generic way of changing a widget's size and adjust the widgets around it to suit.
peter1138
parents: 8845
diff changeset
   635
8489
1e2a5fdb152f (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: 8428
diff changeset
   636
1e2a5fdb152f (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: 8428
diff changeset
   637
/**
1e2a5fdb152f (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: 8428
diff changeset
   638
 * Sets the enabled/disabled status of a widget.
1e2a5fdb152f (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: 8428
diff changeset
   639
 * By default, widgets are enabled.
1e2a5fdb152f (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: 8428
diff changeset
   640
 * On certain conditions, they have to be disabled.
1e2a5fdb152f (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: 8428
diff changeset
   641
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   642
 * @param disab_stat : status to use ie: disabled = true, enabled = false
1e2a5fdb152f (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: 8428
diff changeset
   643
 */
1e2a5fdb152f (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: 8428
diff changeset
   644
inline void Window::SetWidgetDisabledState(byte widget_index, bool disab_stat)
1e2a5fdb152f (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: 8428
diff changeset
   645
{
1e2a5fdb152f (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: 8428
diff changeset
   646
	assert(widget_index < this->widget_count);
1e2a5fdb152f (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: 8428
diff changeset
   647
	SB(this->widget[widget_index].display_flags, WIDG_DISABLED, 1, !!disab_stat);
1e2a5fdb152f (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: 8428
diff changeset
   648
}
1e2a5fdb152f (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: 8428
diff changeset
   649
1e2a5fdb152f (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: 8428
diff changeset
   650
/**
1e2a5fdb152f (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: 8428
diff changeset
   651
 * Sets a widget to disabled.
1e2a5fdb152f (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: 8428
diff changeset
   652
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   653
 */
1e2a5fdb152f (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: 8428
diff changeset
   654
inline void Window::DisableWidget(byte widget_index)
1e2a5fdb152f (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: 8428
diff changeset
   655
{
1e2a5fdb152f (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: 8428
diff changeset
   656
	SetWidgetDisabledState(widget_index, true);
1e2a5fdb152f (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: 8428
diff changeset
   657
}
1e2a5fdb152f (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: 8428
diff changeset
   658
1e2a5fdb152f (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: 8428
diff changeset
   659
/**
1e2a5fdb152f (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: 8428
diff changeset
   660
 * Sets a widget to Enabled.
1e2a5fdb152f (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: 8428
diff changeset
   661
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   662
 */
8491
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   663
inline void Window::EnableWidget(byte widget_index)
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   664
{
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   665
	SetWidgetDisabledState(widget_index, false);
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   666
}
8489
1e2a5fdb152f (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: 8428
diff changeset
   667
1e2a5fdb152f (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: 8428
diff changeset
   668
/**
1e2a5fdb152f (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: 8428
diff changeset
   669
 * Gets the enabled/disabled status of a widget.
1e2a5fdb152f (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: 8428
diff changeset
   670
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   671
 * @return status of the widget ie: disabled = true, enabled = false
1e2a5fdb152f (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: 8428
diff changeset
   672
 */
8491
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   673
inline bool Window::IsWidgetDisabled(byte widget_index) const
8489
1e2a5fdb152f (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: 8428
diff changeset
   674
{
1e2a5fdb152f (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: 8428
diff changeset
   675
	assert(widget_index < this->widget_count);
1e2a5fdb152f (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: 8428
diff changeset
   676
	return HasBit(this->widget[widget_index].display_flags, WIDG_DISABLED);
1e2a5fdb152f (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: 8428
diff changeset
   677
}
1e2a5fdb152f (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: 8428
diff changeset
   678
1e2a5fdb152f (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: 8428
diff changeset
   679
/**
1e2a5fdb152f (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: 8428
diff changeset
   680
 * Sets the hidden/shown status of a widget.
1e2a5fdb152f (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: 8428
diff changeset
   681
 * By default, widgets are visible.
1e2a5fdb152f (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: 8428
diff changeset
   682
 * On certain conditions, they have to be hidden.
1e2a5fdb152f (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: 8428
diff changeset
   683
 * @param widget_index index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   684
 * @param hidden_stat status to use ie. hidden = true, visible = false
1e2a5fdb152f (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: 8428
diff changeset
   685
 */
1e2a5fdb152f (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: 8428
diff changeset
   686
inline void Window::SetWidgetHiddenState(byte widget_index, bool hidden_stat)
1e2a5fdb152f (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: 8428
diff changeset
   687
{
1e2a5fdb152f (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: 8428
diff changeset
   688
	assert(widget_index < this->widget_count);
1e2a5fdb152f (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: 8428
diff changeset
   689
	SB(this->widget[widget_index].display_flags, WIDG_HIDDEN, 1, !!hidden_stat);
1e2a5fdb152f (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: 8428
diff changeset
   690
}
1e2a5fdb152f (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: 8428
diff changeset
   691
1e2a5fdb152f (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: 8428
diff changeset
   692
/**
1e2a5fdb152f (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: 8428
diff changeset
   693
 * Sets a widget hidden.
1e2a5fdb152f (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: 8428
diff changeset
   694
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   695
 */
1e2a5fdb152f (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: 8428
diff changeset
   696
inline void Window::HideWidget(byte widget_index)
1e2a5fdb152f (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: 8428
diff changeset
   697
{
1e2a5fdb152f (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: 8428
diff changeset
   698
	SetWidgetHiddenState(widget_index, true);
1e2a5fdb152f (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: 8428
diff changeset
   699
}
1e2a5fdb152f (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: 8428
diff changeset
   700
1e2a5fdb152f (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: 8428
diff changeset
   701
/**
1e2a5fdb152f (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: 8428
diff changeset
   702
 * Sets a widget visible.
1e2a5fdb152f (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: 8428
diff changeset
   703
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   704
 */
1e2a5fdb152f (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: 8428
diff changeset
   705
inline void Window::ShowWidget(byte widget_index)
1e2a5fdb152f (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: 8428
diff changeset
   706
{
1e2a5fdb152f (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: 8428
diff changeset
   707
	SetWidgetHiddenState(widget_index, false);
1e2a5fdb152f (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: 8428
diff changeset
   708
}
1e2a5fdb152f (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: 8428
diff changeset
   709
1e2a5fdb152f (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: 8428
diff changeset
   710
/**
1e2a5fdb152f (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: 8428
diff changeset
   711
 * Gets the visibility of a widget.
1e2a5fdb152f (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: 8428
diff changeset
   712
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   713
 * @return status of the widget ie: hidden = true, visible = false
1e2a5fdb152f (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: 8428
diff changeset
   714
 */
8491
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   715
inline bool Window::IsWidgetHidden(byte widget_index) const
8489
1e2a5fdb152f (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: 8428
diff changeset
   716
{
1e2a5fdb152f (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: 8428
diff changeset
   717
	assert(widget_index < this->widget_count);
1e2a5fdb152f (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: 8428
diff changeset
   718
	return HasBit(this->widget[widget_index].display_flags, WIDG_HIDDEN);
1e2a5fdb152f (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: 8428
diff changeset
   719
}
1e2a5fdb152f (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: 8428
diff changeset
   720
1e2a5fdb152f (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: 8428
diff changeset
   721
/**
1e2a5fdb152f (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: 8428
diff changeset
   722
 * Sets the lowered/raised status of a widget.
1e2a5fdb152f (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: 8428
diff changeset
   723
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   724
 * @param lowered_stat : status to use ie: lowered = true, raised = false
1e2a5fdb152f (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: 8428
diff changeset
   725
 */
1e2a5fdb152f (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: 8428
diff changeset
   726
inline void Window::SetWidgetLoweredState(byte widget_index, bool lowered_stat)
1e2a5fdb152f (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: 8428
diff changeset
   727
{
1e2a5fdb152f (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: 8428
diff changeset
   728
	assert(widget_index < this->widget_count);
1e2a5fdb152f (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: 8428
diff changeset
   729
	SB(this->widget[widget_index].display_flags, WIDG_LOWERED, 1, !!lowered_stat);
1e2a5fdb152f (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: 8428
diff changeset
   730
}
1e2a5fdb152f (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: 8428
diff changeset
   731
1e2a5fdb152f (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: 8428
diff changeset
   732
/**
1e2a5fdb152f (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: 8428
diff changeset
   733
 * Invert the lowered/raised  status of a widget.
1e2a5fdb152f (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: 8428
diff changeset
   734
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   735
 */
8492
d61f7a733d19 (svn r11554) -Codechange: be more consistent with the naming of the widget functions.
rubidium
parents: 8491
diff changeset
   736
inline void Window::ToggleWidgetLoweredState(byte widget_index)
8489
1e2a5fdb152f (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: 8428
diff changeset
   737
{
1e2a5fdb152f (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: 8428
diff changeset
   738
	assert(widget_index < this->widget_count);
1e2a5fdb152f (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: 8428
diff changeset
   739
	ToggleBit(this->widget[widget_index].display_flags, WIDG_LOWERED);
1e2a5fdb152f (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: 8428
diff changeset
   740
}
1e2a5fdb152f (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: 8428
diff changeset
   741
1e2a5fdb152f (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: 8428
diff changeset
   742
/**
1e2a5fdb152f (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: 8428
diff changeset
   743
 * Marks a widget as lowered.
1e2a5fdb152f (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: 8428
diff changeset
   744
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   745
 */
1e2a5fdb152f (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: 8428
diff changeset
   746
inline void Window::LowerWidget(byte widget_index)
1e2a5fdb152f (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: 8428
diff changeset
   747
{
1e2a5fdb152f (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: 8428
diff changeset
   748
	SetWidgetLoweredState(widget_index, true);
1e2a5fdb152f (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: 8428
diff changeset
   749
}
1e2a5fdb152f (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: 8428
diff changeset
   750
1e2a5fdb152f (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: 8428
diff changeset
   751
/**
1e2a5fdb152f (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: 8428
diff changeset
   752
 * Marks a widget as raised.
1e2a5fdb152f (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: 8428
diff changeset
   753
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   754
 */
1e2a5fdb152f (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: 8428
diff changeset
   755
inline void Window::RaiseWidget(byte widget_index)
1e2a5fdb152f (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: 8428
diff changeset
   756
{
1e2a5fdb152f (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: 8428
diff changeset
   757
	SetWidgetLoweredState(widget_index, false);
1e2a5fdb152f (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: 8428
diff changeset
   758
}
1e2a5fdb152f (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: 8428
diff changeset
   759
1e2a5fdb152f (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: 8428
diff changeset
   760
/**
1e2a5fdb152f (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: 8428
diff changeset
   761
 * Gets the lowered state of a widget.
1e2a5fdb152f (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: 8428
diff changeset
   762
 * @param widget_index : index of this widget in the window
1e2a5fdb152f (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: 8428
diff changeset
   763
 * @return status of the widget ie: lowered = true, raised= false
1e2a5fdb152f (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: 8428
diff changeset
   764
 */
8491
804b3117cc36 (svn r11553) -Fix: make a few widget 'accessor' function const when they should be const.
rubidium
parents: 8489
diff changeset
   765
inline bool Window::IsWidgetLowered(byte widget_index) const
8489
1e2a5fdb152f (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: 8428
diff changeset
   766
{
1e2a5fdb152f (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: 8428
diff changeset
   767
	assert(widget_index < this->widget_count);
1e2a5fdb152f (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: 8428
diff changeset
   768
	return HasBit(this->widget[widget_index].display_flags, WIDG_LOWERED);
1e2a5fdb152f (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: 8428
diff changeset
   769
}
1e2a5fdb152f (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: 8428
diff changeset
   770
8602
9e75e594a068 (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: 8598
diff changeset
   771
#endif /* WINDOW_GUI_H */