diff --git a/main/ui/apps/demo_app.h b/main/ui/apps/demo_app.h new file mode 100644 index 0000000..afa9c62 --- /dev/null +++ b/main/ui/apps/demo_app.h @@ -0,0 +1,53 @@ +#pragma once + +#include "ui/ui_app.h" +#include "ui/app_registry.h" + +/** + * @brief Demo application - counter and brightness slider + * + * Demonstrates interactive UI components with touch input: + * - Counter display with increment/decrement buttons + * - Brightness slider + */ +class DemoApp : public UIApp { +public: + DemoApp() = default; + virtual ~DemoApp() = default; + + esp_err_t init(lv_obj_t* container) override; + esp_err_t deinit(void) override; + std::string get_name(void) const override; + +private: + // UI components + lv_obj_t* _label_header= nullptr; + lv_obj_t* _label_counter= nullptr; + lv_obj_t* _btn_increment= nullptr; + lv_obj_t* _btn_decrement= nullptr; + lv_obj_t* _slider_brightness= nullptr; + lv_obj_t* _label_slider_value= nullptr; + + // State + int _counter= 0; + + // Event callbacks + static void btn_increment_event_cb(lv_event_t* e); + static void btn_decrement_event_cb(lv_event_t* e); + static void slider_event_cb(lv_event_t* e); +}; + +/** + * @brief AppDescriptor for DemoApp + * + * Registers the demo app with the AppRegistry and provides + * icon rendering functionality. + */ +class DemoAppDescriptor : public AppDescriptor { +public: + DemoAppDescriptor(); + void draw_icon(lv_obj_t* parent) override; + +private: + static DemoApp* _app_instance; +}; diff --git a/main/ui/apps/shutdown_app.h b/main/ui/apps/shutdown_app.h new file mode 100644 index 0000000..87c72d4 --- /dev/null +++ b/main/ui/apps/shutdown_app.h @@ -0,0 +1,39 @@ +#pragma once + +#include "ui/ui_app.h" +#include "ui/app_registry.h" + +/** + * @brief Shutdown application - displays shutdown message + * + * Shown when the system is about to enter deep sleep or power off. + * Displays a message and optionally a spinner animation. + */ +class ShutdownApp : public UIApp { +public: + ShutdownApp(std::string message = ""); + virtual ~ShutdownApp() = default; + + esp_err_t init(lv_obj_t* container) override; + esp_err_t deinit(void) override; + std::string get_name(void) const override; + +private: + std::string _message; + lv_obj_t* _label_message = nullptr; +}; + +/** + * @brief AppDescriptor for ShutdownApp + * + * Note: Shutdown app is typically not shown in the navigation bar + * as it's only used during system shutdown. + */ +class ShutdownAppDescriptor : public AppDescriptor { +public: + ShutdownAppDescriptor(); + void draw_icon(lv_obj_t* parent) override; + +private: + static ShutdownApp* _app_instance; +};