mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps] enable node navigation to decide the leaf row height
Change-Id: Ib013dd50c4d57df31e9be7813440037173415330
This commit is contained in:
@@ -80,7 +80,7 @@ void NodeListViewController::willDisplayCellForIndex(TableViewCell * cell, int i
|
||||
|
||||
KDCoordinate NodeListViewController::rowHeight(int j) {
|
||||
if (typeAtLocation(0, j) == 0) {
|
||||
return k_leafRowHeight;
|
||||
return m_nodeNavigationController->leafRowHeight(j);
|
||||
}
|
||||
return k_nodeRowHeight;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
void deselectTable();
|
||||
constexpr static int k_maxNumberOfDisplayedRows = 6; //240/40
|
||||
private:
|
||||
constexpr static KDCoordinate k_leafRowHeight = 50;
|
||||
constexpr static KDCoordinate k_nodeRowHeight = 40;
|
||||
NodeNavigationController * m_nodeNavigationController;
|
||||
SelectableTableView m_selectableTableView;
|
||||
|
||||
@@ -15,6 +15,7 @@ public:
|
||||
virtual TableViewCell * leafCellAtIndex(int index) = 0;
|
||||
virtual TableViewCell * nodeCellAtIndex(int index) = 0;
|
||||
virtual void willDisplayCellForIndex(TableViewCell * cell, int index);
|
||||
virtual KDCoordinate leafRowHeight(int index) = 0;
|
||||
protected:
|
||||
TextField * m_textFieldCaller;
|
||||
NodeListViewController m_listViewController;
|
||||
|
||||
@@ -46,6 +46,10 @@ void ToolboxController::willDisplayCellForIndex(TableViewCell * cell, int index)
|
||||
myCell->setText(node->label());
|
||||
}
|
||||
|
||||
KDCoordinate ToolboxController::leafRowHeight(int index) {
|
||||
return k_leafRowHeight;
|
||||
}
|
||||
|
||||
Node * ToolboxController::nodeModel() {
|
||||
return (Node *)&toolboxModel;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ public:
|
||||
TableViewCell * leafCellAtIndex(int index) override;
|
||||
TableViewCell * nodeCellAtIndex(int index) override;
|
||||
void willDisplayCellForIndex(TableViewCell * cell, int index) override;
|
||||
KDCoordinate leafRowHeight(int index) override;
|
||||
private:
|
||||
constexpr static KDCoordinate k_leafRowHeight = 40;
|
||||
ToolboxLeafCell m_leafCells[NodeListViewController::k_maxNumberOfDisplayedRows];
|
||||
ChevronMenuListCell m_nodeCells[NodeListViewController::k_maxNumberOfDisplayedRows];
|
||||
Node * nodeModel() override;
|
||||
|
||||
@@ -69,6 +69,23 @@ void VariableBoxController::willDisplayCellForIndex(TableViewCell * cell, int in
|
||||
}
|
||||
}
|
||||
|
||||
KDCoordinate VariableBoxController::leafRowHeight(int index) {
|
||||
// TODO: add a constant to index if the node == matrice/liste
|
||||
const char * parentNodeLabel = m_listViewController.nodeModel()->label();
|
||||
const Expression * expression = m_context->scalarExpressionForIndex(index);
|
||||
if (strcmp(parentNodeLabel, "Matrices") == 0) {
|
||||
//expression = m_context->matrixExpressionForIndex(index);
|
||||
}
|
||||
if (strcmp(parentNodeLabel, "Listes") == 0) {
|
||||
//expression = m_context->listExpressionForIndex(index);
|
||||
}
|
||||
if (expression) {
|
||||
KDCoordinate expressionHeight = expression->createLayout()->size().height();
|
||||
return expressionHeight;
|
||||
}
|
||||
return k_leafRowHeight;
|
||||
}
|
||||
|
||||
Node * VariableBoxController::nodeModel() {
|
||||
return (Node *)&variableBoxModel;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ public:
|
||||
TableViewCell * leafCellAtIndex(int index) override;
|
||||
TableViewCell * nodeCellAtIndex(int index) override;
|
||||
void willDisplayCellForIndex(TableViewCell * cell, int index) override;
|
||||
KDCoordinate leafRowHeight(int index) override;
|
||||
private:
|
||||
constexpr static KDCoordinate k_leafRowHeight = 40;
|
||||
Context * m_context;
|
||||
VariableBoxLeafCell m_leafCells[NodeListViewController::k_maxNumberOfDisplayedRows];
|
||||
ChevronMenuListCell m_nodeCells[NodeListViewController::k_maxNumberOfDisplayedRows];
|
||||
|
||||
Reference in New Issue
Block a user