[escher] Add method to get data source in table view

Change-Id: I511bbbfa7727216bcd1d02b9df93491061f6a9a8
This commit is contained in:
Émilie Feral
2016-10-25 11:39:37 +02:00
parent dd2fb25737
commit 5d7e57b228
2 changed files with 10 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ protected:
#if ESCHER_VIEW_LOGGING
const char * className() const override;
#endif
TableViewDataSource * dataSource();
private:
class ContentView : public View {
public:
@@ -25,6 +26,7 @@ private:
void scrollToCell(int i, int j) const;
TableViewCell * cellAtLocation(int i, int j);
void resizeToFitContent();
TableViewDataSource * dataSource();
protected:
#if ESCHER_VIEW_LOGGING
const char * className() const override;

View File

@@ -14,6 +14,10 @@ TableView::TableView(TableViewDataSource * dataSource, KDCoordinate topMargin, K
{
}
TableViewDataSource * TableView::dataSource() {
return m_contentView.dataSource();
}
// This method computes the minimal scrolling needed to properly display the
// requested cell.
void TableView::scrollToCell(int i, int j) {
@@ -52,6 +56,10 @@ TableView::ContentView::ContentView(TableView * tableView, TableViewDataSource *
{
}
TableViewDataSource * TableView::ContentView::dataSource() {
return m_dataSource;
}
KDCoordinate TableView::ContentView::columnWidth(int i) const {
int columnWidth = m_dataSource->columnWidth(i);
columnWidth = columnWidth ? columnWidth : m_tableView->maxContentWidthDisplayableWithoutScrolling();