window.h
author tron
Fri, 14 Oct 2005 07:59:16 +0000
changeset 2512 a66b16c61a69
parent 2498 3ed05caa4449
child 2549 5587f9a38563
permissions -rw-r--r--
(svn r3038) Reorder the loading of standard graphics files to reflect a bit where in the sprite array the sprites end up and assert, that the indices are equal to the corresponding sprite base enums, to guard against typos.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#ifndef WINDOW_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     4
#define WINDOW_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
typedef union WindowEvent WindowEvent;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
//typedef void WindowProc(Window *w, int event, int wparam, long lparam);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
typedef void WindowProc(Window *w, WindowEvent *e);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    12
/* How the resize system works:
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    13
    First, you need to add a WWT_RESIZEBOX to the widgets, and you need
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    14
     to add the flag WDF_RESIZABLE to the window. Now the window is ready
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    15
     to resize itself.
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    16
    As you may have noticed, all widgets have a RESIZE_XXX in their line.
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    17
     This lines controls how the widgets behave on resize. RESIZE_NONE means
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    18
     it doesn't do anything. Any other option let's one of the borders
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    19
     move with the changed width/height. So if a widget has
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    20
     RESIZE_RIGHT, and the window is made 5 pixels wider by the user,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    21
     the right of the window will also be made 5 pixels wider.
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    22
    Now, what if you want to clamp a widget to the bottom? Give it the flag
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    23
     RESIZE_TB. This is RESIZE_TOP + RESIZE_BOTTOM. Now if the window gets
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    24
     5 pixels bigger, both the top and bottom gets 5 bigger, so the whole
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    25
     widgets moves downwards without resizing, and appears to be clamped
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    26
     to the bottom. Nice aint it?
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    27
   You should know one more thing about this system. Most windows can't
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    28
    handle an increase of 1 pixel. So there is a step function, which
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    29
    let the windowsize only be changed by X pixels. You configure this
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    30
    after making the window, like this:
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    31
      w->resize.step_height = 10;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    32
    Now the window will only change in height in steps of 10.
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    33
   You can also give a minimum width and height. The default value is
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    34
    the default height/width of the window itself. You can change this
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    35
    AFTER window-creation, with:
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    36
     w->resize.width or w->resize.height.
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    37
   That was all.. good luck, and enjoy :) -- TrueLight */
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    38
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    39
enum {
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    40
	RESIZE_NONE   = 0,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    41
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    42
	RESIZE_LEFT   = 1,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    43
	RESIZE_RIGHT  = 2,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    44
	RESIZE_TOP    = 4,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    45
	RESIZE_BOTTOM = 8,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    46
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    47
	RESIZE_LR     = RESIZE_LEFT  | RESIZE_RIGHT,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    48
	RESIZE_RB     = RESIZE_RIGHT | RESIZE_BOTTOM,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    49
	RESIZE_TB     = RESIZE_TOP   | RESIZE_BOTTOM,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    50
	RESIZE_LRB    = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_BOTTOM,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    51
	RESIZE_LRTB   = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_TOP | RESIZE_BOTTOM,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    52
	RESIZE_RTB    = RESIZE_RIGHT | RESIZE_TOP    | RESIZE_BOTTOM,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    53
};
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    54
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
typedef struct Widget {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
	byte type;
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
    57
	byte resize_flag;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
	byte color;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
	uint16 left, right, top, bottom;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
	uint16 unkA;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
	uint16 tooltips;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
} Widget;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
1938
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    64
enum FrameFlags {
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    65
	FR_TRANSPARENT  = 0x01,  ///< Makes the background transparent if set
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    66
	FR_NOBORDER     = 0x08,  ///< Hide border (draws just a solid box)
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    67
	FR_BORDERONLY   = 0x10,  ///< Draw border only, no background
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    68
	FR_LOWERED      = 0x20,  ///< If set the frame is lowered and the background color brighter (ie. buttons when pressed)
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    69
	FR_DARKENED     = 0x40,  ///< If set the background is darker, allows for lowered frames with normal background color when used with FR_LOWERED (ie. dropdown boxes)
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    70
};
70baf462aff1 (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1648
diff changeset
    71
1648
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
    72
/* XXX - outside "byte event" so you can set event directly without going into
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
    73
 * the union elements at first. Because of this every first element of the union
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
    74
 * MUST BE 'byte event'. Whoever did this must get shot! Scheduled for immediate
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
    75
 * rewrite after 0.4.0 */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
union WindowEvent {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
	byte event;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
	struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
		byte event;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
		Point pt;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
		int widget;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
	} click;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
	struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
		byte event;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
		Point pt;
1977
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1938
diff changeset
    87
		TileIndex tile;
37bbebf94434 (svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents: 1938
diff changeset
    88
		TileIndex starttile;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
		int userdata;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    90
	} place;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    91
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
	struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
		byte event;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    94
		Point pt;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    95
		int widget;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    96
	} dragdrop;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
	struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    99
		byte event;
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   100
		Point size;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   101
		Point diff;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   102
	} sizing;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   103
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   104
	struct {
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   105
		byte event;
1323
bac2e38e8b60 (svn r1827) Next iteration of the byte -> char transition: some string drawing functions and buffers
tron
parents: 1178
diff changeset
   106
		char *str;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   107
	} edittext;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   108
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   109
	struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   110
		byte event;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   111
		Point pt;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   112
	} popupmenu;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   113
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   114
	struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   115
		byte event;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   116
		int button;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   117
		int index;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
	} dropdown;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   119
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   120
	struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   121
		byte event;
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   122
		Point pt;
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   123
		int widget;
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   124
	} mouseover;
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   125
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   126
	struct {
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   127
		byte event;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   128
		bool cont;   // continue the search? (default true)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
		byte ascii;  // 8-bit ASCII-value of the key
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   130
		uint16 keycode;// untranslated key (including shift-state)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
	} keypress;
