src/window.h
author celestar
Wed, 13 Jun 2007 12:05:56 +0000
branchgamebalance
changeset 9912 1ac8aac92385
parent 9911 0b8b245a2391
permissions -rw-r--r--
(svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
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
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
     3
/** @file window.h regroups declarations for all windowing system, as well as a few helper functions */
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
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#ifndef WINDOW_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
#define WINDOW_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
     8
#include "macros.h"
4299
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
     9
#include "string.h"
4712
273ec3b182bf (svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents: 4695
diff changeset
    10
#include "order.h"
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    11
#include "rail.h"
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
    12
#include "road.h"
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    13
#include "airport.h"
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
    14
#include "vehicle.h"
4299
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
    15
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
    16
struct WindowEvent;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    17
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
typedef void WindowProc(Window *w, WindowEvent *e);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    20
/* 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
    21
    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
    22
     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
    23
     to resize itself.
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    24
    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
    25
     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
    26
     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
    27
     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
    28
     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
    29
     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
    30
    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
    31
     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
    32
     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
    33
     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
    34
     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
    35
   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
    36
    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
    37
    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
    38
    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
    39
      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
    40
    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
    41
   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
    42
    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
    43
    AFTER window-creation, with:
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    44
     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
    45
   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
    46
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
    47
enum ResizeFlag {
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    48
	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
    49
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    50
	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
    51
	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
    52
	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
    53
	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
    54
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    55
	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
    56
	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
    57
	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
    58
	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
    59
	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
    60
	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
    61
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
    62
	/* 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
    63
	 * 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
    64
	 * 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
    65
	 * 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
    66
	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
    67
	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
    68
	WIDG_LOWERED  = 6,  ///< widget is paint lowered, a pressed button in fact
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
    69
};
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    70
4755
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
    71
enum {
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
    72
	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
    73
};
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
    74
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
    75
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
    76
	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
    77
	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
    78
	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
    79
	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
    80
	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
    81
	StringID tooltips;                ///< Tooltips that are shown when rightclicking on a widget
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
    82
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
    84
enum FrameFlags {
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    85
	FR_NONE         = 0x00,
1938
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    86
	FR_TRANSPARENT  = 0x01,  ///< Makes the background transparent if set
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    87
	FR_BORDERONLY   = 0x10,  ///< Draw border only, no background
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    88
	FR_LOWERED      = 0x20,  ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed)
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    89
	FR_DARKENED     = 0x40,  ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes)
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
    90
};
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
    91
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    92
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
    93
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
    94
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
    95
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
    96
enum WindowEventCodes {
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
    97
	WE_CREATE,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
    98
	WE_DESTROY,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
    99
	WE_PAINT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   100
	WE_KEYPRESS,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   101
	WE_CLICK,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   102
	WE_RCLICK,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   103
	WE_MOUSEOVER,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   104
	WE_MOUSELOOP,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   105
	WE_MOUSEWHEEL,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   106
	WE_TICK,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   107
	WE_4,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   108
	WE_TIMEOUT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   109
	WE_PLACE_OBJ,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   110
	WE_ABORT_PLACE_OBJ,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   111
	WE_ON_EDIT_TEXT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   112
	WE_ON_EDIT_TEXT_CANCEL,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   113
	WE_POPUPMENU_SELECT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   114
	WE_POPUPMENU_OVER,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   115
	WE_DRAGDROP,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   116
	WE_PLACE_DRAG,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   117
	WE_PLACE_MOUSEUP,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   118
	WE_PLACE_PRESIZE,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   119
	WE_DROPDOWN_SELECT,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   120
	WE_RESIZE,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   121
	WE_MESSAGE,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   122
	WE_SCROLL,
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   123
	WE_INVALIDATE_DATA,
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   124
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   125
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   126
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
   127
	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
   128
	union {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   129
		struct{
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   130
			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
   131
			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
   132
		} click;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   133
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   134
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   135
			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
   136
			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
   137
			TileIndex starttile;
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   138
			byte select_method;
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   139
			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
   140
		} place;
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   141
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   142
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   143
			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
   144
			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
   145
		} 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
   146
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   147
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   148
			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
   149
			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
   150
		} 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
   151
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   152
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   153
			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
   154
		} edittext;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   155
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   156
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   157
			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
   158
		} popupmenu;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   159
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   160
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   161
			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
   162
			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
   163
		} dropdown;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   164
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   165
		struct {
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   166
			Point pt;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   167
			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
   168
		} mouseover;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   169
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   170
		struct {
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
   171
			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
   172
			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
   173
			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
   174
		} keypress;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   175
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   176
		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
   177
			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
   178
			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
   179
			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
   180
		} message;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   181
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   182
		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
   183
			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
   184
		} scroll;
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 {
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
   187
			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
   188
		} wheel;
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4547
diff changeset
   189
	} we;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   192
struct WindowDesc {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
	int16 left, top, width, height;
2788
db2896482939 (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2757
diff changeset
   194
	WindowClass cls;
db2896482939 (svn r3336) byte -> WindowClass, uint16 -> WindowNumber
tron
parents: 2757
diff changeset
   195
	WindowClass parent_cls;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
	uint32 flags;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
	const Widget *widgets;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
	WindowProc *proc;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   199
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   201
enum WindowDefaultFlag {
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
   202
	WDF_STD_TOOLTIPS    =   1, ///< use standard routine when displaying tooltips
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
   203
	WDF_DEF_WIDGET      =   2, ///< default widget control for some widgets in the on click event
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
	WDF_STD_BTN         =   4, ///< default handling for close and drag widgets (widget no 0 and 1)
2064
c889fcc76398 (svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents: 2021
diff changeset
   205
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
   206
	WDF_UNCLICK_BUTTONS =  16, ///< Unclick buttons when the window event times out */
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
   207
	WDF_STICKY_BUTTON   =  32, ///< Set window to sticky mode; they are not closed unless closed with 'X' (widget 2)
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
	WDF_RESIZABLE       =  64, ///< A window can be resized
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
   209
	WDF_MODAL           = 128, ///< 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
   210
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   211
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
/* can be used as x or y coordinates to cause a specific placement */
5664
dbbf4f842a00 (svn r7616) -Cleanup:
Darkvater
parents: 5268
diff changeset
   213
enum WindowDefaultPosition {
5072
df5bde83a4bc (svn r7130) -Codechange: Handle the positioning of windows through the desc->left/top settings with
Darkvater
parents: 5071
diff changeset
   214
	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
   215
	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
   216
	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
   217
	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
   218
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   220
struct Textbuf {
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
   221
	char *buf;                  ///< buffer in which text is saved
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
   222
	uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes
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
   223
	uint16 length, width;       ///< the current size of the string. Width specifies screensize in pixels, length is in bytes
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
   224
	bool caret;                 ///< is the caret ("_") visible or not
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
   225
	uint16 caretpos;            ///< the current position of the caret in the buffer, in bytes
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
   226
	uint16 caretxoffs;          ///< the current position of the caret in pixels
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   227
};
1390
53a5713cf3f9 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   228
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
#define WP(ptr,str) (*(str*)(ptr)->custom)
2906
18fa7bda750f (svn r3461) - Fix: Increase window-size as for 64-bit machines it wasn't enough
Darkvater
parents: 2888
diff changeset
   230
/* You cannot 100% reliably calculate the biggest custom struct as
18fa7bda750f (svn r3461) - Fix: Increase window-size as for 64-bit machines it wasn't enough
Darkvater
parents: 2888
diff changeset
   231
 * the number of pointers in it and alignment will have a huge impact.
4299
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   232
 * 96 is the largest window-size for 64-bit machines currently */
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   233
#define WINDOW_CUSTOM_SIZE 96
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   234
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   235
struct Scrollbar {
62
2bdd81b8adcc (svn r63) Fix: [ 1009385 ] Too many save games prevented loading
dominik
parents: 0
diff changeset
   236
	uint16 count, cap, pos;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   237
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   239
struct ResizeInfo {
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
   240
	uint width; ///< Minimum width and height
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   241
	uint height;
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
   242
	uint step_width; ///< In how big steps the width and height go
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   243
	uint step_height;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   244
};
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   245
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   246
struct WindowMessage {
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   247
	int msg;
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   248
	int wparam;
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   249
	int lparam;
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   250
};
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   251
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   252
struct Window {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
	uint16 flags4;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   254
	WindowClass window_class;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   255
	WindowNumber window_number;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   256
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   257
	int left, top;
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   258
	int width, height;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   260
	Scrollbar hscroll, vscroll, vscroll2;
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   261
	ResizeInfo resize;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   262
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
	byte caption_color;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   264
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   265
	WindowProc *wndproc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   266
	ViewPort *viewport;
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   267
	const Widget *original_widget;
4077
d3022f976946 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 3812
diff changeset
   268
	Widget *widget;
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   269
	uint widget_count;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   270
	uint32 desc_flags;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   271
2622
1219c6a5bef3 (svn r3162) -Fix: renamed 'Message' to 'WindowMessage', a struct named 'Message' already
truelight
parents: 2596
diff changeset
   272
	WindowMessage message;
5666
1af12f02bf17 (svn r7618) -Feature: Add support for a parent<>child relationship in Window terms. A child
Darkvater
parents: 5664
diff changeset
   273
	Window *parent;
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   274
	byte custom[WINDOW_CUSTOM_SIZE];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   275
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   276
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   277
struct querystr_d {
4299
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   278
	StringID caption;
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   279
	Textbuf text;
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   280
	const char *orig;
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   281
	CharSetFilter afilter;
5682
eeddbbacd4ac (svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents: 5669
diff changeset
   282
	bool handled;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   283
};
4299
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   284
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d));
b86602eaaff1 (svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents: 4266
diff changeset
   285
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   286
struct chatquerystr_d : public querystr_d {
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   287
	int dest;
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   288
};
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   289
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(chatquerystr_d));
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   290
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   291
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
   292
	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
   293
	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
   294
	byte main_button;     ///< scrollpos_y
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   295
	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
   296
	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
   297
	uint16 checked_items; ///< unk32
2216
51a715447fc4 (svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents: 2187
diff changeset
   298
	byte disabled_items;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   299
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   300
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   301
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   302
struct def_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   303
	int16 data_1, data_2, data_3;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   304
	int16 data_4, data_5;
2596
d228e8ce6fcf (svn r3133) - static, const
tron
parents: 2549
diff changeset
   305
	bool close;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   306
	byte byte_1;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   307
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   308
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   309
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   310
struct void_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   311
	void *data;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   312
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   313
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   314
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   315
struct tree_d {
2596
d228e8ce6fcf (svn r3133) - static, const
tron
parents: 2549
diff changeset
   316
	uint16 base;
d228e8ce6fcf (svn r3133) - static, const
tron
parents: 2549
diff changeset
   317
	uint16 count;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   318
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   319
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   320
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   321
struct tooltips_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   322
	StringID string_id;
4834
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   323
	byte paramcount;
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   324
	uint32 params[5];
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   325
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   326
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   328
struct buildvehicle_d {
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   329
	VehicleType vehicle_type;
5187
d1f4e447a7eb (svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents: 5124
diff changeset
   330
	union {
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   331
		RailTypeByte railtype;
6350
c644e180cdf8 (svn r8747) -Fix
tron
parents: 6224
diff changeset
   332
		AirportFTAClass::Flags flags;
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   333
		RoadTypes roadtypes;
5187
d1f4e447a7eb (svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents: 5124
diff changeset
   334
	} filter;
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
   335
	byte sel_index;  ///< deprecated value, used for 'unified' ship and road
5187
d1f4e447a7eb (svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents: 5124
diff changeset
   336
	bool descending_sort_order;
4770
987ef30e5b45 (svn r6684) -Feature: [train build window] added sorting options for the engines
bjarni
parents: 4766
diff changeset
   337
	byte sort_criteria;
6032
cc75c53d40e9 (svn r8333) -Codechange: when invalidating a build window list, set a flag instead of rebuilding the list and then rebuild it the next time it's redrawn
bjarni
parents: 5838
diff changeset
   338
	bool regenerate_list;
2498
befad2fe53d2 (svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents: 2448
diff changeset
   339
	EngineID sel_engine;
befad2fe53d2 (svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents: 2448
diff changeset
   340
	EngineID rename_engine;
5187
d1f4e447a7eb (svn r7299) -CodeChange: Train and Aircraft Build window GUI code simplified a bit:
KUDr
parents: 5124
diff changeset
   341
	EngineList eng_list;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   342
};
4790
04df6a3f9b31 (svn r6712) -Code cleanup: renamed buildtrain_d to buildvehicle_d as it's used for all vehicle types
bjarni
parents: 4786
diff changeset
   343
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildvehicle_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   344
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   345
struct replaceveh_d {
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   346
	byte sel_index[2];
2746
d96ce2fdc3e4 (svn r3291) - Codechange, Autoreplace: Replace int with EngineID and -1 with INVALID_ENGINE, as appropriate.
peter1138
parents: 2683
diff changeset
   347
	EngineID sel_engine[2];
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   348
	uint16 count[2];
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
   349
	bool wagon_btnstate; ///< true means engine is selected
6195
b90cf92697b9 (svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents: 6075
diff changeset
   350
	EngineList list[2];
b90cf92697b9 (svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents: 6075
diff changeset
   351
	bool update_left;
b90cf92697b9 (svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents: 6075
diff changeset
   352
	bool update_right;
b90cf92697b9 (svn r8610) -Codechange/Feature: rewrote the list handling in the autoreplace window
bjarni
parents: 6075
diff changeset
   353
	bool init_lists;
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   354
	GroupID sel_group;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   355
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   356
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d));
842
ebfd36603ab9 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   357
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   358
struct depot_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   359
	VehicleID sel;
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   360
	VehicleType type;
4739
bd535b408617 (svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
bjarni
parents: 4730
diff changeset
   361
	bool generate_list;
4635
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   362
	uint16 engine_list_length;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   363
	uint16 wagon_list_length;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   364
	uint16 engine_count;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   365
	uint16 wagon_count;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   366
	Vehicle **vehicle_list;
b9fb2f19eb64 (svn r6503) -Codechange: added a function to tell what vehicles a depot contains
bjarni
parents: 4634
diff changeset
   367
	Vehicle **wagon_list;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   368
};
4638
8abe4f10b94b (svn r6513) -Codechange: unified the code to draw depot windows
bjarni
parents: 4635
diff changeset
   369
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(depot_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   370
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   371
struct order_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   372
	int sel;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   373
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   374
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   375
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   376
struct traindetails_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   377
	byte tab;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   378
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   379
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   380
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   381
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
   382
	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
   383
	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
   384
	int32 subscroll;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   385
};
4318
fe085a1dd0ad (svn r5971) -Fix: wrong struct in assert_compile (thomasdev)
truelight
parents: 4300
diff changeset
   386
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   387
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   388
struct facesel_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   389
	uint32 face;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   390
	byte gender;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   391
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   392
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   393
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   394
struct refit_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   395
	int sel;
4695
52419a88345d (svn r6602) - Feature: we now support NewGRF livery refits, as used by DBsetXL, amongst others. This requires a savegame bump to save the cargo subtype.
peter1138
parents: 4694
diff changeset
   396
	struct RefitOption *cargo;
4694
a4d2a3abe75c (svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch)
peter1138
parents: 4692
diff changeset
   397
	struct RefitList *list;
a4d2a3abe75c (svn r6601) - Codechange: Support cargo subtypes in the refit window. The refit window has been altered to support resizing and scrolling. Note that the cargo subtype isn't yet passed for actual refitting yet. (Based on mart3p's patch)
peter1138
parents: 4692
diff changeset
   398
	uint length;
4712
273ec3b182bf (svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents: 4695
diff changeset
   399
	VehicleOrderID order;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   400
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   401
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   402
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   403
struct vp_d {
2116
cdfc27b696b7 (svn r2626) static, const, misc.
tron
parents: 2064
diff changeset
   404
	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
   405
	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
   406
	int32 scrollpos_y;
9912
1ac8aac92385 (svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
celestar
parents: 9911
diff changeset
   407
	int32 dest_scrollpos_x;
1ac8aac92385 (svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
celestar
parents: 9911
diff changeset
   408
	int32 dest_scrollpos_y;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   409
};
5123
9eb435a37492 (svn r7203) -Cleanup: Donnu what Miham was smoking there, but removed it (assert_compile + 3)
Darkvater
parents: 5120
diff changeset
   410
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d));
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   411
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
   412
/* vp2_d is the same as vp_d, except for the data_# values.. */
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   413
struct vp2_d {
5123
9eb435a37492 (svn r7203) -Cleanup: Donnu what Miham was smoking there, but removed it (assert_compile + 3)
Darkvater
parents: 5120
diff changeset
   414
	VehicleID follow_vehicle;
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   415
	int32 scrollpos_x;
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   416
	int32 scrollpos_y;
9912
1ac8aac92385 (svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
celestar
parents: 9911
diff changeset
   417
	int32 dest_scrollpos_x;
1ac8aac92385 (svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
celestar
parents: 9911
diff changeset
   418
	int32 dest_scrollpos_y;
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   419
	byte data_1;
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   420
	byte data_2;
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   421
	byte data_3;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   422
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   423
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   424
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   425
struct news_d {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   426
	uint16 follow_vehicle;
849
c6223dbdb202 (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   427
	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
   428
	int32 scrollpos_y;
9912
1ac8aac92385 (svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
celestar
parents: 9911
diff changeset
   429
	int32 dest_scrollpos_x;
1ac8aac92385 (svn r10136) [gamebalance] -Sync: r9900:10100 from trunk
celestar
parents: 9911
diff changeset
   430
	int32 dest_scrollpos_y;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   431
	NewsItem *ni;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   432
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   433
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   434
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   435
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
   436
	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
   437
	int8 rank;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   438
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   439
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
   440
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   441
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
   442
	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
   443
	uint16 counter;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   444
};
1004
edbdc62fbf24 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   445
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
   446
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   447
enum SortListFlags {
6505
abcb0580d976 (svn r8950) -Cleanup: doxygen changes. Mostly @files missing tags and a few comments style.
belugas
parents: 6443
diff changeset
   448
	VL_NONE    = 0x00,  ///< no sort
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
   449
	VL_DESC    = 0x01,  ///< sort descending or ascending
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
	VL_RESORT  = 0x02,  ///< instruct the code to resort the list in the next loop
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
   451
	VL_REBUILD = 0x04,  ///< create sort-listing to use for qsort and friends
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   452
	VL_END     = 0x08
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   453
};
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   454
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
   455
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
   456
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   457
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
   458
	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
   459
	byte criteria; ///< Sorting criteria
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   460
};
588
1b60458bdc29 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   461
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   462
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
   463
	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
   464
	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
   465
	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
   466
	uint16 resort_timer; ///< resort list after a given amount of ticks if set
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   467
};
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   468
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
   469
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   470
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
   471
	int msg;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   472
	int wparam;
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   473
	int lparam;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   474
};
1648
747061dca705 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   475
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
   476
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   477
struct dropdown_d {
2683
6f67fcf73873 (svn r3225) - Fix for "[ 1359165 ] Autoreplace problem with r3171 and later" -- Move the disabled/hidden bits to custom data in window struct.
peter1138
parents: 2636
diff changeset
   478
	uint32 disabled_state;
6f67fcf73873 (svn r3225) - Fix for "[ 1359165 ] Autoreplace problem with r3171 and later" -- Move the disabled/hidden bits to custom data in window struct.
peter1138
parents: 2636
diff changeset
   479
	uint32 hidden_state;
2636
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   480
	WindowClass parent_wnd_class;
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   481
	WindowNumber parent_wnd_num;
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   482
	byte parent_button;
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   483
	byte num_items;
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   484
	byte selected_index;
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   485
	const StringID *items;
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   486
	byte click_delay;
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   487
	bool drag_mode;
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   488
};
2636
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   489
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(dropdown_d));
e2bfdc3e82b6 (svn r3178) - Codechange: move static _dropdown_* vars into the window custom data, giving var1 and var2 more meaningful names.
peter1138
parents: 2634
diff changeset
   490
9911
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   491
struct vehiclelist_d {
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   492
	const Vehicle** sort_list;  // List of vehicles (sorted)
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   493
	Listing *_sorting;          // pointer to the appropiate subcategory of _sorting
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   494
	uint16 length_of_sort_list; // Keeps track of how many vehicle pointers sort list got space for
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   495
	VehicleType vehicle_type;   // The vehicle type that is sorted
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   496
	list_d l;                   // General list struct
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   497
};
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   498
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d));
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   499
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   500
struct grouplist_d {
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   501
	const Group **sort_list;
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   502
	list_d l;                   // General list struct
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   503
};
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   504
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(grouplist_d));
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   505
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   506
struct groupveh_d : vehiclelist_d {
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   507
	GroupID group_sel;
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   508
	VehicleID vehicle_sel;
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   509
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   510
	grouplist_d gl;
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   511
};
0b8b245a2391 (svn r10135) [gamebalance] -Sync: r9700:9900 from trunk
celestar
parents: 9908
diff changeset
   512
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(groupveh_d));
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
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   515
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
   516
	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
   517
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4884
diff changeset
   518
	WWB_MASK        = 0xE0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   519
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   520
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   521
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   522
enum WindowWidgetTypes {
4939
ede0f6777b3c (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents: 4938
diff changeset
   523
	WWT_EMPTY,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   524
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
   525
	WWT_PANEL,      ///< simple depressed panel
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
   526
	WWT_INSET,      ///< pressed (inset) panel, most commonly used as combo box _text_ area
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
   527
	WWT_IMGBTN,     ///< button with image
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
   528
	WWT_IMGBTN_2,   ///< button with diff image when clicked
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4884
diff changeset
   529
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
   530
	WWT_TEXTBTN,    ///< button with text
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
   531
	WWT_TEXTBTN_2,  ///< button with diff text when clicked
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
   532
	WWT_LABEL,      ///< centered label
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   533
	WWT_TEXT,       ///< pure simple text
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
   534
	WWT_MATRIX,
ede0f6777b3c (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents: 4938
diff changeset
   535
	WWT_SCROLLBAR,
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
   536
	WWT_FRAME,      ///< frame
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
   537
	WWT_CAPTION,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   538
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
   539
	WWT_HSCROLLBAR,
ede0f6777b3c (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents: 4938
diff changeset
   540
	WWT_STICKYBOX,
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
   541
	WWT_SCROLL2BAR, ///< 2nd vertical scrollbar
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
   542
	WWT_RESIZEBOX,
ede0f6777b3c (svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents: 4938
diff changeset
   543
	WWT_CLOSEBOX,
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
   544
	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
   545
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
   546
	WWT_MASK = 0x1F,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   547
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4884
diff changeset
   548
	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
   549
	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
   550
	WWT_PUSHIMGBTN  = WWT_IMGBTN  | WWB_PUSHBUTTON,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   551
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   552
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   553
#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
   554
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   555
enum WindowFlags {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   556
	WF_TIMEOUT_SHL       = 0,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   557
	WF_TIMEOUT_MASK      = 7,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   558
	WF_DRAGGING          = 1 <<  3,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   559
	WF_SCROLL_UP         = 1 <<  4,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   560
	WF_SCROLL_DOWN       = 1 <<  5,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   561
	WF_SCROLL_MIDDLE     = 1 <<  6,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   562
	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
   563
	WF_SIZING            = 1 <<  8,
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4337
diff changeset
   564
	WF_STICKY            = 1 <<  9,
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   565
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   566
	WF_DISABLE_VP_SCROLL = 1 << 10,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   567
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
   568
	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
   569
	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
   570
	WF_SCROLL2           = 1 << 13,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   571
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   572
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
   573
/* window.cpp */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   574
void CallWindowEventNP(Window *w, int event);
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   575
void CallWindowTickEvent();
4171
3fadda3afe70 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
   576
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
   577
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
   578
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
   579
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   580
Window *FindWindowById(WindowClass cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   581
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
   582
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
   583
void ChangeWindowOwner(PlayerID old_player, PlayerID new_player);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   584
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   585
Window *FindWindowFromPt(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   586
4171
3fadda3afe70 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
   587
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
   588
void AssignWidgetToWindow(Window *w, const Widget *widget);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   589
Window *AllocateWindow(
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   590
							int x,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   591
							int y,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   592
							int width,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   593
							int height,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   594
							WindowProc *proc,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   595
							WindowClass cls,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   596
							const Widget *widget);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   597
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   598
Window *AllocateWindowDesc(const WindowDesc *desc);
4520
d5f94a18a68c (svn r6345) -Codechange: AllocateWindowDescFront() now ensures that window_number is set before calling the WE_CREATE event
bjarni
parents: 4438
diff changeset
   599
Window *AllocateWindowDescFront(const WindowDesc *desc, int window_number);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   600
5120
e12dfc67761f (svn r7200) -Codechange: remove unneeded redraw (console.c), coding style, use FindWindowById
Darkvater
parents: 5108
diff changeset
   601
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
   602
void ResizeWindow(Window *w, int x, int y);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   603
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   604
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   605
 * Sets the enabled/disabled status of a widget.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   606
 * By default, widgets are enabled.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   607
 * On certain conditions, they have to be disabled.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   608
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   609
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   610
 * @param disab_stat : status to use ie: disabled = true, enabled = false
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   611
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   612
static inline void SetWindowWidgetDisabledState(Window *w, byte widget_index, bool disab_stat)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   613
{
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   614
	assert(widget_index < w->widget_count);
4749
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
   615
	SB(w->widget[widget_index].display_flags, WIDG_DISABLED, 1, !!disab_stat);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   616
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   617
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   618
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   619
 * Sets a widget to disabled.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   620
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   621
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   622
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   623
static inline void DisableWindowWidget(Window *w, byte widget_index)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   624
{
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   625
	SetWindowWidgetDisabledState(w, widget_index, true);
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   626
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   627
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   628
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   629
 * Sets a widget to Enabled.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   630
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   631
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   632
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   633
static inline void EnableWindowWidget(Window *w, byte widget_index)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   634
{
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   635
	SetWindowWidgetDisabledState(w, widget_index, false);
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   636
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   637
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   638
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   639
 * Gets the enabled/disabled status of a widget.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   640
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   641
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   642
 * @return status of the widget ie: disabled = true, enabled = false
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   643
 */
5233
3ff623971cd1 (svn r7353) -Codechange: constify Window* in IsWindowWidget(Lowered|Hidden|Disabled)
rubidium
parents: 5232
diff changeset
   644
static inline bool IsWindowWidgetDisabled(const Window *w, byte widget_index)
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   645
{
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   646
	assert(widget_index < w->widget_count);
5236
e959e132a78e (svn r7356) -Codechange: replace 'for (i = 0, wi = w->widget; wi->type != WWT_LAST; i++, wi++)' type for loops with 'for (i = 0; i < w->window_count; i++) { wi = &w->widget[i];'-type for loops for better readability.
rubidium
parents: 5233
diff changeset
   647
	return HASBIT(w->widget[widget_index].display_flags, WIDG_DISABLED);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   648
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   649
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   650
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   651
 * Sets the hidden/shown status of a widget.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   652
 * By default, widgets are visible.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   653
 * On certain conditions, they have to be hidden.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   654
 * @param w Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   655
 * @param widget_index index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   656
 * @param hidden_stat status to use ie. hidden = true, visible = false
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   657
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   658
static inline void SetWindowWidgetHiddenState(Window *w, byte widget_index, bool hidden_stat)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   659
{
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   660
	assert(widget_index < w->widget_count);
4749
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
   661
	SB(w->widget[widget_index].display_flags, WIDG_HIDDEN, 1, !!hidden_stat);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   662
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   663
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   664
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   665
 * Sets a widget hidden.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   666
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   667
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   668
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   669
static inline void HideWindowWidget(Window *w, byte widget_index)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   670
{
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   671
	SetWindowWidgetHiddenState(w, widget_index, true);
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   672
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   673
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   674
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   675
 * Sets a widget visible.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   676
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   677
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   678
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   679
static inline void ShowWindowWidget(Window *w, byte widget_index)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   680
{
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   681
	SetWindowWidgetHiddenState(w, widget_index, false);
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   682
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   683
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   684
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   685
 * Gets the visibility of a widget.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   686
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   687
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   688
 * @return status of the widget ie: hidden = true, visible = false
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   689
 */
5233
3ff623971cd1 (svn r7353) -Codechange: constify Window* in IsWindowWidget(Lowered|Hidden|Disabled)
rubidium
parents: 5232
diff changeset
   690
static inline bool IsWindowWidgetHidden(const Window *w, byte widget_index)
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   691
{
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   692
	assert(widget_index < w->widget_count);
5236
e959e132a78e (svn r7356) -Codechange: replace 'for (i = 0, wi = w->widget; wi->type != WWT_LAST; i++, wi++)' type for loops with 'for (i = 0; i < w->window_count; i++) { wi = &w->widget[i];'-type for loops for better readability.
rubidium
parents: 5233
diff changeset
   693
	return HASBIT(w->widget[widget_index].display_flags, WIDG_HIDDEN);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   694
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   695
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   696
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   697
 * Sets the lowered/raised status of a widget.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   698
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   699
 * @param widget_index : index of this widget in the window
9908
0fa543611bbe (svn r10112) [gamebalance] -Sync: r9520:9620 from trunk
celestar
parents: 9895
diff changeset
   700
 * @param lowered_stat : status to use ie: lowered = true, raised = false
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   701
 */
4727
ba5bae41b004 (svn r6639) -CodeChange : Conversion of SetWidgetLoweredState to SetWindowWidgetLoweredState, in order to follow pre-established standard
belugas
parents: 4719
diff changeset
   702
static inline void SetWindowWidgetLoweredState(Window *w, byte widget_index, bool lowered_stat)
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   703
{
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   704
	assert(widget_index < w->widget_count);
4749
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
   705
	SB(w->widget[widget_index].display_flags, WIDG_LOWERED, 1, !!lowered_stat);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   706
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   707
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   708
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   709
 * Invert the lowered/raised  status of a widget.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   710
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   711
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   712
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   713
static inline void ToggleWidgetLoweredState(Window *w, byte widget_index)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   714
{
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   715
	assert(widget_index < w->widget_count);
4749
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
   716
	TOGGLEBIT(w->widget[widget_index].display_flags, WIDG_LOWERED);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   717
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   718
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   719
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   720
 * Marks a widget as lowered.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   721
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   722
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   723
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   724
static inline void LowerWindowWidget(Window *w, byte widget_index)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   725
{
4730
6e942e2164ba (svn r6642) -Fix r6639: 2 conversions missed
glx
parents: 4727
diff changeset
   726
	SetWindowWidgetLoweredState(w, widget_index, true);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   727
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   728
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   729
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   730
 * Marks a widget as raised.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   731
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   732
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   733
 */
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   734
static inline void RaiseWindowWidget(Window *w, byte widget_index)
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   735
{
4730
6e942e2164ba (svn r6642) -Fix r6639: 2 conversions missed
glx
parents: 4727
diff changeset
   736
	SetWindowWidgetLoweredState(w, widget_index, false);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   737
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   738
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   739
/**
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   740
 * Gets the lowered state of a widget.
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   741
 * @param w : Window on which the widget is located
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   742
 * @param widget_index : index of this widget in the window
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   743
 * @return status of the widget ie: lowered = true, raised= false
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   744
 */
5233
3ff623971cd1 (svn r7353) -Codechange: constify Window* in IsWindowWidget(Lowered|Hidden|Disabled)
rubidium
parents: 5232
diff changeset
   745
static inline bool IsWindowWidgetLowered(const Window *w, byte widget_index)
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   746
{
5232
0ba6acdc527f (svn r7352) -Codechange: add widget_count parameter to the window.
rubidium
parents: 5199
diff changeset
   747
	assert(widget_index < w->widget_count);
4749
9490e643f23f (svn r6661) Feature: Windows are not restricted to 32 widget items anymore.
belugas
parents: 4739
diff changeset
   748
	return HASBIT(w->widget[widget_index].display_flags, WIDG_LOWERED);
4692
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   749
}
fdccb9b2dbcd (svn r6599) -Codechange: Add accessors around the members click/disabled/hidden_state of Window
belugas
parents: 4638
diff changeset
   750
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   751
void InitWindowSystem();
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   752
void UnInitWindowSystem();
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   753
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
   754
int GetMenuItemIndex(const Window *w, int x, int y);
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   755
void InputLoop();
4171
3fadda3afe70 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
   756
void InvalidateWidget(const Window *w, byte widget_index);
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
   757
void InvalidateThisWindowData(Window *w);
4739
bd535b408617 (svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
bjarni
parents: 4730
diff changeset
   758
void InvalidateWindowData(WindowClass cls, WindowNumber number);
4719
413b21513ef7 (svn r6631) -Codechange: Use accessors for click_state.
belugas
parents: 4712
diff changeset
   759
void RaiseWindowButtons(Window *w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   760
void RelocateAllWindows(int neww, int newh);
380
03dd36311cc1 (svn r569) Fix type mismatch
tron
parents: 176
diff changeset
   761
int PositionMainToolbar(Window *w);
4755
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
   762
void CDECL SetWindowWidgetsDisabledState(Window *w, bool disab_stat, int widgets, ...);
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
   763
void CDECL SetWindowWidgetsHiddenState(Window *w, bool hidden_stat, int widgets, ...);
4a3564952554 (svn r6669) -Add: vararg functions to set hidden/disabled/lowered state of multiple widgets in one call
glx
parents: 4749
diff changeset
   764
void CDECL SetWindowWidgetsLoweredState(Window *w, bool lowered_stat, int widgets, ...);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   765
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
   766
/* misc_gui.cpp */
4884
895f06b87934 (svn r6821) -Codechange: For the measurement tool do not show the tooltip when the selection
Darkvater
parents: 4834
diff changeset
   767
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint params[]);
4834
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   768
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
   769
{
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   770
	GuiShowTooltipsWithArgs(str, 0, NULL);
ddcf440d0ffd (svn r6758) -Feature: Add a measurement tool that will show dimensions and height
Darkvater
parents: 4800
diff changeset
   771
}
4719
413b21513ef7 (svn r6631) -Codechange: Use accessors for click_state.
belugas
parents: 4712
diff changeset
   772
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
   773
/* 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
   774
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
   775
void DrawWindowWidgets(const Window *w);
2448
0a34e90cb31f (svn r2974) -Fix: Drag and drop selection on drop down boxes didn't select correct item when some items were hidden.
peter1138
parents: 2436
diff changeset
   776
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   777
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   778
void HandleButtonClick(Window *w, byte widget);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   779
9895
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   780
Window *GetCallbackWnd();
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   781
void DeleteNonVitalWindows();
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   782
void DeleteAllNonVitalWindows();
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   783
void HideVitalWindows();
7bd07f43b0e3 (svn r9321) [gamebalance] -Sync: r9025:9314 from trunk
celestar
parents: 6505
diff changeset
   784
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
   785
Window **FindWindowZPosition(const Window *w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   786
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
   787
/* 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
   788
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
   789
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
   790
#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
   791
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   792
VARDEF Point _cursorpos_drag_start;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   793
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   794
VARDEF int _scrollbar_start_pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   795
VARDEF int _scrollbar_size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   796
VARDEF byte _scroller_click_timeout;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   797
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   798
VARDEF bool _scrolling_scrollbar;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   799
VARDEF bool _scrolling_viewport;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   800
VARDEF bool _popup_menu_active;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   801
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   802
VARDEF byte _special_mouse_mode;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   803
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
   804
	WSM_NONE     = 0,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   805
	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
   806
	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
   807
	WSM_PRESIZE  = 3,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   808
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   809
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   810
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
   811
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
   812
/** Evenly distribute some widgets when resizing horizontally (often a button row)
6075
33cdb35f9af5 (svn r8390) -Codechange (r8384): Rewrote ResizeButtons()
bjarni
parents: 6073
diff changeset
   813
 *  The widgets are presumed to be in a line and numberef from left to right (without gaps)
6073
d8dae377c879 (svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents: 6032
diff changeset
   814
 * @param w widow to modify
d8dae377c879 (svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents: 6032
diff changeset
   815
 * @param left The leftmost widget to resize
6075
33cdb35f9af5 (svn r8390) -Codechange (r8384): Rewrote ResizeButtons()
bjarni
parents: 6073
diff changeset
   816
 * @param right The rightmost widget to resize. Since right side of it is used, remember to set it to RESIZE_RIGHT
6073
d8dae377c879 (svn r8384) -Codechange: [GUI] instead of writing a resize button function for each window, a global ResizeButtons() is added
bjarni
parents: 6032
diff changeset
   817
 */
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
   818
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
   819
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   820
#endif /* WINDOW_H */