[escher] Simplify TableView::scrollToCell

This commit is contained in:
Ruben Dashyan
2019-04-09 14:36:18 +02:00
committed by Émilie Feral
parent 2d7c87d461
commit a3fe99da21
2 changed files with 2 additions and 9 deletions

View File

@@ -34,7 +34,6 @@ protected:
void setHorizontalCellOverlap(KDCoordinate o) { m_horizontalCellOverlap = o; }
void setVerticalCellOverlap(KDCoordinate o) { m_verticalCellOverlap = o; }
void scrollToCell(int i, int j) const;
void reloadCellAtLocation(int i, int j);
HighlightCell * cellAtLocation(int i, int j);
TableViewDataSource * dataSource();
@@ -42,6 +41,7 @@ protected:
int columnsScrollingOffset() const;
int numberOfDisplayableRows() const;
int numberOfDisplayableColumns() const;
KDRect cellFrame(int i, int j) const;
void layoutSubviews() override;
protected:
#if ESCHER_VIEW_LOGGING
@@ -54,9 +54,6 @@ protected:
int numberOfSubviews() const override;
View * subviewAtIndex(int index) override;
/* realCellWidth enables to handle list view for which
* TableViewDataSource->cellWidht = 0 */
KDRect cellFrame(int i, int j) const;
/* These two methods transform an index (of subview for instance) into
* coordinates that refer to the data source entire table */
int absoluteColumnNumberFromSubviewIndex(int index) const;

View File

@@ -20,7 +20,7 @@ TableViewDataSource * TableView::dataSource() {
// This method computes the minimal scrolling needed to properly display the
// requested cell.
void TableView::scrollToCell(int i, int j) {
m_contentView.scrollToCell(i, j);
scrollToContentRect(m_contentView.cellFrame(i, j), true);
}
HighlightCell * TableView::cellAtLocation(int i, int j) {
@@ -96,10 +96,6 @@ KDCoordinate TableView::ContentView::width() const {
return result ? result : m_tableView->maxContentWidthDisplayableWithoutScrolling();
}
void TableView::ContentView::scrollToCell(int x, int y) const {
m_tableView->scrollToContentRect(cellFrame(x, y), true);
}
void TableView::ContentView::reloadCellAtLocation(int i, int j) {
HighlightCell * cell = cellAtLocation(i, j);
if (cell) {