window.h
changeset 1004 dcc3c5747e22
parent 998 c90459c24842
child 1009 75140dc68759
equal deleted inserted replaced
1003:5a1516385ad5 1004:dcc3c5747e22
   281 	byte main_button; /* scrollpos_y */
   281 	byte main_button; /* scrollpos_y */
   282 	byte action_id;
   282 	byte action_id;
   283 	StringID string_id; /* unk30 */
   283 	StringID string_id; /* unk30 */
   284 	uint16 checked_items; /* unk32 */
   284 	uint16 checked_items; /* unk32 */
   285 } menu_d;
   285 } menu_d;
       
   286 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d));
   286 
   287 
   287 typedef struct {
   288 typedef struct {
   288 	int16 data_1, data_2, data_3;
   289 	int16 data_1, data_2, data_3;
   289 	int16 data_4, data_5;
   290 	int16 data_4, data_5;
   290 	bool close; /* scrollpos_y */
   291 	bool close; /* scrollpos_y */
   291 	byte byte_1;
   292 	byte byte_1;
   292 } def_d;
   293 } def_d;
       
   294 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d));
   293 
   295 
   294 typedef struct {
   296 typedef struct {
   295 	void *data;
   297 	void *data;
   296 } void_d;
   298 } void_d;
       
   299 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d));
   297 
   300 
   298 typedef struct {
   301 typedef struct {
   299 	uint16 base; /* follow_vehicle */
   302 	uint16 base; /* follow_vehicle */
   300 	uint16 count;/* scrollpos_x */
   303 	uint16 count;/* scrollpos_x */
   301 } tree_d;
   304 } tree_d;
       
   305 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
   302 
   306 
   303 typedef struct {
   307 typedef struct {
   304 	byte refresh_counter; /* follow_vehicle */
   308 	byte refresh_counter; /* follow_vehicle */
   305 } plstations_d;
   309 } plstations_d;
       
   310 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(plstations_d));
   306 
   311 
   307 typedef struct {
   312 typedef struct {
   308 	StringID string_id;
   313 	StringID string_id;
   309 } tooltips_d;
   314 } tooltips_d;
       
   315 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d));
   310 
   316 
   311 typedef struct {
   317 typedef struct {
   312 	byte railtype;
   318 	byte railtype;
   313 	byte sel_index;
   319 	byte sel_index;
   314 	int16 sel_engine;
   320 	int16 sel_engine;
   315 	int16 rename_engine;
   321 	int16 rename_engine;
   316 } buildtrain_d;
   322 } buildtrain_d;
       
   323 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildtrain_d));
   317 
   324 
   318 typedef struct {
   325 typedef struct {
   319 	byte railtype;
   326 	byte railtype;
   320 	byte vehicletype;
   327 	byte vehicletype;
   321 	byte sel_index[2];
   328 	byte sel_index[2];
   322 	int16 sel_engine[2];
   329 	int16 sel_engine[2];
   323 	uint16 count[2];
   330 	uint16 count[2];
   324 } replaceveh_d;
   331 } replaceveh_d;
       
   332 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d));
   325 
   333 
   326 typedef struct {
   334 typedef struct {
   327 	VehicleID sel;
   335 	VehicleID sel;
   328 } traindepot_d;
   336 } traindepot_d;
       
   337 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindepot_d));
   329 
   338 
   330 typedef struct {
   339 typedef struct {
   331 	int sel;
   340 	int sel;
   332 } order_d;
   341 } order_d;
       
   342 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d));
   333 
   343 
   334 typedef struct {
   344 typedef struct {
   335 	byte tab;
   345 	byte tab;
   336 } traindetails_d;
   346 } traindetails_d;
       
   347 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d));
   337 
   348 
   338 typedef struct {
   349 typedef struct {
   339 	int32 scroll_x;
   350 	int32 scroll_x;
   340 	int32 scroll_y;
   351 	int32 scroll_y;
   341 	int32 subscroll;
   352 	int32 subscroll;
   342 } smallmap_d;
   353 } smallmap_d;
       
   354 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d));
   343 
   355 
   344 typedef struct {
   356 typedef struct {
   345 	uint32 face;
   357 	uint32 face;
   346 	byte gender;
   358 	byte gender;
   347 } facesel_d;
   359 } facesel_d;
       
   360 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
   348 
   361 
   349 typedef struct {
   362 typedef struct {
   350 	int sel;
   363 	int sel;
   351 	byte cargo;
   364 	byte cargo;
   352 } refit_d;
   365 } refit_d;
       
   366 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d));
   353 
   367 
   354 typedef struct {
   368 typedef struct {
   355 	uint16 follow_vehicle;
   369 	uint16 follow_vehicle;
   356 	int32 scrollpos_x;
   370 	int32 scrollpos_x;
   357 	int32 scrollpos_y;
   371 	int32 scrollpos_y;
   358 } vp_d;
   372 } vp_d;
       
   373 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d) + 3 * sizeof(byte)); // + 3 * byte is a hack from Miham
       
   374 
       
   375 // vp2_d is the same as vp_d, except for the data_# values..
       
   376 typedef struct {
       
   377 	uint16 follow_vehicle;
       
   378 	int32 scrollpos_x;
       
   379 	int32 scrollpos_y;
       
   380 	byte data_1;
       
   381 	byte data_2;
       
   382 	byte data_3;
       
   383 } vp2_d;
       
   384 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d));
   359 
   385 
   360 typedef struct {
   386 typedef struct {
   361 	uint16 follow_vehicle;
   387 	uint16 follow_vehicle;
   362 	int32 scrollpos_x;
   388 	int32 scrollpos_x;
   363 	int32 scrollpos_y;
   389 	int32 scrollpos_y;
   364 	NewsItem *ni;
   390 	NewsItem *ni;
   365 } news_d;
   391 } news_d;
       
   392 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d));
   366 
   393 
   367 typedef struct {
   394 typedef struct {
   368 	uint32 background_img;
   395 	uint32 background_img;
   369 	int8 rank;
   396 	int8 rank;
   370 } highscore_d;
   397 } highscore_d;
       
   398 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d));
   371 
   399 
   372 typedef struct {
   400 typedef struct {
   373 	int height;
   401 	int height;
   374 	uint16 counter;
   402 	uint16 counter;
   375 } scroller_d;
   403 } scroller_d;
       
   404 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d));
   376 
   405 
   377 typedef enum VehicleListFlags {
   406 typedef enum VehicleListFlags {
   378 	VL_DESC    = 0x01,
   407 	VL_DESC    = 0x01,
   379 	VL_RESORT  = 0x02,
   408 	VL_RESORT  = 0x02,
   380 	VL_REBUILD = 0x04
   409 	VL_REBUILD = 0x04
   385 	uint16 list_length;
   414 	uint16 list_length;
   386 	byte sort_type;
   415 	byte sort_type;
   387 	VehicleListFlags flags;
   416 	VehicleListFlags flags;
   388 	uint16 resort_timer;
   417 	uint16 resort_timer;
   389 } vehiclelist_d;
   418 } vehiclelist_d;
   390 assert_compile(sizeof(vehiclelist_d) <= WINDOW_CUSTOM_SIZE);
   419 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d));
   391 
   420 
   392 enum WindowEvents {
   421 enum WindowEvents {
   393 	WE_CLICK = 0,
   422 	WE_CLICK = 0,
   394 	WE_PAINT = 1,
   423 	WE_PAINT = 1,
   395 	WE_MOUSELOOP = 2,
   424 	WE_MOUSELOOP = 2,