#pragma once #include #include #include #include "UIWidget.h" #include "persistence.h" #include "common/Common.h" #include "common/Widget.h" #include "model/AppContext.h" class Device final : public UIWidget { public: explicit Device(void *appstate); void Render() const override; void HandleTap(const SDL_MouseButtonEvent *event) const; void ReleaseTap(const SDL_MouseButtonEvent *event) const; void OnButtonClicked(ButtonType button) const; [[nodiscard]] bool IsHit(int mouse_x, int mouse_y) const override; void OnTap(int mouse_x, int mouse_y) override; void ReleaseTap(int mouse_x, int mouse_y) override; private: void DrawBackground() const; void DrawScreen() const; void RenderU8G2() const; void SetScreen(const std::shared_ptr &screen); void PushScreen(const std::shared_ptr &screen); void PopScreen(); static void PushKey(SDL_Keycode key); static void savePersistence(const char *key, const char *value); std::vector> m_children{}; std::shared_ptr m_widget; std::vector> m_history; persistence_t m_persistence{}; };