mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#ifndef APPS_NODE_NAVIGATION_CONTROLLER_H
|
|
#define APPS_NODE_NAVIGATION_CONTROLLER_H
|
|
|
|
#include <escher.h>
|
|
#include "node.h"
|
|
#include "node_list_view_controller.h"
|
|
|
|
class NodeNavigationController : public StackViewController {
|
|
public:
|
|
NodeNavigationController();
|
|
const char * title() const override;
|
|
bool handleEvent(Ion::Events::Event event) override;
|
|
void didBecomeFirstResponder() override;
|
|
void setTextFieldCaller(TextField * textField);
|
|
protected:
|
|
TextField * m_textFieldCaller;
|
|
private:
|
|
class Stack {
|
|
public:
|
|
class State {
|
|
public:
|
|
State(int selectedRow = -1, KDCoordinate verticalScroll = 0);
|
|
bool isNull();
|
|
int selectedRow();
|
|
KDCoordinate verticalScroll();
|
|
private:
|
|
int m_selectedRow;
|
|
KDCoordinate m_verticalScroll;
|
|
};
|
|
void push(int selectedRow, KDCoordinate verticalScroll);
|
|
void pop();
|
|
State * stateAtIndex(int index);
|
|
int depth();
|
|
void resetStack();
|
|
private:
|
|
constexpr static int k_maxModelTreeDepth = 2;
|
|
State m_statesStack[k_maxModelTreeDepth];
|
|
};
|
|
virtual Node * nodeModel() = 0;
|
|
virtual bool selectLeaf(Node * selectedNode) = 0;
|
|
bool selectSubMenu(Node * selectedNode);
|
|
bool returnToPreviousMenu();
|
|
NodeListViewController m_listViewController;
|
|
Stack m_stack;
|
|
};
|
|
|
|
#endif
|