mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 14:50:44 +01:00
[apps/calculations] Make the history view controller a delegate
to the table view Change-Id: I69302f1999b7f6b7f051c71bcaeac43279b27ed2
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Calculation {
|
||||
|
||||
HistoryController::HistoryController(Responder * parentResponder, CalculationStore * calculationStore) :
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(SelectableTableView(this, this)),
|
||||
m_selectableTableView(SelectableTableView(this, this, 0, 0, 0, 0, this)),
|
||||
m_calculationStore(calculationStore)
|
||||
{
|
||||
}
|
||||
@@ -43,6 +43,11 @@ bool HistoryController::handleEvent(Ion::Events::Event event) {
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryController::tableViewDidChangeSelection(SelectableTableView * t) {
|
||||
m_calculationHistory[t->selectedRow()].setParentResponder(t);
|
||||
app()->setFirstResponder(&m_calculationHistory[t->selectedRow()]);
|
||||
}
|
||||
|
||||
int HistoryController::numberOfRows() {
|
||||
return m_calculationStore->numberOfCalculations();
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Calculation {
|
||||
|
||||
class App;
|
||||
|
||||
class HistoryController : public ViewController, ListViewDataSource {
|
||||
class HistoryController : public ViewController, public ListViewDataSource, public SelectableTableViewDelegate {
|
||||
public:
|
||||
HistoryController(Responder * parentResponder, CalculationStore * calculationStore);
|
||||
|
||||
@@ -28,6 +28,7 @@ public:
|
||||
KDCoordinate cumulatedHeightFromIndex(int j) override;
|
||||
int indexFromCumulatedHeight(KDCoordinate offsetY) override;
|
||||
int typeAtLocation(int i, int j) override;
|
||||
void tableViewDidChangeSelection(SelectableTableView * t) override;
|
||||
|
||||
private:
|
||||
constexpr static int k_maxNumberOfDisplayedRows = 10;
|
||||
|
||||
Reference in New Issue
Block a user