From f43b307856cd48fa2848c32eb26dacbb7de5e402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Fri, 2 Jun 2017 16:56:41 +0200 Subject: [PATCH] [escher] In table view, add method 'reloadCellAtLocation' Change-Id: I2d662669621392698ee963a6c8e70d3d2f4ee829 --- apps/probability/image_table_view.cpp | 2 +- apps/settings/main_controller.cpp | 2 +- apps/shared/float_parameter_controller.cpp | 2 +- escher/include/escher/table_view.h | 2 ++ escher/src/table_view.cpp | 8 ++++++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/probability/image_table_view.cpp b/apps/probability/image_table_view.cpp index 3830597b8..8a83f331f 100644 --- a/apps/probability/image_table_view.cpp +++ b/apps/probability/image_table_view.cpp @@ -96,7 +96,7 @@ void ImageTableView::select(bool select) { if (!select) { m_selectableTableView.deselectTable(); m_isSelected = select; - willDisplayCellForIndex(m_selectableTableView.cellAtLocation(0,0), 0); + m_selectableTableView.reloadCellAtLocation(0, 0); } else { m_isSelected = select; m_selectableTableView.selectCellAtLocation(0, (int)m_calculation->type()); diff --git a/apps/settings/main_controller.cpp b/apps/settings/main_controller.cpp index b6694d07e..3e24b1631 100644 --- a/apps/settings/main_controller.cpp +++ b/apps/settings/main_controller.cpp @@ -64,7 +64,7 @@ bool MainController::handleEvent(Ion::Events::Event event) { return false; } GlobalPreferences::sharedGlobalPreferences()->setShowUpdatePopUp(!GlobalPreferences::sharedGlobalPreferences()->showUpdatePopUp()); - willDisplayCellForIndex(m_selectableTableView.cellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow()), m_selectableTableView.selectedRow()); + m_selectableTableView.reloadCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow()); return true; } m_subController.setNodeModel(m_nodeModel->children(selectedRow())); diff --git a/apps/shared/float_parameter_controller.cpp b/apps/shared/float_parameter_controller.cpp index 41bb61841..4b2e6b2f2 100644 --- a/apps/shared/float_parameter_controller.cpp +++ b/apps/shared/float_parameter_controller.cpp @@ -126,7 +126,7 @@ bool FloatParameterController::textFieldDidFinishEditing(TextField * textField, if (!setParameterAtIndex(selectedRow(), floatBody)) { return false; } - willDisplayCellForIndex(selectableTableView()->selectedCell(), activeCell()); + selectableTableView()->reloadCellAtLocation(0, activeCell()); selectableTableView()->reloadData(); if (event == Ion::Events::EXE || event == Ion::Events::OK) { selectableTableView()->selectCellAtLocation(selectedColumn(), selectedRow()+1); diff --git a/escher/include/escher/table_view.h b/escher/include/escher/table_view.h index a7a04551e..bc57b81cd 100644 --- a/escher/include/escher/table_view.h +++ b/escher/include/escher/table_view.h @@ -17,6 +17,7 @@ public: virtual void scrollToCell(int i, int j); HighlightCell * cellAtLocation(int i, int j); void reloadData(); + void reloadCellAtLocation(int i, int j); KDSize size() const; protected: #if ESCHER_VIEW_LOGGING @@ -28,6 +29,7 @@ protected: ContentView(TableView * tableView, TableViewDataSource * dataSource, KDCoordinate horizontalCellOverlapping, KDCoordinate verticalCellOverlapping); void scrollToCell(int i, int j) const; + void reloadCellAtLocation(int i, int j); HighlightCell * cellAtLocation(int i, int j); void resizeToFitContent(); TableViewDataSource * dataSource(); diff --git a/escher/src/table_view.cpp b/escher/src/table_view.cpp index 90be9e100..f5b4776fd 100644 --- a/escher/src/table_view.cpp +++ b/escher/src/table_view.cpp @@ -54,6 +54,10 @@ void TableView::reloadData() { layoutSubviews(); } +void TableView::reloadCellAtLocation(int i, int j) { + m_contentView.reloadCellAtLocation(i, j); +} + /* TableView::ContentView */ TableView::ContentView::ContentView(TableView * tableView, TableViewDataSource * dataSource, KDCoordinate horizontalCellOverlapping, KDCoordinate verticalCellOverlapping) : @@ -120,6 +124,10 @@ void TableView::ContentView::scrollToCell(int x, int y) const { m_tableView->setContentOffset(KDPoint(contentOffsetX, contentOffsetY)); } +void TableView::ContentView::reloadCellAtLocation(int i, int j) { + m_dataSource->willDisplayCellAtLocation(cellAtLocation(i, j), i, j); +} + int TableView::ContentView::typeOfSubviewAtIndex(int index) const { assert(index >= 0); int i = absoluteColumnNumberFromSubviewIndex(index);