[escher] In table view, add method 'reloadCellAtLocation'

Change-Id: I2d662669621392698ee963a6c8e70d3d2f4ee829
This commit is contained in:
Émilie Feral
2017-06-02 16:56:41 +02:00
parent 0559661a07
commit f43b307856
5 changed files with 13 additions and 3 deletions

View File

@@ -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());

View File

@@ -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()));

View File

@@ -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);

View File

@@ -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();

View File

@@ -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);