[apps] enable node navigation controller to use different cell types

(implemented by its subclasses)

Change-Id: I44ef187c0142f049c710a4515c3dc0edf5573927
This commit is contained in:
Émilie Feral
2016-11-14 10:48:56 +01:00
parent 9e9302b602
commit 41f8d0c75c
8 changed files with 53 additions and 10 deletions

View File

@@ -3,8 +3,9 @@
#include <assert.h>
#include <string.h>
NodeListViewController::NodeListViewController(Responder * parentResponder) :
ViewController(parentResponder),
NodeListViewController::NodeListViewController(NodeNavigationController * parent) :
ViewController(parent),
m_nodeNavigationController(parent),
m_selectableTableView(SelectableTableView(this, this)),
m_nodeModel(nullptr),
m_firstSelectedRow(0)
@@ -63,9 +64,9 @@ TableViewCell * NodeListViewController::reusableCell(int index, int type) {
assert(index >= 0);
assert(index < k_maxNumberOfDisplayedRows);
if (type == 0) {
return &m_commandCells[index];
return m_nodeNavigationController->leafCellAtIndex(index);
}
return &m_menuCells[index];
return m_nodeNavigationController->nodeCellAtIndex(index);
}
int NodeListViewController::reusableCellCount(int type) {
@@ -74,8 +75,7 @@ int NodeListViewController::reusableCellCount(int type) {
}
void NodeListViewController::willDisplayCellForIndex(TableViewCell * cell, int index) {
MenuListCell * myCell = (MenuListCell *)cell;
myCell->setText(m_nodeModel->children(index)->label());
m_nodeNavigationController->willDisplayCellForIndex(cell, index);
}
KDCoordinate NodeListViewController::rowHeight(int j) {