#pragma once #include #include #include #include "app.h" #include "dialog_model.h" #include "event_bus.h" #include "line_editor.h" #include "list_model.h" #include "ui/theme.h" namespace roro { // Exercises every widget: text view, line editor, dialog and Toasts. class DemoApp : public App { public: explicit DemoApp(EventBus& bus) : bus_(bus) {} void onEnter() override; bool onKey(const KeyEvent& e) override; bool textEntryActive() const override { return page_ == Page::Editor && !dialog_; } void draw(Canvas& c) override; void help(std::vector& out) const override; private: enum class Page { Menu, Text, Editor }; bool onMenuKey(const KeyEvent& e); void notify(const char* text, NotificationLevel level); EventBus& bus_; Page page_ = Page::Menu; ListModel menu_{theme::kContent.h / theme::kLineHeight}; int textScroll_ = 0; int textLineCount_ = 0; LineEditor editor_{39}; std::unique_ptr dialog_; }; } // namespace roro