Project Alice
Loading...
Searching...
No Matches
gui_element_types.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "dcon_generated.hpp"
4#include "gui_graphics.hpp"
6#include "opengl_wrapper.hpp"
7#include "sound.hpp"
8#include "system_state.hpp"
9#include "text.hpp"
10#include "texture.hpp"
11#include <cstdint>
12#include <functional>
13#include <unordered_map>
14#include <variant>
15#include <vector>
16
17namespace ui {
18
20 sys::state& state,
22 float x,
23 float baseline_y,
24 uint16_t font_id,
27);
28
29template<typename T, typename ...Params>
30std::unique_ptr<element_base> make_element_by_type(sys::state& state, std::string_view name, Params&&... params) { // also bypasses global creation hooks
31 auto it = state.ui_state.defs_by_name.find(state.lookup_key(name));
32 if(it != state.ui_state.defs_by_name.end()) {
33 auto res = std::make_unique<T>(std::forward<Params>(params)...);
34 std::memcpy(&(res->base_data), &(state.ui_defs.gui[it->second.definition]), sizeof(ui::element_data));
35 make_size_from_graphics(state, res->base_data);
36 res->on_create(state);
37 return res;
38 }
39 return std::unique_ptr<element_base>{};
40}
41template<typename T, typename ...Params>
42std::unique_ptr<T> make_element_by_type(sys::state& state, dcon::gui_def_id id, Params&&... params) { // also bypasses global creation hooks
43 auto res = std::make_unique<T>(std::forward<Params>(params)...);
44 std::memcpy(&(res->base_data), &(state.ui_defs.gui[id]), sizeof(ui::element_data));
45 make_size_from_graphics(state, res->base_data);
46 res->on_create(state);
47 return res;
48}
49
50ogl::color_modification get_color_modification(bool is_under_mouse, bool is_disabled, bool is_interactable);
52
54public:
55 std::vector<std::unique_ptr<element_base>> children;
56
57 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override;
59 void impl_on_update(sys::state& state) noexcept override;
60 message_result impl_set(sys::state& state, Cyto::Any& payload) noexcept final;
61 void impl_render(sys::state& state, int32_t x, int32_t y) noexcept override;
62 void impl_on_reset_text(sys::state& state) noexcept override;
63
64 std::unique_ptr<element_base> remove_child(element_base* child) noexcept final;
65 void move_child_to_front(element_base* child) noexcept final;
66 void move_child_to_back(element_base* child) noexcept final;
67 void add_child_to_front(std::unique_ptr<element_base> child) noexcept final;
68 void add_child_to_back(std::unique_ptr<element_base> child) noexcept final;
69 element_base* get_child_by_name(sys::state const& state, std::string_view name) noexcept final;
70 element_base* get_child_by_index(sys::state const& state, int32_t index) noexcept final;
71};
72
74public:
75 std::vector<element_base*> children;
76
77 mouse_probe impl_probe_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override;
79 void impl_on_update(sys::state& state) noexcept override;
80 message_result impl_set(sys::state& state, Cyto::Any& payload) noexcept final;
81 void impl_render(sys::state& state, int32_t x, int32_t y) noexcept override;
82 void impl_on_reset_text(sys::state& state) noexcept override;
83
84 void move_child_to_front(element_base* child) noexcept final;
85 void move_child_to_back(element_base* child) noexcept final;
86 element_base* get_child_by_index(sys::state const& state, int32_t index) noexcept final;
87};
88
90public:
91 int32_t frame = 0; // if it is from an icon strip
92 bool disabled = false;
93 bool interactable = false;
94 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
95 void on_create(sys::state& state) noexcept override;
96
97 virtual bool get_horizontal_flip(sys::state& state) noexcept {
98 return state.world.locale_get_native_rtl(state.font_collection.get_current_locale());
99 }
100
101 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
105 }
106};
107
109public:
110 void on_create(sys::state& state) noexcept override {
111 set_visible(state, false);
112 }
113};
114
116public:
120
121 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
122};
123
125public:
126 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
130 }
131 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
133 }
134 message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
136 }
139 }
140};
141
143 dcon::texture_id texture_id;
144public:
145 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
147 auto& texhandle = state.open_gl.asset_textures[texture_id];
148 uint8_t* texture = texhandle.data;
149 int32_t size_x = texhandle.size_x;
150 int32_t size_y = texhandle.size_y;
151 int32_t channels = texhandle.channels;
152 size_t size_m = (texhandle.size_x * texhandle.size_y) * 4;
153 if(texture && channels == 4) {
154 // texture memory layout RGBA accessed through uint8_t pointer
155 size_t index = (x + (y * size_x)) * 4 + 3;
156 if(index < size_m && texture[index] == 0x00) {
158 }
159 }
161 }
163 }
164
165 void on_create(sys::state& state) noexcept override {
167 dcon::gfx_object_id gid;
172 }
173 if(gid) {
174 texture_id = state.ui_defs.gfx[gid].primary_texture_handle;
175 }
176 }
177
178 // MAYBE this function has to be changed when make_element_by_type() is changed
179 static std::unique_ptr<partially_transparent_image> make_element_by_type_alias(sys::state& state, dcon::gui_def_id id) {
180 auto res = std::make_unique<partially_transparent_image>();
181 std::memcpy(&(res->base_data), &(state.ui_defs.gui[id]), sizeof(ui::element_data));
182
183 dcon::gfx_object_id gfx_handle;
184
185 if(res->base_data.get_element_type() == ui::element_type::image) {
186 gfx_handle = res->base_data.data.image.gfx_object;
187 } else if(res->base_data.get_element_type() == ui::element_type::button) {
188 gfx_handle = res->base_data.data.button.button_image;
189 }
190 if(gfx_handle) {
191 auto tex_handle = state.ui_defs.gfx[gfx_handle].primary_texture_handle;
192 if(tex_handle) {
193 state.ui_defs.gfx[gfx_handle].flags |= ui::gfx_object::do_transparency_check;
194 }
195 }
196
197 make_size_from_graphics(state, res->base_data);
198 res->on_create(state);
199 return res;
200 }
201};
202
203
205public:
206 float progress = 0.f;
207 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
208 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
210 }
211 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
212 return image_element_base::on_lbutton_down(state, x, y, mods);
213 }
214 message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
215 return image_element_base::on_rbutton_down(state, x, y, mods);
216 }
217};
218
220public:
221 void on_create(sys::state& state) noexcept override {
225 }
226};
227
229protected:
231 std::string cached_text;
232 bool black_text = true;
233
234public:
236 interactable = true;
237 }
238
239 void set_button_text(sys::state& state, std::string const& new_text);
240 void on_reset_text(sys::state& state) noexcept override;
241
242 virtual void button_action(sys::state& state) noexcept { }
243 virtual void button_right_action(sys::state& state) noexcept {
245 }
246 virtual void button_shift_action(sys::state& state) noexcept {
248 }
251 }
252 virtual void button_ctrl_action(sys::state& state) noexcept {
254 }
255 virtual void button_ctrl_right_action(sys::state& state) noexcept {
257 }
258 virtual void button_ctrl_shift_action(sys::state& state) noexcept {
260 }
263 }
266 }
267
268 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
269 if(!state.user_settings.left_mouse_click_hold_and_release && !disabled) {
270 sound::play_interface_sound(state, get_click_sound(state), state.user_settings.interface_volume * state.user_settings.master_volume);
275 else
277 }
279 }
280 message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
281 if(!disabled) {
282 sound::play_interface_sound(state, get_click_sound(state), state.user_settings.interface_volume * state.user_settings.master_volume);
287 else
289 }
291 }
292 message_result on_lbutton_up(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods, bool under_mouse) noexcept override {
293 if(state.user_settings.left_mouse_click_hold_and_release && !disabled && under_mouse) {
294 sound::play_interface_sound(state, get_click_sound(state), state.user_settings.interface_volume * state.user_settings.master_volume);
299 else
301 }
303 }
306 sound::play_interface_sound(state, get_click_sound(state), state.user_settings.interface_volume * state.user_settings.master_volume);
311 else
314 } else {
316 }
317 }
318
319 void on_create(sys::state& state) noexcept override;
320 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
322};
323
325public:
327 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
328};
329
331public:
332 virtual void button_right_action(sys::state& state) noexcept override { }
333 message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final {
334 if(!disabled) {
335 sound::play_interface_sound(state, get_click_sound(state), state.user_settings.interface_volume * state.user_settings.master_volume);
337 }
339 }
340};
341
343public:
344 virtual void button_right_action(sys::state& state) noexcept override { }
345 message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final {
346 if(!disabled) {
347 sound::play_interface_sound(state, get_click_sound(state), state.user_settings.interface_volume * state.user_settings.master_volume);
349 }
351 }
352};
353
354class line_graph : public element_base {
355private:
356 ogl::lines lines;
357public:
358 bool is_coloured = false;
359 float r = 0.f;
360 float g = 0.f;
361 float b = 0.f;
362
364
365 line_graph(uint32_t sz) : lines(sz), count(sz) {
366 is_coloured = false;
367 r = 0.f;
368 g = 0.f;
369 b = 0.f;
370 }
371
372 void set_data_points(sys::state& state, std::vector<float> const& datapoints) noexcept;
373 void set_data_points(sys::state& state, std::vector<float> const& datapoints, float min, float max) noexcept;
374 void on_create(sys::state& state) noexcept override;
375 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
376
377 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
381 }
382};
383
385protected:
386 std::string cached_text;
388public:
389 bool black_text = true;
390 int32_t data = 0;
391 int32_t casualties = 0;
392
393 void set_text(sys::state& state, std::string const& new_text);
394 void on_reset_text(sys::state& state) noexcept override;
395 void on_create(sys::state& state) noexcept override;
396 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
398
399 std::string_view get_text(sys::state& state) const {
400 return cached_text;
401 }
402
403 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
407 }
408};
409
411public:
413 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
414};
415
417public:
418 void on_create(sys::state& state) noexcept override;
419 void set_text(sys::state& state, std::string const& new_text);
420 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
421 void on_reset_text(sys::state& state) noexcept override;
422};
423
425protected:
426 int32_t edit_index = 0;
427
428public:
429 virtual void edit_box_tab(sys::state& state, std::string_view s) noexcept { }
430 virtual void edit_box_enter(sys::state& state, std::string_view s) noexcept { }
431 virtual void edit_box_update(sys::state& state, std::string_view s) noexcept { }
432 virtual void edit_box_up(sys::state& state) noexcept { }
433 virtual void edit_box_down(sys::state& state) noexcept { }
434 virtual void edit_box_esc(sys::state& state) noexcept { }
435 virtual void edit_box_backtick(sys::state& state) noexcept { }
436 virtual void edit_box_back_slash(sys::state& state) noexcept { }
437 virtual void edit_index_position(sys::state& state, int32_t index) noexcept {
438 edit_index = index;
439 }
440 void on_reset_text(sys::state& state) noexcept override;
441 void on_create(sys::state& state) noexcept override;
442
443 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
445 }
446 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
448 void on_text(sys::state& state, char32_t ch) noexcept override;
449 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
450};
451
452class tool_tip : public element_base {
453public:
456 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
457};
458
460public:
461 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
465 }
466 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
467};
468
470public:
471 virtual std::unique_ptr<element_base> make_child(sys::state& state, std::string_view name, dcon::gui_def_id id) noexcept {
472 return nullptr;
473 }
474 void on_create(sys::state& state) noexcept override;
475 void on_drag(sys::state& state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
476
477 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
481 }
482};
483
484template<class TabT>
486public:
487 TabT active_tab = TabT();
488 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
490 }
491};
492
494public:
495 void button_action(sys::state& state) noexcept override {
496 if(parent) {
497 parent->set_visible(state, false);
498 }
499 }
500};
501
503public:
504 virtual bool is_active(sys::state& state) noexcept {
505 return false;
506 }
507
510 }
511
512 void render(sys::state& state, int32_t x, int32_t y) noexcept override {
513 frame = int32_t(is_active(state));
515 }
516};
517
518template<class RowConT>
520public:
521 RowConT content;
523 content = RowConT{};
524 }
526 content = con;
527 }
528};
529
530template<class ItemWinT, class ItemConT>
532private:
533 int16_t subwindow_width = 0;
534
535protected:
536 std::vector<ItemWinT*> windows{};
537
538 virtual std::string_view get_row_element_name() {
539 return std::string_view{};
540 }
541
542 virtual void update_subwindow(sys::state& state, ItemWinT& subwindow, ItemConT content) {
543 send(state, &subwindow, wrapped_listbox_row_content<ItemConT>(content));
544 subwindow.impl_on_update(state);
545 }
546
547public:
548 std::vector<ItemConT> row_contents{};
549 void update(sys::state& state);
550};
551
553public:
554 dcon::gui_def_id base_definition;
555
557 void button_action(sys::state& state) noexcept override;
558 void on_update(sys::state& state) noexcept override;
561 }
562 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
563};
565public:
566 dcon::gui_def_id base_definition;
567
569 void button_action(sys::state& state) noexcept override;
570 void on_update(sys::state& state) noexcept override;
573 }
574 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
575};
576
578protected:
580
581public:
582 virtual dcon::national_identity_id get_current_nation(sys::state& state) noexcept;
583 virtual dcon::rebel_faction_id get_current_rebel_faction(sys::state& state) noexcept;
584 virtual void set_current_nation(sys::state& state, dcon::national_identity_id identity) noexcept;
585 void button_action(sys::state& state) noexcept override;
586 void on_update(sys::state& state) noexcept override;
587 void on_create(sys::state& state) noexcept override;
588 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
591 }
592 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
593};
594
596public:
598
599 void button_action(sys::state& state) noexcept override;
600 void on_update(sys::state& state) noexcept override;
601 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
604 }
605 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
606};
607
609private:
610 dcon::national_identity_id stored_identity{};
611
612public:
613 dcon::national_identity_id get_current_nation(sys::state& state) noexcept override {
614 return stored_identity;
615 }
616 void set_current_nation(sys::state& state, dcon::national_identity_id identity) noexcept override {
617 stored_identity = identity;
619 }
622 }
623};
624
625class overlapping_flags_box : public overlapping_listbox_element_base<overlapping_flags_flag_button, dcon::national_identity_id> {
626protected:
627 dcon::nation_id current_nation{};
628
629 virtual void populate_flags(sys::state& state) { }
630
631public:
632 std::string_view get_row_element_name() override;
633 void update_subwindow(sys::state& state, overlapping_flags_flag_button& subwindow, dcon::national_identity_id content) override;
634 void on_update(sys::state& state) noexcept override;
635};
636
638protected:
639 void populate_flags(sys::state& state) override;
640};
641
643protected:
644 void populate_flags(sys::state& state) override;
645};
646
648protected:
649 void populate_flags(sys::state& state) override;
650};
651
653protected:
654 void populate_flags(sys::state& state) override;
655};
656
658protected:
659 void populate_flags(sys::state& state) override;
660};
661
663protected:
664 void populate_flags(sys::state& state) override;
665};
666
667
669public:
670 dcon::nation_id n;
672
673 void upate_truce(sys::state& state, dcon::nation_id i, sys::date u) {
674 n = i;
675 until = u;
676 }
677 dcon::national_identity_id get_current_nation(sys::state& state) noexcept override {
678 return state.world.nation_get_identity_from_identity_holder(n);
679 }
682 }
683 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
684};
685
687 dcon::nation_id n;
689};
690
691class overlapping_truce_flags : public overlapping_listbox_element_base<overlapping_truce_flag_button, truce_pair> {
692public:
693 dcon::nation_id current_nation{};
694 std::string_view get_row_element_name() override;
695 void update_subwindow(sys::state& state, overlapping_truce_flag_button& subwindow, truce_pair content) override;
696 void on_update(sys::state& state) noexcept override;
697};
698
699template<class TabT>
701public:
704 }
705
706 bool is_active(sys::state& state) noexcept final {
707 return parent && static_cast<generic_tabbed_window<TabT>*>(parent)->active_tab == target;
708 }
709
710 void button_action(sys::state& state) noexcept final {
712 }
713
714 TabT target = TabT();
715};
716
717template<class TabT>
719public:
720 bool is_active(sys::state& state) noexcept final {
721 return parent && static_cast<generic_tabbed_window<TabT>*>(parent)->active_tab == target;
722 }
723
724 void button_action(sys::state& state) noexcept final {
726 }
727
728 void on_create(sys::state& state) noexcept final{};
729
730 TabT target = TabT();
731};
732
733template<class T>
734class piechart : public element_base {
735public:
736
737 static constexpr int32_t resolution = 200;
738 static constexpr size_t channels = 3;
739
740 struct entry {
741 float value;
744 entry(T key, float value) : value(value), key(key), slices(0) { }
745 entry() : value(0.0f), key(), slices(0) { }
746 };
747
749 std::vector<entry> distribution;
750 float radius = 0.f;
751
753
754 void on_create(sys::state& state) noexcept override;
755 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
756 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override;
757 virtual void populate_tooltip(sys::state& state, T t, float percentage, text::columnar_layout& contents) noexcept;
758
761 }
762 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
765
766 float dx = float(x) - radius;
767 float dy = float(y) - radius;
768 auto dist = sqrt(dx * dx + dy * dy);
770 }
771 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
773 }
774 message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override {
776 }
777};
778
779template<class SrcT, class DemoT>
780class demographic_piechart : public piechart<DemoT> {
781public:
782 void on_update(sys::state& state) noexcept override;
783 virtual void for_each_demo(sys::state& state, std::function<void(DemoT)> fun) { }
784};
785
786template<class SrcT>
787class culture_piechart : public demographic_piechart<SrcT, dcon::culture_id> {
788protected:
789 void for_each_demo(sys::state& state, std::function<void(dcon::culture_id)> fun) override {
790 state.world.for_each_culture(fun);
791 }
792};
793
794template<class SrcT>
795class workforce_piechart : public demographic_piechart<SrcT, dcon::pop_type_id> {
796protected:
797 void for_each_demo(sys::state& state, std::function<void(dcon::pop_type_id)> fun) override {
798 state.world.for_each_pop_type(fun);
799 }
800};
801
802template<class SrcT>
803class ideology_piechart : public demographic_piechart<SrcT, dcon::ideology_id> {
804protected:
805 void for_each_demo(sys::state& state, std::function<void(dcon::ideology_id)> fun) override {
806 state.world.for_each_ideology(fun);
807 }
808};
809
811public:
812 int32_t step_size = 1;
815 }
816 void button_action(sys::state& state) noexcept final;
817 void button_shift_action(sys::state& state) noexcept final;
818 void button_shift_right_action(sys::state& state) noexcept final;
819 message_result set(sys::state& state, Cyto::Any& payload) noexcept final;
822 }
823 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
824 auto box = text::open_layout_box(contents, 0);
828 text::localised_format_box(state, contents, box, std::string_view("alice_slider_controls"), sub);
829 text::close_layout_box(contents, box);
830 }
831};
832
834public:
835 int32_t step_size = 1;
838 }
839 void button_action(sys::state& state) noexcept final;
840 void button_shift_action(sys::state& state) noexcept final;
841 void button_shift_right_action(sys::state& state) noexcept final;
842 message_result set(sys::state& state, Cyto::Any& payload) noexcept final;
845 }
846 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept override {
847 auto box = text::open_layout_box(contents, 0);
851 text::localised_format_box(state, contents, box, std::string_view("alice_slider_controls_2"), sub);
852 text::close_layout_box(contents, box);
853 }
854};
855
857public:
858 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final;
860 void update_tooltip(sys::state& state, int32_t x, int32_t y, text::columnar_layout& contents) noexcept final;
861};
862
864public:
865 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final;
866 void on_drag(sys::state& state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final;
867 void on_drag_finish(sys::state& state) noexcept final;
868};
869
871 int32_t lower_value = 0;
872 int32_t upper_value = 100;
873 int32_t lower_limit = 0;
874 int32_t upper_limit = 0;
875 bool using_limits = false;
876};
877
879 int32_t lower_value = 0;
880 int32_t upper_value = 100;
881 int32_t lower_limit = 0;
882 int32_t upper_limit = 0;
883
884 int32_t buttons_size = 20;
885 int32_t track_size = 180;
886 int32_t scaling_factor = 0;
887
888 bool using_limits = false;
889 bool vertical = false;
890};
891
893 int32_t new_value = 0;
894 bool move_slider = false;
895 bool is_relative = false;
896};
897
898class scrollbar : public container_base {
899
900protected:
904
905public:
908 int32_t stored_value = 0;
909
911
913 virtual void on_value_change(sys::state& state, int32_t v) noexcept { }
914
915 void update_raw_value(sys::state& state, int32_t v);
916 void update_scaled_value(sys::state& state, float v);
917
918 float scaled_value() const;
919 int32_t raw_value() const;
920
922
923 void on_create(sys::state& state) noexcept override;
924 message_result get(sys::state& state, Cyto::Any& payload) noexcept final;
925};
926
928public:
929 float line_height = 0.f;
930 int32_t current_line = 0;
931 int32_t visible_lines = 0;
932 bool black_text = true;
934
935 void on_create(sys::state& state) noexcept override;
936 void on_reset_text(sys::state& state) noexcept override;
937 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
938 message_result on_lbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
939 message_result on_rbutton_down(sys::state& state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override;
940 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override;
941};
942
944public:
945 float line_height = 0.f;
946 int32_t current_line = 0;
947 int32_t visible_lines = 0;
948
949 void on_reset_text(sys::state& state) noexcept override;
950 void on_create(sys::state& state) noexcept override;
951 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
952};
953
955 int32_t new_value;
956};
957
959public:
960 void on_create(sys::state& state) noexcept override;
961 void scale_to_parent();
962};
963
965public:
966 void on_value_change(sys::state& state, int32_t v) noexcept override;
967};
968
970protected:
972
973public:
975 void on_create(sys::state& state) noexcept override;
976 message_result get(sys::state& state, Cyto::Any& payload) noexcept override;
977 void calibrate_scrollbar(sys::state& state) noexcept;
978 message_result on_scroll(sys::state& state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override;
979 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
983 }
984};
985
987public:
988 dcon::text_key text_id{};
989
990 void on_update(sys::state& state) noexcept override {
992 text::layout_parameters{0, 0, static_cast<int16_t>(base_data.size.x), static_cast<int16_t>(base_data.size.y),
994 auto box = text::open_layout_box(layout, 0);
996 text::close_layout_box(layout, box);
997 }
998};
999
1000template<class RowWinT, class RowConT>
1002public:
1003 void on_value_change(sys::state& state, int32_t v) noexcept override;
1004};
1005
1006template<class RowConT>
1008protected:
1009 RowConT content{};
1010
1011public:
1012 message_result get(sys::state& state, Cyto::Any& payload) noexcept override;
1013};
1014
1015template<class RowConT>
1017protected:
1018 RowConT content{};
1019
1020public:
1021 virtual void update(sys::state& state) noexcept { }
1022 message_result get(sys::state& state, Cyto::Any& payload) noexcept override;
1023};
1024
1025template<class RowWinT, class RowConT>
1027protected:
1028 std::vector<RowWinT*> row_windows{};
1029
1030 virtual std::string_view get_row_element_name() {
1031 return std::string_view{};
1032 }
1033 virtual bool is_reversed() {
1034 return false;
1035 }
1036
1037public:
1039 std::vector<RowConT> row_contents{};
1040
1041 void update(sys::state& state);
1042 message_result on_scroll(sys::state& state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override;
1043 void on_create(sys::state& state) noexcept override;
1044 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
1046 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
1048 }
1049};
1050
1052public:
1053 void on_value_change(sys::state& state, int32_t v) noexcept override;
1054};
1055
1057public:
1058 message_result get(sys::state& state, Cyto::Any& payload) noexcept override;
1059};
1060
1062};
1065};
1066
1067template<typename contents_type>
1069public:
1070 std::vector<ui::element_base*> row_windows{};
1072 int32_t stored_index = 0;
1075
1078
1079 virtual std::unique_ptr<element_base> make_row(sys::state& state) noexcept = 0;
1080
1081 std::vector<contents_type> row_contents;
1082
1083 message_result on_scroll(sys::state& state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override;
1084 void on_update(sys::state& state) noexcept override;
1085 message_result get(sys::state& state, Cyto::Any& payload) noexcept override;
1086
1087 void on_create(sys::state& state) noexcept override;
1088 void render(sys::state& state, int32_t x, int32_t y) noexcept override;
1089
1090 void resize(sys::state& state, int32_t height);
1091
1092 message_result test_mouse(sys::state& state, int32_t x, int32_t y, mouse_probe_type type) noexcept override {
1094 }
1095};
1096
1097template<typename T>
1099 T data{};
1100};
1101
1102void populate_shortcut_tooltip(sys::state& state, ui::element_base& elm, text::columnar_layout& contents) noexcept;
1103
1105 sys::state& state,
1107 float x,
1108 float baseline_y,
1109 uint16_t font_id,
1112);
1113
1114} // namespace ui
void on_create(sys::state &state) noexcept override
virtual void button_ctrl_shift_right_action(sys::state &state) noexcept
void set_button_text(sys::state &state, std::string const &new_text)
virtual void button_ctrl_action(sys::state &state) noexcept
virtual void button_shift_action(sys::state &state) noexcept
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
message_result on_key_down(sys::state &state, sys::virtual_key key, sys::key_modifiers mods) noexcept final
virtual void button_ctrl_shift_action(sys::state &state) noexcept
message_result on_lbutton_up(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods, bool under_mouse) noexcept override
virtual sound::audio_instance & get_click_sound(sys::state &state) noexcept
virtual void button_action(sys::state &state) noexcept
void on_create(sys::state &state) noexcept override
void format_text(sys::state &state)
virtual void button_right_action(sys::state &state) noexcept
virtual void button_shift_right_action(sys::state &state) noexcept
virtual void button_ctrl_right_action(sys::state &state) noexcept
message_result on_lbutton_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
sound::audio_instance & get_click_sound(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
virtual bool is_active(sys::state &state) noexcept
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void move_child_to_back(element_base *child) noexcept final
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result impl_set(sys::state &state, Cyto::Any &payload) noexcept final
void add_child_to_back(std::unique_ptr< element_base > child) noexcept final
std::unique_ptr< element_base > remove_child(element_base *child) noexcept final
void impl_on_reset_text(sys::state &state) noexcept override
void add_child_to_front(std::unique_ptr< element_base > child) noexcept final
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void move_child_to_front(element_base *child) noexcept final
element_base * get_child_by_name(sys::state const &state, std::string_view name) noexcept final
message_result impl_on_key_down(sys::state &state, sys::virtual_key key, sys::key_modifiers mods) noexcept final
std::vector< std::unique_ptr< element_base > > children
void impl_on_update(sys::state &state) noexcept override
element_base * get_child_by_index(sys::state const &state, int32_t index) noexcept final
void for_each_demo(sys::state &state, std::function< void(dcon::culture_id)> fun) override
void on_update(sys::state &state) noexcept override
virtual void for_each_demo(sys::state &state, std::function< void(DemoT)> fun)
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
virtual void edit_box_backtick(sys::state &state) noexcept
virtual void edit_box_enter(sys::state &state, std::string_view s) noexcept
void on_create(sys::state &state) noexcept override
virtual void edit_box_tab(sys::state &state, std::string_view s) noexcept
message_result on_key_down(sys::state &state, sys::virtual_key key, sys::key_modifiers mods) noexcept override
void on_reset_text(sys::state &state) noexcept override
virtual void edit_index_position(sys::state &state, int32_t index) noexcept
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
virtual void edit_box_update(sys::state &state, std::string_view s) noexcept
virtual void edit_box_down(sys::state &state) noexcept
virtual void edit_box_esc(sys::state &state) noexcept
virtual void edit_box_back_slash(sys::state &state) noexcept
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
virtual void edit_box_up(sys::state &state) noexcept
void render(sys::state &state, int32_t x, int32_t y) noexcept override
virtual tooltip_behavior has_tooltip(sys::state &state) noexcept
element_base * parent
virtual message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept
virtual void on_create(sys::state &state) noexcept
element_data base_data
void set_visible(sys::state &state, bool vis)
virtual message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept
friend void sys::state::on_text(char32_t c)
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 render(sys::state &state, int32_t x, int32_t y) noexcept override
void button_action(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
virtual dcon::national_identity_id get_current_nation(sys::state &state) noexcept
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
virtual dcon::rebel_faction_id get_current_rebel_faction(sys::state &state) noexcept
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
virtual void set_current_nation(sys::state &state, dcon::national_identity_id identity) noexcept
void on_update(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept override
bool is_active(sys::state &state) noexcept final
void on_create(sys::state &state) noexcept final
void button_action(sys::state &state) noexcept final
sound::audio_instance & get_click_sound(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept final
bool is_active(sys::state &state) noexcept final
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void for_each_demo(sys::state &state, std::function< void(dcon::ideology_id)> fun) override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
virtual bool get_horizontal_flip(sys::state &state) noexcept
void on_create(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
void on_create(sys::state &state) noexcept override
const uint32_t count
void render(sys::state &state, int32_t x, int32_t y) noexcept override
line_graph(uint32_t sz)
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void set_data_points(sys::state &state, std::vector< float > const &datapoints) noexcept
void on_create(sys::state &state) noexcept override
listbox2_scrollbar * list_scrollbar
virtual std::unique_ptr< element_base > make_row(sys::state &state) noexcept=0
message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
std::vector< ui::element_base * > row_windows
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void resize(sys::state &state, int32_t height)
void render(sys::state &state, int32_t x, int32_t y) noexcept override
listbox2_base(bool scrollbar_is_internal)
std::vector< contents_type > row_contents
void on_update(sys::state &state) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
void on_value_change(sys::state &state, int32_t v) noexcept override
std::vector< RowConT > row_contents
message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
std::vector< RowWinT * > row_windows
standard_listbox_scrollbar< RowWinT, RowConT > * list_scrollbar
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void scroll_to_bottom(sys::state &state)
virtual std::string_view get_row_element_name()
void update(sys::state &state)
void on_create(sys::state &state) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
virtual void update(sys::state &state) noexcept
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
message_result get(sys::state &state, Cyto::Any &payload) 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
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
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
message_result test_mouse(sys::state &state, int32_t x, int32_t y, 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
void on_value_change(sys::state &state, int32_t v) noexcept override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
nation_script_button(dcon::gui_def_id base_definition)
void button_action(sys::state &state) noexcept override
dcon::gui_def_id base_definition
void on_update(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
message_result impl_set(sys::state &state, Cyto::Any &payload) noexcept final
std::vector< element_base * > children
message_result impl_on_key_down(sys::state &state, sys::virtual_key key, sys::key_modifiers mods) noexcept final
void impl_on_reset_text(sys::state &state) noexcept override
mouse_probe impl_probe_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void move_child_to_front(element_base *child) noexcept final
element_base * get_child_by_index(sys::state const &state, int32_t index) noexcept final
void move_child_to_back(element_base *child) noexcept final
void impl_render(sys::state &state, int32_t x, int32_t y) noexcept override
void impl_on_update(sys::state &state) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
void populate_flags(sys::state &state) override
void populate_flags(sys::state &state) override
void populate_flags(sys::state &state) override
void on_update(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void update_subwindow(sys::state &state, overlapping_flags_flag_button &subwindow, dcon::national_identity_id content) override
virtual void populate_flags(sys::state &state)
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void set_current_nation(sys::state &state, dcon::national_identity_id identity) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void populate_flags(sys::state &state) override
virtual std::string_view get_row_element_name()
virtual void update_subwindow(sys::state &state, ItemWinT &subwindow, ItemConT content)
void populate_flags(sys::state &state) override
void populate_flags(sys::state &state) override
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
dcon::national_identity_id get_current_nation(sys::state &state) noexcept override
void upate_truce(sys::state &state, dcon::nation_id i, sys::date u)
tooltip_behavior has_tooltip(sys::state &state) noexcept override
std::string_view get_row_element_name() override
void on_update(sys::state &state) noexcept override
void update_subwindow(sys::state &state, overlapping_truce_flag_button &subwindow, truce_pair content) override
static std::unique_ptr< partially_transparent_image > make_element_by_type_alias(sys::state &state, dcon::gui_def_id id)
void on_create(sys::state &state) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
ogl::data_texture data_texture
virtual void populate_tooltip(sys::state &state, T t, float percentage, text::columnar_layout &contents) noexcept
void update_chart(sys::state &state)
std::vector< entry > distribution
void render(sys::state &state, int32_t x, int32_t y) noexcept override
message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
static constexpr int32_t resolution
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
static constexpr size_t channels
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
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
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) 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 button_action(sys::state &state) noexcept override
province_script_button(dcon::gui_def_id base_definition)
tooltip_behavior has_tooltip(sys::state &state) noexcept override
message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final
virtual void button_right_action(sys::state &state) noexcept override
void calibrate_scrollbar(sys::state &state) noexcept
message_result get(sys::state &state, Cyto::Any &payload) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
message_result on_scroll(sys::state &state, int32_t x, int32_t y, float amount, sys::key_modifiers mods) noexcept override
void on_create(sys::state &state) noexcept override
multiline_text_element_base * delegate
multiline_text_scrollbar * text_scrollbar
message_result set(sys::state &state, Cyto::Any &payload) noexcept final
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
sound::audio_instance & get_click_sound(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void button_action(sys::state &state) noexcept final
void button_shift_right_action(sys::state &state) noexcept final
void button_shift_action(sys::state &state) noexcept final
void button_shift_right_action(sys::state &state) noexcept final
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept override
void button_action(sys::state &state) noexcept final
void button_shift_action(sys::state &state) noexcept final
message_result set(sys::state &state, Cyto::Any &payload) noexcept final
sound::audio_instance & get_click_sound(sys::state &state) noexcept override
tooltip_behavior has_tooltip(sys::state &state) noexcept override
void on_drag_finish(sys::state &state) noexcept final
void on_drag(sys::state &state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final
message_result on_lbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final
tooltip_behavior has_tooltip(sys::state &state) noexcept final
void update_tooltip(sys::state &state, int32_t x, int32_t y, text::columnar_layout &contents) noexcept final
image_element_base * right_limit
scrollbar_slider * slider
void change_settings(sys::state &state, mutable_scrollbar_settings const &settings_s)
void on_create(sys::state &state) noexcept override
virtual void on_value_change(sys::state &state, int32_t v) noexcept
scrollbar_settings settings
scrollbar_right * right
scrollbar_left * left
message_result get(sys::state &state, Cyto::Any &payload) noexcept final
scrollbar_track * track
int32_t raw_value() const
void update_scaled_value(sys::state &state, float v)
float scaled_value() const
void update_raw_value(sys::state &state, int32_t v)
image_element_base * left_limit
void on_create(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)
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)
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
std::string_view get_text(sys::state &state) const
void on_reset_text(sys::state &state) noexcept override
void format_text(sys::state &state)
void on_update(sys::state &state) noexcept override
void on_value_change(sys::state &state, int32_t v) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
void render(sys::state &state, int32_t x, int32_t y) noexcept override
virtual void button_right_action(sys::state &state) noexcept override
message_result on_rbutton_down(sys::state &state, int32_t x, int32_t y, sys::key_modifiers mods) noexcept final
void render(sys::state &state, int32_t x, int32_t y) noexcept override
text::layout internal_layout
void on_create(sys::state &state) noexcept override
message_result test_mouse(sys::state &state, int32_t x, int32_t y, mouse_probe_type type) noexcept override
void on_create(sys::state &state) noexcept override
void on_drag(sys::state &state, int32_t oldx, int32_t oldy, int32_t x, int32_t y, sys::key_modifiers mods) noexcept override
virtual std::unique_ptr< element_base > make_child(sys::state &state, std::string_view name, dcon::gui_def_id id) noexcept
void for_each_demo(sys::state &state, std::function< void(dcon::pop_type_id)> fun) override
color_modification
audio_instance & get_click_left_sound(sys::state &state)
Definition: sound_nix.cpp:266
audio_instance & get_click_right_sound(sys::state &state)
Definition: sound_nix.cpp:269
audio_instance & get_checkbox_sound(sys::state &state)
Definition: sound_nix.cpp:278
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
audio_instance & get_subtab_sound(sys::state &state)
Definition: sound_nix.cpp:284
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name, cert-dcl58-cpp) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression, cppcoreguidelines-noexcept-swap, performance-noexcept-swap) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
Definition: json.hpp:24635
virtual_key
Definition: constants.hpp:5
key_modifiers
Definition: constants.hpp:156
void add_to_layout_box(sys::state &state, layout_base &dest, layout_box &box, embedded_flag ico)
Definition: text.cpp:1165
layout_box open_layout_box(layout_base &dest, int32_t indent)
Definition: text.cpp:1823
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
endless_layout create_endless_layout(sys::state &state, layout &dest, layout_parameters const &params)
Definition: text.cpp:1100
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
Definition: text.cpp:1068
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
Definition: text.hpp:797
text_color
Definition: text.hpp:18
void close_layout_box(columnar_layout &dest, layout_box &box)
Definition: text.cpp:1831
void make_size_from_graphics(sys::state &state, ui::element_data &dat)
std::unique_ptr< element_base > make_element_by_type(sys::state &state, std::string_view name, Params &&... params)
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)
void populate_shortcut_tooltip(sys::state &state, ui::element_base &elm, text::columnar_layout &contents) noexcept
tooltip_behavior
void send(sys::state &state, element_base *parent, T value)
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)
uint uint32_t
uchar uint8_t
Holds important data about the game world, state, and other data regarding windowing,...
dcon::gfx_object_id button_image
sys::virtual_key shortcut
element_type get_element_type() const
union ui::element_data::internal_data data
static constexpr uint8_t do_transparency_check
dcon::gfx_object_id gfx_object
listbox2_row_element * row
entry(T key, float value)
ankerl::unordered_dense::map< dcon::text_key, element_target, hash_text_key > defs_by_name
dcon::nation_id n