mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 09:17:23 +01:00
[apps] Merge node navigation controller and box controller
Change-Id: Ie8163568dc4cc30932a93b133c433f62be2cff43
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
#include "node_list_view_controller.h"
|
||||
#include "toolbox_controller.h"
|
||||
#include "toolbox_node.h"
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
NodeListViewController::NodeListViewController(NodeNavigationController * parent) :
|
||||
ViewController(parent),
|
||||
m_nodeNavigationController(parent),
|
||||
NodeListViewController::NodeListViewController(Responder * parentResponder) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this, 0, 0, 0, 0, nullptr, false)),
|
||||
m_nodeModel(nullptr),
|
||||
m_firstSelectedRow(0)
|
||||
@@ -64,9 +63,9 @@ TableViewCell * NodeListViewController::reusableCell(int index, int type) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_maxNumberOfDisplayedRows);
|
||||
if (type == 0) {
|
||||
return m_nodeNavigationController->leafCellAtIndex(index);
|
||||
return &m_leafCells[index];
|
||||
}
|
||||
return m_nodeNavigationController->nodeCellAtIndex(index);
|
||||
return &m_nodeCells[index];
|
||||
}
|
||||
|
||||
int NodeListViewController::reusableCellCount(int type) {
|
||||
@@ -75,12 +74,20 @@ int NodeListViewController::reusableCellCount(int type) {
|
||||
}
|
||||
|
||||
void NodeListViewController::willDisplayCellForIndex(TableViewCell * cell, int index) {
|
||||
m_nodeNavigationController->willDisplayCellForIndex(cell, index);
|
||||
ToolboxNode * node = (ToolboxNode *)m_nodeModel->children(index);
|
||||
if (node->numberOfChildren() == 0) {
|
||||
ToolboxLeafCell * myCell = (ToolboxLeafCell *)cell;
|
||||
myCell->setLabel(node->label());
|
||||
myCell->setSubtitle(node->text());
|
||||
return;
|
||||
}
|
||||
MenuListCell * myCell = (MenuListCell *)cell;
|
||||
myCell->setText(node->label());
|
||||
}
|
||||
|
||||
KDCoordinate NodeListViewController::rowHeight(int j) {
|
||||
if (typeAtLocation(0, j) == 0) {
|
||||
return m_nodeNavigationController->leafRowHeight(j);
|
||||
return k_leafRowHeight;
|
||||
}
|
||||
return k_nodeRowHeight;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user