5#include <freertos/FreeRTOS.h>
6#include <freertos/semphr.h>
32 void push(
IView* view,
void* context =
nullptr);
83 uint8_t
depth()
const {
return depth_; }
88 bool isEmpty()
const {
return depth_ == 0; }
120 void render(
bool synchronous =
false);
161 IView*
getModal()
const {
return modalDepth_ > 0 ? modals_[modalDepth_ - 1] :
nullptr; }
230 ViewStack() =
default;
232 static constexpr uint8_t MAX_MODAL_DEPTH = 4;
236 IView* modals_[MAX_MODAL_DEPTH] = {};
237 uint8_t modalDepth_ = 0;
238 IView* pendingPush_ =
nullptr;
239 void* pendingContext_ =
nullptr;
248 bool needsCompositeRepaint_ =
false;
249 const void* exclusiveOwner_ =
nullptr;
250 SemaphoreHandle_t mutex_ =
nullptr;
255 void push_unlocked(IView* view,
void* context);
257 void hideModal_unlocked();
258 void removeModal_unlocked(IView* modal);
263 uint32_t inactivityTimeoutMs_ = 0;
264 uint32_t lastActivityMs_ = 0;
void popToDepth(uint8_t targetDepth)
Pops views until the stack depth is at most targetDepth.
void setInactivityTimeout(InactivityCallback callback, uint32_t timeoutMs)
void replace(IView *view, void *context=nullptr)
void dispatchKey(char key)
void dispatchTick(uint32_t nowMs)
static ViewStack & instance()
Returns singleton view-stack instance.
void removeModal(IView *modal)
Remove a specific modal from any position in the modal stack.
const void * exclusiveOwner() const
Returns current exclusive owner, or nullptr if none.
void showModal(IView *modal)
bool releaseExclusive(const void *owner)
Releases exclusive ownership.
static constexpr uint8_t MAX_DEPTH
void forceRefresh(hal::RefreshMode mode)
Escalates the refresh mode of the next render.
void(*)() InactivityCallback
bool acquireExclusive(const void *owner)
Acquires exclusive ownership of the view stack.
InputResult dispatchLongPress(char key)
void checkInactivity(uint32_t nowMs)
void popToAnchor(IView *anchor)
Pops views until the specified anchor view is the current view.
void push(IView *view, void *context=nullptr)
IView * at(uint8_t depth) const
void resetInactivityTimer()
Centralized key-code constants for cdc_views.