1648
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   132
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   133
	struct {
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   134
		byte event;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   135
		uint msg;    // message to be sent
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   136
		uint wparam; // additional message-specific information
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   137
		uint lparam; // additional message-specific information
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   138
	} message;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   141
enum WindowKeyCodes {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
	WKC_SHIFT = 0x8000,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
	WKC_CTRL  = 0x4000,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   144
	WKC_ALT   = 0x2000,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   145
	WKC_META  = 0x1000,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   146
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
	// Special ones
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
	WKC_NONE = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
	WKC_ESC=1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
	WKC_BACKSPACE = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
	WKC_INSERT = 3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   152
	WKC_DELETE = 4,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
	WKC_PAGEUP = 5,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   155
	WKC_PAGEDOWN = 6,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
	WKC_END = 7,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
	WKC_HOME = 8,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
	// Arrow keys
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
	WKC_LEFT = 9,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
	WKC_UP = 10,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
	WKC_RIGHT = 11,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
	WKC_DOWN = 12,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
	// Return & tab
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   166
	WKC_RETURN = 13,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   167
	WKC_TAB = 14,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   168
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
	// Numerical keyboard
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
	WKC_NUM_0 = 16,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
	WKC_NUM_1 = 17,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
	WKC_NUM_2 = 18,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
	WKC_NUM_3 = 19,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
	WKC_NUM_4 = 20,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
	WKC_NUM_5 = 21,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
	WKC_NUM_6 = 22,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
	WKC_NUM_7 = 23,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
	WKC_NUM_8 = 24,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
	WKC_NUM_9 = 25,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
	WKC_NUM_DIV = 26,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
	WKC_NUM_MUL = 27,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
	WKC_NUM_MINUS = 28,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
	WKC_NUM_PLUS = 29,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   184
	WKC_NUM_ENTER = 30,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
	WKC_NUM_DECIMAL = 31,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   187
	// Space
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   188
	WKC_SPACE = 32,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   189
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
	// Function keys
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
	WKC_F1 = 33,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   192
	WKC_F2 = 34,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
	WKC_F3 = 35,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
	WKC_F4 = 36,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
	WKC_F5 = 37,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   196
	WKC_F6 = 38,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
	WKC_F7 = 39,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   198
	WKC_F8 = 40,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   199
	WKC_F9 = 41,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   200
	WKC_F10 = 42,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   201
	WKC_F11 = 43,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
	WKC_F12 = 44,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
129
df1a60bc0d70 (svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents: 116
diff changeset
   204
	// backquote is the key left of "1"
df1a60bc0d70 (svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents: 116
diff changeset
   205
	// we only store this key here, no matter what character is really mapped to it
df1a60bc0d70 (svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents: 116
diff changeset
   206
	// on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °)
df1a60bc0d70 (svn r130) Change: hotkey for console is Backquote (the key left to '1', regardless of keyboard layout
dominik
parents: 116
diff changeset
   207
	WKC_BACKQUOTE = 45,
424
a3095d8c1c6a (svn r623) -Feature: [ 1066504 ] Pause key pauses the game
tron
parents: 380
diff changeset
   208
	WKC_PAUSE     = 46,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   209
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
	// 0-9 are mapped to 48-57
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   211
	// A-Z are mapped to 65-90
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
	// a-z are mapped to 97-122
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   213
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   214
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   215
	//WKC_UNKNOWN = 0xFF,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   216
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
};
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
typedef struct WindowDesc {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   220
	int16 left, top, width, height;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   221
	byte cls;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   222
	byte parent_cls;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   223
	uint32 flags;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   224
	const Widget *widgets;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   225
	WindowProc *proc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   226
} WindowDesc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   227
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
enum {
682
74c70f645d95 (svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents: 588
diff changeset
   229
	WDF_STD_TOOLTIPS   = 1, /* use standard routine when displaying tooltips */
74c70f645d95 (svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents: 588
diff changeset
   230
	WDF_DEF_WIDGET     = 2,	/* default widget control for some widgets in the on click event */
74c70f645d95 (svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents: 588
diff changeset
   231
	WDF_STD_BTN        = 4,	/* default handling for close and drag widgets (widget no 0 and 1) */
2064
e6a2b42d0b15 (svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents: 2021
diff changeset
   232
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
	WDF_UNCLICK_BUTTONS=16, /* Unclick buttons when the window event times out */
682
74c70f645d95 (svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents: 588
diff changeset
   234
	WDF_STICKY_BUTTON  =32, /* Set window to sticky mode; they are not closed unless closed with 'X' (widget 2) */
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   235
	WDF_RESIZABLE      =64, /* A window can be resized */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   236
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
/* can be used as x or y coordinates to cause a specific placement */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
enum {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   240
	WDP_AUTO = -1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   241
	WDP_CENTER = -2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   242
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
1390
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   244
typedef struct Textbuf {
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   245
	char *buf;                  /* buffer in which text is saved */
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   246
	uint16 maxlength, maxwidth; /* the maximum size of the buffer. Maxwidth specifies screensize in pixels */
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   247
	uint16 length, width;       /* the current size of the buffer. Width specifies screensize in pixels */
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   248
	bool caret;                 /* is the caret ("_") visible or not */
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   249
	uint16 caretpos;            /* the current position of the caret in the buffer */
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   250
	uint16 caretxoffs;          /* the current position of the caret in pixels */
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   251
} Textbuf;
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   252
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   253
typedef struct {
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   254
	StringID caption;
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   255
	WindowClass wnd_class;
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   256
	WindowNumber wnd_num;
1390
e7cdf3ce0fb6 (svn r1894) - Codechange: cleaned up the console a bit, wholly unified handling of text with that of editboxes
Darkvater
parents: 1386
diff changeset
   257
	Textbuf text;
1386
0de4f8541aea (svn r1890) Begin to clean up the edit box: Remove one global variable and split the combined edit/original buffer into two
tron
parents: 1323
diff changeset
   258
	const char* orig;
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   259
} querystr_d;
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   260
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   261
#define WP(ptr,str) (*(str*)(ptr)->custom)
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   262
// querystr_d is the bigest struct that comes in w->custom
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   263
//  because 64-bit systems use 64-bit pointers, it is bigger on a 64-bit system
826
fff56bbc3606 (svn r1297) Language fixes in the source.. (ln-)
miham
parents: 763
diff changeset
   264
//  than on a 32-bit system. Therefore, the size is calculated from querystr_d
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   265
//  instead of a hardcoded number.
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   266
// if any struct becomes bigger the querystr_d, it should be replaced.
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   267
#define WINDOW_CUSTOM_SIZE sizeof(querystr_d)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   268
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   269
typedef struct {
62
2bdd81b8adcc (svn r63) Fix: [ 1009385 ] Too many save games prevented loading
dominik
parents: 0
diff changeset
   270
	uint16 count, cap, pos;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   271
} Scrollbar;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   272
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   273
typedef struct {
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   274
	uint width; /* Minimum width and height */
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   275
	uint height;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   276
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   277
	uint step_width; /* In how big steps the width and height go */
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   278
	uint step_height;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   279
} ResizeInfo;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   280
1648
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   281
typedef struct {
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   282
		int msg;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   283
		int wparam;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   284
		int lparam;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   285
} Message;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   286
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   287
struct Window {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   288
	uint16 flags4;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   289
	WindowClass window_class;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   290
	WindowNumber window_number;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   291
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   292
	int left, top;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   293
	int width, height;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   294
842
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   295
	Scrollbar hscroll, vscroll, vscroll2;
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   296
	ResizeInfo resize;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   297
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   298
	byte caption_color;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   299
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   300
	uint32 click_state, disabled_state, hidden_state;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   301
	WindowProc *wndproc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   302
	ViewPort *viewport;
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   303
	const Widget *original_widget;
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   304
 	Widget *widget;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   305
	//const WindowDesc *desc;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   306
	uint32 desc_flags;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   307
1648
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   308
	Message message;
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   309
	byte custom[WINDOW_CUSTOM_SIZE];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   310
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   311
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   312
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   313
	byte item_count; /* follow_vehicle */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   314
	byte sel_index;		/* scrollpos_x */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   315
	byte main_button; /* scrollpos_y */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   316
	byte action_id;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   317
	StringID string_id; /* unk30 */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   318
	uint16 checked_items; /* unk32 */
2216
cdedee39cc2b (svn r2734) -Feature: The Main Toolbar Dropdown Menu can now display disabled items
celestar
parents: 2187
diff changeset
   319
	byte disabled_items;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   320
} menu_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   321
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   322
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   323
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   324
	int16 data_1, data_2, data_3;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   325
	int16 data_4, data_5;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   326
	bool close; /* scrollpos_y */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
	byte byte_1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   328
} def_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   329
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   330
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   331
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   332
	void *data;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   333
} void_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   334
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   335
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   336
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   337
	uint16 base; /* follow_vehicle */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   338
	uint16 count;/* scrollpos_x */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   339
} tree_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   340
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   341
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   342
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   343
	byte refresh_counter; /* follow_vehicle */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   344
} plstations_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   345
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(plstations_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   346
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   347
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   348
	StringID string_id;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   349
} tooltips_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   350
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   351
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   352
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   353
	byte railtype;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   354
	byte sel_index;
2498
3ed05caa4449 (svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents: 2448
diff changeset
   355
	EngineID sel_engine;
3ed05caa4449 (svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents: 2448
diff changeset
   356
	EngineID rename_engine;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   357
} buildtrain_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   358
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildtrain_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   359
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   360
typedef struct {
842
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   361
	byte vehicletype;
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   362
	byte sel_index[2];
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   363
	int16 sel_engine[2];
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   364
	uint16 count[2];
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   365
} replaceveh_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   366
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d));
842
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   367
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   368
typedef struct {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   369
	VehicleID sel;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   370
} traindepot_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   371
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindepot_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   372
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   373
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   374
	int sel;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   375
} order_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   376
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   377
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   378
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   379
	byte tab;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   380
} traindetails_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   381
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   382
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   383
typedef struct {
849
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   384
	int32 scroll_x;
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   385
	int32 scroll_y;
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   386
	int32 subscroll;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   387
} smallmap_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   388
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   389
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   390
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   391
	uint32 face;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   392
	byte gender;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   393
} facesel_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   394
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   395
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   396
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   397
	int sel;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   398
	byte cargo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   399
} refit_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   400
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   401
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   402
typedef struct {
2116
23031555ff54 (svn r2626) static, const, misc.
tron
parents: 2064
diff changeset
   403
	VehicleID follow_vehicle;
849
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   404
	int32 scrollpos_x;
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   405
	int32 scrollpos_y;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   406
} vp_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   407
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d) + 3 * sizeof(byte)); // + 3 * byte is a hack from Miham
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   408
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   409
// vp2_d is the same as vp_d, except for the data_# values..
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   410
typedef struct {
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   411
	uint16 follow_vehicle;
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   412
	int32 scrollpos_x;
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   413
	int32 scrollpos_y;
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   414
	byte data_1;
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   415
	byte data_2;
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   416
	byte data_3;
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   417
} vp2_d;
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   418
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   419
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   420
typedef struct {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   421
	uint16 follow_vehicle;
849
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   422
	int32 scrollpos_x;
c3407041774f (svn r1330) Increase size of some vars from int16 to int32 to guard against future overflows
tron
parents: 842
diff changeset
   423
	int32 scrollpos_y;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   424
	NewsItem *ni;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   425
} news_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   426
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d));
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   427
859
611a03925f9a (svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents: 849
diff changeset
   428
typedef struct {
998
c90459c24842 (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
   429
	uint32 background_img;
c90459c24842 (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
   430
	int8 rank;
c90459c24842 (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
   431
} highscore_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   432
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d));
998
c90459c24842 (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
   433
c90459c24842 (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
   434
typedef struct {
c90459c24842 (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
   435
	int height;
c90459c24842 (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
	uint16 counter;
c90459c24842 (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
} scroller_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   438
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d));
859
611a03925f9a (svn r1340) -Feature: scrolling credits list...finally! Hope nobody gets offended if I forgot them.
darkvater
parents: 849
diff changeset
   439
588
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   440
typedef enum VehicleListFlags {
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   441
	VL_DESC    = 0x01,
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   442
	VL_RESORT  = 0x02,
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   443
	VL_REBUILD = 0x04
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   444
} VehicleListFlags;
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   445
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   446
typedef struct vehiclelist_d {
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   447
	SortStruct *sort_list;
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   448
	uint16 list_length;
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   449
	byte sort_type;
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   450
	VehicleListFlags flags;
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   451
	uint16 resort_timer;
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   452
} vehiclelist_d;
1004
dcc3c5747e22 (svn r1503) Added feature:
miham
parents: 998
diff changeset
   453
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d));
588
03521b270f62 (svn r1009) -Feature: per-station vehicle lists
tron
parents: 543
diff changeset
   454
1648
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   455
typedef struct message_d {
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   456
	int msg;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   457
	int wparam;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   458
	int lparam;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   459
} message_d;
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   460
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d));
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   461
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   462
enum WindowEvents {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   463
	WE_CLICK = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   464
	WE_PAINT = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   465
	WE_MOUSELOOP = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   466
	WE_TICK = 3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   467
	WE_4 = 4,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   468
	WE_TIMEOUT = 5,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   469
	WE_PLACE_OBJ = 6,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   470
	WE_ABORT_PLACE_OBJ = 7,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   471
	WE_DESTROY = 8,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   472
	WE_ON_EDIT_TEXT = 9,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   473
	WE_POPUPMENU_SELECT = 10,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   474
	WE_POPUPMENU_OVER = 11,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   475
	WE_DRAGDROP = 12,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   476
	WE_PLACE_DRAG = 13,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   477
	WE_PLACE_MOUSEUP = 14,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   478
	WE_PLACE_PRESIZE = 15,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   479
	WE_DROPDOWN_SELECT = 16,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   480
	WE_RCLICK = 17,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   481
	WE_KEYPRESS = 18,
116
ca4332a9ec1d (svn r117) Feature: Performance details window in company league menu (TrueLight)
dominik
parents: 68
diff changeset
   482
	WE_CREATE = 19,
543
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   483
	WE_MOUSEOVER = 20,
946badd71033 (svn r942) -Merged branch/network back into the trunk
truelight
parents: 424
diff changeset
   484
	WE_ON_EDIT_TEXT_CANCEL = 21,
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   485
	WE_RESIZE = 22,
1648
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   486
	WE_MESSAGE = 23
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   487
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   488
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   489
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   490
/****************** THESE ARE NOT WIDGET TYPES!!!!! *******************/
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   491
enum WindowWidgetBehaviours {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   492
	WWB_PUSHBUTTON = 1 << 5,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   493
	WWB_NODISBUTTON = 2 << 5,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   494
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   495
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   496
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   497
enum WindowWidgetTypes {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   498
	WWT_EMPTY = 0,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   499
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   500
	WWT_IMGBTN = 1,						/* button with image */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   501
	WWT_PANEL = WWT_IMGBTN,
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   502
	WWT_PANEL_2 = 2,					/* button with diff image when clicked */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   503
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   504
	WWT_TEXTBTN = 3,					/* button with text */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   505
	WWT_CLOSEBOX = WWT_TEXTBTN,
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   506
	WWT_4 = 4,								/* button with diff text when clicked */
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   507
	WWT_5 = 5,								/* label */
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   508
	WWT_6 = 6,								/* combo box text area */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   509
	WWT_MATRIX = 7,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   510
	WWT_SCROLLBAR = 8,
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   511
	WWT_FRAME = 9,						/* frame */
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   512
	WWT_CAPTION = 10,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   513
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   514
	WWT_HSCROLLBAR = 11,
682
74c70f645d95 (svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents: 588
diff changeset
   515
	WWT_STICKYBOX = 12,
842
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   516
	WWT_SCROLL2BAR = 13,				/* 2nd vertical scrollbar*/
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   517
	WWT_RESIZEBOX = 14,
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   518
	WWT_LAST = 15,						/* Last Item. use WIDGETS_END to fill up padding!! */
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
	WWT_MASK = 31,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   521
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   522
	WWT_PUSHTXTBTN	= WWT_TEXTBTN	| WWB_PUSHBUTTON,
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   523
	WWT_PUSHIMGBTN	= WWT_IMGBTN	| WWB_PUSHBUTTON,
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 164
diff changeset
   524
	WWT_NODISTXTBTN = WWT_TEXTBTN	| WWB_NODISBUTTON,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   525
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   526
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   527
#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
   528
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   529
enum WindowFlags {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   530
	WF_TIMEOUT_SHL = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   531
	WF_TIMEOUT_MASK = 7,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   532
	WF_DRAGGING = 1 << 3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   533
	WF_SCROLL_UP = 1 << 4,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   534
	WF_SCROLL_DOWN = 1 << 5,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   535
	WF_SCROLL_MIDDLE = 1 << 6,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   536
	WF_HSCROLL = 1 << 7,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   537
	WF_SIZING = 1 << 8,
682
74c70f645d95 (svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents: 588
diff changeset
   538
	WF_STICKY = 1 << 9,
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   539
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   540
	WF_DISABLE_VP_SCROLL = 1 << 10,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   541
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   542
	WF_WHITE_BORDER_ONE = 1 << 11,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   543
	WF_WHITE_BORDER_MASK = 3 << 11,
842
efc3546bc313 (svn r1323) Adding autoreplace feature
bjarni
parents: 826
diff changeset
   544
	WF_SCROLL2 = 1 << 13,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   545
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   546
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   547
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   548
void DispatchLeftClickEvent(Window *w, int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   549
void DispatchRightClickEvent(Window *w, int x, int y);
2021
3a8c59ea3fbe (svn r2530) - Fix: [ 1219829 ] Mouse-wheel crashes OTTD. Widget detection failed to detect the most-right and most-bottom pixels of a widget. If scrollwheel is used on a not-found widget (such as the background of the toolbar), it will now fail correctly (glx)
Darkvater
parents: 1977
diff changeset
   550
void DispatchMouseWheelEvent(Window *w, int widget, int wheel);
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
/* window.c */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   553
void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   554
void CallWindowEventNP(Window *w, int event);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1009
diff changeset
   555
void CallWindowTickEvent(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   556
void SetWindowDirty(Window *w);
1648
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   557
void SendWindowMessageW(Window *w, uint msg, uint wparam, uint lparam);
41c3d5de9994 (svn r2152) - Fix: Chatbar in MP games is now on-top of the news window.
darkvater
parents: 1570
diff changeset
   558
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, uint msg, uint wparam, uint lparam);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   559
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   560
Window *FindWindowById(WindowClass cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   561
void DeleteWindow(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   562
Window *BringWindowToFrontById(WindowClass cls, WindowNumber number);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   563
Window *BringWindowToFront(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   564
Window *StartWindowDrag(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   565
Window *StartWindowSizing(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   566
Window *FindWindowFromPt(int x, int y);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   567
867
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   568
bool IsWindowOfPrototype(Window *w, const Widget *widget);
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   569
void AssignWidgetToWindow(Window *w, const Widget *widget);
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   570
/* Use this function to save the current widget to be the global default */
dffd33233237 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 859
diff changeset
   571
void MakeWindowWidgetDefault(Window *w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   572
Window *AllocateWindow(
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   573
							int x,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   574
							int y,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   575
							int width,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   576
							int height,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   577
							WindowProc *proc,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   578
							WindowClass cls,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   579
							const Widget *widget);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   580
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   581
Window *AllocateWindowDesc(const WindowDesc *desc);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   582
Window *AllocateWindowDescFront(const WindowDesc *desc, int value);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   583
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   584
Window *AllocateWindowAutoPlace(
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   585
	int width,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   586
	int height,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   587
	WindowProc *proc,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   588
	WindowClass cls,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   589
	const Widget *widget);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   590
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   591
Window *AllocateWindowAutoPlace2(
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   592
	WindowClass exist_class,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   593
	WindowNumber exist_num,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   594
	int width,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   595
	int height,
158
b1a821f84250 (svn r159) -Fix: w->custom[] was too small for 64bit pointers
truelight
parents: 129
diff changeset
   596
	WindowProc *proc,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   597
	WindowClass cls,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   598
	const Widget *widget);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   599
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   600
void DrawWindowViewport(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   601
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1009
diff changeset
   602
void InitWindowSystem(void);
1474
a26a21fa10ef (svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents: 1390
diff changeset
   603
void UnInitWindowSystem(void);
a26a21fa10ef (svn r1978) - Fix: Plug some memleaks; thanks Valgrind
Darkvater
parents: 1390
diff changeset
   604
void ResetWindowSystem(void);
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2216
diff changeset
   605
int GetMenuItemIndex(const Window *w, int x, int y);
1570
c9b6cf44ce53 (svn r2074) MouseLoop -> InputLoop(), factor out a real mouse-specific MouseLoop from the new InitLoop() (more in the spirit of HandleKeypress()).
pasky
parents: 1474
diff changeset
   606
void InputLoop(void);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1009
diff changeset
   607
void UpdateWindows(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   608
void InvalidateWidget(Window *w, byte widget_index);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   609
2187
a0e206ce9fbf (svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents: 2186
diff changeset
   610
void GuiShowTooltips(StringID string_id);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   611
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   612
void UnclickWindowButtons(Window *w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   613
void UnclickSomeWindowButtons(Window *w, uint32 mask);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   614
void RelocateAllWindows(int neww, int newh);
380
87faf9e3216f (svn r569) Fix type mismatch
tron
parents: 176
diff changeset
   615
int PositionMainToolbar(Window *w);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   616
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   617
/* widget.c */
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2216
diff changeset
   618
int GetWidgetFromPos(const Window *w, int x, int y);
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2216
diff changeset
   619
void DrawWindowWidgets(const Window *w);
2448
1a07657c9f9a (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
   620
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
   621
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   622
void HandleButtonClick(Window *w, byte widget);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   623
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1009
diff changeset
   624
Window *GetCallbackWnd(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 1009
diff changeset
   625
void DeleteNonVitalWindows(void);
763
ced9fcae239d (svn r1225) -Feature: SHIFT+DEL now deletes all non-vital windows (only status bar and main bar remain)
darkvater
parents: 682
diff changeset
   626
void DeleteAllNonVitalWindows(void);
983
4765bf636f6b (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents: 982
diff changeset
   627
void HideVitalWindows(void);
4765bf636f6b (svn r1479) -Added highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
darkvater
parents: 982
diff changeset
   628
void ShowVitalWindows(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   629
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   630
/* window.c */
682
74c70f645d95 (svn r1121) -Feature: Added sticky windows feature. A small pin allows the user to set the window as undeletable and can only be closed by hand. As an example the viewport window has been stickied (thanks to Neko-San)
darkvater
parents: 588
diff changeset
   631
VARDEF Window _windows[25];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   632
VARDEF Window *_last_window;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   633
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   634
VARDEF Point _cursorpos_drag_start;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   635
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   636
VARDEF bool _left_button_down;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   637
VARDEF bool _left_button_clicked;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   638
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   639
VARDEF bool _right_button_down;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   640
VARDEF bool _right_button_clicked;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   641
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   642
VARDEF int _alloc_wnd_parent_num;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   643
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   644
VARDEF int _scrollbar_start_pos;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   645
VARDEF int _scrollbar_size;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   646
VARDEF bool _demo_mode;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   647
VARDEF byte _scroller_click_timeout;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   648
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   649
VARDEF bool _dragging_window;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   650
VARDEF bool _scrolling_scrollbar;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   651
VARDEF bool _scrolling_viewport;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   652
VARDEF bool _popup_menu_active;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   653
//VARDEF bool _dragdrop_active;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   654
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   655
VARDEF Point _fix_mouse_at;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   656
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   657
VARDEF byte _special_mouse_mode;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   658
enum SpecialMouseMode {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   659
	WSM_NONE = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   660
	WSM_DRAGDROP = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   661
	WSM_SIZING = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   662
	WSM_PRESIZE = 3,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   663
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   664
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   665
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
   666
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   667
#endif /* WINDOW_H */