Files
ink-board/main/ui/apps/demo_app.h

54 lines
1.2 KiB
C++

#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;
};