1- /* *
2- * MIT License
3- *
4- * Copyright (c) 2022-2024 Rina Wilk / [email protected] 5- *
6- * Permission is hereby granted, free of charge, to any person obtaining a copy
7- * of this software and associated documentation files (the "Software"), to deal
8- * in the Software without restriction, including without limitation the rights
9- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10- * copies of the Software, and to permit persons to whom the Software is
11- * furnished to do so, subject to the following conditions:
12- *
13- * The above copyright notice and this permission notice shall be included in all
14- * copies or substantial portions of the Software.
15- *
16- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22- * SOFTWARE.
23- */
1+ #ifndef EKG_CORE_RUNTIME_HPP
2+ #define EKG_CORE_RUNTIME_HPP
243
25- #ifndef EKG_CORE_H
26- #define EKG_CORE_H
27-
28- #include < unordered_map>
29-
30- #include " ekg/ui/abstract/ui_abstract_widget.hpp"
4+ #include " ekg/ui/abstract.hpp"
315#include " ekg/service/handler.hpp"
32- #include " ekg/draw/font_renderer.hpp"
33- #include " ekg/service/theme.hpp"
34- #include " ekg/service/input.hpp"
35- #include " ekg/util/io.hpp"
36- #include " ekg/util/gui.hpp"
37- #include " ekg/gpu/api.hpp"
38- #include " ekg/layout/docknize.hpp"
396
40- namespace ekg {
41- extern struct current_hovered_state {
42- public:
43- int32_t id {};
44- int32_t up {};
45- int32_t down {};
46- ekg::type type {};
47- ekg::type down_type {};
48- ekg::type up_type {};
49- int32_t swap {};
50- int32_t last {};
51- } hovered;
7+ #include < memory>
528
9+ namespace ekg {
5310 class runtime {
54- private:
55- static ekg::stack collect;
56- static ekg::stack back;
57- static ekg::stack front;
58- private:
59- std::unordered_map<int32_t , ekg::ui::abstract_widget*> widget_map {};
60-
61- std::vector<ekg::ui::abstract_widget*> update_widget_list {};
62- std::vector<ekg::ui::abstract_widget*> loaded_widget_list {};
63- std::vector<ekg::ui::abstract_widget*> refresh_widget_list {};
64-
65- std::vector<ekg::ui::abstract_widget*> reload_widget_list {};
66- uint64_t reload_widget_counter {};
67-
68- std::vector<ekg::ui::abstract_widget*> synclayout_widget_list {};
69- uint64_t synclayout_widget_counter {};
70-
71- ekg::ui::abstract *p_current_ui_container {};
72- ekg::ui::abstract_widget *p_abs_activity_widget {};
73- ekg::stack *p_current_stack {};
74-
75- int32_t token_id {};
76- bool enable_high_priority_frequency {};
7711 public:
78- ekg::service::input service_input {};
79- ekg::service::theme service_theme {};
80- ekg::service::handler service_handler {};
81- public:
82- ekg::draw::font_renderer f_renderer_small {};
83- ekg::draw::font_renderer f_renderer_normal {};
84- ekg::draw::font_renderer f_renderer_big {};
85-
86- ekg::timing ui_scroll_timing {};
87- ekg::timing ui_timing {};
88- ekg::os::io_event_serial io_event_serial {};
89-
90- ekg::os::platform *p_os_platform {};
91- ekg::gpu::api *p_gpu_api {};
92- ekg::gpu::allocator gpu_allocator {};
93-
94- ekg::layout::mask mask {};
95- protected:
96- void prepare_tasks ();
97-
98- void prepare_ui_env ();
12+ std::vector<std::unique_ptr<ekg::ui::abstract>> loaded_widget_list {};
13+ ekg::id global_id {};
9914
100- void erase (int32_t id);
15+ std::vector<ekg::ui::abstract*> context_widget_list {};
16+ ekg::io::target_collector_t swap_target_collector {};
10117 public:
102- void set_current_stack (ekg::stack *p_stack);
103-
104- ekg::ui::abstract_widget *get_fast_widget_by_id (int32_t id);
105-
106- void gen_widget (ekg::ui::abstract *p_ui);
107-
108- void do_task_reload (ekg::ui::abstract_widget *widget);
109-
110- void do_task_synclayout (ekg::ui::abstract_widget *widget);
111-
112- void do_task_refresh (ekg::ui::abstract_widget *widget);
113-
114- void set_update_high_frequency (ekg::ui::abstract_widget *widget);
115-
116- bool has_bind_group_flag ();
117-
118- void end_group_flag ();
119-
120- void end_group_parent_flag ();
121-
122- void update_size_changed ();
123-
124- void init ();
125-
126- void quit ();
127-
128- void process_event ();
18+ ekg::service::handler handler {};
19+ public:
20+ void do_init ();
21+ void do_quit ();
22+ void do_update ();
23+ void do_render ();
12924
130- void process_update ();
25+ ekg::ui::abstract *push_back_new_widget_safety (
26+ ekg::ui::abstract *p_widget
27+ );
13128
132- void process_render ();
29+ ekg::id generate_unique_id ();
13330 };
134- };
31+ }
13532
13633#endif
0 commit comments