Files
tactility_apps/Apps/TodoList/main/Source/TodoList.h
T
Shadowtrance a75279c96c New Apps - Lot 1 (#27)
* New Apps - Lot 1

Trying to mix it up a little with some fun, useful and just weird.
Adds more new apps...
Brainfuck
Breakout
Magic 8 Ball
Todo List

Also re-organised the app name part of main.yml

* Fix build?

* fixes

* and some more

* Update Brainfuck.cpp

* i heard you like fixes with your fixes

* no hard coded paths
2026-02-19 19:46:54 +01:00

54 lines
1.2 KiB
C++

#pragma once
#include <tt_app.h>
#include <lvgl.h>
#include <TactilityCpp/App.h>
class TodoList final : public App {
private:
static constexpr int MAX_TODOS = 50;
static constexpr int MAX_TEXT_LEN = 128;
struct TodoItem {
char text[MAX_TEXT_LEN];
bool done;
};
// UI pointers (nulled in onHide)
lv_obj_t* list = nullptr;
lv_obj_t* inputRow = nullptr;
lv_obj_t* inputTa = nullptr;
lv_obj_t* countLabel = nullptr;
// Data
TodoItem items[MAX_TODOS] = {};
int count = 0;
bool rebuildPending = false;
lv_timer_t* rebuildTimer = nullptr;
// Persistence
void saveTodos();
void loadTodos();
// UI helpers
void updateCountLabel();
void rebuildList();
void scheduleRebuild();
void addItem(const char* text);
static void onDeferredRebuild(lv_timer_t* timer);
// Static callbacks
static void onItemClicked(lv_event_t* e);
static void onDeleteClicked(lv_event_t* e);
static void onAddClicked(lv_event_t* e);
static void onInputReady(lv_event_t* e);
static void onClearDoneClicked(lv_event_t* e);
public:
void onShow(AppHandle context, lv_obj_t* parent) override;
void onHide(AppHandle context) override;
};