1 #ifndef GRAPHICS_WINDOW_H
2 #define GRAPHICS_WINDOW_H
3 
4 #include "graphics/tooltip.h"
5 #include "input/hotkey.h"
6 #include "input/mouse.h"
7 
8 typedef enum {
9     WINDOW_LOGO,
10     WINDOW_MAIN_MENU,
11     WINDOW_CONFIG,
12     WINDOW_HOTKEY_CONFIG,
13     WINDOW_HOTKEY_EDITOR,
14     WINDOW_NEW_CAREER,
15     WINDOW_CCK_SELECTION,
16     WINDOW_FILE_DIALOG,
17     WINDOW_POPUP_DIALOG,
18     WINDOW_PLAIN_MESSAGE_DIALOG,
19     WINDOW_INTRO_VIDEO,
20     // mission start/end
21     WINDOW_INTERMEZZO,
22     WINDOW_MISSION_SELECTION,
23     WINDOW_MISSION_BRIEFING,
24     WINDOW_VICTORY_DIALOG,
25     WINDOW_VICTORY_VIDEO,
26     WINDOW_MISSION_END,
27     // city
28     WINDOW_CITY,
29     WINDOW_CITY_MILITARY,
30     WINDOW_TOP_MENU,
31     WINDOW_OVERLAY_MENU,
32     WINDOW_MILITARY_MENU,
33     WINDOW_BUILD_MENU,
34     WINDOW_SLIDING_SIDEBAR,
35     WINDOW_MESSAGE_DIALOG,
36     WINDOW_MESSAGE_LIST,
37     WINDOW_BUILDING_INFO,
38     WINDOW_CITY_MAIN_MENU,
39     WINDOW_HOLD_GAMES,
40     WINDOW_RACE_BET,
41     // advisors and dialogs
42     WINDOW_ADVISORS,
43     WINDOW_LABOR_PRIORITY,
44     WINDOW_SET_SALARY,
45     WINDOW_DONATE_TO_CITY,
46     WINDOW_GIFT_TO_EMPEROR,
47     WINDOW_TRADE_PRICES,
48     WINDOW_RESOURCE_SETTINGS,
49     WINDOW_HOLD_FESTIVAL,
50     // empire and dialog
51     WINDOW_EMPIRE,
52     WINDOW_TRADE_OPENED,
53     // options dialogs
54     WINDOW_DIFFICULTY_OPTIONS,
55     WINDOW_DISPLAY_OPTIONS,
56     WINDOW_SOUND_OPTIONS,
57     WINDOW_SPEED_OPTIONS,
58     // utility windows
59     WINDOW_SELECT_LIST,
60     WINDOW_NUMERIC_INPUT,
61     // editor
62     WINDOW_EDITOR_MAP,
63     WINDOW_EDITOR_TOP_MENU,
64     WINDOW_EDITOR_BUILD_MENU,
65     WINDOW_EDITOR_EMPIRE,
66     WINDOW_EDITOR_ATTRIBUTES,
67     WINDOW_EDITOR_ALLOWED_BUILDINGS,
68     WINDOW_EDITOR_INVASIONS,
69     WINDOW_EDITOR_EDIT_INVASION,
70     WINDOW_EDITOR_REQUESTS,
71     WINDOW_EDITOR_EDIT_REQUEST,
72     WINDOW_EDITOR_STARTING_CONDITIONS,
73     WINDOW_EDITOR_START_YEAR,
74     WINDOW_EDITOR_SPECIAL_EVENTS,
75     WINDOW_EDITOR_PRICE_CHANGES,
76     WINDOW_EDITOR_EDIT_PRICE_CHANGE,
77     WINDOW_EDITOR_DEMAND_CHANGES,
78     WINDOW_EDITOR_EDIT_DEMAND_CHANGE,
79     WINDOW_EDITOR_WIN_CRITERIA
80 } window_id;
81 
82 typedef struct {
83     window_id id;
84     void (*draw_background)(void);
85     void (*draw_foreground)(void);
86     void (*handle_input)(const mouse *m, const hotkeys *h);
87     void (*get_tooltip)(tooltip_context *c);
88 } window_type;
89 
90 /**
91  * Invalidates the window immediately, indicating that the current game state
92  * requires a redraw before continuing
93  */
94 void window_invalidate(void);
95 
96 /**
97  * Request a (soft) refresh of the window; does not invalidate the game state
98  */
99 void window_request_refresh(void);
100 
101 /**
102  * Returns whether the window has been invalidated using `window_invalidate`
103  */
104 int window_is_invalid(void);
105 
106 void window_draw(int force);
107 
108 void window_draw_underlying_window(void);
109 
110 int window_is(window_id id);
111 
112 void window_show(const window_type *window);
113 
114 window_id window_get_id(void);
115 
116 void window_go_back(void);
117 
118 #endif // GRAPHICS_WINDOW_H
119