OMOTE/Platformio/src/gui_general_and_keys/guiRegistry.cpp
Max a8265c9580 fixed the ESP32 build action
- Changed include name to fix build actions
- Removes Changes in this fork from readme
2024-02-12 20:51:34 +01:00

31 lines
951 B
C++

#include <string>
#include <list>
#include <lvgl.h>
#include "guiRegistry.h"
// https://stackoverflow.com/questions/840501/how-do-function-pointers-in-c-work
struct gui_definition {
init_gui_tab this_init_gui_tab;
init_gui_pageIndicator this_init_gui_pageIndicator;
};
std::list<gui_definition> registered_guis;
void register_gui(init_gui_tab a_init_gui_tab, init_gui_pageIndicator a_gui_pageIndicator) {
registered_guis.push_back(gui_definition{a_init_gui_tab, a_gui_pageIndicator});
}
void create_gui_tabs_from_gui_registry(lv_obj_t* tabview) {
std::list<gui_definition>::iterator it;
for (it = registered_guis.begin(); it != registered_guis.end(); ++it) {
it->this_init_gui_tab(tabview);
}
}
void create_gui_pageIndicators_from_gui_registry(lv_obj_t* panel) {
std::list<gui_definition>::iterator it;
for (it = registered_guis.begin(); it != registered_guis.end(); ++it) {
it->this_init_gui_pageIndicator(panel);
}
}