Project Alice
Loading...
Searching...
No Matches
budgetwindow.cpp
Go to the documentation of this file.
1namespace alice_ui {
2struct budgetwindow_main_close_button_t;
3struct budgetwindow_main_title_t;
4struct budgetwindow_main_income_label_t;
5struct budgetwindow_main_income_amount_t;
6struct budgetwindow_main_income_page_left_t;
7struct budgetwindow_main_income_page_right_t;
8struct budgetwindow_main_income_page_number_t;
9struct budgetwindow_main_income_table_t;
10struct budgetwindow_main_expenses_page_left_t;
11struct budgetwindow_main_expenses_page_number_t;
12struct budgetwindow_main_expenses_page_right_t;
13struct budgetwindow_main_expenses_label_t;
14struct budgetwindow_main_expenses_amount_t;
15struct budgetwindow_main_expenses_table_t;
16struct budgetwindow_main_admin_eff1_t;
17struct budgetwindow_main_admin_eff2_t;
18struct budgetwindow_main_admin_eff_amount_t;
19struct budgetwindow_main_welfare_label_t;
20struct budgetwindow_main_chart_max_a_t;
21struct budgetwindow_main_chart_min_t;
22struct budgetwindow_main_chart_max_b_t;
23struct budgetwindow_main_chart_poplabel_t;
24struct budgetwindow_main_chart_needslabel_t;
25struct budgetwindow_main_welfare_chart_poor_t;
26struct budgetwindow_main_welfare_chart_middle_t;
27struct budgetwindow_main_welfare_chart_rich_t;
28struct budgetwindow_main_hover_poor_t;
29struct budgetwindow_main_hover_middle_t;
30struct budgetwindow_main_hover_rich_t;
31struct budgetwindow_main_debt_label_t;
32struct budgetwindow_main_debt_enable_t;
33struct budgetwindow_main_total_debt_label_t;
34struct budgetwindow_main_max_debt_label_t;
35struct budgetwindow_main_total_debt_amount_t;
36struct budgetwindow_main_max_debt_amount_t;
37struct budgetwindow_main_debt_chart_t;
38struct budgetwindow_main_debt_overlay_t;
39struct budgetwindow_main_t;
40struct budgetwindow_section_header_label_t;
41struct budgetwindow_section_header_llbutton_t;
42struct budgetwindow_section_header_lbutton_t;
43struct budgetwindow_section_header_rbutton_t;
44struct budgetwindow_section_header_rrbutton_t;
45struct budgetwindow_section_header_setting_amount_t;
46struct budgetwindow_section_header_expand_button_t;
47struct budgetwindow_section_header_total_amount_t;
48struct budgetwindow_section_header_min_setting_t;
49struct budgetwindow_section_header_max_setting_t;
50struct budgetwindow_section_header_t;
51struct budgetwindow_neutral_spacer_t;
52struct budgetwindow_top_spacer_t;
53struct budgetwindow_bottom_spacer_t;
55 std::string_view texture_key;
56 dcon::texture_id background_texture;
57 dcon::text_key tooltip_key;
58 void on_create(sys::state& state) noexcept override;
59 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
60 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
62 }
63 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
64 if(type == ui::mouse_probe_type::click) {
66 } else if(type == ui::mouse_probe_type::tooltip) {
68 } else if(type == ui::mouse_probe_type::scroll) {
70 } else {
72 }
73 }
74 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
75 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
77 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
78 void on_update(sys::state& state) noexcept override;
79};
83 float text_scale = 2.500000f;
84 bool text_is_header = true;
86 std::string cached_text;
87 dcon::text_key text_key;
88 void set_text(sys::state & state, std::string const& new_text);
89 void on_reset_text(sys::state & state) noexcept override;
90 void on_create(sys::state& state) noexcept override;
91 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
92 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
94 }
95 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
96 if(type == ui::mouse_probe_type::click) {
98 } else if(type == ui::mouse_probe_type::tooltip) {
100 } else if(type == ui::mouse_probe_type::scroll) {
102 } else {
104 }
105 }
106 void on_update(sys::state& state) noexcept override;
107};
111 float text_scale = 2.000000f;
112 bool text_is_header = true;
114 std::string cached_text;
115 dcon::text_key text_key;
116 void set_text(sys::state & state, std::string const& new_text);
117 void on_reset_text(sys::state & state) noexcept override;
118 void on_create(sys::state& state) noexcept override;
119 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
120 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
122 }
123 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
124 if(type == ui::mouse_probe_type::click) {
126 } else if(type == ui::mouse_probe_type::tooltip) {
128 } else if(type == ui::mouse_probe_type::scroll) {
130 } else {
132 }
133 }
134 void on_update(sys::state& state) noexcept override;
135};
139 float text_scale = 2.000000f;
140 bool text_is_header = true;
142 std::string cached_text;
143 void set_text(sys::state & state, std::string const& new_text);
144 void on_reset_text(sys::state & state) noexcept override;
145 void on_create(sys::state& state) noexcept override;
146 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
147 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
149 }
150 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
151 if(type == ui::mouse_probe_type::click) {
153 } else if(type == ui::mouse_probe_type::tooltip) {
155 } else if(type == ui::mouse_probe_type::scroll) {
157 } else {
159 }
160 }
161 void on_update(sys::state& state) noexcept override;
162};
164 std::string_view texture_key;
165 dcon::texture_id background_texture;
166 void on_create(sys::state& state) noexcept override;
167 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
168 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
170 }
171 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
172 if(type == ui::mouse_probe_type::click) {
174 } else if(type == ui::mouse_probe_type::tooltip) {
176 } else if(type == ui::mouse_probe_type::scroll) {
178 } else {
180 }
181 }
182 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
183 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
184 void on_update(sys::state& state) noexcept override;
185};
187 std::string_view texture_key;
188 dcon::texture_id background_texture;
189 void on_create(sys::state& state) noexcept override;
190 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
191 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
193 }
194 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
195 if(type == ui::mouse_probe_type::click) {
197 } else if(type == ui::mouse_probe_type::tooltip) {
199 } else if(type == ui::mouse_probe_type::scroll) {
201 } else {
203 }
204 }
205 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
206 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
207 void on_update(sys::state& state) noexcept override;
208};
212 float text_scale = 1.000000f;
213 bool text_is_header = false;
215 std::string cached_text;
216 void set_text(sys::state & state, std::string const& new_text);
217 void on_reset_text(sys::state & state) noexcept override;
218 void on_create(sys::state& state) noexcept override;
219 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
220 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
222 }
223 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
224 if(type == ui::mouse_probe_type::click) {
226 } else if(type == ui::mouse_probe_type::tooltip) {
228 } else if(type == ui::mouse_probe_type::scroll) {
230 } else {
232 }
233 }
234 void on_update(sys::state& state) noexcept override;
235};
237 inline static int16_t lead_space_column_start = 0;
238 inline static int16_t lead_space_column_width = 0;
242 inline static dcon::text_key item_name_text_key;
243 inline static int8_t item_name_sort_direction = 0;
244 inline static int16_t item_name_column_start = 0;
245 inline static int16_t item_name_column_width = 0;
249 inline static dcon::text_key item_value_text_key;
250 inline static int8_t item_value_sort_direction = 0;
251 inline static int16_t item_value_column_start = 0;
252 inline static int16_t item_value_column_width = 0;
253 inline static std::string_view ascending_icon_key;
254 inline static dcon::texture_id ascending_icon;
255 inline static std::string_view descending_icon_key;
256 inline static dcon::texture_id descending_icon;
257 void on_reset_text(sys::state & state) noexcept override;
258 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
259 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
260 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
261 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
262 void tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept override;
263 void on_create(sys::state& state) noexcept override;
264 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
265 if(type == ui::mouse_probe_type::click) {
267 } else if(type == ui::mouse_probe_type::tooltip) {
269 } else if(type == ui::mouse_probe_type::scroll) {
271 } else {
273 }
274 }
275};
277 std::pair<std::string, float> value;
278 bool alternate_row = false;
284 void set_item_name_text(sys::state & state, std::string const& new_text);
290 void set_item_value_text(sys::state & state, std::string const& new_text);
291 inline static std::string_view row_texture_key;
292 inline static dcon::texture_id row_background_texture;
293 inline static std::string_view alt_row_texture_key;
294 inline static dcon::texture_id alt_row_background_texture;
295 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
296 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
297 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
298 void on_update(sys::state& state) noexcept override;
299 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
300 void tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept override;
301 void on_create(sys::state& state) noexcept override;
302 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
303 if(type == ui::mouse_probe_type::click) {
305 } else if(type == ui::mouse_probe_type::tooltip) {
307 } else if(type == ui::mouse_probe_type::scroll) {
309 } else {
311 }
312 }
313};
316 std::vector<std::unique_ptr<ui::element_base>> section_header_pool;
318 std::vector<std::unique_ptr<ui::element_base>> neutral_spacer_pool;
320 std::vector<std::unique_ptr<ui::element_base>> bottom_spacer_pool;
322 std::vector<std::unique_ptr<ui::element_base>> top_spacer_pool;
323 std::vector<std::unique_ptr<budgetwindow_main_income_table_row_t>> row_pool;
324 std::vector<std::unique_ptr<budgetwindow_main_income_table_header_t>> header_pool;
325 struct value_option { std::pair<std::string, float> value; };
326 int32_t page = 0;
327 inline static float row_height = 0;
328 inline static ogl::color4f table_highlight_color{float(1.000000), float(1.000000), float(1.000000), float(0.156863)};
329 inline static ogl::color3f table_divider_color{float(0.000000), float(0.000000), float(0.000000)};
330 std::vector<std::variant<std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option>> values;
331 std::vector<int32_t> page_starts;
332 bool open_page = false;
333 int16_t layout_space = 0;
334 void on_create(sys::state& state) noexcept override;
335 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
337 }
338 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
339 if(type == ui::mouse_probe_type::click) {
341 } else if(type == ui::mouse_probe_type::tooltip) {
343 } else if(type == ui::mouse_probe_type::scroll) {
345 } else {
347 }
348 }
349 ui::message_result on_scroll(sys::state & state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override;
350 void change_page(sys::state & state, int32_t new_page);
351 int32_t max_page();
352 void clear_table();
353 void impl_change_page(sys::state & state, int32_t new_page);
354 void add_value(std::pair<std::string, float> const& v);
355 void add_insert_section_header(sys::state& state, int32_t const& section_type);
358 void add_insert_top_spacer(sys::state& state);
359 std::unique_ptr<budgetwindow_main_income_table_row_t> make_row(sys::state& state);
360 std::unique_ptr<budgetwindow_main_income_table_header_t> make_headers(sys::state& state);
361 void apply_sort(sys::state& state);
362 void impl_apply_sort(sys::state& state);
363 void on_update(sys::state& state) noexcept override;
364};
366 std::string_view texture_key;
367 dcon::texture_id background_texture;
368 void on_create(sys::state& state) noexcept override;
369 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
370 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
372 }
373 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
374 if(type == ui::mouse_probe_type::click) {
376 } else if(type == ui::mouse_probe_type::tooltip) {
378 } else if(type == ui::mouse_probe_type::scroll) {
380 } else {
382 }
383 }
384 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
385 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
386 void on_update(sys::state& state) noexcept override;
387};
391 float text_scale = 1.000000f;
392 bool text_is_header = false;
394 std::string cached_text;
395 void set_text(sys::state & state, std::string const& new_text);
396 void on_reset_text(sys::state & state) noexcept override;
397 void on_create(sys::state& state) noexcept override;
398 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
399 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
401 }
402 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
403 if(type == ui::mouse_probe_type::click) {
405 } else if(type == ui::mouse_probe_type::tooltip) {
407 } else if(type == ui::mouse_probe_type::scroll) {
409 } else {
411 }
412 }
413 void on_update(sys::state& state) noexcept override;
414};
416 std::string_view texture_key;
417 dcon::texture_id background_texture;
418 void on_create(sys::state& state) noexcept override;
419 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
420 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
422 }
423 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
424 if(type == ui::mouse_probe_type::click) {
426 } else if(type == ui::mouse_probe_type::tooltip) {
428 } else if(type == ui::mouse_probe_type::scroll) {
430 } else {
432 }
433 }
434 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
435 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
436 void on_update(sys::state& state) noexcept override;
437};
441 float text_scale = 2.000000f;
442 bool text_is_header = true;
444 std::string cached_text;
445 dcon::text_key text_key;
446 void set_text(sys::state & state, std::string const& new_text);
447 void on_reset_text(sys::state & state) noexcept override;
448 void on_create(sys::state& state) noexcept override;
449 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
450 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
452 }
453 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
454 if(type == ui::mouse_probe_type::click) {
456 } else if(type == ui::mouse_probe_type::tooltip) {
458 } else if(type == ui::mouse_probe_type::scroll) {
460 } else {
462 }
463 }
464 void on_update(sys::state& state) noexcept override;
465};
469 float text_scale = 2.000000f;
470 bool text_is_header = true;
472 std::string cached_text;
473 void set_text(sys::state & state, std::string const& new_text);
474 void on_reset_text(sys::state & state) noexcept override;
475 void on_create(sys::state& state) noexcept override;
476 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
477 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
479 }
480 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
481 if(type == ui::mouse_probe_type::click) {
483 } else if(type == ui::mouse_probe_type::tooltip) {
485 } else if(type == ui::mouse_probe_type::scroll) {
487 } else {
489 }
490 }
491 void on_update(sys::state& state) noexcept override;
492};
494 inline static int16_t lead_space_column_start = 0;
495 inline static int16_t lead_space_column_width = 0;
499 inline static dcon::text_key item_name_text_key;
500 inline static int8_t item_name_sort_direction = 0;
501 inline static int16_t item_name_column_start = 0;
502 inline static int16_t item_name_column_width = 0;
506 inline static dcon::text_key item_value_text_key;
507 inline static int8_t item_value_sort_direction = 0;
508 inline static int16_t item_value_column_start = 0;
509 inline static int16_t item_value_column_width = 0;
510 inline static std::string_view ascending_icon_key;
511 inline static dcon::texture_id ascending_icon;
512 inline static std::string_view descending_icon_key;
513 inline static dcon::texture_id descending_icon;
514 void on_reset_text(sys::state & state) noexcept override;
515 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
516 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
517 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
518 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
519 void tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept override;
520 void on_create(sys::state& state) noexcept override;
521 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
522 if(type == ui::mouse_probe_type::click) {
524 } else if(type == ui::mouse_probe_type::tooltip) {
526 } else if(type == ui::mouse_probe_type::scroll) {
528 } else {
530 }
531 }
532};
534 std::pair<std::string, float> value;
535 bool alternate_row = false;
541 void set_item_name_text(sys::state & state, std::string const& new_text);
547 void set_item_value_text(sys::state & state, std::string const& new_text);
548 inline static std::string_view row_texture_key;
549 inline static dcon::texture_id row_background_texture;
550 inline static std::string_view alt_row_texture_key;
551 inline static dcon::texture_id alt_row_background_texture;
552 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
553 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
554 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
555 void on_update(sys::state& state) noexcept override;
556 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
557 void tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept override;
558 void on_create(sys::state& state) noexcept override;
559 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
560 if(type == ui::mouse_probe_type::click) {
562 } else if(type == ui::mouse_probe_type::tooltip) {
564 } else if(type == ui::mouse_probe_type::scroll) {
566 } else {
568 }
569 }
570};
573 std::vector<std::unique_ptr<ui::element_base>> section_header_pool;
575 std::vector<std::unique_ptr<ui::element_base>> neutral_spacer_pool;
577 std::vector<std::unique_ptr<ui::element_base>> bottom_spacer_pool;
579 std::vector<std::unique_ptr<ui::element_base>> top_spacer_pool;
580 std::vector<std::unique_ptr<budgetwindow_main_expenses_table_row_t>> row_pool;
581 std::vector<std::unique_ptr<budgetwindow_main_expenses_table_header_t>> header_pool;
582 struct value_option { std::pair<std::string, float> value; };
583 int32_t page = 0;
584 inline static float row_height = 0;
585 inline static ogl::color4f table_highlight_color{float(1.000000), float(1.000000), float(1.000000), float(0.156863)};
586 inline static ogl::color3f table_divider_color{float(0.000000), float(0.000000), float(0.000000)};
587 std::vector<std::variant<std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option>> values;
588 std::vector<int32_t> page_starts;
589 bool open_page = false;
590 int16_t layout_space = 0;
591 void on_create(sys::state& state) noexcept override;
592 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
594 }
595 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
596 if(type == ui::mouse_probe_type::click) {
598 } else if(type == ui::mouse_probe_type::tooltip) {
600 } else if(type == ui::mouse_probe_type::scroll) {
602 } else {
604 }
605 }
606 ui::message_result on_scroll(sys::state & state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override;
607 void change_page(sys::state & state, int32_t new_page);
608 int32_t max_page();
609 void clear_table();
610 void impl_change_page(sys::state & state, int32_t new_page);
611 void add_value(std::pair<std::string, float> const& v);
612 void add_insert_section_header(sys::state& state, int32_t const& section_type);
615 void add_insert_top_spacer(sys::state& state);
616 std::unique_ptr<budgetwindow_main_expenses_table_row_t> make_row(sys::state& state);
617 std::unique_ptr<budgetwindow_main_expenses_table_header_t> make_headers(sys::state& state);
618 void apply_sort(sys::state& state);
619 void impl_apply_sort(sys::state& state);
620 void on_update(sys::state& state) noexcept override;
621};
625 float text_scale = 1.500000f;
626 bool text_is_header = true;
628 std::string cached_text;
629 dcon::text_key text_key;
630 void set_text(sys::state & state, std::string const& new_text);
631 void on_reset_text(sys::state & state) noexcept override;
632 void on_create(sys::state& state) noexcept override;
633 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
634 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
636 }
637 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
638 if(type == ui::mouse_probe_type::click) {
640 } else if(type == ui::mouse_probe_type::tooltip) {
642 } else if(type == ui::mouse_probe_type::scroll) {
644 } else {
646 }
647 }
648 void on_update(sys::state& state) noexcept override;
649};
653 float text_scale = 1.500000f;
654 bool text_is_header = true;
656 std::string cached_text;
657 dcon::text_key text_key;
658 void set_text(sys::state & state, std::string const& new_text);
659 void on_reset_text(sys::state & state) noexcept override;
660 void on_create(sys::state& state) noexcept override;
661 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
662 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
664 }
665 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
666 if(type == ui::mouse_probe_type::click) {
668 } else if(type == ui::mouse_probe_type::tooltip) {
670 } else if(type == ui::mouse_probe_type::scroll) {
672 } else {
674 }
675 }
676 void on_update(sys::state& state) noexcept override;
677};
681 float text_scale = 1.500000f;
682 bool text_is_header = true;
684 std::string cached_text;
685 void set_text(sys::state & state, std::string const& new_text);
686 void on_reset_text(sys::state & state) noexcept override;
687 void on_create(sys::state& state) noexcept override;
688 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
689 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
691 }
692 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
693 if(type == ui::mouse_probe_type::click) {
695 } else if(type == ui::mouse_probe_type::tooltip) {
697 } else if(type == ui::mouse_probe_type::scroll) {
699 } else {
701 }
702 }
703 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
704 void on_update(sys::state& state) noexcept override;
705};
709 float text_scale = 1.500000f;
710 bool text_is_header = true;
712 std::string cached_text;
713 dcon::text_key text_key;
714 void set_text(sys::state & state, std::string const& new_text);
715 void on_reset_text(sys::state & state) noexcept override;
716 void on_create(sys::state& state) noexcept override;
717 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
718 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
720 }
721 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
722 if(type == ui::mouse_probe_type::click) {
724 } else if(type == ui::mouse_probe_type::tooltip) {
726 } else if(type == ui::mouse_probe_type::scroll) {
728 } else {
730 }
731 }
732 void on_update(sys::state& state) noexcept override;
733};
737 float text_scale = 1.000000f;
738 bool text_is_header = false;
740 std::string cached_text;
741 dcon::text_key text_key;
742 void set_text(sys::state & state, std::string const& new_text);
743 void on_reset_text(sys::state & state) noexcept override;
744 void on_create(sys::state& state) noexcept override;
745 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
746 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
748 }
749 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
750 if(type == ui::mouse_probe_type::click) {
752 } else if(type == ui::mouse_probe_type::tooltip) {
754 } else if(type == ui::mouse_probe_type::scroll) {
756 } else {
758 }
759 }
760 void on_update(sys::state& state) noexcept override;
761};
765 float text_scale = 1.000000f;
766 bool text_is_header = false;
768 std::string cached_text;
769 dcon::text_key text_key;
770 void set_text(sys::state & state, std::string const& new_text);
771 void on_reset_text(sys::state & state) noexcept override;
772 void on_create(sys::state& state) noexcept override;
773 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
774 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
776 }
777 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
778 if(type == ui::mouse_probe_type::click) {
780 } else if(type == ui::mouse_probe_type::tooltip) {
782 } else if(type == ui::mouse_probe_type::scroll) {
784 } else {
786 }
787 }
788 void on_update(sys::state& state) noexcept override;
789};
793 float text_scale = 1.000000f;
794 bool text_is_header = false;
796 std::string cached_text;
797 dcon::text_key text_key;
798 void set_text(sys::state & state, std::string const& new_text);
799 void on_reset_text(sys::state & state) noexcept override;
800 void on_create(sys::state& state) noexcept override;
801 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
802 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
804 }
805 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
806 if(type == ui::mouse_probe_type::click) {
808 } else if(type == ui::mouse_probe_type::tooltip) {
810 } else if(type == ui::mouse_probe_type::scroll) {
812 } else {
814 }
815 }
816 void on_update(sys::state& state) noexcept override;
817};
821 float text_scale = 1.000000f;
822 bool text_is_header = false;
824 std::string cached_text;
825 dcon::text_key text_key;
826 void set_text(sys::state & state, std::string const& new_text);
827 void on_reset_text(sys::state & state) noexcept override;
828 void on_create(sys::state& state) noexcept override;
829 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
830 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
832 }
833 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
834 if(type == ui::mouse_probe_type::click) {
836 } else if(type == ui::mouse_probe_type::tooltip) {
838 } else if(type == ui::mouse_probe_type::scroll) {
840 } else {
842 }
843 }
844 void on_update(sys::state& state) noexcept override;
845};
849 float text_scale = 1.000000f;
850 bool text_is_header = false;
852 std::string cached_text;
853 dcon::text_key text_key;
854 void set_text(sys::state & state, std::string const& new_text);
855 void on_reset_text(sys::state & state) noexcept override;
856 void on_create(sys::state& state) noexcept override;
857 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
858 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
860 }
861 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
862 if(type == ui::mouse_probe_type::click) {
864 } else if(type == ui::mouse_probe_type::tooltip) {
866 } else if(type == ui::mouse_probe_type::scroll) {
868 } else {
870 }
871 }
872 void on_update(sys::state& state) noexcept override;
873};
876 ogl::color4f line_color{ 0.854902f, 0.254902f, 0.192157f, 1.000000f };
877 void set_data_points(sys::state& state, std::vector<float> const& datapoints, float min, float max);
878 void on_create(sys::state& state) noexcept override;
879 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
880 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
882 }
883 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
884 if(type == ui::mouse_probe_type::click) {
886 } else if(type == ui::mouse_probe_type::tooltip) {
888 } else if(type == ui::mouse_probe_type::scroll) {
890 } else {
892 }
893 }
894 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
895 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
896 void on_update(sys::state& state) noexcept override;
897};
900 ogl::color4f line_color{ 0.462745f, 0.313726f, 1.000000f, 1.000000f };
901 void set_data_points(sys::state& state, std::vector<float> const& datapoints, float min, float max);
902 void on_create(sys::state& state) noexcept override;
903 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
904 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
906 }
907 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
908 if(type == ui::mouse_probe_type::click) {
910 } else if(type == ui::mouse_probe_type::tooltip) {
912 } else if(type == ui::mouse_probe_type::scroll) {
914 } else {
916 }
917 }
918 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
919 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
920 void on_update(sys::state& state) noexcept override;
921};
924 ogl::color4f line_color{ 0.133333f, 0.658824f, 0.203922f, 1.000000f };
925 void set_data_points(sys::state& state, std::vector<float> const& datapoints, float min, float max);
926 void on_create(sys::state& state) noexcept override;
927 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
928 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
930 }
931 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
932 if(type == ui::mouse_probe_type::click) {
934 } else if(type == ui::mouse_probe_type::tooltip) {
936 } else if(type == ui::mouse_probe_type::scroll) {
938 } else {
940 }
941 }
942 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
943 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
944 void on_update(sys::state& state) noexcept override;
945};
947 std::string_view texture_key;
948 dcon::texture_id background_texture;
951 float text_scale = 1.000000f;
952 bool text_is_header = true;
954 std::string cached_text;
955 dcon::text_key text_key;
956 void set_text(sys::state & state, std::string const& new_text);
957 void on_reset_text(sys::state & state) noexcept override;
958 void on_create(sys::state& state) noexcept override;
959 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
960 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
962 }
963 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
964 if(type == ui::mouse_probe_type::click) {
966 } else if(type == ui::mouse_probe_type::tooltip) {
968 } else if(type == ui::mouse_probe_type::scroll) {
970 } else {
972 }
973 }
974 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
975 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
976 void on_hover(sys::state& state) noexcept override;
977 void on_hover_end(sys::state& state) noexcept override;
978 void on_update(sys::state& state) noexcept override;
979};
981 std::string_view texture_key;
982 dcon::texture_id background_texture;
985 float text_scale = 1.000000f;
986 bool text_is_header = true;
988 std::string cached_text;
989 dcon::text_key text_key;
990 void set_text(sys::state & state, std::string const& new_text);
991 void on_reset_text(sys::state & state) noexcept override;
992 void on_create(sys::state& state) noexcept override;
993 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
994 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
996 }
997 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
998 if(type == ui::mouse_probe_type::click) {
1000 } else if(type == ui::mouse_probe_type::tooltip) {
1002 } else if(type == ui::mouse_probe_type::scroll) {
1004 } else {
1006 }
1007 }
1008 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1009 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1010 void on_hover(sys::state& state) noexcept override;
1011 void on_hover_end(sys::state& state) noexcept override;
1012 void on_update(sys::state& state) noexcept override;
1013};
1015 std::string_view texture_key;
1016 dcon::texture_id background_texture;
1019 float text_scale = 1.000000f;
1020 bool text_is_header = true;
1022 std::string cached_text;
1023 dcon::text_key text_key;
1024 void set_text(sys::state & state, std::string const& new_text);
1025 void on_reset_text(sys::state & state) noexcept override;
1026 void on_create(sys::state& state) noexcept override;
1027 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1028 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1030 }
1031 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1032 if(type == ui::mouse_probe_type::click) {
1034 } else if(type == ui::mouse_probe_type::tooltip) {
1036 } else if(type == ui::mouse_probe_type::scroll) {
1038 } else {
1040 }
1041 }
1042 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1043 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1044 void on_hover(sys::state& state) noexcept override;
1045 void on_hover_end(sys::state& state) noexcept override;
1046 void on_update(sys::state& state) noexcept override;
1047};
1051 float text_scale = 1.500000f;
1052 bool text_is_header = true;
1054 std::string cached_text;
1055 dcon::text_key text_key;
1056 void set_text(sys::state & state, std::string const& new_text);
1057 void on_reset_text(sys::state & state) noexcept override;
1058 void on_create(sys::state& state) noexcept override;
1059 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1060 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1062 }
1063 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1064 if(type == ui::mouse_probe_type::click) {
1066 } else if(type == ui::mouse_probe_type::tooltip) {
1068 } else if(type == ui::mouse_probe_type::scroll) {
1070 } else {
1072 }
1073 }
1074 void on_update(sys::state& state) noexcept override;
1075};
1077 std::string_view texture_key;
1078 std::string_view alt_texture_key;
1079 dcon::texture_id alt_background_texture;
1080 bool is_active = false;
1081 dcon::texture_id background_texture;
1082 bool disabled = false;
1085 float text_scale = 1.000000f;
1086 bool text_is_header = false;
1088 std::string cached_text;
1089 dcon::text_key text_key;
1090 void set_text(sys::state & state, std::string const& new_text);
1091 void on_reset_text(sys::state & state) noexcept override;
1092 void on_create(sys::state& state) noexcept override;
1093 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1094 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1096 }
1097 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1098 if(type == ui::mouse_probe_type::click) {
1100 } else if(type == ui::mouse_probe_type::tooltip) {
1102 } else if(type == ui::mouse_probe_type::scroll) {
1104 } else {
1106 }
1107 }
1108 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1109 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1110 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1111 void on_update(sys::state& state) noexcept override;
1112};
1116 float text_scale = 1.000000f;
1117 bool text_is_header = false;
1119 std::string cached_text;
1120 dcon::text_key text_key;
1121 void set_text(sys::state & state, std::string const& new_text);
1122 void on_reset_text(sys::state & state) noexcept override;
1123 void on_create(sys::state& state) noexcept override;
1124 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1125 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1127 }
1128 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1129 if(type == ui::mouse_probe_type::click) {
1131 } else if(type == ui::mouse_probe_type::tooltip) {
1133 } else if(type == ui::mouse_probe_type::scroll) {
1135 } else {
1137 }
1138 }
1139 void on_update(sys::state& state) noexcept override;
1140};
1144 float text_scale = 1.000000f;
1145 bool text_is_header = false;
1147 std::string cached_text;
1148 dcon::text_key text_key;
1149 void set_text(sys::state & state, std::string const& new_text);
1150 void on_reset_text(sys::state & state) noexcept override;
1151 void on_create(sys::state& state) noexcept override;
1152 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1153 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1155 }
1156 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1157 if(type == ui::mouse_probe_type::click) {
1159 } else if(type == ui::mouse_probe_type::tooltip) {
1161 } else if(type == ui::mouse_probe_type::scroll) {
1163 } else {
1165 }
1166 }
1167 void on_update(sys::state& state) noexcept override;
1168};
1172 float text_scale = 1.000000f;
1173 bool text_is_header = false;
1175 std::string cached_text;
1176 dcon::text_key text_key;
1177 void set_text(sys::state & state, std::string const& new_text);
1178 void on_reset_text(sys::state & state) noexcept override;
1179 void on_create(sys::state& state) noexcept override;
1180 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1181 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1183 }
1184 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1185 if(type == ui::mouse_probe_type::click) {
1187 } else if(type == ui::mouse_probe_type::tooltip) {
1189 } else if(type == ui::mouse_probe_type::scroll) {
1191 } else {
1193 }
1194 }
1195 void on_update(sys::state& state) noexcept override;
1196};
1200 float text_scale = 1.000000f;
1201 bool text_is_header = false;
1203 std::string cached_text;
1204 dcon::text_key text_key;
1205 void set_text(sys::state & state, std::string const& new_text);
1206 void on_reset_text(sys::state & state) noexcept override;
1207 void on_create(sys::state& state) noexcept override;
1208 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1209 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1211 }
1212 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1213 if(type == ui::mouse_probe_type::click) {
1215 } else if(type == ui::mouse_probe_type::tooltip) {
1217 } else if(type == ui::mouse_probe_type::scroll) {
1219 } else {
1221 }
1222 }
1223 void on_update(sys::state& state) noexcept override;
1224};
1227 struct graph_entry {dcon::text_key key; ogl::color3f color; float amount; };
1228 std::vector<graph_entry> graph_content;
1229 void update_chart(sys::state& state);
1230 void on_create(sys::state& state) noexcept override;
1231 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1232 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1234 }
1235 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1236 if(type == ui::mouse_probe_type::click) {
1238 } else if(type == ui::mouse_probe_type::tooltip) {
1240 } else if(type == ui::mouse_probe_type::scroll) {
1242 } else {
1244 }
1245 }
1246 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1247 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1248 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1249 void on_update(sys::state& state) noexcept override;
1250};
1252 std::string_view texture_key;
1253 dcon::texture_id background_texture;
1254 void on_create(sys::state& state) noexcept override;
1255 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1256 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1258 }
1259 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1260 if(type == ui::mouse_probe_type::click) {
1262 } else if(type == ui::mouse_probe_type::tooltip) {
1264 } else if(type == ui::mouse_probe_type::scroll) {
1266 } else {
1268 }
1269 }
1270 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1271 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1272 void on_update(sys::state& state) noexcept override;
1273};
1277 float text_scale = 1.400000f;
1278 bool text_is_header = false;
1280 std::string cached_text;
1281 void set_text(sys::state & state, std::string const& new_text);
1282 void on_reset_text(sys::state & state) noexcept override;
1283 void on_create(sys::state& state) noexcept override;
1284 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1285 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1287 }
1288 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1289 if(type == ui::mouse_probe_type::click) {
1291 } else if(type == ui::mouse_probe_type::tooltip) {
1293 } else if(type == ui::mouse_probe_type::scroll) {
1295 } else {
1297 }
1298 }
1299 void on_update(sys::state& state) noexcept override;
1300};
1302 std::string_view texture_key;
1303 dcon::texture_id background_texture;
1304 dcon::text_key tooltip_key;
1305 void on_create(sys::state& state) noexcept override;
1306 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1307 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1309 }
1310 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1311 if(type == ui::mouse_probe_type::click) {
1313 } else if(type == ui::mouse_probe_type::tooltip) {
1315 } else if(type == ui::mouse_probe_type::scroll) {
1317 } else {
1319 }
1320 }
1321 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1322 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1323 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1324 void on_update(sys::state& state) noexcept override;
1325};
1327 std::string_view texture_key;
1328 dcon::texture_id background_texture;
1329 dcon::text_key tooltip_key;
1330 void on_create(sys::state& state) noexcept override;
1331 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1332 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1334 }
1335 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1336 if(type == ui::mouse_probe_type::click) {
1338 } else if(type == ui::mouse_probe_type::tooltip) {
1340 } else if(type == ui::mouse_probe_type::scroll) {
1342 } else {
1344 }
1345 }
1346 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1347 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1348 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1349 void on_update(sys::state& state) noexcept override;
1350};
1352 std::string_view texture_key;
1353 dcon::texture_id background_texture;
1354 dcon::text_key tooltip_key;
1355 void on_create(sys::state& state) noexcept override;
1356 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1357 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1359 }
1360 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1361 if(type == ui::mouse_probe_type::click) {
1363 } else if(type == ui::mouse_probe_type::tooltip) {
1365 } else if(type == ui::mouse_probe_type::scroll) {
1367 } else {
1369 }
1370 }
1371 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1372 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1373 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1374 void on_update(sys::state& state) noexcept override;
1375};
1377 std::string_view texture_key;
1378 dcon::texture_id background_texture;
1379 dcon::text_key tooltip_key;
1380 void on_create(sys::state& state) noexcept override;
1381 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1382 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1384 }
1385 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1386 if(type == ui::mouse_probe_type::click) {
1388 } else if(type == ui::mouse_probe_type::tooltip) {
1390 } else if(type == ui::mouse_probe_type::scroll) {
1392 } else {
1394 }
1395 }
1396 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1397 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1398 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1399 void on_update(sys::state& state) noexcept override;
1400};
1404 float text_scale = 1.000000f;
1405 bool text_is_header = false;
1407 std::string cached_text;
1408 void set_text(sys::state & state, std::string const& new_text);
1409 void on_reset_text(sys::state & state) noexcept override;
1410 void on_create(sys::state& state) noexcept override;
1411 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1412 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1414 }
1415 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1416 if(type == ui::mouse_probe_type::click) {
1418 } else if(type == ui::mouse_probe_type::tooltip) {
1420 } else if(type == ui::mouse_probe_type::scroll) {
1422 } else {
1424 }
1425 }
1426 void on_update(sys::state& state) noexcept override;
1427};
1429 std::string_view texture_key;
1430 std::string_view alt_texture_key;
1431 dcon::texture_id alt_background_texture;
1432 bool is_active = false;
1433 dcon::texture_id background_texture;
1434 bool disabled = false;
1435 void on_create(sys::state& state) noexcept override;
1436 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1437 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1439 }
1440 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1441 if(type == ui::mouse_probe_type::click) {
1443 } else if(type == ui::mouse_probe_type::tooltip) {
1445 } else if(type == ui::mouse_probe_type::scroll) {
1447 } else {
1449 }
1450 }
1451 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1452 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1453 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1454 void on_update(sys::state& state) noexcept override;
1455};
1459 float text_scale = 1.000000f;
1460 bool text_is_header = false;
1462 std::string cached_text;
1463 void set_text(sys::state & state, std::string const& new_text);
1464 void on_reset_text(sys::state & state) noexcept override;
1465 void on_create(sys::state& state) noexcept override;
1466 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1467 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1469 }
1470 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1471 if(type == ui::mouse_probe_type::click) {
1473 } else if(type == ui::mouse_probe_type::tooltip) {
1475 } else if(type == ui::mouse_probe_type::scroll) {
1477 } else {
1479 }
1480 }
1481 void on_update(sys::state& state) noexcept override;
1482};
1486 float text_scale = 1.000000f;
1487 bool text_is_header = false;
1489 std::string cached_text;
1490 void set_text(sys::state & state, std::string const& new_text);
1491 void on_reset_text(sys::state & state) noexcept override;
1492 void on_create(sys::state& state) noexcept override;
1493 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1494 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1496 }
1497 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1498 if(type == ui::mouse_probe_type::click) {
1500 } else if(type == ui::mouse_probe_type::tooltip) {
1502 } else if(type == ui::mouse_probe_type::scroll) {
1504 } else {
1506 }
1507 }
1508 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1509 void on_update(sys::state& state) noexcept override;
1510};
1514 float text_scale = 1.000000f;
1515 bool text_is_header = false;
1517 std::string cached_text;
1518 void set_text(sys::state & state, std::string const& new_text);
1519 void on_reset_text(sys::state & state) noexcept override;
1520 void on_create(sys::state& state) noexcept override;
1521 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1522 ui::tooltip_behavior has_tooltip(sys::state & state) noexcept override {
1524 }
1525 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1526 if(type == ui::mouse_probe_type::click) {
1528 } else if(type == ui::mouse_probe_type::tooltip) {
1530 } else if(type == ui::mouse_probe_type::scroll) {
1532 } else {
1534 }
1535 }
1536 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
1537 void on_update(sys::state& state) noexcept override;
1538};
1577 std::string_view texture_key;
1578 dcon::texture_id background_texture;
1579 void on_create(sys::state& state) noexcept override;
1580 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1581 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1582 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1583 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1585 }
1586 void on_drag(sys::state& state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
1587 auto location_abs = get_absolute_location(state, *this);
1588 if(location_abs.x <= oldx && oldx < base_data.size.x + location_abs.x && location_abs.y <= oldy && oldy < base_data.size.y + location_abs.y) {
1589 ui::xy_pair new_abs_pos = location_abs;
1590 new_abs_pos.x += int16_t(x - oldx);
1591 new_abs_pos.y += int16_t(y - oldy);
1592 if(ui::ui_width(state) > base_data.size.x)
1593 new_abs_pos.x = int16_t(std::clamp(int32_t(new_abs_pos.x), 0, ui::ui_width(state) - base_data.size.x));
1594 if(ui::ui_height(state) > base_data.size.y)
1595 new_abs_pos.y = int16_t(std::clamp(int32_t(new_abs_pos.y), 0, ui::ui_height(state) - base_data.size.y));
1596 if(state.world.locale_get_native_rtl(state.font_collection.get_current_locale())) {
1597 base_data.position.x -= int16_t(new_abs_pos.x - location_abs.x);
1598 } else {
1599 base_data.position.x += int16_t(new_abs_pos.x - location_abs.x);
1600 }
1601 base_data.position.y += int16_t(new_abs_pos.y - location_abs.y);
1602 }
1603 }
1604 void on_update(sys::state& state) noexcept override;
1605};
1606std::unique_ptr<ui::element_base> make_budgetwindow_main(sys::state& state);
1619 std::string_view texture_key;
1620 dcon::texture_id background_texture;
1621 void on_create(sys::state& state) noexcept override;
1622 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1623 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1624 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1625 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1627 }
1628 void on_update(sys::state& state) noexcept override;
1629 void* get_by_name(sys::state& state, std::string_view name) noexcept override {
1630 if(name == "section_type") {
1631 return (void*)(&section_type);
1632 }
1633 return nullptr;
1634 }
1635};
1636std::unique_ptr<ui::element_base> make_budgetwindow_section_header(sys::state& state);
1638 std::string_view texture_key;
1639 dcon::texture_id background_texture;
1640 void on_create(sys::state& state) noexcept override;
1641 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1642 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1643 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1644 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1646 }
1647 void on_update(sys::state& state) noexcept override;
1648};
1649std::unique_ptr<ui::element_base> make_budgetwindow_neutral_spacer(sys::state& state);
1651 std::string_view texture_key;
1652 dcon::texture_id background_texture;
1653 void on_create(sys::state& state) noexcept override;
1654 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1655 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1656 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1657 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1659 }
1660 void on_update(sys::state& state) noexcept override;
1661};
1662std::unique_ptr<ui::element_base> make_budgetwindow_top_spacer(sys::state& state);
1664 std::string_view texture_key;
1665 dcon::texture_id background_texture;
1666 void on_create(sys::state& state) noexcept override;
1667 void render(sys::state & state, int32_t x, int32_t y) noexcept override;
1668 ui::message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1669 ui::message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
1670 ui::message_result test_mouse(sys::state& state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override {
1672 }
1673 void on_update(sys::state& state) noexcept override;
1674};
1675std::unique_ptr<ui::element_base> make_budgetwindow_bottom_spacer(sys::state& state);
1678 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
1679// BEGIN main::close_button::lbutton_action
1680 parent->set_visible(state, false);
1681// END
1683}
1686}
1688 if(key == sys::virtual_key::ESCAPE) {
1689 on_lbutton_down(state, 0, 0, mods);
1691 }
1693}
1694void budgetwindow_main_close_button_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
1695 text::add_line(state, contents, tooltip_key);
1696}
1697void budgetwindow_main_close_button_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1698 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1699}
1702// BEGIN main::close_button::update
1703// END
1704}
1706// BEGIN main::close_button::create
1707// END
1708}
1709void budgetwindow_main_title_t::set_text(sys::state& state, std::string const& new_text) {
1710 if(new_text != cached_text) {
1711 cached_text = new_text;
1712 internal_layout.contents.clear();
1714 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1715 sl.add_text(state, cached_text);
1716 }
1717}
1719 cached_text = text::produce_simple_string(state, text_key);
1720 internal_layout.contents.clear();
1721 internal_layout.number_of_lines = 0;
1722 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1723 sl.add_text(state, cached_text);
1724}
1725void budgetwindow_main_title_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1726 if(internal_layout.contents.empty()) return;
1727 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
1728 auto linesz = state.font_collection.line_height(state, fh);
1729 if(linesz == 0.0f) return;
1730 auto ycentered = (base_data.size.y - linesz) / 2;
1731 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
1732 for(auto& t : internal_layout.contents) {
1733 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
1734 }
1735}
1738// BEGIN main::title::update
1739// END
1740}
1742 on_reset_text(state);
1743// BEGIN main::title::create
1744// END
1745}
1746void budgetwindow_main_income_label_t::set_text(sys::state& state, std::string const& new_text) {
1747 if(new_text != cached_text) {
1748 cached_text = new_text;
1749 internal_layout.contents.clear();
1751 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1752 sl.add_text(state, cached_text);
1753 }
1754}
1756 cached_text = text::produce_simple_string(state, text_key);
1757 internal_layout.contents.clear();
1758 internal_layout.number_of_lines = 0;
1759 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1760 sl.add_text(state, cached_text);
1761}
1762void budgetwindow_main_income_label_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1763 if(internal_layout.contents.empty()) return;
1764 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
1765 auto linesz = state.font_collection.line_height(state, fh);
1766 if(linesz == 0.0f) return;
1767 auto ycentered = (base_data.size.y - linesz) / 2;
1768 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
1769 for(auto& t : internal_layout.contents) {
1770 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
1771 }
1772}
1775// BEGIN main::income_label::update
1776// END
1777}
1779 on_reset_text(state);
1780// BEGIN main::income_label::create
1781// END
1782}
1783void budgetwindow_main_income_amount_t::set_text(sys::state& state, std::string const& new_text) {
1784 if(new_text != cached_text) {
1785 cached_text = new_text;
1786 internal_layout.contents.clear();
1788 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1789 sl.add_text(state, cached_text);
1790 }
1791}
1793}
1794void budgetwindow_main_income_amount_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1795 if(internal_layout.contents.empty()) return;
1796 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
1797 auto linesz = state.font_collection.line_height(state, fh);
1798 if(linesz == 0.0f) return;
1799 auto ycentered = (base_data.size.y - linesz) / 2;
1800 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
1801 for(auto& t : internal_layout.contents) {
1802 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
1803 }
1804}
1807// BEGIN main::income_amount::update
1808 float total = 0.0f;
1809 total += economy::estimate_diplomatic_income(state, state.local_player_nation);
1810 total += economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::poor) * float(state.world.nation_get_poor_tax(state.local_player_nation)) / 100.0f;
1811 total += economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::middle) * float(state.world.nation_get_middle_tax(state.local_player_nation)) / 100.0f;
1812 total += economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::rich) * float(state.world.nation_get_rich_tax(state.local_player_nation)) / 100.0f;
1813 total += economy::estimate_tariff_import_income(state, state.local_player_nation);
1814 total += economy::estimate_tariff_export_income(state, state.local_player_nation);
1815 total += economy::estimate_gold_income(state, state.local_player_nation);
1816 set_text(state, text::prettify_currency(total));
1817// END
1818}
1820// BEGIN main::income_amount::create
1821// END
1822}
1825 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
1826// BEGIN main::income_page_left::lbutton_action
1827 main.income_table->change_page(state, main.income_table->page - 1);
1828// END
1830}
1833}
1834void budgetwindow_main_income_page_left_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1835 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1836}
1839// BEGIN main::income_page_left::update
1840 set_visible(state, main.income_table->max_page() > 0);
1841// END
1842}
1844// BEGIN main::income_page_left::create
1845// END
1846}
1849 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
1850// BEGIN main::income_page_right::lbutton_action
1851 main.income_table->change_page(state, main.income_table->page + 1);
1852// END
1854}
1857}
1858void budgetwindow_main_income_page_right_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1859 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1860}
1863// BEGIN main::income_page_right::update
1864 set_visible(state, main.income_table->max_page() > 0);
1865// END
1866}
1868// BEGIN main::income_page_right::create
1869// END
1870}
1871void budgetwindow_main_income_page_number_t::set_text(sys::state& state, std::string const& new_text) {
1872 if(new_text != cached_text) {
1873 cached_text = new_text;
1874 internal_layout.contents.clear();
1876 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1877 sl.add_text(state, cached_text);
1878 }
1879}
1881}
1882void budgetwindow_main_income_page_number_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1883 if(internal_layout.contents.empty()) return;
1884 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
1885 auto linesz = state.font_collection.line_height(state, fh);
1886 if(linesz == 0.0f) return;
1887 auto ycentered = (base_data.size.y - linesz) / 2;
1888 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
1889 for(auto& t : internal_layout.contents) {
1890 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
1891 }
1892}
1895// BEGIN main::income_page_number::update
1896 if(main.income_table->max_page() > 0) {
1897 set_text(state, std::to_string(main.income_table->page + 1) + "/" + std::to_string(main.income_table->max_page() + 1));
1898 } else {
1899 set_text(state, "");
1900 }
1901// END
1902}
1904// BEGIN main::income_page_number::create
1905// END
1906}
1908 {
1909 item_name_cached_text = text::produce_simple_string(state, item_name_text_key);
1910 item_name_internal_layout.contents.clear();
1911 item_name_internal_layout.number_of_lines = 0;
1912 text::single_line_layout sl{ item_name_internal_layout, text::layout_parameters{ 0, 0, int16_t(item_name_column_width - 24 - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, budgetwindow_main_income_table_row_t::item_name_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1913 sl.add_text(state, item_name_cached_text);
1914 }
1915 {
1916 item_value_cached_text = text::produce_simple_string(state, item_value_text_key);
1917 item_value_internal_layout.contents.clear();
1918 item_value_internal_layout.number_of_lines = 0;
1919 text::single_line_layout sl{ item_value_internal_layout, text::layout_parameters{ 0, 0, int16_t(item_value_column_width - 24 - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, budgetwindow_main_income_table_row_t::item_value_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
1920 sl.add_text(state, item_value_cached_text);
1921 }
1922}
1923void budgetwindow_main_income_table_header_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
1924 auto fh = text::make_font_id(state, false, 1.0f * 16);
1925 auto linesz = state.font_collection.line_height(state, fh);
1926 auto ycentered = (base_data.size.y - linesz) / 2;
1927 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) - ui::get_absolute_location(state, *this).x;
1928 ogl::render_textured_rect(state, ui::get_color_modification(false, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, budgetwindow_main_income_table_row_t::row_background_texture, budgetwindow_main_income_table_row_t::row_texture_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1929 bool col_um_lead_space = rel_mouse_x >= lead_space_column_start && rel_mouse_x < (lead_space_column_start + lead_space_column_width);
1930 bool col_um_item_name = rel_mouse_x >= item_name_column_start && rel_mouse_x < (item_name_column_start + item_name_column_width);
1931 if(col_um_item_name) {
1933 }
1934if(item_name_sort_direction > 0) {
1935 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name, false, true), float(x + item_name_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1936}
1937if(item_name_sort_direction < 0) {
1938 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name, false, true), float(x + item_name_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1939}
1940 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
1941 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name , false, true);
1942 for(auto& t : item_name_internal_layout.contents) {
1943 ui::render_text_chunk(state, t, float(x) + t.x + item_name_column_start + 24 + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_name_text_color), cmod);
1944 }
1945 }
1946 bool col_um_item_value = rel_mouse_x >= item_value_column_start && rel_mouse_x < (item_value_column_start + item_value_column_width);
1947 if(col_um_item_value) {
1949 }
1950if(item_value_sort_direction > 0) {
1951 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value, false, true), float(x + item_value_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1952}
1953if(item_value_sort_direction < 0) {
1954 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value, false, true), float(x + item_value_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
1955}
1956 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
1957 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value , false, true);
1958 for(auto& t : item_value_internal_layout.contents) {
1959 ui::render_text_chunk(state, t, float(x) + t.x + item_value_column_start + 24 + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_value_text_color), cmod);
1960 }
1961 }
1963}
1965 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
1966 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
1967 auto old_direction = item_name_sort_direction;
1968 item_name_sort_direction = 0;
1969 item_value_sort_direction = 0;
1970 item_name_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
1971 (( budgetwindow_main_income_table_t*)parent)->apply_sort(state);
1972 }
1973 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
1974 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
1975 auto old_direction = item_value_sort_direction;
1976 item_name_sort_direction = 0;
1977 item_value_sort_direction = 0;
1978 item_value_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
1979 (( budgetwindow_main_income_table_t*)parent)->apply_sort(state);
1980 }
1985 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
1986 }
1987 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
1988 }
1989 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
1990 }
1991}
1992void budgetwindow_main_income_table_header_t::tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept {
1993 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
1994 }
1995 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
1996 }
1997 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
1998 }
1999 ident = -1;
2000 subrect.top_left = ui::get_absolute_location(state, *this);
2001 subrect.size = base_data.size;
2002}
2004 on_reset_text(state);
2005}
2006void budgetwindow_main_income_table_row_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2007 auto fh = text::make_font_id(state, false, 1.0f * 16);
2008 auto linesz = state.font_collection.line_height(state, fh);
2009 auto ycentered = (base_data.size.y - linesz) / 2;
2010 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) - ui::get_absolute_location(state, *this).x;
2011 if(alternate_row) {
2012 ogl::render_textured_rect(state, ui::get_color_modification(false, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, alt_row_background_texture, alt_row_texture_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2013 } else {
2014 ogl::render_textured_rect(state, ui::get_color_modification(false, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, row_background_texture, row_texture_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2015 }
2016 if(this == state.ui_state.under_mouse) {
2018 }
2021 if(col_um_item_name && this != state.ui_state.under_mouse) {
2023 }
2024 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
2025 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name , false, false);
2026 for(auto& t : item_name_internal_layout.contents) {
2027 ui::render_text_chunk(state, t, float(x) + t.x + budgetwindow_main_income_table_header_t::item_name_column_start + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_name_text_color), cmod);
2028 }
2029 }
2031 if(col_um_item_value && this != state.ui_state.under_mouse) {
2033 }
2034 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
2035 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value , false, false);
2036 for(auto& t : item_value_internal_layout.contents) {
2037 ui::render_text_chunk(state, t, float(x) + t.x + budgetwindow_main_income_table_header_t::item_value_column_start + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_value_text_color), cmod);
2038 }
2039 }
2040}
2045void budgetwindow_main_income_table_row_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
2047 }
2049 }
2051 }
2052}
2053void budgetwindow_main_income_table_row_t::tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept {
2055 }
2057 }
2059 }
2060 ident = -1;
2061 subrect.top_left = ui::get_absolute_location(state, *this);
2062 subrect.size = base_data.size;
2063}
2065}
2068 budgetwindow_main_t& main = *((budgetwindow_main_t*)(parent->parent));
2069// BEGIN main::income_table::row_update
2070 set_item_name_text(state, value.first);
2071 set_item_value_text(state, text::prettify_currency(value.second));
2072// END
2073}
2075 if(new_text != item_name_cached_text) {
2076 item_name_cached_text = new_text;
2079 {
2080 text::single_line_layout sl{ item_name_internal_layout, text::layout_parameters{ 0, 0, int16_t(budgetwindow_main_income_table_header_t::item_name_column_width - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, item_name_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2081 sl.add_text(state, item_name_cached_text);
2082 }
2083 } else {
2084 }
2085}
2087 if(new_text != item_value_cached_text) {
2088 item_value_cached_text = new_text;
2091 {
2092 text::single_line_layout sl{ item_value_internal_layout, text::layout_parameters{ 0, 0, int16_t(budgetwindow_main_income_table_header_t::item_value_column_width - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, item_value_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2093 sl.add_text(state, item_value_cached_text);
2094 }
2095 } else {
2096 }
2097}
2099 size_t section_header_pool_used = 0;
2100 size_t neutral_spacer_pool_used = 0;
2101 size_t bottom_spacer_pool_used = 0;
2102 size_t top_spacer_pool_used = 0;
2103 size_t row_pool_used = 0;
2104 size_t header_pool_used = 0;
2105 int16_t vert_used = 0;
2106 bool alt_bg = true;
2107 page = std::clamp(new_page, 0, max_page());
2108 children.clear();
2109 if(page_starts.empty()) return;
2110 if(open_page) { page_starts.push_back(int32_t(values.size())); open_page = false; }
2111 for(int32_t i = page_starts[page]; i < page_starts[page + 1]; ++i) {
2112 if(std::holds_alternative<section_header_option>(values[i])) {
2113 if(section_header_pool_used >= section_header_pool.size()) section_header_pool.emplace_back(make_budgetwindow_section_header(state));
2114 children.push_back(section_header_pool[section_header_pool_used].get());
2115 children.back()->parent = this;
2116 ((budgetwindow_section_header_t*)(section_header_pool[section_header_pool_used].get()))->section_type = std::get<section_header_option>(values[i]).section_type;
2117 section_header_pool[section_header_pool_used]->base_data.position.y = vert_used;
2118 vert_used += section_header_pool[section_header_pool_used]->base_data.size.y;
2119 ++section_header_pool_used;
2120 alt_bg = false;
2121 }
2122 if(std::holds_alternative<neutral_spacer_option>(values[i])) {
2123 if(neutral_spacer_pool_used >= neutral_spacer_pool.size()) neutral_spacer_pool.emplace_back(make_budgetwindow_neutral_spacer(state));
2124 children.push_back(neutral_spacer_pool[neutral_spacer_pool_used].get());
2125 children.back()->parent = this;
2126 neutral_spacer_pool[neutral_spacer_pool_used]->base_data.position.y = vert_used;
2127 vert_used += neutral_spacer_pool[neutral_spacer_pool_used]->base_data.size.y;
2128 ++neutral_spacer_pool_used;
2129 alt_bg = false;
2130 }
2131 if(std::holds_alternative<bottom_spacer_option>(values[i])) {
2132 if(bottom_spacer_pool_used >= bottom_spacer_pool.size()) bottom_spacer_pool.emplace_back(make_budgetwindow_bottom_spacer(state));
2133 children.push_back(bottom_spacer_pool[bottom_spacer_pool_used].get());
2134 children.back()->parent = this;
2135 bottom_spacer_pool[bottom_spacer_pool_used]->base_data.position.y = vert_used;
2136 vert_used += bottom_spacer_pool[bottom_spacer_pool_used]->base_data.size.y;
2137 ++bottom_spacer_pool_used;
2138 alt_bg = false;
2139 }
2140 if(std::holds_alternative<top_spacer_option>(values[i])) {
2141 if(top_spacer_pool_used >= top_spacer_pool.size()) top_spacer_pool.emplace_back(make_budgetwindow_top_spacer(state));
2142 children.push_back(top_spacer_pool[top_spacer_pool_used].get());
2143 children.back()->parent = this;
2144 top_spacer_pool[top_spacer_pool_used]->base_data.position.y = vert_used;
2145 vert_used += top_spacer_pool[top_spacer_pool_used]->base_data.size.y;
2146 ++top_spacer_pool_used;
2147 alt_bg = false;
2148 }
2149 if(std::holds_alternative<value_option>(values[i])) {
2150 if(row_pool_used >= row_pool.size())row_pool.emplace_back(make_row(state));
2151 children.push_back(row_pool[row_pool_used].get());
2152 children.back()->parent = this;
2153 row_pool[row_pool_used]->value = std::get<value_option>(values[i]).value;
2154 row_pool[row_pool_used]->alternate_row = alt_bg;
2155 row_pool[row_pool_used]->base_data.position.y = vert_used;
2156 vert_used += row_pool[row_pool_used]->base_data.size.y;
2157 ++row_pool_used;
2158 alt_bg = !alt_bg;
2159 }
2160 if(std::holds_alternative<std::monostate>(values[i])) {
2161 if(header_pool_used >= header_pool.size()) header_pool.emplace_back(make_headers(state));
2162 children.push_back(header_pool[header_pool_used].get());
2163 children.back()->parent = this;
2164 header_pool[header_pool_used]->base_data.position.y = vert_used;
2165 vert_used += header_pool[header_pool_used]->base_data.size.y;
2166 ++header_pool_used;
2167 alt_bg = true;
2168 }
2169 }
2170}
2172 bool lflip = new_page < page && page > 0;
2173 bool rflip = new_page > page && page < max_page();
2174 if(rflip) {
2175 auto pos = ui::get_absolute_location(state, *this);
2176 state.ui_animation.start_animation(state, pos.x, pos.y, base_data.size.x, base_data.size.y, ogl::animation::type::page_flip_left, 200);
2177 } else if(lflip) {
2178 auto pos = ui::get_absolute_location(state, *this);
2179 state.ui_animation.start_animation(state, pos.x, pos.y, base_data.size.x, base_data.size.y, ogl::animation::type::page_flip_left_rev, 200);
2180 }
2181 impl_change_page(state, new_page); for(auto c : children) c->impl_on_update(state);
2182 state.game_state_updated.store(true, std::memory_order::release);
2183 if(rflip || lflip) {
2184 state.ui_animation.post_update_frame(state);
2185 }
2186}
2188 return open_page ? std::max(int32_t(page_starts.size()) - 1, 0) : std::max(int32_t(page_starts.size()) - 2, 0);
2189}
2191 children.clear();
2192 page_starts.clear();
2193 values.clear();
2194 open_page = false;
2195 layout_space = 0;
2196}
2197void budgetwindow_main_income_table_t::add_value(std::pair<std::string, float> const& v) {
2198 if(!open_page) {
2199 page_starts.push_back(0);
2200 open_page = true;
2201 }
2202 if(values.empty() || !std::holds_alternative<value_option>(values.back())) {
2203 if(base_data.size.y - layout_space <= 2 * int32_t(row_height * 8)) {
2204 page_starts.push_back(int32_t(values.size()));
2205 layout_space = 0;
2206 }
2207 values.emplace_back(std::monostate{});
2208 layout_space += int16_t(row_height * 8);
2209 }
2210 if(base_data.size.y - layout_space <= int32_t(row_height * 8)) {
2211 page_starts.push_back(int32_t(values.size()));
2212 layout_space = 0;
2213 values.emplace_back(std::monostate{});
2214 layout_space += int16_t(row_height * 8);
2215 }
2216 values.emplace_back(value_option{v});
2217 layout_space += int16_t(row_height * 8);
2218}
2221 if(!open_page) {
2222 page_starts.push_back(0);
2223 open_page = true;
2224 }
2225 if(base_data.size.y - layout_space <= section_header_pool[0]->base_data.size.y) {
2226 page_starts.push_back(int32_t(values.size()));
2227 layout_space = 0;
2228 }
2229 values.emplace_back(section_header_option{section_type});
2231}
2234 if(!open_page) {
2235 page_starts.push_back(0);
2236 open_page = true;
2237 }
2238 if(base_data.size.y - layout_space <= neutral_spacer_pool[0]->base_data.size.y) {
2239 page_starts.push_back(int32_t(values.size()));
2240 layout_space = 0;
2241 }
2242 values.emplace_back(neutral_spacer_option{});
2244}
2247 if(!open_page) {
2248 page_starts.push_back(0);
2249 open_page = true;
2250 }
2251 if(base_data.size.y - layout_space <= bottom_spacer_pool[0]->base_data.size.y) {
2252 page_starts.push_back(int32_t(values.size()));
2253 layout_space = 0;
2254 }
2255 values.emplace_back(bottom_spacer_option{});
2257}
2259 if(top_spacer_pool.empty()) top_spacer_pool.emplace_back(make_budgetwindow_top_spacer(state));
2260 if(!open_page) {
2261 page_starts.push_back(0);
2262 open_page = true;
2263 }
2264 if(base_data.size.y - layout_space <= top_spacer_pool[0]->base_data.size.y) {
2265 page_starts.push_back(int32_t(values.size()));
2266 layout_space = 0;
2267 }
2268 values.emplace_back(top_spacer_option{});
2270}
2271std::unique_ptr<budgetwindow_main_income_table_row_t> budgetwindow_main_income_table_t::make_row(sys::state& state) {
2272 auto cptr = std::make_unique<budgetwindow_main_income_table_row_t>();
2273 cptr->parent = this;
2274 cptr->base_data.position.x = 0;
2275 cptr->base_data.position.y = 0;
2276 cptr->base_data.size.y = int16_t(row_height * 8);
2277 cptr->base_data.size.x = this->base_data.size.x;
2278 cptr->on_create(state);
2279 return cptr;
2280}
2281std::unique_ptr<budgetwindow_main_income_table_header_t> budgetwindow_main_income_table_t::make_headers(sys::state& state){
2282 auto cptr = std::make_unique<budgetwindow_main_income_table_header_t>();
2283 cptr->parent = this;
2284 cptr->base_data.position.x = 0;
2285 cptr->base_data.position.y = 0;
2286 cptr->base_data.size.y = int16_t(row_height * 8);
2287 cptr->base_data.size.x = this->base_data.size.x;
2288 cptr->on_create(state);
2289 return cptr;
2290}
2292 bool work_to_do = false;
2295 if(!work_to_do) return;
2297 std::vector<std::pair<std::string, float>> val_temp;
2298 size_t i = 0;
2299 while(i < values.size()) {
2300 if(std::holds_alternative<value_option>(values[i])) {
2301 auto start_pos = i;
2302 do {
2303 if(std::holds_alternative<value_option>(values[i])) val_temp.push_back(std::get<value_option>(values[i]).value);
2304 ++i;
2305 } while(i < values.size() && (std::holds_alternative<value_option>(values[i]) || std::holds_alternative<std::monostate>(values[i])));
2307 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](const std::pair<std::string, float>& a, const std::pair<std::string, float>& b){
2308 int8_t result = 0;
2309// BEGIN main::income_table::sort::item_name
2310 result = int8_t(std::clamp(a.first.compare(b.first), -1, 1));
2311// END
2312 return result == budgetwindow_main_income_table_header_t::item_name_sort_direction;
2313 });
2314 }
2316 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](const std::pair<std::string, float>& a, const std::pair<std::string, float>& b){
2317 int8_t result = 0;
2318// BEGIN main::income_table::sort::item_value
2319 if(a.second == b.second)
2320 result = 0;
2321 else
2322 result = (a.second < b.second) ? -1 : 1;
2323// END
2324 return result == budgetwindow_main_income_table_header_t::item_value_sort_direction;
2325 });
2326 }
2327 while(start_pos < i) {
2328 if(std::holds_alternative<value_option>(values[start_pos])) {
2329 std::get<value_option>(values[start_pos]).value = val_temp.back();
2330 val_temp.pop_back();
2331 }
2332 ++start_pos;
2333 }
2334 val_temp.clear();
2335 } else {
2336 ++i;
2337 }
2338 }
2339}
2341 impl_apply_sort(state);
2342 impl_change_page(state, page); for(auto c : children) c->impl_on_update(state);
2343}
2344ui::message_result budgetwindow_main_income_table_t::on_scroll(sys::state& state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept {
2345 change_page(state, page + ((amount < 0) ? 1 : -1));
2347}
2350// BEGIN main::income_table::update
2351 clear_table();
2352 add_insert_section_header(state, budget_categories::poor_tax);
2353 if(budget_categories::expanded[budget_categories::poor_tax]) {
2354 add_insert_top_spacer(state);
2355 auto total = economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::poor) * float(state.world.nation_get_poor_tax(state.local_player_nation)) / 100.0f;
2356 auto type_totals = state.world.pop_type_make_vectorizable_float_buffer();
2357 auto all_totals = 0.0f;
2358
2359 for(auto p : state.world.nation_get_province_ownership(state.local_player_nation)) {
2360 auto province = p.get_province();
2361 if(state.world.province_get_nation_from_province_ownership(province) == state.world.province_get_nation_from_province_control(province)) {
2362 for(auto pl : province.get_pop_location()) {
2363 if(culture::pop_strata(pl.get_pop().get_poptype().get_strata()) == culture::pop_strata::poor) {
2364 all_totals += pl.get_pop().get_savings();
2365 type_totals.set(pl.get_pop().get_poptype(), type_totals.get(pl.get_pop().get_poptype()) + pl.get_pop().get_savings());
2366 }
2367 }
2368 }
2369 }
2370
2371 for(auto pt : state.world.in_pop_type) {
2372 if(type_totals.get(pt) > 0.0f && all_totals > 0.0f) {
2373 add_value(std::pair<std::string, float>(text::produce_simple_string(state, pt.get_name()), total * type_totals.get(pt) / all_totals));
2374 }
2375 }
2376 add_insert_bottom_spacer(state);
2377 } else {
2378 add_insert_neutral_spacer(state);
2379 }
2380 add_insert_section_header(state, budget_categories::middle_tax);
2381 if(budget_categories::expanded[budget_categories::middle_tax]) {
2382 add_insert_top_spacer(state);
2383
2384 auto total = economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::middle) * float(state.world.nation_get_middle_tax(state.local_player_nation)) / 100.0f;
2385 auto type_totals = state.world.pop_type_make_vectorizable_float_buffer();
2386 auto all_totals = 0.0f;
2387
2388 for(auto p : state.world.nation_get_province_ownership(state.local_player_nation)) {
2389 auto province = p.get_province();
2390 if(state.world.province_get_nation_from_province_ownership(province) == state.world.province_get_nation_from_province_control(province)) {
2391 for(auto pl : province.get_pop_location()) {
2392 if(culture::pop_strata(pl.get_pop().get_poptype().get_strata()) == culture::pop_strata::middle) {
2393 all_totals += pl.get_pop().get_savings();
2394 type_totals.set(pl.get_pop().get_poptype(), type_totals.get(pl.get_pop().get_poptype()) + pl.get_pop().get_savings());
2395 }
2396 }
2397 }
2398 }
2399
2400 for(auto pt : state.world.in_pop_type) {
2401 if(type_totals.get(pt) > 0.0f && all_totals > 0.0f) {
2402 add_value(std::pair<std::string, float>(text::produce_simple_string(state, pt.get_name()), total * type_totals.get(pt) / all_totals));
2403 }
2404 }
2405 add_insert_bottom_spacer(state);
2406 } else {
2407 add_insert_neutral_spacer(state);
2408 }
2409 add_insert_section_header(state, budget_categories::rich_tax);
2410 if(budget_categories::expanded[budget_categories::rich_tax]) {
2411 add_insert_top_spacer(state);
2412 auto total = economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::rich) * float(state.world.nation_get_rich_tax(state.local_player_nation)) / 100.0f;
2413 auto type_totals = state.world.pop_type_make_vectorizable_float_buffer();
2414 auto all_totals = 0.0f;
2415
2416 for(auto p : state.world.nation_get_province_ownership(state.local_player_nation)) {
2417 auto province = p.get_province();
2418 if(state.world.province_get_nation_from_province_ownership(province) == state.world.province_get_nation_from_province_control(province)) {
2419 for(auto pl : province.get_pop_location()) {
2420 if(culture::pop_strata(pl.get_pop().get_poptype().get_strata()) == culture::pop_strata::rich) {
2421 all_totals += pl.get_pop().get_savings();
2422 type_totals.set(pl.get_pop().get_poptype(), type_totals.get(pl.get_pop().get_poptype()) + pl.get_pop().get_savings());
2423 }
2424 }
2425 }
2426 }
2427
2428 for(auto pt : state.world.in_pop_type) {
2429 if(type_totals.get(pt) > 0.0f && all_totals > 0.0f) {
2430 add_value(std::pair<std::string, float>(text::produce_simple_string(state, pt.get_name()), total * type_totals.get(pt) / all_totals));
2431 }
2432 }
2433 add_insert_bottom_spacer(state);
2434 } else {
2435 add_insert_neutral_spacer(state);
2436 }
2437 add_insert_section_header(state, budget_categories::tariffs_import);
2438 if(budget_categories::expanded[budget_categories::tariffs_import]) {
2439 add_insert_top_spacer(state);
2440 auto totals = economy::explain_national_tariff(state, state.local_player_nation, true, false);
2441 for(auto& item : totals) {
2442 add_value(std::pair<std::string, float>(
2444 state.world.national_identity_get_name(
2445 state.world.nation_get_identity_from_identity_holder(item.trade_partner)
2446 )
2447 )
2448 +
2449 " ("
2450 +
2452 state.world.commodity_get_name(item.commodity)
2453 )
2454 +
2455 ")",
2456 item.tariff
2457 ));
2458 }
2459 add_insert_bottom_spacer(state);
2460 } else {
2461 add_insert_neutral_spacer(state);
2462 }
2463 add_insert_section_header(state, budget_categories::tariffs_export);
2464 if(budget_categories::expanded[budget_categories::tariffs_export]) {
2465 add_insert_top_spacer(state);
2466 auto totals = economy::explain_national_tariff(state, state.local_player_nation, false, true);
2467 for(auto& item : totals) {
2468 add_value(std::pair<std::string, float>(
2470 state.world.national_identity_get_name(
2471 state.world.nation_get_identity_from_identity_holder(item.trade_partner)
2472 )
2473 )
2474 +
2475 " ("
2476 +
2478 state.world.commodity_get_name(item.commodity)
2479 )
2480 +
2481 ")",
2482 item.tariff
2483 ));
2484 }
2485 add_insert_bottom_spacer(state);
2486 } else {
2487 add_insert_neutral_spacer(state);
2488 }
2489 add_insert_section_header(state, budget_categories::diplomatic_income);
2490 if(budget_categories::expanded[budget_categories::diplomatic_income]) {
2491 add_insert_top_spacer(state);
2492 add_value(std::pair<std::string, float>(text::produce_simple_string(state, "warsubsidies_button"), economy::estimate_war_subsidies_income(state, state.local_player_nation)));
2493 add_value(std::pair<std::string, float>(text::produce_simple_string(state, "alice_budget_indemnities"), economy::estimate_reparations_income(state, state.local_player_nation)));
2494 for(auto n : state.world.nation_get_overlord_as_ruler(state.local_player_nation)) {
2495 auto transferamt = economy::estimate_subject_payments_paid(state, n.get_subject());
2496 add_value(std::pair<std::string, float>(text::produce_simple_string(state, text::get_name(state, n.get_subject())), transferamt));
2497 }
2498 add_insert_bottom_spacer(state);
2499 } else {
2500 add_insert_neutral_spacer(state);
2501 }
2502 add_insert_section_header(state, budget_categories::gold);
2503 if(budget_categories::expanded[budget_categories::gold]) {
2504 add_insert_top_spacer(state);
2505 for(auto poid : state.world.nation_get_province_ownership_as_nation(state.local_player_nation)) {
2506 auto prov = poid.get_province();
2507
2508 float amount = 0.0f;
2509 state.world.for_each_commodity([&](dcon::commodity_id c) {
2510 if(state.world.commodity_get_money_rgo(c)) {
2511 amount += province::rgo_production_quantity(state, prov.id, c) * state.world.commodity_get_cost(c);
2512 }
2513 });
2514
2515 if(amount > 0.0f) {
2516 add_value(std::pair<std::string, float>(text::produce_simple_string(state, state.world.province_get_name(prov)), amount * state.defines.gold_to_cash_rate));
2517 }
2518 }
2519 add_insert_bottom_spacer(state);
2520 }
2521// END
2522 impl_apply_sort(state);
2523 impl_change_page(state, page);
2524}
2526// BEGIN main::income_table::create
2527// END
2528}
2531 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
2532// BEGIN main::expenses_page_left::lbutton_action
2533 main.expenses_table->change_page(state, main.expenses_table->page - 1);
2534// END
2536}
2539}
2540void budgetwindow_main_expenses_page_left_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2541 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2542}
2545// BEGIN main::expenses_page_left::update
2546 set_visible(state, main.expenses_table->max_page() > 0);
2547// END
2548}
2550// BEGIN main::expenses_page_left::create
2551// END
2552}
2553void budgetwindow_main_expenses_page_number_t::set_text(sys::state& state, std::string const& new_text) {
2554 if(new_text != cached_text) {
2555 cached_text = new_text;
2556 internal_layout.contents.clear();
2558 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2559 sl.add_text(state, cached_text);
2560 }
2561}
2563}
2564void budgetwindow_main_expenses_page_number_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2565 if(internal_layout.contents.empty()) return;
2566 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
2567 auto linesz = state.font_collection.line_height(state, fh);
2568 if(linesz == 0.0f) return;
2569 auto ycentered = (base_data.size.y - linesz) / 2;
2570 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
2571 for(auto& t : internal_layout.contents) {
2572 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
2573 }
2574}
2577// BEGIN main::expenses_page_number::update
2578 if(main.expenses_table->max_page() > 0) {
2579 set_text(state, std::to_string(main.expenses_table->page + 1) + "/" + std::to_string(main.expenses_table->max_page() + 1));
2580 } else {
2581 set_text(state, "");
2582 }
2583// END
2584}
2586// BEGIN main::expenses_page_number::create
2587// END
2588}
2591 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
2592// BEGIN main::expenses_page_right::lbutton_action
2593 main.expenses_table->change_page(state, main.expenses_table->page + 1);
2594// END
2596}
2599}
2600void budgetwindow_main_expenses_page_right_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2601 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2602}
2605// BEGIN main::expenses_page_right::update
2606 set_visible(state, main.expenses_table->max_page() > 0);
2607// END
2608}
2610// BEGIN main::expenses_page_right::create
2611// END
2612}
2613void budgetwindow_main_expenses_label_t::set_text(sys::state& state, std::string const& new_text) {
2614 if(new_text != cached_text) {
2615 cached_text = new_text;
2616 internal_layout.contents.clear();
2618 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2619 sl.add_text(state, cached_text);
2620 }
2621}
2623 cached_text = text::produce_simple_string(state, text_key);
2624 internal_layout.contents.clear();
2625 internal_layout.number_of_lines = 0;
2626 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2627 sl.add_text(state, cached_text);
2628}
2629void budgetwindow_main_expenses_label_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2630 if(internal_layout.contents.empty()) return;
2631 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
2632 auto linesz = state.font_collection.line_height(state, fh);
2633 if(linesz == 0.0f) return;
2634 auto ycentered = (base_data.size.y - linesz) / 2;
2635 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
2636 for(auto& t : internal_layout.contents) {
2637 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
2638 }
2639}
2642// BEGIN main::expenses_label::update
2643// END
2644}
2646 on_reset_text(state);
2647// BEGIN main::expenses_label::create
2648// END
2649}
2650void budgetwindow_main_expenses_amount_t::set_text(sys::state& state, std::string const& new_text) {
2651 if(new_text != cached_text) {
2652 cached_text = new_text;
2653 internal_layout.contents.clear();
2655 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2656 sl.add_text(state, cached_text);
2657 }
2658}
2660}
2661void budgetwindow_main_expenses_amount_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2662 if(internal_layout.contents.empty()) return;
2663 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
2664 auto linesz = state.font_collection.line_height(state, fh);
2665 if(linesz == 0.0f) return;
2666 auto ycentered = (base_data.size.y - linesz) / 2;
2667 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
2668 for(auto& t : internal_layout.contents) {
2669 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
2670 }
2671}
2674// BEGIN main::expenses_amount::update
2675 float total = 0.0f;
2676 total += economy::estimate_diplomatic_expenses(state, state.local_player_nation);
2677 total += economy::estimate_social_spending(state, state.local_player_nation) * float(state.world.nation_get_social_spending(state.local_player_nation)) / 100.0f;
2678 total += economy::estimate_pop_payouts_by_income_type(state, state.local_player_nation, culture::income_type::military) * float(state.world.nation_get_military_spending(state.local_player_nation)) * float(state.world.nation_get_military_spending(state.local_player_nation)) / 10000.0f;
2679 total += economy::estimate_pop_payouts_by_income_type(state, state.local_player_nation, culture::income_type::education) * float(state.world.nation_get_education_spending(state.local_player_nation)) * float(state.world.nation_get_education_spending(state.local_player_nation)) / 10000.0f;
2680 total += economy::estimate_pop_payouts_by_income_type(state, state.local_player_nation, culture::income_type::administration) * float(state.world.nation_get_administrative_spending(state.local_player_nation)) * float(state.world.nation_get_administrative_spending(state.local_player_nation)) / 10000.0f;
2681 total += economy::estimate_domestic_investment(state, state.local_player_nation) * float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) / 10000.0f;
2682 total += economy::estimate_overseas_penalty_spending(state, state.local_player_nation) * float(state.world.nation_get_overseas_spending(state.local_player_nation)) / 100.0f;
2683 total += economy::estimate_subsidy_spending(state, state.local_player_nation);
2684 total += economy::estimate_construction_spending(state, state.local_player_nation) * float(state.world.nation_get_construction_spending(state.local_player_nation)) / 100.0f;
2685 total += economy::estimate_land_spending(state, state.local_player_nation) * float(state.world.nation_get_land_spending(state.local_player_nation)) / 100.0f;
2686 total += economy::estimate_naval_spending(state, state.local_player_nation) * float(state.world.nation_get_naval_spending(state.local_player_nation)) / 100.0f;
2687 total += economy::interest_payment(state, state.local_player_nation);
2688 total += economy::estimate_stockpile_filling_spending(state, state.local_player_nation);
2689 set_text(state, text::prettify_currency(total));
2690// END
2691}
2693// BEGIN main::expenses_amount::create
2694// END
2695}
2697 {
2698 item_name_cached_text = text::produce_simple_string(state, item_name_text_key);
2699 item_name_internal_layout.contents.clear();
2700 item_name_internal_layout.number_of_lines = 0;
2701 text::single_line_layout sl{ item_name_internal_layout, text::layout_parameters{ 0, 0, int16_t(item_name_column_width - 24 - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, budgetwindow_main_expenses_table_row_t::item_name_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2702 sl.add_text(state, item_name_cached_text);
2703 }
2704 {
2705 item_value_cached_text = text::produce_simple_string(state, item_value_text_key);
2706 item_value_internal_layout.contents.clear();
2707 item_value_internal_layout.number_of_lines = 0;
2708 text::single_line_layout sl{ item_value_internal_layout, text::layout_parameters{ 0, 0, int16_t(item_value_column_width - 24 - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, budgetwindow_main_expenses_table_row_t::item_value_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2709 sl.add_text(state, item_value_cached_text);
2710 }
2711}
2712void budgetwindow_main_expenses_table_header_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2713 auto fh = text::make_font_id(state, false, 1.0f * 16);
2714 auto linesz = state.font_collection.line_height(state, fh);
2715 auto ycentered = (base_data.size.y - linesz) / 2;
2716 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) - ui::get_absolute_location(state, *this).x;
2717 ogl::render_textured_rect(state, ui::get_color_modification(false, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, budgetwindow_main_expenses_table_row_t::row_background_texture, budgetwindow_main_expenses_table_row_t::row_texture_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2718 bool col_um_lead_space = rel_mouse_x >= lead_space_column_start && rel_mouse_x < (lead_space_column_start + lead_space_column_width);
2719 bool col_um_item_name = rel_mouse_x >= item_name_column_start && rel_mouse_x < (item_name_column_start + item_name_column_width);
2720 if(col_um_item_name) {
2722 }
2723if(item_name_sort_direction > 0) {
2724 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name, false, true), float(x + item_name_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2725}
2726if(item_name_sort_direction < 0) {
2727 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name, false, true), float(x + item_name_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2728}
2729 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
2730 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name , false, true);
2731 for(auto& t : item_name_internal_layout.contents) {
2732 ui::render_text_chunk(state, t, float(x) + t.x + item_name_column_start + 24 + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_name_text_color), cmod);
2733 }
2734 }
2735 bool col_um_item_value = rel_mouse_x >= item_value_column_start && rel_mouse_x < (item_value_column_start + item_value_column_width);
2736 if(col_um_item_value) {
2738 }
2739if(item_value_sort_direction > 0) {
2740 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value, false, true), float(x + item_value_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, ascending_icon, ascending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2741}
2742if(item_value_sort_direction < 0) {
2743 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value, false, true), float(x + item_value_column_start + 8), float(y + base_data.size.y / 2 - 8), float(16), float(16), ogl::get_late_load_texture_handle(state, descending_icon, descending_icon_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2744}
2745 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
2746 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value , false, true);
2747 for(auto& t : item_value_internal_layout.contents) {
2748 ui::render_text_chunk(state, t, float(x) + t.x + item_value_column_start + 24 + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_value_text_color), cmod);
2749 }
2750 }
2752}
2754 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
2755 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
2756 auto old_direction = item_name_sort_direction;
2757 item_name_sort_direction = 0;
2758 item_value_sort_direction = 0;
2759 item_name_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
2760 (( budgetwindow_main_expenses_table_t*)parent)->apply_sort(state);
2761 }
2762 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
2763 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
2764 auto old_direction = item_value_sort_direction;
2765 item_name_sort_direction = 0;
2766 item_value_sort_direction = 0;
2767 item_value_sort_direction = int8_t(old_direction <= 0 ? 1 : -1);
2768 (( budgetwindow_main_expenses_table_t*)parent)->apply_sort(state);
2769 }
2774 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
2775 }
2776 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
2777 }
2778 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
2779 }
2780}
2781void budgetwindow_main_expenses_table_header_t::tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept {
2782 if(x >= lead_space_column_start && x < lead_space_column_start + lead_space_column_width) {
2783 }
2784 if(x >= item_name_column_start && x < item_name_column_start + item_name_column_width) {
2785 }
2786 if(x >= item_value_column_start && x < item_value_column_start + item_value_column_width) {
2787 }
2788 ident = -1;
2789 subrect.top_left = ui::get_absolute_location(state, *this);
2790 subrect.size = base_data.size;
2791}
2793 on_reset_text(state);
2794}
2795void budgetwindow_main_expenses_table_row_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
2796 auto fh = text::make_font_id(state, false, 1.0f * 16);
2797 auto linesz = state.font_collection.line_height(state, fh);
2798 auto ycentered = (base_data.size.y - linesz) / 2;
2799 int32_t rel_mouse_x = int32_t(state.mouse_x_position / state.user_settings.ui_scale) - ui::get_absolute_location(state, *this).x;
2800 if(alternate_row) {
2801 ogl::render_textured_rect(state, ui::get_color_modification(false, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, alt_row_background_texture, alt_row_texture_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2802 } else {
2803 ogl::render_textured_rect(state, ui::get_color_modification(false, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, row_background_texture, row_texture_key), ui::rotation::upright, false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
2804 }
2805 if(this == state.ui_state.under_mouse) {
2807 }
2810 if(col_um_item_name && this != state.ui_state.under_mouse) {
2812 }
2813 if(!item_name_internal_layout.contents.empty() && linesz > 0.0f) {
2814 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_name , false, false);
2815 for(auto& t : item_name_internal_layout.contents) {
2816 ui::render_text_chunk(state, t, float(x) + t.x + budgetwindow_main_expenses_table_header_t::item_name_column_start + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_name_text_color), cmod);
2817 }
2818 }
2820 if(col_um_item_value && this != state.ui_state.under_mouse) {
2822 }
2823 if(!item_value_internal_layout.contents.empty() && linesz > 0.0f) {
2824 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse && col_um_item_value , false, false);
2825 for(auto& t : item_value_internal_layout.contents) {
2826 ui::render_text_chunk(state, t, float(x) + t.x + budgetwindow_main_expenses_table_header_t::item_value_column_start + 8, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, item_value_text_color), cmod);
2827 }
2828 }
2829}
2836 }
2838 }
2840 }
2841}
2842void budgetwindow_main_expenses_table_row_t::tooltip_position(sys::state& state, int32_t x, int32_t y, int32_t& ident, ui::urect& subrect) noexcept {
2844 }
2846 }
2848 }
2849 ident = -1;
2850 subrect.top_left = ui::get_absolute_location(state, *this);
2851 subrect.size = base_data.size;
2852}
2854}
2857 budgetwindow_main_t& main = *((budgetwindow_main_t*)(parent->parent));
2858// BEGIN main::expenses_table::row_update
2859 set_item_name_text(state, value.first);
2860 set_item_value_text(state, text::prettify_currency(value.second));
2861// END
2862}
2864 if(new_text != item_name_cached_text) {
2865 item_name_cached_text = new_text;
2868 {
2869 text::single_line_layout sl{ item_name_internal_layout, text::layout_parameters{ 0, 0, int16_t(budgetwindow_main_expenses_table_header_t::item_name_column_width - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, item_name_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2870 sl.add_text(state, item_name_cached_text);
2871 }
2872 } else {
2873 }
2874}
2876 if(new_text != item_value_cached_text) {
2877 item_value_cached_text = new_text;
2880 {
2881 text::single_line_layout sl{ item_value_internal_layout, text::layout_parameters{ 0, 0, int16_t(budgetwindow_main_expenses_table_header_t::item_value_column_width - 16), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, false, 1.0f * 16), 0, item_value_text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
2882 sl.add_text(state, item_value_cached_text);
2883 }
2884 } else {
2885 }
2886}
2888 size_t section_header_pool_used = 0;
2889 size_t neutral_spacer_pool_used = 0;
2890 size_t bottom_spacer_pool_used = 0;
2891 size_t top_spacer_pool_used = 0;
2892 size_t row_pool_used = 0;
2893 size_t header_pool_used = 0;
2894 int16_t vert_used = 0;
2895 bool alt_bg = true;
2896 page = std::clamp(new_page, 0, max_page());
2897 children.clear();
2898 if(page_starts.empty()) return;
2899 if(open_page) { page_starts.push_back(int32_t(values.size())); open_page = false; }
2900 for(int32_t i = page_starts[page]; i < page_starts[page + 1]; ++i) {
2901 if(std::holds_alternative<section_header_option>(values[i])) {
2902 if(section_header_pool_used >= section_header_pool.size()) section_header_pool.emplace_back(make_budgetwindow_section_header(state));
2903 children.push_back(section_header_pool[section_header_pool_used].get());
2904 children.back()->parent = this;
2905 ((budgetwindow_section_header_t*)(section_header_pool[section_header_pool_used].get()))->section_type = std::get<section_header_option>(values[i]).section_type;
2906 section_header_pool[section_header_pool_used]->base_data.position.y = vert_used;
2907 vert_used += section_header_pool[section_header_pool_used]->base_data.size.y;
2908 ++section_header_pool_used;
2909 alt_bg = false;
2910 }
2911 if(std::holds_alternative<neutral_spacer_option>(values[i])) {
2912 if(neutral_spacer_pool_used >= neutral_spacer_pool.size()) neutral_spacer_pool.emplace_back(make_budgetwindow_neutral_spacer(state));
2913 children.push_back(neutral_spacer_pool[neutral_spacer_pool_used].get());
2914 children.back()->parent = this;
2915 neutral_spacer_pool[neutral_spacer_pool_used]->base_data.position.y = vert_used;
2916 vert_used += neutral_spacer_pool[neutral_spacer_pool_used]->base_data.size.y;
2917 ++neutral_spacer_pool_used;
2918 alt_bg = false;
2919 }
2920 if(std::holds_alternative<bottom_spacer_option>(values[i])) {
2921 if(bottom_spacer_pool_used >= bottom_spacer_pool.size()) bottom_spacer_pool.emplace_back(make_budgetwindow_bottom_spacer(state));
2922 children.push_back(bottom_spacer_pool[bottom_spacer_pool_used].get());
2923 children.back()->parent = this;
2924 bottom_spacer_pool[bottom_spacer_pool_used]->base_data.position.y = vert_used;
2925 vert_used += bottom_spacer_pool[bottom_spacer_pool_used]->base_data.size.y;
2926 ++bottom_spacer_pool_used;
2927 alt_bg = false;
2928 }
2929 if(std::holds_alternative<top_spacer_option>(values[i])) {
2930 if(top_spacer_pool_used >= top_spacer_pool.size()) top_spacer_pool.emplace_back(make_budgetwindow_top_spacer(state));
2931 children.push_back(top_spacer_pool[top_spacer_pool_used].get());
2932 children.back()->parent = this;
2933 top_spacer_pool[top_spacer_pool_used]->base_data.position.y = vert_used;
2934 vert_used += top_spacer_pool[top_spacer_pool_used]->base_data.size.y;
2935 ++top_spacer_pool_used;
2936 alt_bg = false;
2937 }
2938 if(std::holds_alternative<value_option>(values[i])) {
2939 if(row_pool_used >= row_pool.size())row_pool.emplace_back(make_row(state));
2940 children.push_back(row_pool[row_pool_used].get());
2941 children.back()->parent = this;
2942 row_pool[row_pool_used]->value = std::get<value_option>(values[i]).value;
2943 row_pool[row_pool_used]->alternate_row = alt_bg;
2944 row_pool[row_pool_used]->base_data.position.y = vert_used;
2945 vert_used += row_pool[row_pool_used]->base_data.size.y;
2946 ++row_pool_used;
2947 alt_bg = !alt_bg;
2948 }
2949 if(std::holds_alternative<std::monostate>(values[i])) {
2950 if(header_pool_used >= header_pool.size()) header_pool.emplace_back(make_headers(state));
2951 children.push_back(header_pool[header_pool_used].get());
2952 children.back()->parent = this;
2953 header_pool[header_pool_used]->base_data.position.y = vert_used;
2954 vert_used += header_pool[header_pool_used]->base_data.size.y;
2955 ++header_pool_used;
2956 alt_bg = true;
2957 }
2958 }
2959}
2961 bool lflip = new_page < page && page > 0;
2962 bool rflip = new_page > page && page < max_page();
2963 if(rflip) {
2964 auto pos = ui::get_absolute_location(state, *this);
2965 state.ui_animation.start_animation(state, pos.x, pos.y, base_data.size.x, base_data.size.y, ogl::animation::type::page_flip_left, 200);
2966 } else if(lflip) {
2967 auto pos = ui::get_absolute_location(state, *this);
2968 state.ui_animation.start_animation(state, pos.x, pos.y, base_data.size.x, base_data.size.y, ogl::animation::type::page_flip_left_rev, 200);
2969 }
2970 impl_change_page(state, new_page); for(auto c : children) c->impl_on_update(state);
2971 state.game_state_updated.store(true, std::memory_order::release);
2972 if(rflip || lflip) {
2973 state.ui_animation.post_update_frame(state);
2974 }
2975}
2977 return open_page ? std::max(int32_t(page_starts.size()) - 1, 0) : std::max(int32_t(page_starts.size()) - 2, 0);
2978}
2980 children.clear();
2981 page_starts.clear();
2982 values.clear();
2983 open_page = false;
2984 layout_space = 0;
2985}
2986void budgetwindow_main_expenses_table_t::add_value(std::pair<std::string, float> const& v) {
2987 if(!open_page) {
2988 page_starts.push_back(0);
2989 open_page = true;
2990 }
2991 if(values.empty() || !std::holds_alternative<value_option>(values.back())) {
2992 if(base_data.size.y - layout_space <= 2 * int32_t(row_height * 8)) {
2993 page_starts.push_back(int32_t(values.size()));
2994 layout_space = 0;
2995 }
2996 values.emplace_back(std::monostate{});
2997 layout_space += int16_t(row_height * 8);
2998 }
2999 if(base_data.size.y - layout_space <= int32_t(row_height * 8)) {
3000 page_starts.push_back(int32_t(values.size()));
3001 layout_space = 0;
3002 values.emplace_back(std::monostate{});
3003 layout_space += int16_t(row_height * 8);
3004 }
3005 values.emplace_back(value_option{v});
3006 layout_space += int16_t(row_height * 8);
3007}
3010 if(!open_page) {
3011 page_starts.push_back(0);
3012 open_page = true;
3013 }
3014 if(base_data.size.y - layout_space <= section_header_pool[0]->base_data.size.y) {
3015 page_starts.push_back(int32_t(values.size()));
3016 layout_space = 0;
3017 }
3018 values.emplace_back(section_header_option{section_type});
3020}
3023 if(!open_page) {
3024 page_starts.push_back(0);
3025 open_page = true;
3026 }
3027 if(base_data.size.y - layout_space <= neutral_spacer_pool[0]->base_data.size.y) {
3028 page_starts.push_back(int32_t(values.size()));
3029 layout_space = 0;
3030 }
3031 values.emplace_back(neutral_spacer_option{});
3033}
3036 if(!open_page) {
3037 page_starts.push_back(0);
3038 open_page = true;
3039 }
3040 if(base_data.size.y - layout_space <= bottom_spacer_pool[0]->base_data.size.y) {
3041 page_starts.push_back(int32_t(values.size()));
3042 layout_space = 0;
3043 }
3044 values.emplace_back(bottom_spacer_option{});
3046}
3048 if(top_spacer_pool.empty()) top_spacer_pool.emplace_back(make_budgetwindow_top_spacer(state));
3049 if(!open_page) {
3050 page_starts.push_back(0);
3051 open_page = true;
3052 }
3053 if(base_data.size.y - layout_space <= top_spacer_pool[0]->base_data.size.y) {
3054 page_starts.push_back(int32_t(values.size()));
3055 layout_space = 0;
3056 }
3057 values.emplace_back(top_spacer_option{});
3059}
3060std::unique_ptr<budgetwindow_main_expenses_table_row_t> budgetwindow_main_expenses_table_t::make_row(sys::state& state) {
3061 auto cptr = std::make_unique<budgetwindow_main_expenses_table_row_t>();
3062 cptr->parent = this;
3063 cptr->base_data.position.x = 0;
3064 cptr->base_data.position.y = 0;
3065 cptr->base_data.size.y = int16_t(row_height * 8);
3066 cptr->base_data.size.x = this->base_data.size.x;
3067 cptr->on_create(state);
3068 return cptr;
3069}
3070std::unique_ptr<budgetwindow_main_expenses_table_header_t> budgetwindow_main_expenses_table_t::make_headers(sys::state& state){
3071 auto cptr = std::make_unique<budgetwindow_main_expenses_table_header_t>();
3072 cptr->parent = this;
3073 cptr->base_data.position.x = 0;
3074 cptr->base_data.position.y = 0;
3075 cptr->base_data.size.y = int16_t(row_height * 8);
3076 cptr->base_data.size.x = this->base_data.size.x;
3077 cptr->on_create(state);
3078 return cptr;
3079}
3081 bool work_to_do = false;
3084 if(!work_to_do) return;
3086 std::vector<std::pair<std::string, float>> val_temp;
3087 size_t i = 0;
3088 while(i < values.size()) {
3089 if(std::holds_alternative<value_option>(values[i])) {
3090 auto start_pos = i;
3091 do {
3092 if(std::holds_alternative<value_option>(values[i])) val_temp.push_back(std::get<value_option>(values[i]).value);
3093 ++i;
3094 } while(i < values.size() && (std::holds_alternative<value_option>(values[i]) || std::holds_alternative<std::monostate>(values[i])));
3096 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](const std::pair<std::string, float>& a, const std::pair<std::string, float>& b){
3097 int8_t result = 0;
3098// BEGIN main::expenses_table::sort::item_name
3099 result = int8_t(std::clamp(a.first.compare(b.first), -1, 1));
3100// END
3101 return result == budgetwindow_main_expenses_table_header_t::item_name_sort_direction;
3102 });
3103 }
3105 sys::merge_sort(val_temp.begin(), val_temp.end(), [&](const std::pair<std::string, float>& a, const std::pair<std::string, float>& b){
3106 int8_t result = 0;
3107// BEGIN main::expenses_table::sort::item_value
3108 if(a.second == b.second)
3109 result = 0;
3110 else
3111 result = (a.second < b.second) ? -1 : 1;
3112// END
3113 return result == budgetwindow_main_expenses_table_header_t::item_value_sort_direction;
3114 });
3115 }
3116 while(start_pos < i) {
3117 if(std::holds_alternative<value_option>(values[start_pos])) {
3118 std::get<value_option>(values[start_pos]).value = val_temp.back();
3119 val_temp.pop_back();
3120 }
3121 ++start_pos;
3122 }
3123 val_temp.clear();
3124 } else {
3125 ++i;
3126 }
3127 }
3128}
3130 impl_apply_sort(state);
3131 impl_change_page(state, page); for(auto c : children) c->impl_on_update(state);
3132}
3133ui::message_result budgetwindow_main_expenses_table_t::on_scroll(sys::state& state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept {
3134 change_page(state, page + ((amount < 0) ? 1 : -1));
3136}
3139// BEGIN main::expenses_table::update
3140 clear_table();
3141 add_insert_section_header(state, budget_categories::construction);
3142 if(budget_categories::expanded[budget_categories::construction]) {
3143 // TODO
3144 } else {
3145 add_insert_neutral_spacer(state);
3146 }
3147 add_insert_section_header(state, budget_categories::army_upkeep);
3148 if(budget_categories::expanded[budget_categories::army_upkeep]) {
3149 add_insert_top_spacer(state);
3150 auto fraction = float(state.world.nation_get_land_spending(state.local_player_nation)) / 100.0f;
3151 auto goods = state.world.commodity_make_vectorizable_float_buffer();
3152
3153 uint32_t total_commodities = state.world.commodity_size();
3154 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](auto soid) {
3155 auto local_state = state.world.state_ownership_get_state(soid);
3156 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3157 for(uint32_t i = 1; i < total_commodities; ++i) {
3158 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3159 goods.set(cid, goods.get(cid) + state.world.market_get_army_demand(market, cid)
3160 * economy::price(state, market, cid)
3161 * state.world.market_get_demand_satisfaction(market, cid));
3162 }
3163 });
3164 for(auto c : state.world.in_commodity) {
3165 if(goods.get(c) > 0.0f) {
3166 add_value(std::pair<std::string, float>(text::produce_simple_string(state, state.world.commodity_get_name(c)), goods.get(c) * fraction));
3167 }
3168 }
3169 add_insert_bottom_spacer(state);
3170 } else {
3171 add_insert_neutral_spacer(state);
3172 }
3173 add_insert_section_header(state, budget_categories::navy_upkeep);
3174 if(budget_categories::expanded[budget_categories::navy_upkeep]) {
3175 add_insert_top_spacer(state);
3176 auto fraction = float(state.world.nation_get_naval_spending(state.local_player_nation)) / 100.0f;
3177 auto goods = state.world.commodity_make_vectorizable_float_buffer();
3178
3179 uint32_t total_commodities = state.world.commodity_size();
3180 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](auto soid) {
3181 auto local_state = state.world.state_ownership_get_state(soid);
3182 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3183 for(uint32_t i = 1; i < total_commodities; ++i) {
3184 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3185 goods.set(cid, goods.get(cid) + state.world.market_get_navy_demand(market, cid)
3186 * economy::price(state, market, cid)
3187 * state.world.market_get_demand_satisfaction(market, cid));
3188 }
3189 });
3190 for(auto c : state.world.in_commodity) {
3191 if(goods.get(c) > 0.0f) {
3192 add_value(std::pair<std::string, float>(text::produce_simple_string(state, state.world.commodity_get_name(c)), goods.get(c) * fraction));
3193 }
3194 }
3195 add_insert_bottom_spacer(state);
3196 } else {
3197 add_insert_neutral_spacer(state);
3198 }
3199 add_insert_section_header(state, budget_categories::admin);
3200 if(budget_categories::expanded[budget_categories::admin]) {
3201 add_insert_top_spacer(state);
3202 auto fraction = float(state.world.nation_get_administrative_spending(state.local_player_nation)) / 100.0f;
3204 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](auto soid) {
3205 auto local_state = state.world.state_ownership_get_state(soid);
3206 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3207 float total = 0.0f;
3208 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3209 auto adj_pop_of_type =
3210 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3211
3212 if(adj_pop_of_type <= 0)
3213 return;
3214
3215 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3216 if(ln_type == in) {
3217 total += adj_pop_of_type * state.world.market_get_life_needs_costs(market, pt);
3218 }
3219 auto en_type = culture::income_type(state.world.pop_type_get_everyday_needs_income_type(pt));
3220 if(en_type == in) {
3221 total += adj_pop_of_type * state.world.market_get_everyday_needs_costs(market, pt);
3222 }
3223 auto lx_type = culture::income_type(state.world.pop_type_get_luxury_needs_income_type(pt));
3224 if(lx_type == in) {
3225 total += adj_pop_of_type * state.world.market_get_luxury_needs_costs(market, pt);
3226 }
3227 });
3228 if(total > 0.0f) {
3229 add_value(std::pair<std::string, float>(text::get_dynamic_state_name(state, local_state), total * fraction));
3230 }
3231 });
3232 add_insert_bottom_spacer(state);
3233 } else {
3234 add_insert_neutral_spacer(state);
3235 }
3236 add_insert_section_header(state, budget_categories::education);
3237 if(budget_categories::expanded[budget_categories::education]) {
3238 add_insert_top_spacer(state);
3239 auto fraction = float(state.world.nation_get_education_spending(state.local_player_nation)) / 100.0f;
3241 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](auto soid) {
3242 auto local_state = state.world.state_ownership_get_state(soid);
3243 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3244 float total = 0.0f;
3245 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3246 auto adj_pop_of_type =
3247 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3248
3249 if(adj_pop_of_type <= 0)
3250 return;
3251
3252 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3253 if(ln_type == in) {
3254 total += adj_pop_of_type * state.world.market_get_life_needs_costs(market, pt);
3255 }
3256 auto en_type = culture::income_type(state.world.pop_type_get_everyday_needs_income_type(pt));
3257 if(en_type == in) {
3258 total += adj_pop_of_type * state.world.market_get_everyday_needs_costs(market, pt);
3259 }
3260 auto lx_type = culture::income_type(state.world.pop_type_get_luxury_needs_income_type(pt));
3261 if(lx_type == in) {
3262 total += adj_pop_of_type * state.world.market_get_luxury_needs_costs(market, pt);
3263 }
3264 });
3265 if(total > 0.0f) {
3266 add_value(std::pair<std::string, float>(text::get_dynamic_state_name(state, local_state), total * fraction));
3267 }
3268 });
3269 add_insert_bottom_spacer(state);
3270 } else {
3271 add_insert_neutral_spacer(state);
3272 }
3273 add_insert_section_header(state, budget_categories::social);
3274 if(budget_categories::expanded[budget_categories::social]) {
3275 add_insert_top_spacer(state);
3276 auto const p_level = state.world.nation_get_modifier_values(state.local_player_nation, sys::national_mod_offsets::pension_level);
3277 auto const unemp_level = state.world.nation_get_modifier_values(state.local_player_nation, sys::national_mod_offsets::unemployment_benefit);
3278 auto fraction = float(state.world.nation_get_social_spending(state.local_player_nation)) / 100.0f;
3279
3280 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](auto soid) {
3281 auto local_state = state.world.state_ownership_get_state(soid);
3282 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3283 float total = 0.0f;
3284
3285 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3286 auto adj_pop_of_type =
3287 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt))
3288 / state.defines.alice_needs_scaling_factor;
3289 if(adj_pop_of_type <= 0)
3290 return;
3291
3292 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3293 if(ln_type == culture::income_type::administration || ln_type == culture::income_type::education || ln_type == culture::income_type::military) {
3294 //nothing
3295 } else { // unemployment, pensions
3296 total += adj_pop_of_type * p_level * state.world.market_get_life_needs_costs(market, pt);
3297 if(state.world.pop_type_get_has_unemployment(pt)) {
3298 auto emp = state.world.state_instance_get_demographics(local_state, demographics::to_employment_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3299 total +=
3300 (adj_pop_of_type - emp)
3301 * unemp_level
3302 * state.world.market_get_life_needs_costs(market, pt);
3303 }
3304 }
3305 });
3306 if(total > 0.0f) {
3307 add_value(std::pair<std::string, float>(text::get_dynamic_state_name(state, local_state), total * fraction));
3308 }
3309 });
3310 add_insert_bottom_spacer(state);
3311 } else {
3312 add_insert_neutral_spacer(state);
3313 }
3314 add_insert_section_header(state, budget_categories::military);
3315 if(budget_categories::expanded[budget_categories::military]) {
3316 add_insert_top_spacer(state);
3317 auto fraction = float(state.world.nation_get_military_spending(state.local_player_nation)) / 100.0f;
3319 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](auto soid) {
3320 auto local_state = state.world.state_ownership_get_state(soid);
3321 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3322 float total = 0.0f;
3323 state.world.for_each_pop_type([&](dcon::pop_type_id pt) {
3324 auto adj_pop_of_type =
3325 state.world.state_instance_get_demographics(local_state, demographics::to_key(state, pt)) / state.defines.alice_needs_scaling_factor;
3326
3327 if(adj_pop_of_type <= 0)
3328 return;
3329
3330 auto ln_type = culture::income_type(state.world.pop_type_get_life_needs_income_type(pt));
3331 if(ln_type == in) {
3332 total += adj_pop_of_type * state.world.market_get_life_needs_costs(market, pt);
3333 }
3334 auto en_type = culture::income_type(state.world.pop_type_get_everyday_needs_income_type(pt));
3335 if(en_type == in) {
3336 total += adj_pop_of_type * state.world.market_get_everyday_needs_costs(market, pt);
3337 }
3338 auto lx_type = culture::income_type(state.world.pop_type_get_luxury_needs_income_type(pt));
3339 if(lx_type == in) {
3340 total += adj_pop_of_type * state.world.market_get_luxury_needs_costs(market, pt);
3341 }
3342 });
3343 if(total > 0.0f) {
3344 add_value(std::pair<std::string, float>(text::get_dynamic_state_name(state, local_state), total * fraction));
3345 }
3346 });
3347 add_insert_bottom_spacer(state);
3348 } else {
3349 add_insert_neutral_spacer(state);
3350 }
3351 add_insert_section_header(state, budget_categories::domestic_investment);
3352 if(budget_categories::expanded[budget_categories::domestic_investment]) {
3353 add_insert_top_spacer(state);
3354 auto cap_total = 0.f;
3355 auto aristo_total = 0.f;
3356 state.world.nation_for_each_state_ownership(state.local_player_nation, [&](auto soid) {
3357 auto local_state = state.world.state_ownership_get_state(soid);
3358 auto market = state.world.state_instance_get_market_from_local_market(local_state);
3359 auto adj_pop_of_type_capis = (state.world.state_instance_get_demographics(
3360 local_state, demographics::to_key(state, state.culture_definitions.capitalists))
3361 ) / state.defines.alice_needs_scaling_factor;
3362 auto adj_pop_of_type_arist = (state.world.state_instance_get_demographics(
3363 local_state, demographics::to_key(state, state.culture_definitions.aristocrat))
3364 ) / state.defines.alice_needs_scaling_factor;
3365 float arist_costs =
3366 state.world.market_get_life_needs_costs(market, state.culture_definitions.aristocrat)
3367 + state.world.market_get_everyday_needs_costs(market, state.culture_definitions.aristocrat)
3368 + state.world.market_get_luxury_needs_costs(market, state.culture_definitions.aristocrat);
3369 float capis_costs =
3370 state.world.market_get_life_needs_costs(market, state.culture_definitions.capitalists)
3371 + state.world.market_get_everyday_needs_costs(market, state.culture_definitions.capitalists)
3372 + state.world.market_get_luxury_needs_costs(market, state.culture_definitions.capitalists);
3373
3374 cap_total += state.defines.alice_domestic_investment_multiplier * ( adj_pop_of_type_capis * capis_costs );
3375 aristo_total += state.defines.alice_domestic_investment_multiplier * (adj_pop_of_type_arist * arist_costs );
3376 });
3377 add_value(std::pair<std::string, float>(text::produce_simple_string(state, state.world.pop_type_get_name(state.culture_definitions.capitalists)), cap_total * float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) / 100.0f));
3378 add_value(std::pair<std::string, float>(text::produce_simple_string(state, state.world.pop_type_get_name(state.culture_definitions.aristocrat)), aristo_total * float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) / 100.0f));
3379 add_insert_bottom_spacer(state);
3380 } else {
3381 add_insert_neutral_spacer(state);
3382 }
3383 add_insert_section_header(state, budget_categories::overseas_spending);
3384 if(budget_categories::expanded[budget_categories::overseas_spending]) {
3385 add_insert_top_spacer(state);
3386 auto capital = state.world.nation_get_capital(state.local_player_nation);
3387 auto capital_state = state.world.province_get_state_membership(capital);
3388 auto market = state.world.state_instance_get_market_from_local_market(capital_state);
3389
3390 auto overseas_factor = state.defines.province_overseas_penalty * float(state.world.nation_get_owned_province_count(state.local_player_nation) - state.world.nation_get_central_province_count(state.local_player_nation));
3391 uint32_t total_commodities = state.world.commodity_size();
3392
3393 if(overseas_factor > 0) {
3394 for(uint32_t i = 1; i < total_commodities; ++i) {
3395 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3396
3397 if(state.world.commodity_get_overseas_penalty(cid) && (state.world.commodity_get_is_available_from_start(cid) || state.world.nation_get_unlocked_commodities(state.local_player_nation, cid))) {
3398 auto amount =
3399 overseas_factor * economy::price(state, market, cid) * state.world.market_get_demand_satisfaction(market, cid) * float(state.world.nation_get_overseas_spending(state.local_player_nation)) / 100.0f;
3400 add_value(std::pair<std::string, float>(text::produce_simple_string(state, state.world.commodity_get_name(cid)), amount));
3401 }
3402 }
3403 }
3404 add_insert_bottom_spacer(state);
3405 } else {
3406 add_insert_neutral_spacer(state);
3407 }
3408 add_insert_section_header(state, budget_categories::diplomatic_expenses);
3409 if(budget_categories::expanded[budget_categories::diplomatic_expenses]) {
3410 add_insert_top_spacer(state);
3411 add_value(std::pair<std::string, float>(text::produce_simple_string(state, "warsubsidies_button"), economy::estimate_war_subsidies_spending(state, state.local_player_nation)));
3412 add_value(std::pair<std::string, float>(text::produce_simple_string(state, "alice_budget_indemnities"), economy::estimate_reparations_spending(state, state.local_player_nation)));
3413 add_value(std::pair<std::string, float>(text::produce_simple_string(state, "alice_budget_overlord"), economy::estimate_subject_payments_paid(state, state.local_player_nation)));
3414 add_insert_bottom_spacer(state);
3415 } else {
3416 add_insert_neutral_spacer(state);
3417 }
3418 add_insert_section_header(state, budget_categories::debt_payment);
3419 if(budget_categories::expanded[budget_categories::debt_payment]) {
3420 // TODO?
3421 } else {
3422 add_insert_neutral_spacer(state);
3423 }
3424 add_insert_section_header(state, budget_categories::stockpile);
3425 if(budget_categories::expanded[budget_categories::stockpile]) {
3426 add_insert_top_spacer(state);
3427 uint32_t total_commodities = state.world.commodity_size();
3428
3429 auto capital = state.world.nation_get_capital(state.local_player_nation);
3430 auto capital_state = state.world.province_get_state_membership(capital);
3431 auto market = state.world.state_instance_get_market_from_local_market(capital_state);
3432
3433 for(uint32_t i = 1; i < total_commodities; ++i) {
3434 dcon::commodity_id cid{ dcon::commodity_id::value_base_t(i) };
3435 auto difference =
3436 state.world.nation_get_stockpile_targets(state.local_player_nation, cid)
3437 - state.world.nation_get_stockpiles(state.local_player_nation, cid);
3438
3439 if(difference > 0 && state.world.nation_get_drawing_on_stockpiles(state.local_player_nation, cid) == false) {
3440 auto amount = difference * economy::price(state, market, cid) * state.world.market_get_demand_satisfaction(market, cid);
3441 if(amount > 0) {
3442 add_value(std::pair<std::string, float>(text::produce_simple_string(state, state.world.commodity_get_name(cid)), amount));
3443 }
3444 }
3445 }
3446 add_insert_bottom_spacer(state);
3447 }
3448// END
3449 impl_apply_sort(state);
3450 impl_change_page(state, page);
3451}
3452void budgetwindow_main_expenses_table_t::on_create(sys::state& state) noexcept {
3453// BEGIN main::expenses_table::create
3454// END
3455}
3456void budgetwindow_main_admin_eff1_t::set_text(sys::state& state, std::string const& new_text) {
3457 if(new_text != cached_text) {
3458 cached_text = new_text;
3459 internal_layout.contents.clear();
3460 internal_layout.number_of_lines = 0;
3461 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3462 sl.add_text(state, cached_text);
3463 }
3464}
3465void budgetwindow_main_admin_eff1_t::on_reset_text(sys::state& state) noexcept {
3466 cached_text = text::produce_simple_string(state, text_key);
3467 internal_layout.contents.clear();
3468 internal_layout.number_of_lines = 0;
3469 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3470 sl.add_text(state, cached_text);
3471}
3472void budgetwindow_main_admin_eff1_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3473 if(internal_layout.contents.empty()) return;
3474 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3475 auto linesz = state.font_collection.line_height(state, fh);
3476 if(linesz == 0.0f) return;
3477 auto ycentered = (base_data.size.y - linesz) / 2;
3478 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3479 for(auto& t : internal_layout.contents) {
3480 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3481 }
3482}
3483void budgetwindow_main_admin_eff1_t::on_update(sys::state& state) noexcept {
3485// BEGIN main::admin_eff1::update
3486// END
3487}
3488void budgetwindow_main_admin_eff1_t::on_create(sys::state& state) noexcept {
3489 on_reset_text(state);
3490// BEGIN main::admin_eff1::create
3491// END
3492}
3493void budgetwindow_main_admin_eff2_t::set_text(sys::state& state, std::string const& new_text) {
3494 if(new_text != cached_text) {
3495 cached_text = new_text;
3496 internal_layout.contents.clear();
3497 internal_layout.number_of_lines = 0;
3498 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3499 sl.add_text(state, cached_text);
3500 }
3501}
3502void budgetwindow_main_admin_eff2_t::on_reset_text(sys::state& state) noexcept {
3503 cached_text = text::produce_simple_string(state, text_key);
3504 internal_layout.contents.clear();
3505 internal_layout.number_of_lines = 0;
3506 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3507 sl.add_text(state, cached_text);
3508}
3509void budgetwindow_main_admin_eff2_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3510 if(internal_layout.contents.empty()) return;
3511 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3512 auto linesz = state.font_collection.line_height(state, fh);
3513 if(linesz == 0.0f) return;
3514 auto ycentered = (base_data.size.y - linesz) / 2;
3515 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3516 for(auto& t : internal_layout.contents) {
3517 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3518 }
3519}
3520void budgetwindow_main_admin_eff2_t::on_update(sys::state& state) noexcept {
3522// BEGIN main::admin_eff2::update
3523// END
3524}
3525void budgetwindow_main_admin_eff2_t::on_create(sys::state& state) noexcept {
3526 on_reset_text(state);
3527// BEGIN main::admin_eff2::create
3528// END
3529}
3530void budgetwindow_main_admin_eff_amount_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
3532// BEGIN main::admin_eff_amount::tooltip
3533 auto n = state.local_player_nation;
3534
3535 {
3538 text::fp_percentage{ 1.0f + state.world.nation_get_modifier_values(n, sys::national_mod_offsets::administrative_efficiency_modifier) });
3539 auto box = text::open_layout_box(contents, 0);
3540 text::localised_format_box(state, contents, box, "admin_explain_1", m);
3541 text::close_layout_box(contents, box);
3542 }
3543 ui::active_modifiers_description(state, contents, n, 15, sys::national_mod_offsets::administrative_efficiency_modifier,
3544 false);
3545 {
3546 auto non_colonial = state.world.nation_get_non_colonial_population(n);
3547 auto total = non_colonial > 0.0f ? state.world.nation_get_non_colonial_bureaucrats(n) / non_colonial : 0.0f;
3548
3551 auto box = text::open_layout_box(contents, 0);
3552 text::localised_format_box(state, contents, box, "admin_explain_2", m);
3553 text::close_layout_box(contents, box);
3554 }
3555 {
3556 float issue_sum = 0.0f;
3557 for(auto i : state.culture_definitions.social_issues) {
3558 issue_sum = issue_sum + state.world.issue_option_get_administrative_multiplier(state.world.nation_get_issues(n, i));
3559 }
3560 auto from_issues = issue_sum * state.defines.bureaucracy_percentage_increment;
3561
3563 text::add_to_substitution_map(m, text::variable_type::val, text::fp_percentage{ (from_issues + state.defines.max_bureaucracy_percentage) });
3564 text::add_to_substitution_map(m, text::variable_type::x, text::fp_percentage{ state.defines.max_bureaucracy_percentage });
3566 auto box = text::open_layout_box(contents, 0);
3567 text::localised_format_box(state, contents, box, "admin_explain_3", m);
3568 text::close_layout_box(contents, box);
3569 }
3570// END
3571}
3572void budgetwindow_main_admin_eff_amount_t::set_text(sys::state& state, std::string const& new_text) {
3573 if(new_text != cached_text) {
3574 cached_text = new_text;
3575 internal_layout.contents.clear();
3576 internal_layout.number_of_lines = 0;
3577 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3578 sl.add_text(state, cached_text);
3579 }
3580}
3581void budgetwindow_main_admin_eff_amount_t::on_reset_text(sys::state& state) noexcept {
3582}
3583void budgetwindow_main_admin_eff_amount_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3584 if(internal_layout.contents.empty()) return;
3585 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3586 auto linesz = state.font_collection.line_height(state, fh);
3587 if(linesz == 0.0f) return;
3588 auto ycentered = (base_data.size.y - linesz) / 2;
3589 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3590 for(auto& t : internal_layout.contents) {
3591 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3592 }
3593}
3594void budgetwindow_main_admin_eff_amount_t::on_update(sys::state& state) noexcept {
3596// BEGIN main::admin_eff_amount::update
3597 set_text(state, text::format_percentage(state.world.nation_get_administrative_efficiency(state.local_player_nation)));
3598// END
3599}
3600void budgetwindow_main_admin_eff_amount_t::on_create(sys::state& state) noexcept {
3601// BEGIN main::admin_eff_amount::create
3602// END
3603}
3604void budgetwindow_main_welfare_label_t::set_text(sys::state& state, std::string const& new_text) {
3605 if(new_text != cached_text) {
3606 cached_text = new_text;
3607 internal_layout.contents.clear();
3608 internal_layout.number_of_lines = 0;
3609 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3610 sl.add_text(state, cached_text);
3611 }
3612}
3613void budgetwindow_main_welfare_label_t::on_reset_text(sys::state& state) noexcept {
3614 cached_text = text::produce_simple_string(state, text_key);
3615 internal_layout.contents.clear();
3616 internal_layout.number_of_lines = 0;
3617 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3618 sl.add_text(state, cached_text);
3619}
3620void budgetwindow_main_welfare_label_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3621 if(internal_layout.contents.empty()) return;
3622 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3623 auto linesz = state.font_collection.line_height(state, fh);
3624 if(linesz == 0.0f) return;
3625 auto ycentered = (base_data.size.y - linesz) / 2;
3626 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3627 for(auto& t : internal_layout.contents) {
3628 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3629 }
3630}
3631void budgetwindow_main_welfare_label_t::on_update(sys::state& state) noexcept {
3633// BEGIN main::welfare_label::update
3634// END
3635}
3636void budgetwindow_main_welfare_label_t::on_create(sys::state& state) noexcept {
3637 on_reset_text(state);
3638// BEGIN main::welfare_label::create
3639// END
3640}
3641void budgetwindow_main_chart_max_a_t::set_text(sys::state& state, std::string const& new_text) {
3642 if(new_text != cached_text) {
3643 cached_text = new_text;
3644 internal_layout.contents.clear();
3645 internal_layout.number_of_lines = 0;
3646 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3647 sl.add_text(state, cached_text);
3648 }
3649}
3650void budgetwindow_main_chart_max_a_t::on_reset_text(sys::state& state) noexcept {
3651 cached_text = text::produce_simple_string(state, text_key);
3652 internal_layout.contents.clear();
3653 internal_layout.number_of_lines = 0;
3654 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3655 sl.add_text(state, cached_text);
3656}
3657void budgetwindow_main_chart_max_a_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3658 if(internal_layout.contents.empty()) return;
3659 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3660 auto linesz = state.font_collection.line_height(state, fh);
3661 if(linesz == 0.0f) return;
3662 auto ycentered = (base_data.size.y - linesz) / 2;
3663 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3664 for(auto& t : internal_layout.contents) {
3665 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3666 }
3667}
3668void budgetwindow_main_chart_max_a_t::on_update(sys::state& state) noexcept {
3670// BEGIN main::chart_max_a::update
3671// END
3672}
3673void budgetwindow_main_chart_max_a_t::on_create(sys::state& state) noexcept {
3674 on_reset_text(state);
3675// BEGIN main::chart_max_a::create
3676// END
3677}
3678void budgetwindow_main_chart_min_t::set_text(sys::state& state, std::string const& new_text) {
3679 if(new_text != cached_text) {
3680 cached_text = new_text;
3681 internal_layout.contents.clear();
3682 internal_layout.number_of_lines = 0;
3683 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3684 sl.add_text(state, cached_text);
3685 }
3686}
3687void budgetwindow_main_chart_min_t::on_reset_text(sys::state& state) noexcept {
3688 cached_text = text::produce_simple_string(state, text_key);
3689 internal_layout.contents.clear();
3690 internal_layout.number_of_lines = 0;
3691 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3692 sl.add_text(state, cached_text);
3693}
3694void budgetwindow_main_chart_min_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3695 if(internal_layout.contents.empty()) return;
3696 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3697 auto linesz = state.font_collection.line_height(state, fh);
3698 if(linesz == 0.0f) return;
3699 auto ycentered = (base_data.size.y - linesz) / 2;
3700 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3701 for(auto& t : internal_layout.contents) {
3702 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3703 }
3704}
3705void budgetwindow_main_chart_min_t::on_update(sys::state& state) noexcept {
3707// BEGIN main::chart_min::update
3708// END
3709}
3710void budgetwindow_main_chart_min_t::on_create(sys::state& state) noexcept {
3711 on_reset_text(state);
3712// BEGIN main::chart_min::create
3713// END
3714}
3715void budgetwindow_main_chart_max_b_t::set_text(sys::state& state, std::string const& new_text) {
3716 if(new_text != cached_text) {
3717 cached_text = new_text;
3718 internal_layout.contents.clear();
3719 internal_layout.number_of_lines = 0;
3720 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3721 sl.add_text(state, cached_text);
3722 }
3723}
3724void budgetwindow_main_chart_max_b_t::on_reset_text(sys::state& state) noexcept {
3725 cached_text = text::produce_simple_string(state, text_key);
3726 internal_layout.contents.clear();
3727 internal_layout.number_of_lines = 0;
3728 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3729 sl.add_text(state, cached_text);
3730}
3731void budgetwindow_main_chart_max_b_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3732 if(internal_layout.contents.empty()) return;
3733 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3734 auto linesz = state.font_collection.line_height(state, fh);
3735 if(linesz == 0.0f) return;
3736 auto ycentered = (base_data.size.y - linesz) / 2;
3737 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3738 for(auto& t : internal_layout.contents) {
3739 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3740 }
3741}
3742void budgetwindow_main_chart_max_b_t::on_update(sys::state& state) noexcept {
3744// BEGIN main::chart_max_b::update
3745// END
3746}
3747void budgetwindow_main_chart_max_b_t::on_create(sys::state& state) noexcept {
3748 on_reset_text(state);
3749// BEGIN main::chart_max_b::create
3750// END
3751}
3752void budgetwindow_main_chart_poplabel_t::set_text(sys::state& state, std::string const& new_text) {
3753 if(new_text != cached_text) {
3754 cached_text = new_text;
3755 internal_layout.contents.clear();
3756 internal_layout.number_of_lines = 0;
3757 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3758 sl.add_text(state, cached_text);
3759 }
3760}
3761void budgetwindow_main_chart_poplabel_t::on_reset_text(sys::state& state) noexcept {
3762 cached_text = text::produce_simple_string(state, text_key);
3763 internal_layout.contents.clear();
3764 internal_layout.number_of_lines = 0;
3765 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3766 sl.add_text(state, cached_text);
3767}
3768void budgetwindow_main_chart_poplabel_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3769 if(internal_layout.contents.empty()) return;
3770 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3771 auto linesz = state.font_collection.line_height(state, fh);
3772 if(linesz == 0.0f) return;
3773 auto ycentered = (base_data.size.y - linesz) / 2;
3774 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3775 for(auto& t : internal_layout.contents) {
3776 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3777 }
3778}
3779void budgetwindow_main_chart_poplabel_t::on_update(sys::state& state) noexcept {
3781// BEGIN main::chart_poplabel::update
3782// END
3783}
3784void budgetwindow_main_chart_poplabel_t::on_create(sys::state& state) noexcept {
3785 on_reset_text(state);
3786// BEGIN main::chart_poplabel::create
3787// END
3788}
3789void budgetwindow_main_chart_needslabel_t::set_text(sys::state& state, std::string const& new_text) {
3790 if(new_text != cached_text) {
3791 cached_text = new_text;
3792 internal_layout.contents.clear();
3793 internal_layout.number_of_lines = 0;
3794 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3795 sl.add_text(state, cached_text);
3796 }
3797}
3798void budgetwindow_main_chart_needslabel_t::on_reset_text(sys::state& state) noexcept {
3799 cached_text = text::produce_simple_string(state, text_key);
3800 internal_layout.contents.clear();
3801 internal_layout.number_of_lines = 0;
3802 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
3803 sl.add_text(state, cached_text);
3804}
3805void budgetwindow_main_chart_needslabel_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3806 if(internal_layout.contents.empty()) return;
3807 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
3808 auto linesz = state.font_collection.line_height(state, fh);
3809 if(linesz == 0.0f) return;
3810 auto ycentered = (base_data.size.y - linesz) / 2;
3811 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
3812 for(auto& t : internal_layout.contents) {
3813 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
3814 }
3815}
3816void budgetwindow_main_chart_needslabel_t::on_update(sys::state& state) noexcept {
3818// BEGIN main::chart_needslabel::update
3819// END
3820}
3821void budgetwindow_main_chart_needslabel_t::on_create(sys::state& state) noexcept {
3822 on_reset_text(state);
3823// BEGIN main::chart_needslabel::create
3824// END
3825}
3826ui::message_result budgetwindow_main_welfare_chart_poor_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
3828}
3829ui::message_result budgetwindow_main_welfare_chart_poor_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
3831}
3832void budgetwindow_main_welfare_chart_poor_t::set_data_points(sys::state& state, std::vector<float> const& datapoints, float min, float max) {
3833 assert(datapoints.size() == 32);
3834 float y_height = max - min;
3835 std::vector<float> scaled_datapoints = std::vector<float>(32);
3836 if(y_height == 0.f) {
3837 for(size_t i = 0; i < 32; i++) {
3838 scaled_datapoints[i] = .5f;
3839 }
3840 } else {
3841 for(size_t i = 0; i < 32; i++) {
3842 scaled_datapoints[i] = (datapoints[i] - min) / y_height;
3843 }
3844 }
3845 lines.set_y(scaled_datapoints.data());
3846}
3847void budgetwindow_main_welfare_chart_poor_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3848 ogl::render_linegraph(state, ogl::color_modification::none, float(x), float(y), base_data.size.x, base_data.size.y, line_color.r, line_color.g, line_color.b, line_color.a, lines);
3849}
3850void budgetwindow_main_welfare_chart_poor_t::on_update(sys::state& state) noexcept {
3852// BEGIN main::welfare_chart_poor::update
3853 float min = 0.f;
3854 float max = 0.f;
3855 for(auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3856
3857 for(auto pop_loc : prov.get_province().get_pop_location()) {
3858 auto pop_id = pop_loc.get_pop();
3859 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3860 auto pop_size = pop_strata == uint8_t(culture::pop_strata::poor) ? state.world.pop_get_size(pop_id) : 0.f;
3861
3862 max += pop_size;
3863 }
3864 }
3865
3866 std::vector<float> datapoints(32);
3867
3868 float integral = 0.f;
3869 float total_area = 0.f;
3870
3871 for(uint32_t i = 0; i < 32; ++i) {
3872 float cutoff = (float)i / 32 + 0.01f;
3873 float value = 0.f;
3874
3875 for(auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3876
3877 for(auto pop_loc : prov.get_province().get_pop_location()) {
3878 auto pop_id = pop_loc.get_pop();
3879 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3880 auto pop_size = pop_strata == uint8_t(culture::pop_strata::poor) ? state.world.pop_get_size(pop_id) : 0.f;
3881
3882 float total =
3885 + pop_demographics::get_life_needs(state, pop_id);
3886
3887 if(total / 3.f >= cutoff)
3888 value += pop_size;
3889
3890 integral += total / 3.f * pop_size;
3891 total_area += pop_size;
3892 }
3893 }
3894
3895 datapoints[i] = value;
3896 }
3897 set_data_points(state, datapoints, min, max);
3898// END
3899}
3900void budgetwindow_main_welfare_chart_poor_t::on_create(sys::state& state) noexcept {
3901// BEGIN main::welfare_chart_poor::create
3902// END
3903}
3904ui::message_result budgetwindow_main_welfare_chart_middle_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
3906}
3907ui::message_result budgetwindow_main_welfare_chart_middle_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
3909}
3910void budgetwindow_main_welfare_chart_middle_t::set_data_points(sys::state& state, std::vector<float> const& datapoints, float min, float max) {
3911 assert(datapoints.size() == 32);
3912 float y_height = max - min;
3913 std::vector<float> scaled_datapoints = std::vector<float>(32);
3914 if(y_height == 0.f) {
3915 for(size_t i = 0; i < 32; i++) {
3916 scaled_datapoints[i] = .5f;
3917 }
3918 } else {
3919 for(size_t i = 0; i < 32; i++) {
3920 scaled_datapoints[i] = (datapoints[i] - min) / y_height;
3921 }
3922 }
3923 lines.set_y(scaled_datapoints.data());
3924}
3925void budgetwindow_main_welfare_chart_middle_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
3926 ogl::render_linegraph(state, ogl::color_modification::none, float(x), float(y), base_data.size.x, base_data.size.y, line_color.r, line_color.g, line_color.b, line_color.a, lines);
3927}
3928void budgetwindow_main_welfare_chart_middle_t::on_update(sys::state& state) noexcept {
3930// BEGIN main::welfare_chart_middle::update
3931 float min = 0.f;
3932 float max = 0.f;
3933 for(auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3934
3935 for(auto pop_loc : prov.get_province().get_pop_location()) {
3936 auto pop_id = pop_loc.get_pop();
3937 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3938 auto pop_size = pop_strata == uint8_t(culture::pop_strata::middle) ? state.world.pop_get_size(pop_id) : 0.f;
3939
3940 max += pop_size;
3941 }
3942 }
3943
3944 std::vector<float> datapoints(32);
3945
3946 float integral = 0.f;
3947 float total_area = 0.f;
3948
3949 for(uint32_t i = 0; i < 32; ++i) {
3950 float cutoff = (float)i / 32 + 0.01f;
3951 float value = 0.f;
3952
3953 for(auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
3954
3955 for(auto pop_loc : prov.get_province().get_pop_location()) {
3956 auto pop_id = pop_loc.get_pop();
3957 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
3958 auto pop_size = pop_strata == uint8_t(culture::pop_strata::middle) ? state.world.pop_get_size(pop_id) : 0.f;
3959
3960 float total =
3963 + pop_demographics::get_life_needs(state, pop_id);
3964
3965 if(total / 3.f >= cutoff)
3966 value += pop_size;
3967
3968 integral += total / 3.f * pop_size;
3969 total_area += pop_size;
3970 }
3971 }
3972
3973 datapoints[i] = value;
3974 }
3975 set_data_points(state, datapoints, min, max);
3976// END
3977}
3978void budgetwindow_main_welfare_chart_middle_t::on_create(sys::state& state) noexcept {
3979// BEGIN main::welfare_chart_middle::create
3980// END
3981}
3982ui::message_result budgetwindow_main_welfare_chart_rich_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
3984}
3985ui::message_result budgetwindow_main_welfare_chart_rich_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
3987}
3988void budgetwindow_main_welfare_chart_rich_t::set_data_points(sys::state& state, std::vector<float> const& datapoints, float min, float max) {
3989 assert(datapoints.size() == 32);
3990 float y_height = max - min;
3991 std::vector<float> scaled_datapoints = std::vector<float>(32);
3992 if(y_height == 0.f) {
3993 for(size_t i = 0; i < 32; i++) {
3994 scaled_datapoints[i] = .5f;
3995 }
3996 } else {
3997 for(size_t i = 0; i < 32; i++) {
3998 scaled_datapoints[i] = (datapoints[i] - min) / y_height;
3999 }
4000 }
4001 lines.set_y(scaled_datapoints.data());
4002}
4003void budgetwindow_main_welfare_chart_rich_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4004 ogl::render_linegraph(state, ogl::color_modification::none, float(x), float(y), base_data.size.x, base_data.size.y, line_color.r, line_color.g, line_color.b, line_color.a, lines);
4005}
4006void budgetwindow_main_welfare_chart_rich_t::on_update(sys::state& state) noexcept {
4008// BEGIN main::welfare_chart_rich::update
4009 float min = 0.f;
4010 float max = 0.f;
4011 for(auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
4012
4013 for(auto pop_loc : prov.get_province().get_pop_location()) {
4014 auto pop_id = pop_loc.get_pop();
4015 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
4016 auto pop_size = pop_strata == uint8_t(culture::pop_strata::rich) ? state.world.pop_get_size(pop_id) : 0.f;
4017
4018 max += pop_size;
4019 }
4020 }
4021
4022 std::vector<float> datapoints(32);
4023
4024 float integral = 0.f;
4025 float total_area = 0.f;
4026
4027 for(uint32_t i = 0; i < 32; ++i) {
4028 float cutoff = (float)i / 32 + 0.01f;
4029 float value = 0.f;
4030
4031 for(auto prov : state.world.nation_get_province_ownership(state.local_player_nation)) {
4032
4033 for(auto pop_loc : prov.get_province().get_pop_location()) {
4034 auto pop_id = pop_loc.get_pop();
4035 auto pop_strata = state.world.pop_type_get_strata(state.world.pop_get_poptype(pop_id));
4036 auto pop_size = pop_strata == uint8_t(culture::pop_strata::rich) ? state.world.pop_get_size(pop_id) : 0.f;
4037
4038 float total =
4041 + pop_demographics::get_life_needs(state, pop_id);
4042
4043 if(total / 3.f >= cutoff)
4044 value += pop_size;
4045
4046 integral += total / 3.f * pop_size;
4047 total_area += pop_size;
4048 }
4049 }
4050
4051 datapoints[i] = value;
4052 }
4053 set_data_points(state, datapoints, min, max);
4054// END
4055}
4056void budgetwindow_main_welfare_chart_rich_t::on_create(sys::state& state) noexcept {
4057// BEGIN main::welfare_chart_rich::create
4058// END
4059}
4060void budgetwindow_main_hover_poor_t::on_hover(sys::state& state) noexcept {
4062// BEGIN main::hover_poor::on_hover
4063 main.welfare_chart_middle->line_color.a = 0.2f;
4064 main.welfare_chart_rich->line_color.a = 0.2f;
4065// END
4066}
4067void budgetwindow_main_hover_poor_t::on_hover_end(sys::state& state) noexcept {
4069// BEGIN main::hover_poor::on_hover_end
4070 main.welfare_chart_middle->line_color.a = 1.0f;
4071 main.welfare_chart_rich->line_color.a = 1.0f;
4072// END
4073}
4074ui::message_result budgetwindow_main_hover_poor_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4076}
4077ui::message_result budgetwindow_main_hover_poor_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4079}
4080void budgetwindow_main_hover_poor_t::set_text(sys::state& state, std::string const& new_text) {
4081 if(new_text != cached_text) {
4082 cached_text = new_text;
4083 internal_layout.contents.clear();
4084 internal_layout.number_of_lines = 0;
4085 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4086 sl.add_text(state, cached_text);
4087 }
4088}
4089void budgetwindow_main_hover_poor_t::on_reset_text(sys::state& state) noexcept {
4090 cached_text = text::produce_simple_string(state, text_key);
4091 internal_layout.contents.clear();
4092 internal_layout.number_of_lines = 0;
4093 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4094 sl.add_text(state, cached_text);
4095}
4096void budgetwindow_main_hover_poor_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4097 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4098 if(internal_layout.contents.empty()) return;
4099 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4100 auto linesz = state.font_collection.line_height(state, fh);
4101 if(linesz == 0.0f) return;
4102 auto ycentered = (base_data.size.y - linesz) / 2;
4103 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, true);
4104 for(auto& t : internal_layout.contents) {
4105 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4106 }
4107}
4108void budgetwindow_main_hover_poor_t::on_update(sys::state& state) noexcept {
4110// BEGIN main::hover_poor::update
4111// END
4112}
4113void budgetwindow_main_hover_poor_t::on_create(sys::state& state) noexcept {
4114 on_reset_text(state);
4115// BEGIN main::hover_poor::create
4116// END
4117}
4118void budgetwindow_main_hover_middle_t::on_hover(sys::state& state) noexcept {
4120// BEGIN main::hover_middle::on_hover
4121 main.welfare_chart_poor->line_color.a = 0.2f;
4122 main.welfare_chart_rich->line_color.a = 0.2f;
4123// END
4124}
4125void budgetwindow_main_hover_middle_t::on_hover_end(sys::state& state) noexcept {
4127// BEGIN main::hover_middle::on_hover_end
4128 main.welfare_chart_poor->line_color.a = 1.0f;
4129 main.welfare_chart_rich->line_color.a = 1.0f;
4130// END
4131}
4132ui::message_result budgetwindow_main_hover_middle_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4134}
4135ui::message_result budgetwindow_main_hover_middle_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4137}
4138void budgetwindow_main_hover_middle_t::set_text(sys::state& state, std::string const& new_text) {
4139 if(new_text != cached_text) {
4140 cached_text = new_text;
4141 internal_layout.contents.clear();
4142 internal_layout.number_of_lines = 0;
4143 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4144 sl.add_text(state, cached_text);
4145 }
4146}
4147void budgetwindow_main_hover_middle_t::on_reset_text(sys::state& state) noexcept {
4148 cached_text = text::produce_simple_string(state, text_key);
4149 internal_layout.contents.clear();
4150 internal_layout.number_of_lines = 0;
4151 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4152 sl.add_text(state, cached_text);
4153}
4154void budgetwindow_main_hover_middle_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4155 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4156 if(internal_layout.contents.empty()) return;
4157 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4158 auto linesz = state.font_collection.line_height(state, fh);
4159 if(linesz == 0.0f) return;
4160 auto ycentered = (base_data.size.y - linesz) / 2;
4161 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, true);
4162 for(auto& t : internal_layout.contents) {
4163 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4164 }
4165}
4166void budgetwindow_main_hover_middle_t::on_update(sys::state& state) noexcept {
4168// BEGIN main::hover_middle::update
4169// END
4170}
4171void budgetwindow_main_hover_middle_t::on_create(sys::state& state) noexcept {
4172 on_reset_text(state);
4173// BEGIN main::hover_middle::create
4174// END
4175}
4176void budgetwindow_main_hover_rich_t::on_hover(sys::state& state) noexcept {
4178// BEGIN main::hover_rich::on_hover
4179 main.welfare_chart_poor->line_color.a = 0.2f;
4180 main.welfare_chart_middle->line_color.a = 0.2f;
4181// END
4182}
4183void budgetwindow_main_hover_rich_t::on_hover_end(sys::state& state) noexcept {
4185// BEGIN main::hover_rich::on_hover_end
4186 main.welfare_chart_poor->line_color.a = 1.0f;
4187 main.welfare_chart_middle->line_color.a = 1.0f;
4188// END
4189}
4190ui::message_result budgetwindow_main_hover_rich_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4192}
4193ui::message_result budgetwindow_main_hover_rich_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4195}
4196void budgetwindow_main_hover_rich_t::set_text(sys::state& state, std::string const& new_text) {
4197 if(new_text != cached_text) {
4198 cached_text = new_text;
4199 internal_layout.contents.clear();
4200 internal_layout.number_of_lines = 0;
4201 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4202 sl.add_text(state, cached_text);
4203 }
4204}
4205void budgetwindow_main_hover_rich_t::on_reset_text(sys::state& state) noexcept {
4206 cached_text = text::produce_simple_string(state, text_key);
4207 internal_layout.contents.clear();
4208 internal_layout.number_of_lines = 0;
4209 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4210 sl.add_text(state, cached_text);
4211}
4212void budgetwindow_main_hover_rich_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4213 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4214 if(internal_layout.contents.empty()) return;
4215 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4216 auto linesz = state.font_collection.line_height(state, fh);
4217 if(linesz == 0.0f) return;
4218 auto ycentered = (base_data.size.y - linesz) / 2;
4219 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, true);
4220 for(auto& t : internal_layout.contents) {
4221 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4222 }
4223}
4224void budgetwindow_main_hover_rich_t::on_update(sys::state& state) noexcept {
4226// BEGIN main::hover_rich::update
4227// END
4228}
4229void budgetwindow_main_hover_rich_t::on_create(sys::state& state) noexcept {
4230 on_reset_text(state);
4231// BEGIN main::hover_rich::create
4232// END
4233}
4234void budgetwindow_main_debt_label_t::set_text(sys::state& state, std::string const& new_text) {
4235 if(new_text != cached_text) {
4236 cached_text = new_text;
4237 internal_layout.contents.clear();
4238 internal_layout.number_of_lines = 0;
4239 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4240 sl.add_text(state, cached_text);
4241 }
4242}
4243void budgetwindow_main_debt_label_t::on_reset_text(sys::state& state) noexcept {
4244 cached_text = text::produce_simple_string(state, text_key);
4245 internal_layout.contents.clear();
4246 internal_layout.number_of_lines = 0;
4247 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4248 sl.add_text(state, cached_text);
4249}
4250void budgetwindow_main_debt_label_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4251 if(internal_layout.contents.empty()) return;
4252 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4253 auto linesz = state.font_collection.line_height(state, fh);
4254 if(linesz == 0.0f) return;
4255 auto ycentered = (base_data.size.y - linesz) / 2;
4256 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
4257 for(auto& t : internal_layout.contents) {
4258 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4259 }
4260}
4261void budgetwindow_main_debt_label_t::on_update(sys::state& state) noexcept {
4263// BEGIN main::debt_label::update
4264// END
4265}
4266void budgetwindow_main_debt_label_t::on_create(sys::state& state) noexcept {
4267 on_reset_text(state);
4268// BEGIN main::debt_label::create
4269// END
4270}
4271ui::message_result budgetwindow_main_debt_enable_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4272 if(disabled) return ui::message_result::consumed;
4274 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
4275// BEGIN main::debt_enable::lbutton_action
4276 command::enable_debt(state, state.local_player_nation, !state.world.nation_get_is_debt_spending(state.local_player_nation));
4277// END
4279}
4280ui::message_result budgetwindow_main_debt_enable_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4282}
4283void budgetwindow_main_debt_enable_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
4285// BEGIN main::debt_enable::tooltip
4286 auto last_br = state.world.nation_get_bankrupt_until(state.local_player_nation);
4287 if(last_br && state.current_date < last_br) {
4288 text::add_line(state, contents, "alice_currently_bankrupt", text::variable_type::x, last_br);
4289 } else if(economy::max_loan(state, state.local_player_nation) <= 0.0f) {
4290 text::add_line(state, contents, "alice_no_loans_possible");
4291 } else {
4292 text::add_line(state, contents, "alice_debt_spending");
4293 text::add_line_break_to_layout(state, contents);
4294 text::add_line(state, contents, "alice_loan_size", text::variable_type::x, text::fp_currency{ economy::max_loan(state, state.local_player_nation) });
4295 }
4296// END
4297}
4298void budgetwindow_main_debt_enable_t::set_text(sys::state& state, std::string const& new_text) {
4299 if(new_text != cached_text) {
4300 cached_text = new_text;
4301 internal_layout.contents.clear();
4302 internal_layout.number_of_lines = 0;
4303 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4304 sl.add_text(state, cached_text);
4305 }
4306}
4307void budgetwindow_main_debt_enable_t::on_reset_text(sys::state& state) noexcept {
4308 cached_text = text::produce_simple_string(state, text_key);
4309 internal_layout.contents.clear();
4310 internal_layout.number_of_lines = 0;
4311 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4312 sl.add_text(state, cached_text);
4313}
4314void budgetwindow_main_debt_enable_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4315 if(is_active)
4316 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, disabled, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, alt_background_texture, alt_texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4317 else
4318 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, disabled, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4319 if(internal_layout.contents.empty()) return;
4320 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4321 auto linesz = state.font_collection.line_height(state, fh);
4322 if(linesz == 0.0f) return;
4323 auto ycentered = (base_data.size.y - linesz) / 2;
4324 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, disabled, true);
4325 for(auto& t : internal_layout.contents) {
4326 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4327 }
4328}
4329void budgetwindow_main_debt_enable_t::on_update(sys::state& state) noexcept {
4331// BEGIN main::debt_enable::update
4332 is_active = state.world.nation_get_is_debt_spending(state.local_player_nation);
4333 disabled = false;
4334 auto last_br = state.world.nation_get_bankrupt_until(state.local_player_nation);
4335 if(last_br && state.current_date < last_br)
4336 disabled = true;
4337 if(economy::max_loan(state, state.local_player_nation) <= 0.0f)
4338 disabled = true;
4339// END
4340}
4341void budgetwindow_main_debt_enable_t::on_create(sys::state& state) noexcept {
4342 on_reset_text(state);
4343// BEGIN main::debt_enable::create
4344// END
4345}
4346void budgetwindow_main_total_debt_label_t::set_text(sys::state& state, std::string const& new_text) {
4347 if(new_text != cached_text) {
4348 cached_text = new_text;
4349 internal_layout.contents.clear();
4350 internal_layout.number_of_lines = 0;
4351 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4352 sl.add_text(state, cached_text);
4353 }
4354}
4355void budgetwindow_main_total_debt_label_t::on_reset_text(sys::state& state) noexcept {
4356 cached_text = text::produce_simple_string(state, text_key);
4357 internal_layout.contents.clear();
4358 internal_layout.number_of_lines = 0;
4359 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4360 sl.add_text(state, cached_text);
4361}
4362void budgetwindow_main_total_debt_label_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4363 if(internal_layout.contents.empty()) return;
4364 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4365 auto linesz = state.font_collection.line_height(state, fh);
4366 if(linesz == 0.0f) return;
4367 auto ycentered = (base_data.size.y - linesz) / 2;
4368 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
4369 for(auto& t : internal_layout.contents) {
4370 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4371 }
4372}
4373void budgetwindow_main_total_debt_label_t::on_update(sys::state& state) noexcept {
4375// BEGIN main::total_debt_label::update
4376// END
4377}
4378void budgetwindow_main_total_debt_label_t::on_create(sys::state& state) noexcept {
4379 on_reset_text(state);
4380// BEGIN main::total_debt_label::create
4381// END
4382}
4383void budgetwindow_main_max_debt_label_t::set_text(sys::state& state, std::string const& new_text) {
4384 if(new_text != cached_text) {
4385 cached_text = new_text;
4386 internal_layout.contents.clear();
4387 internal_layout.number_of_lines = 0;
4388 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4389 sl.add_text(state, cached_text);
4390 }
4391}
4392void budgetwindow_main_max_debt_label_t::on_reset_text(sys::state& state) noexcept {
4393 cached_text = text::produce_simple_string(state, text_key);
4394 internal_layout.contents.clear();
4395 internal_layout.number_of_lines = 0;
4396 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4397 sl.add_text(state, cached_text);
4398}
4399void budgetwindow_main_max_debt_label_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4400 if(internal_layout.contents.empty()) return;
4401 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4402 auto linesz = state.font_collection.line_height(state, fh);
4403 if(linesz == 0.0f) return;
4404 auto ycentered = (base_data.size.y - linesz) / 2;
4405 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
4406 for(auto& t : internal_layout.contents) {
4407 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4408 }
4409}
4410void budgetwindow_main_max_debt_label_t::on_update(sys::state& state) noexcept {
4412// BEGIN main::max_debt_label::update
4413// END
4414}
4415void budgetwindow_main_max_debt_label_t::on_create(sys::state& state) noexcept {
4416 on_reset_text(state);
4417// BEGIN main::max_debt_label::create
4418// END
4419}
4420void budgetwindow_main_total_debt_amount_t::set_text(sys::state& state, std::string const& new_text) {
4421 if(new_text != cached_text) {
4422 cached_text = new_text;
4423 internal_layout.contents.clear();
4424 internal_layout.number_of_lines = 0;
4425 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4426 sl.add_text(state, cached_text);
4427 }
4428}
4429void budgetwindow_main_total_debt_amount_t::on_reset_text(sys::state& state) noexcept {
4430}
4431void budgetwindow_main_total_debt_amount_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4432 if(internal_layout.contents.empty()) return;
4433 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4434 auto linesz = state.font_collection.line_height(state, fh);
4435 if(linesz == 0.0f) return;
4436 auto ycentered = (base_data.size.y - linesz) / 2;
4437 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
4438 for(auto& t : internal_layout.contents) {
4439 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4440 }
4441}
4442void budgetwindow_main_total_debt_amount_t::on_update(sys::state& state) noexcept {
4444// BEGIN main::total_debt_amount::update
4445 auto amount = state.world.nation_get_local_loan(state.local_player_nation);
4446 set_text(state, text::prettify_currency(amount));
4447// END
4448}
4449void budgetwindow_main_total_debt_amount_t::on_create(sys::state& state) noexcept {
4450 on_reset_text(state);
4451// BEGIN main::total_debt_amount::create
4452// END
4453}
4454void budgetwindow_main_max_debt_amount_t::set_text(sys::state& state, std::string const& new_text) {
4455 if(new_text != cached_text) {
4456 cached_text = new_text;
4457 internal_layout.contents.clear();
4458 internal_layout.number_of_lines = 0;
4459 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
4460 sl.add_text(state, cached_text);
4461 }
4462}
4463void budgetwindow_main_max_debt_amount_t::on_reset_text(sys::state& state) noexcept {
4464}
4465void budgetwindow_main_max_debt_amount_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4466 if(internal_layout.contents.empty()) return;
4467 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
4468 auto linesz = state.font_collection.line_height(state, fh);
4469 if(linesz == 0.0f) return;
4470 auto ycentered = (base_data.size.y - linesz) / 2;
4471 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
4472 for(auto& t : internal_layout.contents) {
4473 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
4474 }
4475}
4476void budgetwindow_main_max_debt_amount_t::on_update(sys::state& state) noexcept {
4478// BEGIN main::max_debt_amount::update
4479 auto amount = economy::max_loan(state, state.local_player_nation);
4480 set_text(state, text::prettify_currency(amount));
4481// END
4482}
4483void budgetwindow_main_max_debt_amount_t::on_create(sys::state& state) noexcept {
4484 on_reset_text(state);
4485// BEGIN main::max_debt_amount::create
4486// END
4487}
4488ui::message_result budgetwindow_main_debt_chart_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4490}
4491ui::message_result budgetwindow_main_debt_chart_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4493}
4494void budgetwindow_main_debt_chart_t::update_chart(sys::state& state) {
4495 std::sort(graph_content.begin(), graph_content.end(), [](auto const& a, auto const& b) { return a.amount > b.amount; });
4496 float total = 0.0f;
4497 for(auto& e : graph_content) { total += e.amount; }
4498 if(total <= 0.0f) {
4499 for(int32_t k = 0; k < 200; k++) {
4500 data_texture.data[k * 3] = uint8_t(0);
4501 data_texture.data[k * 3 + 1] = uint8_t(0);
4502 data_texture.data[k * 3 + 2] = uint8_t(0);
4503 }
4504 data_texture.data_updated = true;
4505 return;
4506 }
4507 int32_t index = 0;
4508 float offset = 0.0f;
4509 for(int32_t k = 0; k < 200; k++) {
4510 if(graph_content[index].amount + offset < (float(k) + 0.5f) * total / float(200)) {
4511 offset += graph_content[index].amount;
4512 ++index;
4513 }
4514 data_texture.data[k * 3] = uint8_t(graph_content[index].color.r * 255.0f);
4515 data_texture.data[k * 3 + 1] = uint8_t(graph_content[index].color.g * 255.0f);
4516 data_texture.data[k * 3 + 2] = uint8_t(graph_content[index].color.b * 255.0f);
4517 }
4518 data_texture.data_updated = true;
4519}
4520void budgetwindow_main_debt_chart_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
4522 float temp_total = 0.0f;
4523 for(auto& p : graph_content) { temp_total += p.amount; }
4524 float temp_offset = temp_total * float(x) / float(base_data.size.x);
4525 int32_t temp_index = 0;
4526 for(auto& p : graph_content) { if(temp_offset <= p.amount) break; temp_offset -= p.amount; ++temp_index; }
4527 if(temp_index < int32_t(graph_content.size())) {
4528 auto& selected_key = graph_content[temp_index].key;
4529// BEGIN main::debt_chart::tooltip
4530 auto box = text::open_layout_box(contents);
4531 text::add_to_layout_box(state, contents, box, selected_key);
4532 text::add_space_to_layout_box(state, contents, box);
4533 text::add_to_layout_box(state, contents, box, text::fp_currency{ graph_content[temp_index].amount });
4534 text::close_layout_box(contents, box);
4535// END
4536 }
4537}
4538void budgetwindow_main_debt_chart_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4539 ogl::render_stripchart(state, ogl::color_modification::none, float(x), float(y), float(base_data.size.x), float(base_data.size.y), data_texture);
4540}
4541void budgetwindow_main_debt_chart_t::on_update(sys::state& state) noexcept {
4543// BEGIN main::debt_chart::update
4544 graph_content.clear();
4545
4546 auto interest = economy::interest_payment(state, state.local_player_nation) > 0;
4547 set_visible(state, interest);
4548 if(!interest)
4549 return;
4550
4551 auto t = state.world.nation_get_local_loan(state.local_player_nation);
4552
4553 if(t > 0.0f) {
4554 int32_t num_gp = 7;
4555 if(t <= 1000.0f) {
4556 num_gp = 1;
4557 } else if(t <= 2000.0f) {
4558 num_gp = 2;
4559 } else if(t <= 4000.0f) {
4560 num_gp = 4;
4561 }
4562 float total_share = 0.0f;
4563 float share = 10.0f;
4564 for(auto n : state.nations_by_rank) {
4565 if(state.world.nation_get_is_great_power(n) && n != state.local_player_nation) {
4566 auto c = state.world.nation_get_color(n);
4567 graph_content.emplace_back(graph_entry{ text::get_name(state, n), ogl::color3f{sys::red_from_int(c), sys::green_from_int(c), sys::blue_from_int(c) }, share });
4568 total_share += share;
4569 share -= 1.0f;
4570
4571 --num_gp;
4572 if(num_gp <= 0)
4573 break;
4574 }
4575 }
4576 for(auto& i : graph_content) {
4577 i.amount *= i.amount * t / total_share;
4578 }
4579 }
4580 update_chart(state);
4581// END
4582}
4583void budgetwindow_main_debt_chart_t::on_create(sys::state& state) noexcept {
4584// BEGIN main::debt_chart::create
4585// END
4586}
4587ui::message_result budgetwindow_main_debt_overlay_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4589}
4590ui::message_result budgetwindow_main_debt_overlay_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4592}
4593void budgetwindow_main_debt_overlay_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4594 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4595}
4596void budgetwindow_main_debt_overlay_t::on_update(sys::state& state) noexcept {
4598// BEGIN main::debt_overlay::update
4599 set_visible(state, economy::interest_payment(state, state.local_player_nation) > 0);
4600// END
4601}
4602void budgetwindow_main_debt_overlay_t::on_create(sys::state& state) noexcept {
4603// BEGIN main::debt_overlay::create
4604// END
4605}
4606ui::message_result budgetwindow_main_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4607 state.ui_state.drag_target = this;
4609}
4610ui::message_result budgetwindow_main_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
4612}
4613void budgetwindow_main_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
4614 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
4615}
4616void budgetwindow_main_t::on_update(sys::state& state) noexcept {
4617// BEGIN main::update
4618// END
4619}
4620void budgetwindow_main_t::on_create(sys::state& state) noexcept {
4621 auto window_bytes = state.ui_state.new_ui_windows.find(std::string("budgetwindow::main"));
4622 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
4623 std::vector<sys::aui_pending_bytes> pending_children;
4624 auto win_data = read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
4625 base_data.position.x = win_data.x_pos;
4626 base_data.position.y = win_data.y_pos;
4627 base_data.size.x = win_data.x_size;
4628 base_data.size.y = win_data.y_size;
4629 base_data.flags = uint8_t(win_data.orientation);
4630 texture_key = win_data.texture;
4631 auto name_key = state.lookup_key("budgetwindow::main");
4632 for(auto ex : state.ui_defs.extensions) {
4633 if(name_key && ex.window == name_key) {
4634 auto ch_res = ui::make_element_immediate(state, ex.child);
4635 if(ch_res) {
4636 this->add_child_to_back(std::move(ch_res));
4637 }
4638 }
4639 }
4640 while(!pending_children.empty()) {
4641 auto child_data = read_child_bytes(pending_children.back().data, pending_children.back().size);
4642 pending_children.pop_back();
4643 if(child_data.name == "close_button") {
4644 auto cptr = std::make_unique<budgetwindow_main_close_button_t>();
4645 cptr->parent = this;
4646 close_button = cptr.get();
4647 cptr->base_data.position.x = child_data.x_pos;
4648 cptr->base_data.position.y = child_data.y_pos;
4649 cptr->base_data.size.x = child_data.x_size;
4650 cptr->base_data.size.y = child_data.y_size;
4651 cptr->texture_key = child_data.texture;
4652 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
4653 cptr->on_create(state);
4654 this->add_child_to_back(std::move(cptr));
4655 continue;
4656 }
4657 if(child_data.name == "title") {
4658 auto cptr = std::make_unique<budgetwindow_main_title_t>();
4659 cptr->parent = this;
4660 title = cptr.get();
4661 cptr->base_data.position.x = child_data.x_pos;
4662 cptr->base_data.position.y = child_data.y_pos;
4663 cptr->base_data.size.x = child_data.x_size;
4664 cptr->base_data.size.y = child_data.y_size;
4665 cptr->text_key = state.lookup_key(child_data.text_key);
4666 cptr->text_scale = child_data.text_scale;
4667 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4668 cptr->text_alignment = child_data.text_alignment;
4669 cptr->text_color = child_data.text_color;
4670 cptr->on_create(state);
4671 this->add_child_to_back(std::move(cptr));
4672 continue;
4673 }
4674 if(child_data.name == "income_label") {
4675 auto cptr = std::make_unique<budgetwindow_main_income_label_t>();
4676 cptr->parent = this;
4677 income_label = cptr.get();
4678 cptr->base_data.position.x = child_data.x_pos;
4679 cptr->base_data.position.y = child_data.y_pos;
4680 cptr->base_data.size.x = child_data.x_size;
4681 cptr->base_data.size.y = child_data.y_size;
4682 cptr->text_key = state.lookup_key(child_data.text_key);
4683 cptr->text_scale = child_data.text_scale;
4684 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4685 cptr->text_alignment = child_data.text_alignment;
4686 cptr->text_color = child_data.text_color;
4687 cptr->on_create(state);
4688 this->add_child_to_back(std::move(cptr));
4689 continue;
4690 }
4691 if(child_data.name == "income_amount") {
4692 auto cptr = std::make_unique<budgetwindow_main_income_amount_t>();
4693 cptr->parent = this;
4694 income_amount = cptr.get();
4695 cptr->base_data.position.x = child_data.x_pos;
4696 cptr->base_data.position.y = child_data.y_pos;
4697 cptr->base_data.size.x = child_data.x_size;
4698 cptr->base_data.size.y = child_data.y_size;
4699 cptr->text_scale = child_data.text_scale;
4700 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4701 cptr->text_alignment = child_data.text_alignment;
4702 cptr->text_color = child_data.text_color;
4703 cptr->on_create(state);
4704 this->add_child_to_back(std::move(cptr));
4705 continue;
4706 }
4707 if(child_data.name == "income_page_left") {
4708 auto cptr = std::make_unique<budgetwindow_main_income_page_left_t>();
4709 cptr->parent = this;
4710 income_page_left = cptr.get();
4711 cptr->base_data.position.x = child_data.x_pos;
4712 cptr->base_data.position.y = child_data.y_pos;
4713 cptr->base_data.size.x = child_data.x_size;
4714 cptr->base_data.size.y = child_data.y_size;
4716 cptr->texture_key = child_data.texture;
4717 cptr->on_create(state);
4718 this->add_child_to_back(std::move(cptr));
4719 continue;
4720 }
4721 if(child_data.name == "income_page_right") {
4722 auto cptr = std::make_unique<budgetwindow_main_income_page_right_t>();
4723 cptr->parent = this;
4724 income_page_right = cptr.get();
4725 cptr->base_data.position.x = child_data.x_pos;
4726 cptr->base_data.position.y = child_data.y_pos;
4727 cptr->base_data.size.x = child_data.x_size;
4728 cptr->base_data.size.y = child_data.y_size;
4730 cptr->texture_key = child_data.texture;
4731 cptr->on_create(state);
4732 this->add_child_to_back(std::move(cptr));
4733 continue;
4734 }
4735 if(child_data.name == "income_page_number") {
4736 auto cptr = std::make_unique<budgetwindow_main_income_page_number_t>();
4737 cptr->parent = this;
4738 income_page_number = cptr.get();
4739 cptr->base_data.position.x = child_data.x_pos;
4740 cptr->base_data.position.y = child_data.y_pos;
4741 cptr->base_data.size.x = child_data.x_size;
4742 cptr->base_data.size.y = child_data.y_size;
4743 cptr->text_scale = child_data.text_scale;
4744 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4745 cptr->text_alignment = child_data.text_alignment;
4746 cptr->text_color = child_data.text_color;
4747 cptr->on_create(state);
4748 this->add_child_to_back(std::move(cptr));
4749 continue;
4750 }
4751 if(child_data.name == "income_table") {
4752 auto cptr = std::make_unique<budgetwindow_main_income_table_t>();
4753 cptr->parent = this;
4754 income_table = cptr.get();
4755 cptr->base_data.position.x = child_data.x_pos;
4756 cptr->base_data.position.y = child_data.y_pos;
4757 cptr->base_data.size.x = child_data.x_size;
4758 cptr->base_data.size.y = child_data.y_size;
4759 int16_t col_sz_used = 0;
4760 budgetwindow_main_income_table_header_t::lead_space_column_start = col_sz_used;
4761 budgetwindow_main_income_table_header_t::lead_space_column_width = child_data.table_columns[0].width;
4762 col_sz_used += child_data.table_columns[0].width;
4763 budgetwindow_main_income_table_header_t::item_name_text_color = child_data.table_columns[1].header_text_color;
4764 budgetwindow_main_income_table_header_t::item_name_text_key = state.lookup_key(child_data.table_columns[1].header_key);
4765 budgetwindow_main_income_table_row_t::item_name_default_text_color = child_data.table_columns[1].cell_text_color;
4766 budgetwindow_main_income_table_row_t::item_name_text_alignment = child_data.table_columns[1].text_alignment;
4767 budgetwindow_main_income_table_header_t::item_name_column_start = col_sz_used;
4768 budgetwindow_main_income_table_header_t::item_name_column_width = child_data.table_columns[1].width;
4769 col_sz_used += child_data.table_columns[1].width;
4770 budgetwindow_main_income_table_header_t::item_value_text_color = child_data.table_columns[2].header_text_color;
4771 budgetwindow_main_income_table_header_t::item_value_text_key = state.lookup_key(child_data.table_columns[2].header_key);
4772 budgetwindow_main_income_table_row_t::item_value_default_text_color = child_data.table_columns[2].cell_text_color;
4773 budgetwindow_main_income_table_row_t::item_value_text_alignment = child_data.table_columns[2].text_alignment;
4774 budgetwindow_main_income_table_header_t::item_value_column_start = col_sz_used;
4775 budgetwindow_main_income_table_header_t::item_value_column_width = child_data.table_columns[2].width;
4776 col_sz_used += child_data.table_columns[2].width;
4777 budgetwindow_main_income_table_header_t::ascending_icon_key = child_data.ascending_sort_icon;
4778 budgetwindow_main_income_table_header_t::descending_icon_key = child_data.descending_sort_icon;
4779 budgetwindow_main_income_table_row_t::row_texture_key = child_data.row_background_a;
4780 budgetwindow_main_income_table_row_t::alt_row_texture_key = child_data.row_background_b;
4781 budgetwindow_main_income_table_t::row_height = child_data.row_height;
4782 budgetwindow_main_income_table_t::table_divider_color = child_data.table_divider_color;
4783 budgetwindow_main_income_table_t::table_highlight_color = child_data.table_highlight_color;
4784 cptr->on_create(state);
4785 this->add_child_to_back(std::move(cptr));
4786 continue;
4787 }
4788 if(child_data.name == "expenses_page_left") {
4789 auto cptr = std::make_unique<budgetwindow_main_expenses_page_left_t>();
4790 cptr->parent = this;
4791 expenses_page_left = cptr.get();
4792 cptr->base_data.position.x = child_data.x_pos;
4793 cptr->base_data.position.y = child_data.y_pos;
4794 cptr->base_data.size.x = child_data.x_size;
4795 cptr->base_data.size.y = child_data.y_size;
4797 cptr->texture_key = child_data.texture;
4798 cptr->on_create(state);
4799 this->add_child_to_back(std::move(cptr));
4800 continue;
4801 }
4802 if(child_data.name == "expenses_page_number") {
4803 auto cptr = std::make_unique<budgetwindow_main_expenses_page_number_t>();
4804 cptr->parent = this;
4805 expenses_page_number = cptr.get();
4806 cptr->base_data.position.x = child_data.x_pos;
4807 cptr->base_data.position.y = child_data.y_pos;
4808 cptr->base_data.size.x = child_data.x_size;
4809 cptr->base_data.size.y = child_data.y_size;
4810 cptr->text_scale = child_data.text_scale;
4811 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4812 cptr->text_alignment = child_data.text_alignment;
4813 cptr->text_color = child_data.text_color;
4814 cptr->on_create(state);
4815 this->add_child_to_back(std::move(cptr));
4816 continue;
4817 }
4818 if(child_data.name == "expenses_page_right") {
4819 auto cptr = std::make_unique<budgetwindow_main_expenses_page_right_t>();
4820 cptr->parent = this;
4821 expenses_page_right = cptr.get();
4822 cptr->base_data.position.x = child_data.x_pos;
4823 cptr->base_data.position.y = child_data.y_pos;
4824 cptr->base_data.size.x = child_data.x_size;
4825 cptr->base_data.size.y = child_data.y_size;
4827 cptr->texture_key = child_data.texture;
4828 cptr->on_create(state);
4829 this->add_child_to_back(std::move(cptr));
4830 continue;
4831 }
4832 if(child_data.name == "expenses_label") {
4833 auto cptr = std::make_unique<budgetwindow_main_expenses_label_t>();
4834 cptr->parent = this;
4835 expenses_label = cptr.get();
4836 cptr->base_data.position.x = child_data.x_pos;
4837 cptr->base_data.position.y = child_data.y_pos;
4838 cptr->base_data.size.x = child_data.x_size;
4839 cptr->base_data.size.y = child_data.y_size;
4840 cptr->text_key = state.lookup_key(child_data.text_key);
4841 cptr->text_scale = child_data.text_scale;
4842 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4843 cptr->text_alignment = child_data.text_alignment;
4844 cptr->text_color = child_data.text_color;
4845 cptr->on_create(state);
4846 this->add_child_to_back(std::move(cptr));
4847 continue;
4848 }
4849 if(child_data.name == "expenses_amount") {
4850 auto cptr = std::make_unique<budgetwindow_main_expenses_amount_t>();
4851 cptr->parent = this;
4852 expenses_amount = cptr.get();
4853 cptr->base_data.position.x = child_data.x_pos;
4854 cptr->base_data.position.y = child_data.y_pos;
4855 cptr->base_data.size.x = child_data.x_size;
4856 cptr->base_data.size.y = child_data.y_size;
4857 cptr->text_scale = child_data.text_scale;
4858 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4859 cptr->text_alignment = child_data.text_alignment;
4860 cptr->text_color = child_data.text_color;
4861 cptr->on_create(state);
4862 this->add_child_to_back(std::move(cptr));
4863 continue;
4864 }
4865 if(child_data.name == "expenses_table") {
4866 auto cptr = std::make_unique<budgetwindow_main_expenses_table_t>();
4867 cptr->parent = this;
4868 expenses_table = cptr.get();
4869 cptr->base_data.position.x = child_data.x_pos;
4870 cptr->base_data.position.y = child_data.y_pos;
4871 cptr->base_data.size.x = child_data.x_size;
4872 cptr->base_data.size.y = child_data.y_size;
4873 int16_t col_sz_used = 0;
4874 budgetwindow_main_expenses_table_header_t::lead_space_column_start = col_sz_used;
4875 budgetwindow_main_expenses_table_header_t::lead_space_column_width = child_data.table_columns[0].width;
4876 col_sz_used += child_data.table_columns[0].width;
4877 budgetwindow_main_expenses_table_header_t::item_name_text_color = child_data.table_columns[1].header_text_color;
4878 budgetwindow_main_expenses_table_header_t::item_name_text_key = state.lookup_key(child_data.table_columns[1].header_key);
4879 budgetwindow_main_expenses_table_row_t::item_name_default_text_color = child_data.table_columns[1].cell_text_color;
4880 budgetwindow_main_expenses_table_row_t::item_name_text_alignment = child_data.table_columns[1].text_alignment;
4881 budgetwindow_main_expenses_table_header_t::item_name_column_start = col_sz_used;
4882 budgetwindow_main_expenses_table_header_t::item_name_column_width = child_data.table_columns[1].width;
4883 col_sz_used += child_data.table_columns[1].width;
4884 budgetwindow_main_expenses_table_header_t::item_value_text_color = child_data.table_columns[2].header_text_color;
4885 budgetwindow_main_expenses_table_header_t::item_value_text_key = state.lookup_key(child_data.table_columns[2].header_key);
4886 budgetwindow_main_expenses_table_row_t::item_value_default_text_color = child_data.table_columns[2].cell_text_color;
4887 budgetwindow_main_expenses_table_row_t::item_value_text_alignment = child_data.table_columns[2].text_alignment;
4888 budgetwindow_main_expenses_table_header_t::item_value_column_start = col_sz_used;
4889 budgetwindow_main_expenses_table_header_t::item_value_column_width = child_data.table_columns[2].width;
4890 col_sz_used += child_data.table_columns[2].width;
4891 budgetwindow_main_expenses_table_header_t::ascending_icon_key = child_data.ascending_sort_icon;
4892 budgetwindow_main_expenses_table_header_t::descending_icon_key = child_data.descending_sort_icon;
4893 budgetwindow_main_expenses_table_row_t::row_texture_key = child_data.row_background_a;
4894 budgetwindow_main_expenses_table_row_t::alt_row_texture_key = child_data.row_background_b;
4895 budgetwindow_main_expenses_table_t::row_height = child_data.row_height;
4896 budgetwindow_main_expenses_table_t::table_divider_color = child_data.table_divider_color;
4897 budgetwindow_main_expenses_table_t::table_highlight_color = child_data.table_highlight_color;
4898 cptr->on_create(state);
4899 this->add_child_to_back(std::move(cptr));
4900 continue;
4901 }
4902 if(child_data.name == "admin_eff1") {
4903 auto cptr = std::make_unique<budgetwindow_main_admin_eff1_t>();
4904 cptr->parent = this;
4905 admin_eff1 = cptr.get();
4906 cptr->base_data.position.x = child_data.x_pos;
4907 cptr->base_data.position.y = child_data.y_pos;
4908 cptr->base_data.size.x = child_data.x_size;
4909 cptr->base_data.size.y = child_data.y_size;
4910 cptr->text_key = state.lookup_key(child_data.text_key);
4911 cptr->text_scale = child_data.text_scale;
4912 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4913 cptr->text_alignment = child_data.text_alignment;
4914 cptr->text_color = child_data.text_color;
4915 cptr->on_create(state);
4916 this->add_child_to_back(std::move(cptr));
4917 continue;
4918 }
4919 if(child_data.name == "admin_eff2") {
4920 auto cptr = std::make_unique<budgetwindow_main_admin_eff2_t>();
4921 cptr->parent = this;
4922 admin_eff2 = cptr.get();
4923 cptr->base_data.position.x = child_data.x_pos;
4924 cptr->base_data.position.y = child_data.y_pos;
4925 cptr->base_data.size.x = child_data.x_size;
4926 cptr->base_data.size.y = child_data.y_size;
4927 cptr->text_key = state.lookup_key(child_data.text_key);
4928 cptr->text_scale = child_data.text_scale;
4929 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4930 cptr->text_alignment = child_data.text_alignment;
4931 cptr->text_color = child_data.text_color;
4932 cptr->on_create(state);
4933 this->add_child_to_back(std::move(cptr));
4934 continue;
4935 }
4936 if(child_data.name == "admin_eff_amount") {
4937 auto cptr = std::make_unique<budgetwindow_main_admin_eff_amount_t>();
4938 cptr->parent = this;
4939 admin_eff_amount = cptr.get();
4940 cptr->base_data.position.x = child_data.x_pos;
4941 cptr->base_data.position.y = child_data.y_pos;
4942 cptr->base_data.size.x = child_data.x_size;
4943 cptr->base_data.size.y = child_data.y_size;
4944 cptr->text_scale = child_data.text_scale;
4945 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4946 cptr->text_alignment = child_data.text_alignment;
4947 cptr->text_color = child_data.text_color;
4948 cptr->on_create(state);
4949 this->add_child_to_back(std::move(cptr));
4950 continue;
4951 }
4952 if(child_data.name == "welfare_label") {
4953 auto cptr = std::make_unique<budgetwindow_main_welfare_label_t>();
4954 cptr->parent = this;
4955 welfare_label = cptr.get();
4956 cptr->base_data.position.x = child_data.x_pos;
4957 cptr->base_data.position.y = child_data.y_pos;
4958 cptr->base_data.size.x = child_data.x_size;
4959 cptr->base_data.size.y = child_data.y_size;
4960 cptr->text_key = state.lookup_key(child_data.text_key);
4961 cptr->text_scale = child_data.text_scale;
4962 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4963 cptr->text_alignment = child_data.text_alignment;
4964 cptr->text_color = child_data.text_color;
4965 cptr->on_create(state);
4966 this->add_child_to_back(std::move(cptr));
4967 continue;
4968 }
4969 if(child_data.name == "chart_max_a") {
4970 auto cptr = std::make_unique<budgetwindow_main_chart_max_a_t>();
4971 cptr->parent = this;
4972 chart_max_a = cptr.get();
4973 cptr->base_data.position.x = child_data.x_pos;
4974 cptr->base_data.position.y = child_data.y_pos;
4975 cptr->base_data.size.x = child_data.x_size;
4976 cptr->base_data.size.y = child_data.y_size;
4977 cptr->text_key = state.lookup_key(child_data.text_key);
4978 cptr->text_scale = child_data.text_scale;
4979 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4980 cptr->text_alignment = child_data.text_alignment;
4981 cptr->text_color = child_data.text_color;
4982 cptr->on_create(state);
4983 this->add_child_to_back(std::move(cptr));
4984 continue;
4985 }
4986 if(child_data.name == "chart_min") {
4987 auto cptr = std::make_unique<budgetwindow_main_chart_min_t>();
4988 cptr->parent = this;
4989 chart_min = cptr.get();
4990 cptr->base_data.position.x = child_data.x_pos;
4991 cptr->base_data.position.y = child_data.y_pos;
4992 cptr->base_data.size.x = child_data.x_size;
4993 cptr->base_data.size.y = child_data.y_size;
4994 cptr->text_key = state.lookup_key(child_data.text_key);
4995 cptr->text_scale = child_data.text_scale;
4996 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
4997 cptr->text_alignment = child_data.text_alignment;
4998 cptr->text_color = child_data.text_color;
4999 cptr->on_create(state);
5000 this->add_child_to_back(std::move(cptr));
5001 continue;
5002 }
5003 if(child_data.name == "chart_max_b") {
5004 auto cptr = std::make_unique<budgetwindow_main_chart_max_b_t>();
5005 cptr->parent = this;
5006 chart_max_b = cptr.get();
5007 cptr->base_data.position.x = child_data.x_pos;
5008 cptr->base_data.position.y = child_data.y_pos;
5009 cptr->base_data.size.x = child_data.x_size;
5010 cptr->base_data.size.y = child_data.y_size;
5011 cptr->text_key = state.lookup_key(child_data.text_key);
5012 cptr->text_scale = child_data.text_scale;
5013 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5014 cptr->text_alignment = child_data.text_alignment;
5015 cptr->text_color = child_data.text_color;
5016 cptr->on_create(state);
5017 this->add_child_to_back(std::move(cptr));
5018 continue;
5019 }
5020 if(child_data.name == "chart_poplabel") {
5021 auto cptr = std::make_unique<budgetwindow_main_chart_poplabel_t>();
5022 cptr->parent = this;
5023 chart_poplabel = cptr.get();
5024 cptr->base_data.position.x = child_data.x_pos;
5025 cptr->base_data.position.y = child_data.y_pos;
5026 cptr->base_data.size.x = child_data.x_size;
5027 cptr->base_data.size.y = child_data.y_size;
5028 cptr->text_key = state.lookup_key(child_data.text_key);
5029 cptr->text_scale = child_data.text_scale;
5030 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5031 cptr->text_alignment = child_data.text_alignment;
5032 cptr->text_color = child_data.text_color;
5033 cptr->on_create(state);
5034 this->add_child_to_back(std::move(cptr));
5035 continue;
5036 }
5037 if(child_data.name == "chart_needslabel") {
5038 auto cptr = std::make_unique<budgetwindow_main_chart_needslabel_t>();
5039 cptr->parent = this;
5040 chart_needslabel = cptr.get();
5041 cptr->base_data.position.x = child_data.x_pos;
5042 cptr->base_data.position.y = child_data.y_pos;
5043 cptr->base_data.size.x = child_data.x_size;
5044 cptr->base_data.size.y = child_data.y_size;
5045 cptr->text_key = state.lookup_key(child_data.text_key);
5046 cptr->text_scale = child_data.text_scale;
5047 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5048 cptr->text_alignment = child_data.text_alignment;
5049 cptr->text_color = child_data.text_color;
5050 cptr->on_create(state);
5051 this->add_child_to_back(std::move(cptr));
5052 continue;
5053 }
5054 if(child_data.name == "welfare_chart_poor") {
5055 auto cptr = std::make_unique<budgetwindow_main_welfare_chart_poor_t>();
5056 cptr->parent = this;
5057 welfare_chart_poor = cptr.get();
5058 cptr->base_data.position.x = child_data.x_pos;
5059 cptr->base_data.position.y = child_data.y_pos;
5060 cptr->base_data.size.x = child_data.x_size;
5061 cptr->base_data.size.y = child_data.y_size;
5062 cptr->line_color = child_data.table_highlight_color;
5063 cptr->on_create(state);
5064 this->add_child_to_back(std::move(cptr));
5065 continue;
5066 }
5067 if(child_data.name == "welfare_chart_middle") {
5068 auto cptr = std::make_unique<budgetwindow_main_welfare_chart_middle_t>();
5069 cptr->parent = this;
5070 welfare_chart_middle = cptr.get();
5071 cptr->base_data.position.x = child_data.x_pos;
5072 cptr->base_data.position.y = child_data.y_pos;
5073 cptr->base_data.size.x = child_data.x_size;
5074 cptr->base_data.size.y = child_data.y_size;
5075 cptr->line_color = child_data.table_highlight_color;
5076 cptr->on_create(state);
5077 this->add_child_to_back(std::move(cptr));
5078 continue;
5079 }
5080 if(child_data.name == "welfare_chart_rich") {
5081 auto cptr = std::make_unique<budgetwindow_main_welfare_chart_rich_t>();
5082 cptr->parent = this;
5083 welfare_chart_rich = cptr.get();
5084 cptr->base_data.position.x = child_data.x_pos;
5085 cptr->base_data.position.y = child_data.y_pos;
5086 cptr->base_data.size.x = child_data.x_size;
5087 cptr->base_data.size.y = child_data.y_size;
5088 cptr->line_color = child_data.table_highlight_color;
5089 cptr->on_create(state);
5090 this->add_child_to_back(std::move(cptr));
5091 continue;
5092 }
5093 if(child_data.name == "hover_poor") {
5094 auto cptr = std::make_unique<budgetwindow_main_hover_poor_t>();
5095 cptr->parent = this;
5096 hover_poor = cptr.get();
5097 cptr->base_data.position.x = child_data.x_pos;
5098 cptr->base_data.position.y = child_data.y_pos;
5099 cptr->base_data.size.x = child_data.x_size;
5100 cptr->base_data.size.y = child_data.y_size;
5101 cptr->texture_key = child_data.texture;
5102 cptr->text_key = state.lookup_key(child_data.text_key);
5103 cptr->text_scale = child_data.text_scale;
5104 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5105 cptr->text_alignment = child_data.text_alignment;
5106 cptr->text_color = child_data.text_color;
5107 cptr->on_create(state);
5108 this->add_child_to_back(std::move(cptr));
5109 continue;
5110 }
5111 if(child_data.name == "hover_middle") {
5112 auto cptr = std::make_unique<budgetwindow_main_hover_middle_t>();
5113 cptr->parent = this;
5114 hover_middle = cptr.get();
5115 cptr->base_data.position.x = child_data.x_pos;
5116 cptr->base_data.position.y = child_data.y_pos;
5117 cptr->base_data.size.x = child_data.x_size;
5118 cptr->base_data.size.y = child_data.y_size;
5119 cptr->texture_key = child_data.texture;
5120 cptr->text_key = state.lookup_key(child_data.text_key);
5121 cptr->text_scale = child_data.text_scale;
5122 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5123 cptr->text_alignment = child_data.text_alignment;
5124 cptr->text_color = child_data.text_color;
5125 cptr->on_create(state);
5126 this->add_child_to_back(std::move(cptr));
5127 continue;
5128 }
5129 if(child_data.name == "hover_rich") {
5130 auto cptr = std::make_unique<budgetwindow_main_hover_rich_t>();
5131 cptr->parent = this;
5132 hover_rich = cptr.get();
5133 cptr->base_data.position.x = child_data.x_pos;
5134 cptr->base_data.position.y = child_data.y_pos;
5135 cptr->base_data.size.x = child_data.x_size;
5136 cptr->base_data.size.y = child_data.y_size;
5137 cptr->texture_key = child_data.texture;
5138 cptr->text_key = state.lookup_key(child_data.text_key);
5139 cptr->text_scale = child_data.text_scale;
5140 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5141 cptr->text_alignment = child_data.text_alignment;
5142 cptr->text_color = child_data.text_color;
5143 cptr->on_create(state);
5144 this->add_child_to_back(std::move(cptr));
5145 continue;
5146 }
5147 if(child_data.name == "debt_label") {
5148 auto cptr = std::make_unique<budgetwindow_main_debt_label_t>();
5149 cptr->parent = this;
5150 debt_label = cptr.get();
5151 cptr->base_data.position.x = child_data.x_pos;
5152 cptr->base_data.position.y = child_data.y_pos;
5153 cptr->base_data.size.x = child_data.x_size;
5154 cptr->base_data.size.y = child_data.y_size;
5155 cptr->text_key = state.lookup_key(child_data.text_key);
5156 cptr->text_scale = child_data.text_scale;
5157 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5158 cptr->text_alignment = child_data.text_alignment;
5159 cptr->text_color = child_data.text_color;
5160 cptr->on_create(state);
5161 this->add_child_to_back(std::move(cptr));
5162 continue;
5163 }
5164 if(child_data.name == "debt_enable") {
5165 auto cptr = std::make_unique<budgetwindow_main_debt_enable_t>();
5166 cptr->parent = this;
5167 debt_enable = cptr.get();
5168 cptr->base_data.position.x = child_data.x_pos;
5169 cptr->base_data.position.y = child_data.y_pos;
5170 cptr->base_data.size.x = child_data.x_size;
5171 cptr->base_data.size.y = child_data.y_size;
5172 cptr->texture_key = child_data.texture;
5173 cptr->alt_texture_key = child_data.alt_texture;
5174 cptr->text_key = state.lookup_key(child_data.text_key);
5175 cptr->text_scale = child_data.text_scale;
5176 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5177 cptr->text_alignment = child_data.text_alignment;
5178 cptr->text_color = child_data.text_color;
5179 cptr->on_create(state);
5180 this->add_child_to_back(std::move(cptr));
5181 continue;
5182 }
5183 if(child_data.name == "total_debt_label") {
5184 auto cptr = std::make_unique<budgetwindow_main_total_debt_label_t>();
5185 cptr->parent = this;
5186 total_debt_label = cptr.get();
5187 cptr->base_data.position.x = child_data.x_pos;
5188 cptr->base_data.position.y = child_data.y_pos;
5189 cptr->base_data.size.x = child_data.x_size;
5190 cptr->base_data.size.y = child_data.y_size;
5191 cptr->text_key = state.lookup_key(child_data.text_key);
5192 cptr->text_scale = child_data.text_scale;
5193 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5194 cptr->text_alignment = child_data.text_alignment;
5195 cptr->text_color = child_data.text_color;
5196 cptr->on_create(state);
5197 this->add_child_to_back(std::move(cptr));
5198 continue;
5199 }
5200 if(child_data.name == "max_debt_label") {
5201 auto cptr = std::make_unique<budgetwindow_main_max_debt_label_t>();
5202 cptr->parent = this;
5203 max_debt_label = cptr.get();
5204 cptr->base_data.position.x = child_data.x_pos;
5205 cptr->base_data.position.y = child_data.y_pos;
5206 cptr->base_data.size.x = child_data.x_size;
5207 cptr->base_data.size.y = child_data.y_size;
5208 cptr->text_key = state.lookup_key(child_data.text_key);
5209 cptr->text_scale = child_data.text_scale;
5210 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5211 cptr->text_alignment = child_data.text_alignment;
5212 cptr->text_color = child_data.text_color;
5213 cptr->on_create(state);
5214 this->add_child_to_back(std::move(cptr));
5215 continue;
5216 }
5217 if(child_data.name == "total_debt_amount") {
5218 auto cptr = std::make_unique<budgetwindow_main_total_debt_amount_t>();
5219 cptr->parent = this;
5220 total_debt_amount = cptr.get();
5221 cptr->base_data.position.x = child_data.x_pos;
5222 cptr->base_data.position.y = child_data.y_pos;
5223 cptr->base_data.size.x = child_data.x_size;
5224 cptr->base_data.size.y = child_data.y_size;
5225 cptr->text_key = state.lookup_key(child_data.text_key);
5226 cptr->text_scale = child_data.text_scale;
5227 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5228 cptr->text_alignment = child_data.text_alignment;
5229 cptr->text_color = child_data.text_color;
5230 cptr->on_create(state);
5231 this->add_child_to_back(std::move(cptr));
5232 continue;
5233 }
5234 if(child_data.name == "max_debt_amount") {
5235 auto cptr = std::make_unique<budgetwindow_main_max_debt_amount_t>();
5236 cptr->parent = this;
5237 max_debt_amount = cptr.get();
5238 cptr->base_data.position.x = child_data.x_pos;
5239 cptr->base_data.position.y = child_data.y_pos;
5240 cptr->base_data.size.x = child_data.x_size;
5241 cptr->base_data.size.y = child_data.y_size;
5242 cptr->text_key = state.lookup_key(child_data.text_key);
5243 cptr->text_scale = child_data.text_scale;
5244 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
5245 cptr->text_alignment = child_data.text_alignment;
5246 cptr->text_color = child_data.text_color;
5247 cptr->on_create(state);
5248 this->add_child_to_back(std::move(cptr));
5249 continue;
5250 }
5251 if(child_data.name == "debt_chart") {
5252 auto cptr = std::make_unique<budgetwindow_main_debt_chart_t>();
5253 cptr->parent = this;
5254 debt_chart = cptr.get();
5255 cptr->base_data.position.x = child_data.x_pos;
5256 cptr->base_data.position.y = child_data.y_pos;
5257 cptr->base_data.size.x = child_data.x_size;
5258 cptr->base_data.size.y = child_data.y_size;
5260 cptr->on_create(state);
5261 this->add_child_to_back(std::move(cptr));
5262 continue;
5263 }
5264 if(child_data.name == "debt_overlay") {
5265 auto cptr = std::make_unique<budgetwindow_main_debt_overlay_t>();
5266 cptr->parent = this;
5267 debt_overlay = cptr.get();
5268 cptr->base_data.position.x = child_data.x_pos;
5269 cptr->base_data.position.y = child_data.y_pos;
5270 cptr->base_data.size.x = child_data.x_size;
5271 cptr->base_data.size.y = child_data.y_size;
5273 cptr->texture_key = child_data.texture;
5274 cptr->on_create(state);
5275 this->add_child_to_back(std::move(cptr));
5276 continue;
5277 }
5278 }
5279// BEGIN main::create
5280// END
5281}
5282std::unique_ptr<ui::element_base> make_budgetwindow_main(sys::state& state) {
5283 auto ptr = std::make_unique<budgetwindow_main_t>();
5284 ptr->on_create(state);
5285 return ptr;
5286}
5287void budgetwindow_section_header_label_t::set_text(sys::state& state, std::string const& new_text) {
5288 if(new_text != cached_text) {
5289 cached_text = new_text;
5290 internal_layout.contents.clear();
5291 internal_layout.number_of_lines = 0;
5292 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
5293 sl.add_text(state, cached_text);
5294 }
5295}
5296void budgetwindow_section_header_label_t::on_reset_text(sys::state& state) noexcept {
5297}
5298void budgetwindow_section_header_label_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5299 if(internal_layout.contents.empty()) return;
5300 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
5301 auto linesz = state.font_collection.line_height(state, fh);
5302 if(linesz == 0.0f) return;
5303 auto ycentered = (base_data.size.y - linesz) / 2;
5304 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
5305 for(auto& t : internal_layout.contents) {
5306 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
5307 }
5308}
5309void budgetwindow_section_header_label_t::on_update(sys::state& state) noexcept {
5310 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5311// BEGIN section_header::label::update
5312 switch(section_header.section_type) {
5313 case budget_categories::diplomatic_income: set_text(state, text::produce_simple_string(state, "alice_budget_diplo_income")); break;
5314 case budget_categories::poor_tax: set_text(state, text::produce_simple_string(state, "budget_tax_poor")); break;
5315 case budget_categories::middle_tax: set_text(state, text::produce_simple_string(state, "budget_tax_middle")); break;
5316 case budget_categories::rich_tax: set_text(state, text::produce_simple_string(state, "budget_tax_rich")); break;
5317 case budget_categories::tariffs_import: set_text(state, text::produce_simple_string(state, "alice_budget_tariffs_import")); break;
5318 case budget_categories::tariffs_export: set_text(state, text::produce_simple_string(state, "alice_budget_tariffs_export")); break;
5319 case budget_categories::gold: set_text(state, text::produce_simple_string(state, "alice_budget_gold")); break;
5320 case budget_categories::diplomatic_expenses: set_text(state, text::produce_simple_string(state, "alice_budget_diplo_expenses")); break;
5321 case budget_categories::social: set_text(state, text::produce_simple_string(state, "alice_budget_social_spending")); break;
5322 case budget_categories::military: set_text(state, text::produce_simple_string(state, "military")); break;
5323 case budget_categories::education: set_text(state, text::produce_simple_string(state, "education")); break;
5324 case budget_categories::admin: set_text(state, text::produce_simple_string(state, "administration")); break;
5325 case budget_categories::domestic_investment: set_text(state, text::produce_simple_string(state, "alice_budget_domestic_investment")); break;
5326 case budget_categories::overseas_spending: set_text(state, text::produce_simple_string(state, "alice_budget_overseas_maintanance")); break;
5327 case budget_categories::subsidies: set_text(state, text::produce_simple_string(state, "budget_industrial_subsidies")); break;
5328 case budget_categories::construction: set_text(state, text::produce_simple_string(state, "alice_budget_construction")); break;
5329 case budget_categories::army_upkeep: set_text(state, text::produce_simple_string(state, "alice_budget_army_upkeep")); break;
5330 case budget_categories::navy_upkeep: set_text(state, text::produce_simple_string(state, "alice_budget_navy_upkeep")); break;
5331 case budget_categories::debt_payment: set_text(state, text::produce_simple_string(state, "alice_budget_debt_service")); break;
5332 case budget_categories::stockpile: set_text(state, text::produce_simple_string(state, "national_stockpile")); break;
5333 default: set_text(state, ""); break;
5334 }
5335// END
5336}
5337void budgetwindow_section_header_label_t::on_create(sys::state& state) noexcept {
5338// BEGIN section_header::label::create
5339// END
5340}
5341ui::message_result budgetwindow_section_header_llbutton_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5342 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5343 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
5344// BEGIN section_header::llbutton::lbutton_action
5346 switch(section_header.section_type) {
5347 case budget_categories::diplomatic_income: break;
5348 case budget_categories::poor_tax: vals.poor_tax = economy::budget_minimums(state, state.local_player_nation).poor_tax; break;
5349 case budget_categories::middle_tax: vals.middle_tax = economy::budget_minimums(state, state.local_player_nation).middle_tax; break;
5350 case budget_categories::rich_tax: vals.rich_tax = economy::budget_minimums(state, state.local_player_nation).rich_tax; break;
5351 case budget_categories::tariffs_import: vals.tariffs_import = economy::budget_minimums(state, state.local_player_nation).tariffs_import; break;
5352 case budget_categories::tariffs_export: vals.tariffs_export = economy::budget_minimums(state, state.local_player_nation).tariffs_export; break;
5353 case budget_categories::gold: break;
5354 case budget_categories::diplomatic_expenses: break;
5355 case budget_categories::social: vals.social_spending = economy::budget_minimums(state, state.local_player_nation).social_spending; break;
5356 case budget_categories::military: vals.military_spending = economy::budget_minimums(state, state.local_player_nation).military_spending; break;
5357 case budget_categories::education: vals.education_spending = economy::budget_minimums(state, state.local_player_nation).education_spending; break;
5358 case budget_categories::admin: vals.administrative_spending = economy::budget_minimums(state, state.local_player_nation).administrative_spending; break;
5359 case budget_categories::domestic_investment: vals.domestic_investment = economy::budget_minimums(state, state.local_player_nation).domestic_investment; break;
5360 case budget_categories::overseas_spending: vals.overseas = economy::budget_minimums(state, state.local_player_nation).overseas; break;
5361 case budget_categories::subsidies: break;
5362 case budget_categories::construction: vals.construction_spending = economy::budget_minimums(state, state.local_player_nation).construction_spending; break;
5363 case budget_categories::army_upkeep: vals.land_spending = economy::budget_minimums(state, state.local_player_nation).land_spending; break;
5364 case budget_categories::navy_upkeep: vals.naval_spending = economy::budget_minimums(state, state.local_player_nation).naval_spending; break;
5365 case budget_categories::debt_payment: break;
5366 case budget_categories::stockpile: break;
5367 default: break;
5368 }
5369 command::change_budget_settings(state, state.local_player_nation, vals);
5370// END
5372}
5373ui::message_result budgetwindow_section_header_llbutton_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5375}
5376void budgetwindow_section_header_llbutton_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
5377 text::add_line(state, contents, tooltip_key);
5378}
5379void budgetwindow_section_header_llbutton_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5380 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
5381}
5382void budgetwindow_section_header_llbutton_t::on_update(sys::state& state) noexcept {
5383 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5384// BEGIN section_header::llbutton::update
5385 switch(section_header.section_type) {
5386 case budget_categories::diplomatic_income: set_visible(state, false); break;
5387 case budget_categories::poor_tax: set_visible(state, true); break;
5388 case budget_categories::middle_tax: set_visible(state, true); break;
5389 case budget_categories::rich_tax: set_visible(state, true); break;
5390 case budget_categories::tariffs_import: set_visible(state, true); break;
5391 case budget_categories::tariffs_export: set_visible(state, true); break;
5392 case budget_categories::gold: set_visible(state, false); break;
5393 case budget_categories::diplomatic_expenses: set_visible(state, false); break;
5394 case budget_categories::social: set_visible(state, true); break;
5395 case budget_categories::military: set_visible(state, true); break;
5396 case budget_categories::education: set_visible(state, true); break;
5397 case budget_categories::admin: set_visible(state, true); break;
5398 case budget_categories::domestic_investment: set_visible(state, true); break;
5399 case budget_categories::overseas_spending: set_visible(state, true); break;
5400 case budget_categories::subsidies: set_visible(state, false); break;
5401 case budget_categories::construction: set_visible(state, true); break;
5402 case budget_categories::army_upkeep: set_visible(state, true); break;
5403 case budget_categories::navy_upkeep: set_visible(state, true); break;
5404 case budget_categories::debt_payment: set_visible(state, false); break;
5405 case budget_categories::stockpile: set_visible(state, false); break;
5406 default: set_visible(state, false); break;
5407 }
5408// END
5409}
5410void budgetwindow_section_header_llbutton_t::on_create(sys::state& state) noexcept {
5411// BEGIN section_header::llbutton::create
5412// END
5413}
5414ui::message_result budgetwindow_section_header_lbutton_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5415 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5416 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
5418// BEGIN section_header::lbutton::lbutton_shift_action
5420 switch(section_header.section_type) {
5421 case budget_categories::diplomatic_income: break;
5422 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) - 1, 0, 100)); break;
5423 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) - 1, 0, 100)); break;
5424 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) - 1, 0, 100)); break;
5425 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) - 1, 0, 100)); break;
5426 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) - 1, 0, 100)); break;
5427 case budget_categories::gold: break;
5428 case budget_categories::diplomatic_expenses: break;
5429 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) - 1, 0, 100)); break;
5430 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) - 1, 0, 100)); break;
5431 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) - 1, 0, 100)); break;
5432 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) - 1, 0, 100)); break;
5433 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) - 1, 0, 100)); break;
5434 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) - 1, 0, 100)); break;
5435 case budget_categories::subsidies: break;
5436 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) - 1, 0, 100)); break;
5437 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) - 1, 0, 100)); break;
5438 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) - 1, 0, 100)); break;
5439 case budget_categories::debt_payment: break;
5440 case budget_categories::stockpile: break;
5441 default: break;
5442 }
5443 command::change_budget_settings(state, state.local_player_nation, vals);
5444// END
5446 }
5447// BEGIN section_header::lbutton::lbutton_action
5449 switch(section_header.section_type) {
5450 case budget_categories::diplomatic_income: break;
5451 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) - 10, 0, 100)); break;
5452 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) - 10, 0, 100)); break;
5453 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) - 10, 0, 100)); break;
5454 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) - 10, 0, 100)); break;
5455 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) - 10, 0, 100)); break;
5456 case budget_categories::gold: break;
5457 case budget_categories::diplomatic_expenses: break;
5458 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) - 10, 0, 100)); break;
5459 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) - 10, 0, 100)); break;
5460 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) - 10, 0, 100)); break;
5461 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) - 10, 0, 100)); break;
5462 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) - 10, 0, 100)); break;
5463 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) - 10, 0, 100)); break;
5464 case budget_categories::subsidies: break;
5465 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) - 10, 0, 100)); break;
5466 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) - 10, 0, 100)); break;
5467 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) - 10, 0, 100)); break;
5468 case budget_categories::debt_payment: break;
5469 case budget_categories::stockpile: break;
5470 default: break;
5471 }
5472 command::change_budget_settings(state, state.local_player_nation, vals);
5473// END
5475}
5476ui::message_result budgetwindow_section_header_lbutton_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5478}
5479void budgetwindow_section_header_lbutton_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
5480 text::add_line(state, contents, tooltip_key);
5481}
5482void budgetwindow_section_header_lbutton_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5483 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
5484}
5485void budgetwindow_section_header_lbutton_t::on_update(sys::state& state) noexcept {
5486 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5487// BEGIN section_header::lbutton::update
5488 switch(section_header.section_type) {
5489 case budget_categories::diplomatic_income: set_visible(state, false); break;
5490 case budget_categories::poor_tax: set_visible(state, true); break;
5491 case budget_categories::middle_tax: set_visible(state, true); break;
5492 case budget_categories::rich_tax: set_visible(state, true); break;
5493 case budget_categories::tariffs_import: set_visible(state, true); break;
5494 case budget_categories::tariffs_export: set_visible(state, true); break;
5495 case budget_categories::gold: set_visible(state, false); break;
5496 case budget_categories::diplomatic_expenses: set_visible(state, false); break;
5497 case budget_categories::social: set_visible(state, true); break;
5498 case budget_categories::military: set_visible(state, true); break;
5499 case budget_categories::education: set_visible(state, true); break;
5500 case budget_categories::admin: set_visible(state, true); break;
5501 case budget_categories::domestic_investment: set_visible(state, true); break;
5502 case budget_categories::overseas_spending: set_visible(state, true); break;
5503 case budget_categories::subsidies: set_visible(state, false); break;
5504 case budget_categories::construction: set_visible(state, true); break;
5505 case budget_categories::army_upkeep: set_visible(state, true); break;
5506 case budget_categories::navy_upkeep: set_visible(state, true); break;
5507 case budget_categories::debt_payment: set_visible(state, false); break;
5508 case budget_categories::stockpile: set_visible(state, false); break;
5509 default: set_visible(state, false); break;
5510 }
5511// END
5512}
5513void budgetwindow_section_header_lbutton_t::on_create(sys::state& state) noexcept {
5514// BEGIN section_header::lbutton::create
5515// END
5516}
5517ui::message_result budgetwindow_section_header_rbutton_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5518 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5519 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
5521// BEGIN section_header::rbutton::lbutton_shift_action
5523 switch(section_header.section_type) {
5524 case budget_categories::diplomatic_income: break;
5525 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) + 1, 0, 100)); break;
5526 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) + 1, 0, 100)); break;
5527 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) + 1, 0, 100)); break;
5528 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) + 1, 0, 100)); break;
5529 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) + 1, 0, 100)); break;
5530 case budget_categories::gold: break;
5531 case budget_categories::diplomatic_expenses: break;
5532 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) + 1, 0, 100)); break;
5533 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) + 1, 0, 100)); break;
5534 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) + 1, 0, 100)); break;
5535 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) + 1, 0, 100)); break;
5536 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) + 1, 0, 100)); break;
5537 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) + 1, 0, 100)); break;
5538 case budget_categories::subsidies: break;
5539 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) + 1, 0, 100)); break;
5540 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) + 1, 0, 100)); break;
5541 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) + 1, 0, 100)); break;
5542 case budget_categories::debt_payment: break;
5543 case budget_categories::stockpile: break;
5544 default: break;
5545 }
5546 command::change_budget_settings(state, state.local_player_nation, vals);
5547// END
5549 }
5550// BEGIN section_header::rbutton::lbutton_action
5552 switch(section_header.section_type) {
5553 case budget_categories::diplomatic_income: break;
5554 case budget_categories::poor_tax: vals.poor_tax = int8_t(std::clamp(state.world.nation_get_poor_tax(state.local_player_nation) + 10, 0, 100)); break;
5555 case budget_categories::middle_tax: vals.middle_tax = int8_t(std::clamp(state.world.nation_get_middle_tax(state.local_player_nation) + 10, 0, 100)); break;
5556 case budget_categories::rich_tax: vals.rich_tax = int8_t(std::clamp(state.world.nation_get_rich_tax(state.local_player_nation) + 10, 0, 100)); break;
5557 case budget_categories::tariffs_import: vals.tariffs_import = int8_t(std::clamp(state.world.nation_get_tariffs_import(state.local_player_nation) + 10, 0, 100)); break;
5558 case budget_categories::tariffs_export: vals.tariffs_export = int8_t(std::clamp(state.world.nation_get_tariffs_export(state.local_player_nation) + 10, 0, 100)); break;
5559 case budget_categories::gold: break;
5560 case budget_categories::diplomatic_expenses: break;
5561 case budget_categories::social: vals.social_spending = int8_t(std::clamp(state.world.nation_get_social_spending(state.local_player_nation) + 10, 0, 100)); break;
5562 case budget_categories::military: vals.military_spending = int8_t(std::clamp(state.world.nation_get_military_spending(state.local_player_nation) + 10, 0, 100)); break;
5563 case budget_categories::education: vals.education_spending = int8_t(std::clamp(state.world.nation_get_education_spending(state.local_player_nation) + 10, 0, 100)); break;
5564 case budget_categories::admin: vals.administrative_spending = int8_t(std::clamp(state.world.nation_get_administrative_spending(state.local_player_nation) + 10, 0, 100)); break;
5565 case budget_categories::domestic_investment: vals.domestic_investment = int8_t(std::clamp(state.world.nation_get_domestic_investment_spending(state.local_player_nation) + 10, 0, 100)); break;
5566 case budget_categories::overseas_spending: vals.overseas = int8_t(std::clamp(state.world.nation_get_overseas_spending(state.local_player_nation) + 10, 0, 100)); break;
5567 case budget_categories::subsidies: break;
5568 case budget_categories::construction: vals.construction_spending = int8_t(std::clamp(state.world.nation_get_construction_spending(state.local_player_nation) + 10, 0, 100)); break;
5569 case budget_categories::army_upkeep: vals.land_spending = int8_t(std::clamp(state.world.nation_get_land_spending(state.local_player_nation) + 10, 0, 100)); break;
5570 case budget_categories::navy_upkeep: vals.naval_spending = int8_t(std::clamp(state.world.nation_get_naval_spending(state.local_player_nation) + 10, 0, 100)); break;
5571 case budget_categories::debt_payment: break;
5572 case budget_categories::stockpile: break;
5573 default: break;
5574 }
5575 command::change_budget_settings(state, state.local_player_nation, vals);
5576// END
5578}
5579ui::message_result budgetwindow_section_header_rbutton_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5581}
5582void budgetwindow_section_header_rbutton_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
5583 text::add_line(state, contents, tooltip_key);
5584}
5585void budgetwindow_section_header_rbutton_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5586 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
5587}
5588void budgetwindow_section_header_rbutton_t::on_update(sys::state& state) noexcept {
5589 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5590// BEGIN section_header::rbutton::update
5591 switch(section_header.section_type) {
5592 case budget_categories::diplomatic_income: set_visible(state, false); break;
5593 case budget_categories::poor_tax: set_visible(state, true); break;
5594 case budget_categories::middle_tax: set_visible(state, true); break;
5595 case budget_categories::rich_tax: set_visible(state, true); break;
5596 case budget_categories::tariffs_import: set_visible(state, true); break;
5597 case budget_categories::tariffs_export: set_visible(state, true); break;
5598 case budget_categories::gold: set_visible(state, false); break;
5599 case budget_categories::diplomatic_expenses: set_visible(state, false); break;
5600 case budget_categories::social: set_visible(state, true); break;
5601 case budget_categories::military: set_visible(state, true); break;
5602 case budget_categories::education: set_visible(state, true); break;
5603 case budget_categories::admin: set_visible(state, true); break;
5604 case budget_categories::domestic_investment: set_visible(state, true); break;
5605 case budget_categories::overseas_spending: set_visible(state, true); break;
5606 case budget_categories::subsidies: set_visible(state, false); break;
5607 case budget_categories::construction: set_visible(state, true); break;
5608 case budget_categories::army_upkeep: set_visible(state, true); break;
5609 case budget_categories::navy_upkeep: set_visible(state, true); break;
5610 case budget_categories::debt_payment: set_visible(state, false); break;
5611 case budget_categories::stockpile: set_visible(state, false); break;
5612 default: set_visible(state, false); break;
5613 }
5614// END
5615}
5616void budgetwindow_section_header_rbutton_t::on_create(sys::state& state) noexcept {
5617// BEGIN section_header::rbutton::create
5618// END
5619}
5620ui::message_result budgetwindow_section_header_rrbutton_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5621 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5622 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
5623// BEGIN section_header::rrbutton::lbutton_action
5625 switch(section_header.section_type) {
5626 case budget_categories::diplomatic_income: break;
5627 case budget_categories::poor_tax: vals.poor_tax = economy::budget_maximums(state, state.local_player_nation).poor_tax; break;
5628 case budget_categories::middle_tax: vals.middle_tax = economy::budget_maximums(state, state.local_player_nation).middle_tax; break;
5629 case budget_categories::rich_tax: vals.rich_tax = economy::budget_maximums(state, state.local_player_nation).rich_tax; break;
5630 case budget_categories::tariffs_import: vals.tariffs_import = economy::budget_maximums(state, state.local_player_nation).tariffs_import; break;
5631 case budget_categories::tariffs_export: vals.tariffs_export = economy::budget_maximums(state, state.local_player_nation).tariffs_export; break;
5632 case budget_categories::gold: break;
5633 case budget_categories::diplomatic_expenses: break;
5634 case budget_categories::social: vals.social_spending = economy::budget_maximums(state, state.local_player_nation).social_spending; break;
5635 case budget_categories::military: vals.military_spending = economy::budget_maximums(state, state.local_player_nation).military_spending; break;
5636 case budget_categories::education: vals.education_spending = economy::budget_maximums(state, state.local_player_nation).education_spending; break;
5637 case budget_categories::admin: vals.administrative_spending = economy::budget_maximums(state, state.local_player_nation).administrative_spending; break;
5638 case budget_categories::domestic_investment: vals.domestic_investment = economy::budget_maximums(state, state.local_player_nation).domestic_investment; break;
5639 case budget_categories::overseas_spending: vals.overseas = economy::budget_maximums(state, state.local_player_nation).overseas; break;
5640 case budget_categories::subsidies: break;
5641 case budget_categories::construction: vals.construction_spending = economy::budget_maximums(state, state.local_player_nation).construction_spending; break;
5642 case budget_categories::army_upkeep: vals.land_spending = economy::budget_maximums(state, state.local_player_nation).land_spending; break;
5643 case budget_categories::navy_upkeep: vals.naval_spending = economy::budget_maximums(state, state.local_player_nation).naval_spending; break;
5644 case budget_categories::debt_payment: break;
5645 case budget_categories::stockpile: break;
5646 default: break;
5647 }
5648 command::change_budget_settings(state, state.local_player_nation, vals);
5649// END
5651}
5652ui::message_result budgetwindow_section_header_rrbutton_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5654}
5655void budgetwindow_section_header_rrbutton_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
5656 text::add_line(state, contents, tooltip_key);
5657}
5658void budgetwindow_section_header_rrbutton_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5659 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
5660}
5661void budgetwindow_section_header_rrbutton_t::on_update(sys::state& state) noexcept {
5662 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5663// BEGIN section_header::rrbutton::update
5664 switch(section_header.section_type) {
5665 case budget_categories::diplomatic_income: set_visible(state, false); break;
5666 case budget_categories::poor_tax: set_visible(state, true); break;
5667 case budget_categories::middle_tax: set_visible(state, true); break;
5668 case budget_categories::rich_tax: set_visible(state, true); break;
5669 case budget_categories::tariffs_import: set_visible(state, true); break;
5670 case budget_categories::tariffs_export: set_visible(state, true); break;
5671 case budget_categories::gold: set_visible(state, false); break;
5672 case budget_categories::diplomatic_expenses: set_visible(state, false); break;
5673 case budget_categories::social: set_visible(state, true); break;
5674 case budget_categories::military: set_visible(state, true); break;
5675 case budget_categories::education: set_visible(state, true); break;
5676 case budget_categories::admin: set_visible(state, true); break;
5677 case budget_categories::domestic_investment: set_visible(state, true); break;
5678 case budget_categories::overseas_spending: set_visible(state, true); break;
5679 case budget_categories::subsidies: set_visible(state, false); break;
5680 case budget_categories::construction: set_visible(state, true); break;
5681 case budget_categories::army_upkeep: set_visible(state, true); break;
5682 case budget_categories::navy_upkeep: set_visible(state, true); break;
5683 case budget_categories::debt_payment: set_visible(state, false); break;
5684 case budget_categories::stockpile: set_visible(state, false); break;
5685 default: set_visible(state, false); break;
5686 }
5687// END
5688}
5689void budgetwindow_section_header_rrbutton_t::on_create(sys::state& state) noexcept {
5690// BEGIN section_header::rrbutton::create
5691// END
5692}
5693void budgetwindow_section_header_setting_amount_t::set_text(sys::state& state, std::string const& new_text) {
5694 if(new_text != cached_text) {
5695 cached_text = new_text;
5696 internal_layout.contents.clear();
5697 internal_layout.number_of_lines = 0;
5698 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
5699 sl.add_text(state, cached_text);
5700 }
5701}
5702void budgetwindow_section_header_setting_amount_t::on_reset_text(sys::state& state) noexcept {
5703}
5704void budgetwindow_section_header_setting_amount_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5705 if(internal_layout.contents.empty()) return;
5706 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
5707 auto linesz = state.font_collection.line_height(state, fh);
5708 if(linesz == 0.0f) return;
5709 auto ycentered = (base_data.size.y - linesz) / 2;
5710 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
5711 for(auto& t : internal_layout.contents) {
5712 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
5713 }
5714}
5715void budgetwindow_section_header_setting_amount_t::on_update(sys::state& state) noexcept {
5716 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5717// BEGIN section_header::setting_amount::update
5718 switch(section_header.section_type) {
5719 case budget_categories::diplomatic_income: set_text(state, ""); break;
5720 case budget_categories::poor_tax: set_text(state, std::to_string(state.world.nation_get_poor_tax(state.local_player_nation))); break;
5721 case budget_categories::middle_tax: set_text(state, std::to_string(state.world.nation_get_middle_tax(state.local_player_nation))); break;
5722 case budget_categories::rich_tax: set_text(state, std::to_string(state.world.nation_get_rich_tax(state.local_player_nation))); break;
5723 case budget_categories::tariffs_import: set_text(state, std::to_string(state.world.nation_get_tariffs_import(state.local_player_nation))); break;
5724 case budget_categories::tariffs_export: set_text(state, std::to_string(state.world.nation_get_tariffs_export(state.local_player_nation))); break;
5725 case budget_categories::gold: set_text(state, ""); break;
5726 case budget_categories::diplomatic_expenses: set_text(state, ""); break;
5727 case budget_categories::social: set_text(state, std::to_string(state.world.nation_get_social_spending(state.local_player_nation))); break;
5728 case budget_categories::military: set_text(state, std::to_string(state.world.nation_get_military_spending(state.local_player_nation))); break;
5729 case budget_categories::education: set_text(state, std::to_string(state.world.nation_get_education_spending(state.local_player_nation))); break;
5730 case budget_categories::admin: set_text(state, std::to_string(state.world.nation_get_administrative_spending(state.local_player_nation))); break;
5731 case budget_categories::domestic_investment: set_text(state, std::to_string(state.world.nation_get_domestic_investment_spending(state.local_player_nation))); break;
5732 case budget_categories::overseas_spending: set_text(state, std::to_string(state.world.nation_get_overseas_spending(state.local_player_nation))); break;
5733 case budget_categories::subsidies: set_text(state, ""); break;
5734 case budget_categories::construction: set_text(state, std::to_string(state.world.nation_get_construction_spending(state.local_player_nation))); break;
5735 case budget_categories::army_upkeep: set_text(state, std::to_string(state.world.nation_get_land_spending(state.local_player_nation))); break;
5736 case budget_categories::navy_upkeep: set_text(state, std::to_string(state.world.nation_get_naval_spending(state.local_player_nation))); break;
5737 case budget_categories::debt_payment: set_text(state, ""); break;
5738 case budget_categories::stockpile: set_text(state, ""); break;
5739 default: set_text(state, ""); break;
5740 }
5741// END
5742}
5743void budgetwindow_section_header_setting_amount_t::on_create(sys::state& state) noexcept {
5744// BEGIN section_header::setting_amount::create
5745// END
5746}
5747ui::message_result budgetwindow_section_header_expand_button_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5748 if(disabled) return ui::message_result::consumed;
5749 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5750 sound::play_interface_sound(state, sound::get_click_sound(state), state.user_settings.interface_volume* state.user_settings.master_volume);
5751// BEGIN section_header::expand_button::lbutton_action
5752 budget_categories::expanded[section_header.section_type] = !budget_categories::expanded[section_header.section_type];
5753 state.game_state_updated.store(true, std::memory_order::release);
5754// END
5756}
5757ui::message_result budgetwindow_section_header_expand_button_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
5759}
5760void budgetwindow_section_header_expand_button_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
5761 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5762// BEGIN section_header::expand_button::tooltip
5763 if(!budget_categories::expanded[section_header.section_type])
5764 text::add_line(state, contents, "alice_budget_expand_tt");
5765 else
5766 text::add_line(state, contents, "alice_budget_contract_tt");
5767// END
5768}
5769void budgetwindow_section_header_expand_button_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5770 if(is_active)
5771 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, disabled, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, alt_background_texture, alt_texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
5772 else
5773 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, disabled, true), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
5774}
5775void budgetwindow_section_header_expand_button_t::on_update(sys::state& state) noexcept {
5776 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5777// BEGIN section_header::expand_button::update
5778 switch(section_header.section_type) {
5779 case budget_categories::diplomatic_income: disabled = (economy::estimate_diplomatic_income(state, state.local_player_nation) <= 0); break;
5780 case budget_categories::poor_tax: disabled = false; break;
5781 case budget_categories::middle_tax: disabled = false; break;
5782 case budget_categories::rich_tax: disabled = false; break;
5783 case budget_categories::tariffs_import: disabled = (economy::estimate_tariff_import_income(state, state.local_player_nation) <= 0); break;
5784 case budget_categories::tariffs_export: disabled = (economy::estimate_tariff_export_income(state, state.local_player_nation) <= 0); break;
5785 case budget_categories::gold: disabled = (economy::estimate_gold_income(state, state.local_player_nation) <= 0); break;
5786 case budget_categories::diplomatic_expenses: disabled = (economy::estimate_diplomatic_expenses(state, state.local_player_nation) <= 0); break;
5787 case budget_categories::social: disabled = (economy::estimate_social_spending(state, state.local_player_nation) <= 0); break;
5788 case budget_categories::military: disabled = false; break;
5789 case budget_categories::education: disabled = false; break;
5790 case budget_categories::admin: disabled = false; break;
5791 case budget_categories::domestic_investment: disabled = false; break;
5792 case budget_categories::overseas_spending: disabled = (economy::estimate_overseas_penalty_spending(state, state.local_player_nation) <= 0); break;
5793 case budget_categories::subsidies: disabled = (economy::estimate_subsidy_spending(state, state.local_player_nation) <= 0); break;
5794 case budget_categories::construction: disabled = (economy::estimate_construction_spending(state, state.local_player_nation) <= 0); break;
5795 case budget_categories::army_upkeep: disabled = (economy::estimate_land_spending(state, state.local_player_nation) <= 0); break;
5796 case budget_categories::navy_upkeep:disabled = (economy::estimate_naval_spending(state, state.local_player_nation) <= 0); break;
5797 case budget_categories::debt_payment: disabled = (economy::interest_payment(state, state.local_player_nation) <= 0); break;
5798 case budget_categories::stockpile: disabled = (economy::estimate_stockpile_filling_spending(state, state.local_player_nation) <= 0); break;
5799 default: disabled = false; break;
5800 }
5801
5802 is_active = !(!disabled && budget_categories::expanded[section_header.section_type]);
5803
5804// END
5805}
5806void budgetwindow_section_header_expand_button_t::on_create(sys::state& state) noexcept {
5807// BEGIN section_header::expand_button::create
5808// END
5809}
5810void budgetwindow_section_header_total_amount_t::set_text(sys::state& state, std::string const& new_text) {
5811 if(new_text != cached_text) {
5812 cached_text = new_text;
5813 internal_layout.contents.clear();
5814 internal_layout.number_of_lines = 0;
5815 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
5816 sl.add_text(state, cached_text);
5817 }
5818}
5819void budgetwindow_section_header_total_amount_t::on_reset_text(sys::state& state) noexcept {
5820}
5821void budgetwindow_section_header_total_amount_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5822 if(internal_layout.contents.empty()) return;
5823 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
5824 auto linesz = state.font_collection.line_height(state, fh);
5825 if(linesz == 0.0f) return;
5826 auto ycentered = (base_data.size.y - linesz) / 2;
5827 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
5828 for(auto& t : internal_layout.contents) {
5829 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
5830 }
5831}
5832void budgetwindow_section_header_total_amount_t::on_update(sys::state& state) noexcept {
5833 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5834// BEGIN section_header::total_amount::update
5835 switch(section_header.section_type) {
5836 case budget_categories::diplomatic_income: set_text(state, text::prettify_currency(economy::estimate_diplomatic_income(state, state.local_player_nation))); break;
5837 case budget_categories::poor_tax: set_text(state, text::prettify_currency(economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::poor) * float(state.world.nation_get_poor_tax(state.local_player_nation)) / 100.0f)); break;
5838 case budget_categories::middle_tax: set_text(state, text::prettify_currency(economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::middle) * float(state.world.nation_get_middle_tax(state.local_player_nation)) / 100.0f)); break;
5839 case budget_categories::rich_tax: set_text(state, text::prettify_currency(economy::estimate_tax_income_by_strata(state, state.local_player_nation, culture::pop_strata::rich) * float(state.world.nation_get_rich_tax(state.local_player_nation)) / 100.0f)); break;
5840 case budget_categories::tariffs_import: set_text(state, text::prettify_currency(economy::estimate_tariff_import_income(state, state.local_player_nation))); break;
5841 case budget_categories::tariffs_export: set_text(state, text::prettify_currency(economy::estimate_tariff_export_income(state, state.local_player_nation))); break;
5842 case budget_categories::gold: set_text(state, text::prettify_currency(economy::estimate_gold_income(state, state.local_player_nation))); break;
5843 case budget_categories::diplomatic_expenses: set_text(state, text::prettify_currency(economy::estimate_diplomatic_expenses(state, state.local_player_nation))); break;
5844 case budget_categories::social: set_text(state, text::prettify_currency(economy::estimate_social_spending(state, state.local_player_nation) * float(state.world.nation_get_social_spending(state.local_player_nation)) / 100.0f)); break;
5845 case budget_categories::military: set_text(state, text::prettify_currency(economy::estimate_pop_payouts_by_income_type(state, state.local_player_nation, culture::income_type::military) * float(state.world.nation_get_military_spending(state.local_player_nation)) * float(state.world.nation_get_military_spending(state.local_player_nation)) / 10000.0f)); break;
5846 case budget_categories::education: set_text(state, text::prettify_currency(economy::estimate_pop_payouts_by_income_type(state, state.local_player_nation, culture::income_type::education) * float(state.world.nation_get_education_spending(state.local_player_nation)) * float(state.world.nation_get_education_spending(state.local_player_nation)) / 10000.0f)); break;
5847 case budget_categories::admin: set_text(state, text::prettify_currency(economy::estimate_pop_payouts_by_income_type(state, state.local_player_nation, culture::income_type::administration) * float(state.world.nation_get_administrative_spending(state.local_player_nation)) * float(state.world.nation_get_administrative_spending(state.local_player_nation)) / 10000.0f)); break;
5848 case budget_categories::domestic_investment: set_text(state, text::prettify_currency(economy::estimate_domestic_investment(state, state.local_player_nation) * float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) * float(state.world.nation_get_domestic_investment_spending(state.local_player_nation)) / 10000.0f)); break;
5849 case budget_categories::overseas_spending: set_text(state, text::prettify_currency(economy::estimate_overseas_penalty_spending(state, state.local_player_nation) * float(state.world.nation_get_overseas_spending(state.local_player_nation)) / 100.0f)); break;
5850 case budget_categories::subsidies: set_text(state, text::prettify_currency(economy::estimate_subsidy_spending(state, state.local_player_nation))); break;
5851 case budget_categories::construction: set_text(state, text::prettify_currency(economy::estimate_construction_spending(state, state.local_player_nation) * float(state.world.nation_get_construction_spending(state.local_player_nation)) / 100.0f)); break;
5852 case budget_categories::army_upkeep: set_text(state, text::prettify_currency(economy::estimate_land_spending(state, state.local_player_nation) * float(state.world.nation_get_land_spending(state.local_player_nation)) / 100.0f)); break;
5853 case budget_categories::navy_upkeep: set_text(state, text::prettify_currency(economy::estimate_naval_spending(state, state.local_player_nation) * float(state.world.nation_get_naval_spending(state.local_player_nation)) / 100.0f)); break;
5854 case budget_categories::debt_payment: set_text(state, text::prettify_currency(economy::interest_payment(state, state.local_player_nation))); break;
5855 case budget_categories::stockpile: set_text(state, text::prettify_currency(economy::estimate_stockpile_filling_spending(state, state.local_player_nation))); break;
5856 default: set_text(state, ""); break;
5857 }
5858// END
5859}
5860void budgetwindow_section_header_total_amount_t::on_create(sys::state& state) noexcept {
5861// BEGIN section_header::total_amount::create
5862// END
5863}
5864void budgetwindow_section_header_min_setting_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
5865 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5866// BEGIN section_header::min_setting::tooltip
5867 auto value = 0;
5868 switch(section_header.section_type) {
5869 case budget_categories::diplomatic_income: break;
5870 case budget_categories::poor_tax: value = economy::budget_minimums(state, state.local_player_nation).poor_tax; break;
5871 case budget_categories::middle_tax: value = economy::budget_minimums(state, state.local_player_nation).middle_tax; break;
5872 case budget_categories::rich_tax: value = economy::budget_minimums(state, state.local_player_nation).rich_tax; break;
5873 case budget_categories::tariffs_export: value = economy::budget_minimums(state, state.local_player_nation).tariffs_export; break;
5874 case budget_categories::tariffs_import: value = economy::budget_minimums(state, state.local_player_nation).tariffs_import; break;
5875 case budget_categories::gold: break;
5876 case budget_categories::diplomatic_expenses: break;
5877 case budget_categories::social: value = economy::budget_minimums(state, state.local_player_nation).social_spending; break;
5878 case budget_categories::military: value = economy::budget_minimums(state, state.local_player_nation).military_spending; break;
5879 case budget_categories::education: value = economy::budget_minimums(state, state.local_player_nation).education_spending; break;
5880 case budget_categories::admin: value = economy::budget_minimums(state, state.local_player_nation).administrative_spending; break;
5881 case budget_categories::domestic_investment: value = economy::budget_minimums(state, state.local_player_nation).domestic_investment; break;
5882 case budget_categories::overseas_spending: value = economy::budget_minimums(state, state.local_player_nation).overseas; break;
5883 case budget_categories::subsidies: break;
5884 case budget_categories::construction: value = economy::budget_minimums(state, state.local_player_nation).construction_spending; break;
5885 case budget_categories::army_upkeep: value = economy::budget_minimums(state, state.local_player_nation).land_spending; break;
5886 case budget_categories::navy_upkeep: value = economy::budget_minimums(state, state.local_player_nation).naval_spending; break;
5887 case budget_categories::debt_payment: break;
5888 case budget_categories::stockpile: break;
5889 default: break;
5890 }
5891 if(value == 0) {
5892
5893 } else {
5894 switch(section_header.section_type) {
5895 case budget_categories::diplomatic_income: break;
5896 case budget_categories::poor_tax: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tax, true); break;
5897 case budget_categories::middle_tax: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tax, true); break;
5898 case budget_categories::rich_tax: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tax, true); break;
5899 case budget_categories::tariffs_import: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tariff, true); break;
5900 case budget_categories::tariffs_export: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_tariff, true); break;
5901 case budget_categories::gold: break;
5902 case budget_categories::diplomatic_expenses: break;
5903 case budget_categories::social: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_social_spending, true); break;
5904 case budget_categories::military: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_military_spending, true); break;
5905 case budget_categories::education: break;
5906 case budget_categories::admin: break;
5907 case budget_categories::domestic_investment: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::min_domestic_investment, true); break;
5908 case budget_categories::overseas_spending: break;
5909 case budget_categories::subsidies: break;
5910 case budget_categories::construction: break;
5911 case budget_categories::army_upkeep: break;
5912 case budget_categories::navy_upkeep: break;
5913 case budget_categories::debt_payment: break;
5914 case budget_categories::stockpile: break;
5915 default: break;
5916 }
5917 }
5918// END
5919}
5920void budgetwindow_section_header_min_setting_t::set_text(sys::state& state, std::string const& new_text) {
5921 if(new_text != cached_text) {
5922 cached_text = new_text;
5923 internal_layout.contents.clear();
5924 internal_layout.number_of_lines = 0;
5925 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
5926 sl.add_text(state, cached_text);
5927 }
5928}
5929void budgetwindow_section_header_min_setting_t::on_reset_text(sys::state& state) noexcept {
5930}
5931void budgetwindow_section_header_min_setting_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
5932 if(internal_layout.contents.empty()) return;
5933 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
5934 auto linesz = state.font_collection.line_height(state, fh);
5935 if(linesz == 0.0f) return;
5936 auto ycentered = (base_data.size.y - linesz) / 2;
5937 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
5938 for(auto& t : internal_layout.contents) {
5939 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
5940 }
5941}
5942void budgetwindow_section_header_min_setting_t::on_update(sys::state& state) noexcept {
5943 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5944// BEGIN section_header::min_setting::update
5945 auto value = 0;
5946 switch(section_header.section_type) {
5947 case budget_categories::diplomatic_income: break;
5948 case budget_categories::poor_tax: value = economy::budget_minimums(state, state.local_player_nation).poor_tax; break;
5949 case budget_categories::middle_tax: value = economy::budget_minimums(state, state.local_player_nation).middle_tax; break;
5950 case budget_categories::rich_tax: value = economy::budget_minimums(state, state.local_player_nation).rich_tax; break;
5951 case budget_categories::tariffs_import: value = economy::budget_minimums(state, state.local_player_nation).tariffs_import; break;
5952 case budget_categories::tariffs_export: value = economy::budget_minimums(state, state.local_player_nation).tariffs_export; break;
5953 case budget_categories::gold: break;
5954 case budget_categories::diplomatic_expenses: break;
5955 case budget_categories::social: value = economy::budget_minimums(state, state.local_player_nation).social_spending; break;
5956 case budget_categories::military: value = economy::budget_minimums(state, state.local_player_nation).military_spending; break;
5957 case budget_categories::education: value = economy::budget_minimums(state, state.local_player_nation).education_spending; break;
5958 case budget_categories::admin: value = economy::budget_minimums(state, state.local_player_nation).administrative_spending; break;
5959 case budget_categories::domestic_investment: value = economy::budget_minimums(state, state.local_player_nation).domestic_investment; break;
5960 case budget_categories::overseas_spending: value = economy::budget_minimums(state, state.local_player_nation).overseas; break;
5961 case budget_categories::subsidies: break;
5962 case budget_categories::construction: value = economy::budget_minimums(state, state.local_player_nation).construction_spending; break;
5963 case budget_categories::army_upkeep: value = economy::budget_minimums(state, state.local_player_nation).land_spending; break;
5964 case budget_categories::navy_upkeep: value = economy::budget_minimums(state, state.local_player_nation).naval_spending; break;
5965 case budget_categories::debt_payment: break;
5966 case budget_categories::stockpile: break;
5967 default: break;
5968 }
5969 if(value == 0) {
5970 set_text(state, "");
5971 } else {
5974 set_text(state, text::resolve_string_substitution(state, "alice_budget_min", m));
5975 }
5976// END
5977}
5978void budgetwindow_section_header_min_setting_t::on_create(sys::state& state) noexcept {
5979// BEGIN section_header::min_setting::create
5980// END
5981}
5982void budgetwindow_section_header_max_setting_t::update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept {
5983 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
5984// BEGIN section_header::max_setting::tooltip
5985 auto value = 100;
5986 switch(section_header.section_type) {
5987 case budget_categories::diplomatic_income: break;
5988 case budget_categories::poor_tax: value = economy::budget_maximums(state, state.local_player_nation).poor_tax; break;
5989 case budget_categories::middle_tax: value = economy::budget_maximums(state, state.local_player_nation).middle_tax; break;
5990 case budget_categories::rich_tax: value = economy::budget_maximums(state, state.local_player_nation).rich_tax; break;
5991 case budget_categories::tariffs_import: value = economy::budget_maximums(state, state.local_player_nation).tariffs_import; break;
5992 case budget_categories::tariffs_export: value = economy::budget_maximums(state, state.local_player_nation).tariffs_export; break;
5993 case budget_categories::gold: break;
5994 case budget_categories::diplomatic_expenses: break;
5995 case budget_categories::social: value = economy::budget_maximums(state, state.local_player_nation).social_spending; break;
5996 case budget_categories::military: value = economy::budget_maximums(state, state.local_player_nation).military_spending; break;
5997 case budget_categories::education: value = economy::budget_maximums(state, state.local_player_nation).education_spending; break;
5998 case budget_categories::admin: value = economy::budget_maximums(state, state.local_player_nation).administrative_spending; break;
5999 case budget_categories::domestic_investment: value = economy::budget_maximums(state, state.local_player_nation).domestic_investment; break;
6000 case budget_categories::overseas_spending: value = economy::budget_maximums(state, state.local_player_nation).overseas; break;
6001 case budget_categories::subsidies: break;
6002 case budget_categories::construction: value = economy::budget_maximums(state, state.local_player_nation).construction_spending; break;
6003 case budget_categories::army_upkeep: value = economy::budget_maximums(state, state.local_player_nation).land_spending; break;
6004 case budget_categories::navy_upkeep: value = economy::budget_maximums(state, state.local_player_nation).naval_spending; break;
6005 case budget_categories::debt_payment: break;
6006 case budget_categories::stockpile: break;
6007 default: break;
6008 }
6009 if(value == 100) {
6010
6011 } else {
6012 switch(section_header.section_type) {
6013 case budget_categories::diplomatic_income: break;
6014 case budget_categories::poor_tax: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tax, true); break;
6015 case budget_categories::middle_tax: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tax, true); break;
6016 case budget_categories::rich_tax: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tax, true); break;
6017 case budget_categories::tariffs_import: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tariff, true); break;
6018 case budget_categories::tariffs_export: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_tariff, true); break;
6019 case budget_categories::gold: break;
6020 case budget_categories::diplomatic_expenses: break;
6021 case budget_categories::social: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_social_spending, true); break;
6022 case budget_categories::military: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_military_spending, true); break;
6023 case budget_categories::education: break;
6024 case budget_categories::admin: break;
6025 case budget_categories::domestic_investment: ui::active_modifiers_description(state, contents, state.local_player_nation, 0, sys::national_mod_offsets::max_domestic_investment, true); break;
6026 case budget_categories::overseas_spending: break;
6027 case budget_categories::subsidies: break;
6028 case budget_categories::construction: break;
6029 case budget_categories::army_upkeep: break;
6030 case budget_categories::navy_upkeep: break;
6031 case budget_categories::debt_payment: break;
6032 case budget_categories::stockpile: break;
6033 default: break;
6034 }
6035 }
6036// END
6037}
6038void budgetwindow_section_header_max_setting_t::set_text(sys::state& state, std::string const& new_text) {
6039 if(new_text != cached_text) {
6040 cached_text = new_text;
6041 internal_layout.contents.clear();
6042 internal_layout.number_of_lines = 0;
6043 text::single_line_layout sl{ internal_layout, text::layout_parameters{ 0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y), text::make_font_id(state, text_is_header, text_scale * 16), 0, text_alignment, text::text_color::black, true, true }, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()) ? text::layout_base::rtl_status::rtl : text::layout_base::rtl_status::ltr };
6044 sl.add_text(state, cached_text);
6045 }
6046}
6047void budgetwindow_section_header_max_setting_t::on_reset_text(sys::state& state) noexcept {
6048}
6049void budgetwindow_section_header_max_setting_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
6050 if(internal_layout.contents.empty()) return;
6051 auto fh = text::make_font_id(state, text_is_header, text_scale * 16);
6052 auto linesz = state.font_collection.line_height(state, fh);
6053 if(linesz == 0.0f) return;
6054 auto ycentered = (base_data.size.y - linesz) / 2;
6055 auto cmod = ui::get_color_modification(this == state.ui_state.under_mouse, false, false);
6056 for(auto& t : internal_layout.contents) {
6057 ui::render_text_chunk(state, t, float(x) + t.x, float(y + int32_t(ycentered)), fh, ui::get_text_color(state, text_color), cmod);
6058 }
6059}
6060void budgetwindow_section_header_max_setting_t::on_update(sys::state& state) noexcept {
6061 budgetwindow_section_header_t& section_header = *((budgetwindow_section_header_t*)(parent));
6062// BEGIN section_header::max_setting::update
6063 auto value = 100;
6064 switch(section_header.section_type) {
6065 case budget_categories::diplomatic_income: break;
6066 case budget_categories::poor_tax: value = economy::budget_maximums(state, state.local_player_nation).poor_tax; break;
6067 case budget_categories::middle_tax: value = economy::budget_maximums(state, state.local_player_nation).middle_tax; break;
6068 case budget_categories::rich_tax: value = economy::budget_maximums(state, state.local_player_nation).rich_tax; break;
6069 case budget_categories::tariffs_import: value = economy::budget_maximums(state, state.local_player_nation).tariffs_import; break;
6070 case budget_categories::tariffs_export: value = economy::budget_maximums(state, state.local_player_nation).tariffs_export; break;
6071 case budget_categories::gold: break;
6072 case budget_categories::diplomatic_expenses: break;
6073 case budget_categories::social: value = economy::budget_maximums(state, state.local_player_nation).social_spending; break;
6074 case budget_categories::military: value = economy::budget_maximums(state, state.local_player_nation).military_spending; break;
6075 case budget_categories::education: value = economy::budget_maximums(state, state.local_player_nation).education_spending; break;
6076 case budget_categories::admin: value = economy::budget_maximums(state, state.local_player_nation).administrative_spending; break;
6077 case budget_categories::domestic_investment: value = economy::budget_maximums(state, state.local_player_nation).domestic_investment; break;
6078 case budget_categories::overseas_spending: value = economy::budget_maximums(state, state.local_player_nation).overseas; break;
6079 case budget_categories::subsidies: break;
6080 case budget_categories::construction: value = economy::budget_maximums(state, state.local_player_nation).construction_spending; break;
6081 case budget_categories::army_upkeep: value = economy::budget_maximums(state, state.local_player_nation).land_spending; break;
6082 case budget_categories::navy_upkeep: value = economy::budget_maximums(state, state.local_player_nation).naval_spending; break;
6083 case budget_categories::debt_payment: break;
6084 case budget_categories::stockpile: break;
6085 default: break;
6086 }
6087 if(value == 100) {
6088 set_text(state, "");
6089 } else {
6092 set_text(state, text::resolve_string_substitution(state, "alice_budget_max", m));
6093 }
6094// END
6095}
6096void budgetwindow_section_header_max_setting_t::on_create(sys::state& state) noexcept {
6097// BEGIN section_header::max_setting::create
6098// END
6099}
6100ui::message_result budgetwindow_section_header_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6102}
6103ui::message_result budgetwindow_section_header_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6105}
6106void budgetwindow_section_header_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
6107 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
6108}
6109void budgetwindow_section_header_t::on_update(sys::state& state) noexcept {
6110// BEGIN section_header::update
6111// END
6112}
6113void budgetwindow_section_header_t::on_create(sys::state& state) noexcept {
6114 auto window_bytes = state.ui_state.new_ui_windows.find(std::string("budgetwindow::section_header"));
6115 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6116 std::vector<sys::aui_pending_bytes> pending_children;
6117 auto win_data = read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6118 base_data.position.x = win_data.x_pos;
6119 base_data.position.y = win_data.y_pos;
6120 base_data.size.x = win_data.x_size;
6121 base_data.size.y = win_data.y_size;
6122 base_data.flags = uint8_t(win_data.orientation);
6123 texture_key = win_data.texture;
6124 auto name_key = state.lookup_key("budgetwindow::section_header");
6125 for(auto ex : state.ui_defs.extensions) {
6126 if(name_key && ex.window == name_key) {
6127 auto ch_res = ui::make_element_immediate(state, ex.child);
6128 if(ch_res) {
6129 this->add_child_to_back(std::move(ch_res));
6130 }
6131 }
6132 }
6133 while(!pending_children.empty()) {
6134 auto child_data = read_child_bytes(pending_children.back().data, pending_children.back().size);
6135 pending_children.pop_back();
6136 if(child_data.name == "label") {
6137 auto cptr = std::make_unique<budgetwindow_section_header_label_t>();
6138 cptr->parent = this;
6139 label = cptr.get();
6140 cptr->base_data.position.x = child_data.x_pos;
6141 cptr->base_data.position.y = child_data.y_pos;
6142 cptr->base_data.size.x = child_data.x_size;
6143 cptr->base_data.size.y = child_data.y_size;
6144 cptr->text_scale = child_data.text_scale;
6145 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
6146 cptr->text_alignment = child_data.text_alignment;
6147 cptr->text_color = child_data.text_color;
6148 cptr->on_create(state);
6149 this->add_child_to_back(std::move(cptr));
6150 continue;
6151 }
6152 if(child_data.name == "llbutton") {
6153 auto cptr = std::make_unique<budgetwindow_section_header_llbutton_t>();
6154 cptr->parent = this;
6155 llbutton = cptr.get();
6156 cptr->base_data.position.x = child_data.x_pos;
6157 cptr->base_data.position.y = child_data.y_pos;
6158 cptr->base_data.size.x = child_data.x_size;
6159 cptr->base_data.size.y = child_data.y_size;
6161 cptr->texture_key = child_data.texture;
6162 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6163 cptr->on_create(state);
6164 this->add_child_to_back(std::move(cptr));
6165 continue;
6166 }
6167 if(child_data.name == "lbutton") {
6168 auto cptr = std::make_unique<budgetwindow_section_header_lbutton_t>();
6169 cptr->parent = this;
6170 lbutton = cptr.get();
6171 cptr->base_data.position.x = child_data.x_pos;
6172 cptr->base_data.position.y = child_data.y_pos;
6173 cptr->base_data.size.x = child_data.x_size;
6174 cptr->base_data.size.y = child_data.y_size;
6176 cptr->texture_key = child_data.texture;
6177 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6178 cptr->on_create(state);
6179 this->add_child_to_back(std::move(cptr));
6180 continue;
6181 }
6182 if(child_data.name == "rbutton") {
6183 auto cptr = std::make_unique<budgetwindow_section_header_rbutton_t>();
6184 cptr->parent = this;
6185 rbutton = cptr.get();
6186 cptr->base_data.position.x = child_data.x_pos;
6187 cptr->base_data.position.y = child_data.y_pos;
6188 cptr->base_data.size.x = child_data.x_size;
6189 cptr->base_data.size.y = child_data.y_size;
6191 cptr->texture_key = child_data.texture;
6192 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6193 cptr->on_create(state);
6194 this->add_child_to_back(std::move(cptr));
6195 continue;
6196 }
6197 if(child_data.name == "rrbutton") {
6198 auto cptr = std::make_unique<budgetwindow_section_header_rrbutton_t>();
6199 cptr->parent = this;
6200 rrbutton = cptr.get();
6201 cptr->base_data.position.x = child_data.x_pos;
6202 cptr->base_data.position.y = child_data.y_pos;
6203 cptr->base_data.size.x = child_data.x_size;
6204 cptr->base_data.size.y = child_data.y_size;
6206 cptr->texture_key = child_data.texture;
6207 cptr->tooltip_key = state.lookup_key(child_data.tooltip_text_key);
6208 cptr->on_create(state);
6209 this->add_child_to_back(std::move(cptr));
6210 continue;
6211 }
6212 if(child_data.name == "setting_amount") {
6213 auto cptr = std::make_unique<budgetwindow_section_header_setting_amount_t>();
6214 cptr->parent = this;
6215 setting_amount = cptr.get();
6216 cptr->base_data.position.x = child_data.x_pos;
6217 cptr->base_data.position.y = child_data.y_pos;
6218 cptr->base_data.size.x = child_data.x_size;
6219 cptr->base_data.size.y = child_data.y_size;
6220 cptr->text_scale = child_data.text_scale;
6221 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
6222 cptr->text_alignment = child_data.text_alignment;
6223 cptr->text_color = child_data.text_color;
6224 cptr->on_create(state);
6225 this->add_child_to_back(std::move(cptr));
6226 continue;
6227 }
6228 if(child_data.name == "expand_button") {
6229 auto cptr = std::make_unique<budgetwindow_section_header_expand_button_t>();
6230 cptr->parent = this;
6231 expand_button = cptr.get();
6232 cptr->base_data.position.x = child_data.x_pos;
6233 cptr->base_data.position.y = child_data.y_pos;
6234 cptr->base_data.size.x = child_data.x_size;
6235 cptr->base_data.size.y = child_data.y_size;
6236 cptr->texture_key = child_data.texture;
6237 cptr->alt_texture_key = child_data.alt_texture;
6238 cptr->on_create(state);
6239 this->add_child_to_back(std::move(cptr));
6240 continue;
6241 }
6242 if(child_data.name == "total_amount") {
6243 auto cptr = std::make_unique<budgetwindow_section_header_total_amount_t>();
6244 cptr->parent = this;
6245 total_amount = cptr.get();
6246 cptr->base_data.position.x = child_data.x_pos;
6247 cptr->base_data.position.y = child_data.y_pos;
6248 cptr->base_data.size.x = child_data.x_size;
6249 cptr->base_data.size.y = child_data.y_size;
6250 cptr->text_scale = child_data.text_scale;
6251 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
6252 cptr->text_alignment = child_data.text_alignment;
6253 cptr->text_color = child_data.text_color;
6254 cptr->on_create(state);
6255 this->add_child_to_back(std::move(cptr));
6256 continue;
6257 }
6258 if(child_data.name == "min_setting") {
6259 auto cptr = std::make_unique<budgetwindow_section_header_min_setting_t>();
6260 cptr->parent = this;
6261 min_setting = cptr.get();
6262 cptr->base_data.position.x = child_data.x_pos;
6263 cptr->base_data.position.y = child_data.y_pos;
6264 cptr->base_data.size.x = child_data.x_size;
6265 cptr->base_data.size.y = child_data.y_size;
6266 cptr->text_scale = child_data.text_scale;
6267 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
6268 cptr->text_alignment = child_data.text_alignment;
6269 cptr->text_color = child_data.text_color;
6270 cptr->on_create(state);
6271 this->add_child_to_back(std::move(cptr));
6272 continue;
6273 }
6274 if(child_data.name == "max_setting") {
6275 auto cptr = std::make_unique<budgetwindow_section_header_max_setting_t>();
6276 cptr->parent = this;
6277 max_setting = cptr.get();
6278 cptr->base_data.position.x = child_data.x_pos;
6279 cptr->base_data.position.y = child_data.y_pos;
6280 cptr->base_data.size.x = child_data.x_size;
6281 cptr->base_data.size.y = child_data.y_size;
6282 cptr->text_scale = child_data.text_scale;
6283 cptr->text_is_header = (child_data.text_type == aui_text_type::header);
6284 cptr->text_alignment = child_data.text_alignment;
6285 cptr->text_color = child_data.text_color;
6286 cptr->on_create(state);
6287 this->add_child_to_back(std::move(cptr));
6288 continue;
6289 }
6290 }
6291// BEGIN section_header::create
6292// END
6293}
6294std::unique_ptr<ui::element_base> make_budgetwindow_section_header(sys::state& state) {
6295 auto ptr = std::make_unique<budgetwindow_section_header_t>();
6296 ptr->on_create(state);
6297 return ptr;
6298}
6299ui::message_result budgetwindow_neutral_spacer_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6301}
6302ui::message_result budgetwindow_neutral_spacer_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6304}
6305void budgetwindow_neutral_spacer_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
6306 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
6307}
6308void budgetwindow_neutral_spacer_t::on_update(sys::state& state) noexcept {
6309// BEGIN neutral_spacer::update
6310// END
6311}
6312void budgetwindow_neutral_spacer_t::on_create(sys::state& state) noexcept {
6313 auto window_bytes = state.ui_state.new_ui_windows.find(std::string("budgetwindow::neutral_spacer"));
6314 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6315 std::vector<sys::aui_pending_bytes> pending_children;
6316 auto win_data = read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6317 base_data.position.x = win_data.x_pos;
6318 base_data.position.y = win_data.y_pos;
6319 base_data.size.x = win_data.x_size;
6320 base_data.size.y = win_data.y_size;
6321 base_data.flags = uint8_t(win_data.orientation);
6322 texture_key = win_data.texture;
6323 auto name_key = state.lookup_key("budgetwindow::neutral_spacer");
6324 for(auto ex : state.ui_defs.extensions) {
6325 if(name_key && ex.window == name_key) {
6326 auto ch_res = ui::make_element_immediate(state, ex.child);
6327 if(ch_res) {
6328 this->add_child_to_back(std::move(ch_res));
6329 }
6330 }
6331 }
6332 while(!pending_children.empty()) {
6333 auto child_data = read_child_bytes(pending_children.back().data, pending_children.back().size);
6334 pending_children.pop_back();
6335 }
6336// BEGIN neutral_spacer::create
6337// END
6338}
6339std::unique_ptr<ui::element_base> make_budgetwindow_neutral_spacer(sys::state& state) {
6340 auto ptr = std::make_unique<budgetwindow_neutral_spacer_t>();
6341 ptr->on_create(state);
6342 return ptr;
6343}
6344ui::message_result budgetwindow_top_spacer_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6346}
6347ui::message_result budgetwindow_top_spacer_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6349}
6350void budgetwindow_top_spacer_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
6351 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
6352}
6353void budgetwindow_top_spacer_t::on_update(sys::state& state) noexcept {
6354// BEGIN top_spacer::update
6355// END
6356}
6357void budgetwindow_top_spacer_t::on_create(sys::state& state) noexcept {
6358 auto window_bytes = state.ui_state.new_ui_windows.find(std::string("budgetwindow::top_spacer"));
6359 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6360 std::vector<sys::aui_pending_bytes> pending_children;
6361 auto win_data = read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6362 base_data.position.x = win_data.x_pos;
6363 base_data.position.y = win_data.y_pos;
6364 base_data.size.x = win_data.x_size;
6365 base_data.size.y = win_data.y_size;
6366 base_data.flags = uint8_t(win_data.orientation);
6367 texture_key = win_data.texture;
6368 auto name_key = state.lookup_key("budgetwindow::top_spacer");
6369 for(auto ex : state.ui_defs.extensions) {
6370 if(name_key && ex.window == name_key) {
6371 auto ch_res = ui::make_element_immediate(state, ex.child);
6372 if(ch_res) {
6373 this->add_child_to_back(std::move(ch_res));
6374 }
6375 }
6376 }
6377 while(!pending_children.empty()) {
6378 auto child_data = read_child_bytes(pending_children.back().data, pending_children.back().size);
6379 pending_children.pop_back();
6380 }
6381// BEGIN top_spacer::create
6382// END
6383}
6384std::unique_ptr<ui::element_base> make_budgetwindow_top_spacer(sys::state& state) {
6385 auto ptr = std::make_unique<budgetwindow_top_spacer_t>();
6386 ptr->on_create(state);
6387 return ptr;
6388}
6389ui::message_result budgetwindow_bottom_spacer_t::on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6391}
6392ui::message_result budgetwindow_bottom_spacer_t::on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept {
6394}
6395void budgetwindow_bottom_spacer_t::render(sys::state & state, int32_t x, int32_t y) noexcept {
6396 ogl::render_textured_rect(state, ui::get_color_modification(this == state.ui_state.under_mouse, false, false), float(x), float(y), float(base_data.size.x), float(base_data.size.y), ogl::get_late_load_texture_handle(state, background_texture, texture_key), base_data.get_rotation(), false, state.world.locale_get_native_rtl(state.font_collection.get_current_locale()));
6397}
6398void budgetwindow_bottom_spacer_t::on_update(sys::state& state) noexcept {
6399// BEGIN bottom_spacer::update
6400// END
6401}
6402void budgetwindow_bottom_spacer_t::on_create(sys::state& state) noexcept {
6403 auto window_bytes = state.ui_state.new_ui_windows.find(std::string("budgetwindow::bottom_spacer"));
6404 if(window_bytes == state.ui_state.new_ui_windows.end()) std::abort();
6405 std::vector<sys::aui_pending_bytes> pending_children;
6406 auto win_data = read_window_bytes(window_bytes->second.data, window_bytes->second.size, pending_children);
6407 base_data.position.x = win_data.x_pos;
6408 base_data.position.y = win_data.y_pos;
6409 base_data.size.x = win_data.x_size;
6410 base_data.size.y = win_data.y_size;
6411 base_data.flags = uint8_t(win_data.orientation);
6412 texture_key = win_data.texture;
6413 auto name_key = state.lookup_key("budgetwindow::bottom_spacer");
6414 for(auto ex : state.ui_defs.extensions) {
6415 if(name_key && ex.window == name_key) {
6416 auto ch_res = ui::make_element_immediate(state, ex.child);
6417 if(ch_res) {
6418 this->add_child_to_back(std::move(ch_res));
6419 }
6420 }
6421 }
6422 while(!pending_children.empty()) {
6423 auto child_data = read_child_bytes(pending_children.back().data, pending_children.back().size);
6424 pending_children.pop_back();
6425 }
6426// BEGIN bottom_spacer::create
6427// END
6428}
6429std::unique_ptr<ui::element_base> make_budgetwindow_bottom_spacer(sys::state& state) {
6430 auto ptr = std::make_unique<budgetwindow_bottom_spacer_t>();
6431 ptr->on_create(state);
6432 return ptr;
6433}
6434// LOST-CODE
6435}
element_base * parent
virtual message_result get(sys::state &state, Cyto::Any &payload) noexcept
static constexpr uint8_t wants_update_when_hidden_mask
element_data base_data
std::vector< element_base * > children
#define assert(condition)
Definition: debug.h:74
int main(int argc, char *argv[])
aui_element_data read_child_bytes(char const *bytes, size_t size)
aui_window_data read_window_bytes(char const *bytes, size_t size, std::vector< sys::aui_pending_bytes > &children_out)
constexpr int32_t diplomatic_income
Definition: alice_ui.hpp:7
constexpr int32_t army_upkeep
Definition: alice_ui.hpp:23
constexpr int32_t construction
Definition: alice_ui.hpp:22
constexpr int32_t middle_tax
Definition: alice_ui.hpp:9
constexpr int32_t tariffs_import
Definition: alice_ui.hpp:11
constexpr int32_t navy_upkeep
Definition: alice_ui.hpp:24
constexpr int32_t rich_tax
Definition: alice_ui.hpp:10
constexpr int32_t poor_tax
Definition: alice_ui.hpp:8
constexpr int32_t tariffs_export
Definition: alice_ui.hpp:12
constexpr int32_t gold
Definition: alice_ui.hpp:13
std::unique_ptr< ui::element_base > make_budgetwindow_bottom_spacer(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_neutral_spacer(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_top_spacer(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_section_header(sys::state &state)
std::unique_ptr< ui::element_base > make_budgetwindow_main(sys::state &state)
budget_settings_data make_empty_budget_settings()
Definition: commands.hpp:617
void change_budget_settings(sys::state &state, dcon::nation_id source, budget_settings_data const &values)
Definition: commands.cpp:971
float estimate_reparations_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8081
float estimate_subsidy_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8067
float estimate_social_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7990
float estimate_subject_payments_paid(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8218
float estimate_diplomatic_expenses(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8138
float estimate_pop_payouts_by_income_type(sys::state &state, dcon::nation_id n, culture::income_type in)
Definition: economy.cpp:8023
float estimate_domestic_investment(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8147
float estimate_overseas_penalty_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:4041
float max_loan(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:816
float estimate_construction_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:3692
float estimate_war_subsidies_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8071
float estimate_land_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8177
command::budget_settings_data budget_minimums(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8703
float price(sys::state const &state, dcon::state_instance_id s, dcon::commodity_id c)
Definition: economy.cpp:150
float estimate_tariff_import_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7958
std::vector< trade_breakdown_item > explain_national_tariff(sys::state &state, dcon::nation_id n, bool import_flag, bool export_flag)
Definition: economy.cpp:7883
float estimate_diplomatic_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8132
float estimate_war_subsidies_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8097
float estimate_reparations_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8109
float estimate_naval_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8194
float estimate_tax_income_by_strata(sys::state &state, dcon::nation_id n, culture::pop_strata ps)
Definition: economy.cpp:8054
float estimate_stockpile_filling_spending(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:4016
float estimate_tariff_export_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7974
float interest_payment(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:808
float estimate_gold_income(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:7942
command::budget_settings_data budget_maximums(sys::state &state, dcon::nation_id n)
Definition: economy.cpp:8745
GLuint get_late_load_texture_handle(sys::state &state, dcon::texture_id &id, std::string_view asset_name)
Definition: texture.cpp:1049
void render_alpha_colored_rect(sys::state const &state, float x, float y, float width, float height, float red, float green, float blue, float alpha)
void render_linegraph(sys::state const &state, color_modification enabled, float x, float y, float width, float height, lines &l)
void render_textured_rect(sys::state const &state, color_modification enabled, float x, float y, float width, float height, GLuint texture_handle, ui::rotation r, bool flipped, bool rtl)
void render_stripchart(sys::state const &state, color_modification enabled, float x, float y, float sizex, float sizey, data_texture &t)
float get_luxury_needs(sys::state const &state, dcon::pop_id p)
float get_life_needs(sys::state const &state, dcon::pop_id p)
float get_everyday_needs(sys::state const &state, dcon::pop_id p)
void play_interface_sound(sys::state &state, audio_instance &s, float volume)
Definition: sound_nix.cpp:203
audio_instance & get_click_sound(sys::state &state)
Definition: sound_nix.cpp:263
float blue_from_int(uint32_t v)
virtual_key
Definition: constants.hpp:5
float green_from_int(uint32_t v)
key_modifiers
Definition: constants.hpp:156
float red_from_int(uint32_t v)
void merge_sort(IT first, IT end, CMP const &cmp) noexcept
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
Definition: text.cpp:1165
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
Definition: text.cpp:2137
layout_box open_layout_box(layout_base &dest, int32_t indent)
Definition: text.cpp:1823
alignment
Definition: text.hpp:36
void localised_format_box(sys::state &state, layout_base &dest, layout_box &box, std::string_view key, text::substitution_map const &sub)
Definition: text.cpp:1904
void add_line(sys::state &state, layout_base &dest, dcon::text_key txt, int32_t indent)
Definition: text.cpp:1923
void add_line_break_to_layout(sys::state &state, columnar_layout &dest)
Definition: text.cpp:1152
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
Definition: text.cpp:1068
std::string get_dynamic_state_name(sys::state &state, dcon::state_instance_id state_id)
Definition: text.cpp:837
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
Definition: text.hpp:797
std::string produce_simple_string(sys::state const &state, dcon::text_key id)
Definition: text.cpp:617
text_color
Definition: text.hpp:18
uint16_t make_font_id(sys::state &state, bool as_header, float target_line_size)
Definition: fonts.cpp:891
dcon::text_key get_name(sys::state &state, dcon::nation_id id)
Definition: text.cpp:880
std::string format_percentage(float num, size_t digits)
Definition: text.cpp:977
void add_space_to_layout_box(sys::state &state, layout_base &dest, layout_box &box)
Definition: text.cpp:1812
std::string prettify_currency(float num)
Definition: text.cpp:702
void close_layout_box(columnar_layout &dest, layout_box &box)
Definition: text.cpp:1831
int32_t ui_height(sys::state const &state)
int32_t ui_width(sys::state const &state)
void render_text_chunk(sys::state &state, text::text_chunk t, float x, float baseline_y, uint16_t font_id, ogl::color3f text_color, ogl::color_modification cmod)
xy_pair get_absolute_location(sys::state &state, element_base const &node)
tooltip_behavior
ogl::color3f get_text_color(sys::state &state, text::text_color text_color)
message_result
ogl::color_modification get_color_modification(bool is_under_mouse, bool is_disabled, bool is_interactable)
std::unique_ptr< element_base > make_element_immediate(sys::state &state, dcon::gui_def_id id)
void active_modifiers_description(sys::state &state, text::layout_base &layout, dcon::nation_id n, int32_t identation, dcon::national_modifier_value nmid, bool header)
uint uint32_t
uchar uint8_t
@ ident
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_reset_text(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::message_result on_key_down(sys::state &state, sys::virtual_key key, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ogl::color3f color
dcon::text_key key
float amount
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
std::vector< graph_entry > graph_content
void on_create(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_reset_text(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_reset_text(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void set_item_value_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_item_name_text(sys::state &state, std::string const &new_text)
void change_page(sys::state &state, int32_t new_page)
std::unique_ptr< budgetwindow_main_expenses_table_row_t > make_row(sys::state &state)
void on_create(sys::state &state) noexcept override
std::vector< std::unique_ptr< ui::element_base > > neutral_spacer_pool
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
std::vector< std::unique_ptr< ui::element_base > > bottom_spacer_pool
std::vector< std::unique_ptr< ui::element_base > > section_header_pool
ui::message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
void add_value(std::pair< std::string, float > const &v)
std::unique_ptr< budgetwindow_main_expenses_table_header_t > make_headers(sys::state &state)
std::vector< std::variant< std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option > > values
std::vector< std::unique_ptr< ui::element_base > > top_spacer_pool
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void add_insert_section_header(sys::state &state, int32_t const &section_type)
void on_update(sys::state &state) noexcept override
void impl_change_page(sys::state &state, int32_t new_page)
std::vector< std::unique_ptr< budgetwindow_main_expenses_table_header_t > > header_pool
std::vector< std::unique_ptr< budgetwindow_main_expenses_table_row_t > > row_pool
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_hover_end(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_hover(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_hover(sys::state &state) noexcept override
void on_hover_end(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_hover(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_hover_end(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void set_item_value_text(sys::state &state, std::string const &new_text)
void on_update(sys::state &state) noexcept override
static text::text_color item_value_default_text_color
void on_create(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
std::pair< std::string, float > value
void tooltip_position(sys::state &state, int32_t x, int32_t y, int32_t &ident, ui::urect &subrect) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
static text::text_color item_name_default_text_color
void set_item_name_text(sys::state &state, std::string const &new_text)
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void add_insert_section_header(sys::state &state, int32_t const &section_type)
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void add_insert_bottom_spacer(sys::state &state)
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
std::vector< std::variant< std::monostate, value_option, section_header_option, neutral_spacer_option, bottom_spacer_option, top_spacer_option > > values
std::vector< std::unique_ptr< ui::element_base > > neutral_spacer_pool
std::vector< std::unique_ptr< ui::element_base > > bottom_spacer_pool
std::vector< std::unique_ptr< budgetwindow_main_income_table_header_t > > header_pool
ui::message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
void impl_change_page(sys::state &state, int32_t new_page)
std::vector< std::unique_ptr< budgetwindow_main_income_table_row_t > > row_pool
std::unique_ptr< budgetwindow_main_income_table_row_t > make_row(sys::state &state)
std::unique_ptr< budgetwindow_main_income_table_header_t > make_headers(sys::state &state)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
std::vector< std::unique_ptr< ui::element_base > > top_spacer_pool
void add_insert_neutral_spacer(sys::state &state)
void change_page(sys::state &state, int32_t new_page)
void add_value(std::pair< std::string, float > const &v)
std::vector< std::unique_ptr< ui::element_base > > section_header_pool
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
budgetwindow_main_expenses_page_right_t * expenses_page_right
budgetwindow_main_total_debt_label_t * total_debt_label
budgetwindow_main_debt_overlay_t * debt_overlay
budgetwindow_main_expenses_table_t * expenses_table
budgetwindow_main_expenses_page_number_t * expenses_page_number
budgetwindow_main_chart_max_a_t * chart_max_a
budgetwindow_main_chart_max_b_t * chart_max_b
budgetwindow_main_income_page_left_t * income_page_left
void on_drag(sys::state &state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
budgetwindow_main_admin_eff2_t * admin_eff2
budgetwindow_main_close_button_t * close_button
budgetwindow_main_income_page_number_t * income_page_number
budgetwindow_main_chart_poplabel_t * chart_poplabel
budgetwindow_main_income_page_right_t * income_page_right
budgetwindow_main_welfare_label_t * welfare_label
budgetwindow_main_welfare_chart_poor_t * welfare_chart_poor
budgetwindow_main_welfare_chart_middle_t * welfare_chart_middle
budgetwindow_main_chart_min_t * chart_min
budgetwindow_main_max_debt_label_t * max_debt_label
budgetwindow_main_income_amount_t * income_amount
budgetwindow_main_hover_poor_t * hover_poor
budgetwindow_main_hover_rich_t * hover_rich
budgetwindow_main_max_debt_amount_t * max_debt_amount
budgetwindow_main_title_t * title
budgetwindow_main_debt_chart_t * debt_chart
budgetwindow_main_admin_eff1_t * admin_eff1
budgetwindow_main_debt_label_t * debt_label
void render(sys::state &state, int32_t x, int32_t y) noexcept override
budgetwindow_main_expenses_label_t * expenses_label
budgetwindow_main_income_table_t * income_table
budgetwindow_main_chart_needslabel_t * chart_needslabel
budgetwindow_main_welfare_chart_rich_t * welfare_chart_rich
budgetwindow_main_income_label_t * income_label
budgetwindow_main_debt_enable_t * debt_enable
budgetwindow_main_hover_middle_t * hover_middle
budgetwindow_main_expenses_amount_t * expenses_amount
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
budgetwindow_main_total_debt_amount_t * total_debt_amount
budgetwindow_main_expenses_page_left_t * expenses_page_left
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
budgetwindow_main_admin_eff_amount_t * admin_eff_amount
dcon::texture_id background_texture
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void set_data_points(sys::state &state, std::vector< float > const &datapoints, float min, float max)
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void set_data_points(sys::state &state, std::vector< float > const &datapoints, float min, float max)
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_data_points(sys::state &state, std::vector< float > const &datapoints, float min, float max)
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_reset_text(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_create(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_reset_text(sys::state &state) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void on_reset_text(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_update(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_create(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void on_update(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void on_create(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void set_text(sys::state &state, std::string const &new_text)
void on_reset_text(sys::state &state) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
budgetwindow_section_header_setting_amount_t * setting_amount
budgetwindow_section_header_rrbutton_t * rrbutton
budgetwindow_section_header_expand_button_t * expand_button
budgetwindow_section_header_total_amount_t * total_amount
void * get_by_name(sys::state &state, std::string_view name) noexcept override
void on_create(sys::state &state) noexcept override
budgetwindow_section_header_rbutton_t * rbutton
budgetwindow_section_header_lbutton_t * lbutton
void on_update(sys::state &state) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
budgetwindow_section_header_max_setting_t * max_setting
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
budgetwindow_section_header_label_t * label
void render(sys::state &state, int32_t x, int32_t y) noexcept override
budgetwindow_section_header_llbutton_t * llbutton
budgetwindow_section_header_min_setting_t * min_setting
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_reset_text(sys::state &state) noexcept override
void set_text(sys::state &state, std::string const &new_text)
ui::message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
ui::message_result test_mouse(sys::state &state, int32_t x, int32_t y, ui::mouse_probe_type type) noexcept override
void on_update(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
ui::message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
Holds important data about the game world, state, and other data regarding windowing,...
std::vector< text_chunk > contents
Definition: text.hpp:821
int32_t number_of_lines
Definition: text.hpp:822