[escher] Divide class selectable table view delegate in 2: selectable

table view data source & selectable table view delegate

Change-Id: I90fbd61e271db3754c13bd0069b95c2026de6814
This commit is contained in:
Émilie Feral
2017-05-17 17:03:03 +02:00
parent 71284311bb
commit af4d6b6e81
54 changed files with 153 additions and 136 deletions

View File

@@ -2,35 +2,38 @@
#include <assert.h>
SelectableTableView::SelectableTableView(Responder * parentResponder, TableViewDataSource * dataSource, KDCoordinate horizontalCellOverlapping, KDCoordinate verticalCellOverlapping, KDCoordinate topMargin, KDCoordinate rightMargin, KDCoordinate bottomMargin, KDCoordinate leftMargin,
SelectableTableViewDelegate * delegate, bool showIndicators, bool colorBackground, KDColor backgroundColor,
SelectableTableViewDataSource * selectionDataSource, SelectableTableViewDelegate * delegate, bool showIndicators, bool colorBackground, KDColor backgroundColor,
KDCoordinate indicatorThickness, KDColor indicatorColor, KDColor backgroundIndicatorColor, KDCoordinate indicatorMargin) :
TableView(dataSource, delegate, horizontalCellOverlapping, verticalCellOverlapping, topMargin, rightMargin, bottomMargin, leftMargin, showIndicators, colorBackground, backgroundColor,
TableView(dataSource, selectionDataSource, horizontalCellOverlapping, verticalCellOverlapping, topMargin, rightMargin, bottomMargin, leftMargin, showIndicators, colorBackground, backgroundColor,
indicatorThickness, indicatorColor, backgroundIndicatorColor, indicatorMargin),
Responder(parentResponder),
m_selectionDataSource(selectionDataSource),
m_delegate(delegate)
{
assert(m_delegate != nullptr);
assert(m_selectionDataSource != nullptr);
}
int SelectableTableView::selectedRow() {
return m_delegate->selectedRow();
return m_selectionDataSource->selectedRow();
}
int SelectableTableView::selectedColumn() {
return m_delegate->selectedColumn();
return m_selectionDataSource->selectedColumn();
}
void SelectableTableView::selectRow(int j) {
m_delegate->selectRow(j);
m_selectionDataSource->selectRow(j);
}
void SelectableTableView::selectColumn(int i) {
m_delegate->selectColumn(i);
m_selectionDataSource->selectColumn(i);
}
void SelectableTableView::didEnterResponderChain(Responder * previousFirstResponder) {
selectCellAtLocation(selectedColumn(), selectedRow());
m_delegate->tableViewDidChangeSelection(this, 0, -1);
if (m_delegate) {
m_delegate->tableViewDidChangeSelection(this, 0, -1);
}
}
void SelectableTableView::willExitResponderChain(Responder * nextFirstResponder) {