From dad80001afea3903235528fb922c9d3b8073040f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 29 Sep 2016 17:37:23 +0200 Subject: [PATCH] [escher] break table view and table view data source in two files Change-Id: I98407e8900727d1ce8fea78c721f56192a24e1f8 --- escher/Makefile | 1 + escher/include/escher.h | 1 + escher/include/escher/table_view.h | 23 +-------------- .../include/escher/table_view_data_source.h | 28 +++++++++++++++++++ escher/src/table_view.cpp | 3 -- escher/src/table_view_data_source.cpp | 4 +++ 6 files changed, 35 insertions(+), 25 deletions(-) create mode 100644 escher/include/escher/table_view_data_source.h create mode 100644 escher/src/table_view_data_source.cpp diff --git a/escher/Makefile b/escher/Makefile index 82220c591..e95ee39a9 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -23,6 +23,7 @@ objs += $(addprefix escher/src/,\ tab_view_controller.o\ table_view.o\ table_view_cell.o\ + table_view_data_source.o\ text_field.o\ text_view.o\ tiled_view.o\ diff --git a/escher/include/escher.h b/escher/include/escher.h index d60d09190..38db06028 100644 --- a/escher/include/escher.h +++ b/escher/include/escher.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include diff --git a/escher/include/escher/table_view.h b/escher/include/escher/table_view.h index 24ed7ab3c..f50649101 100644 --- a/escher/include/escher/table_view.h +++ b/escher/include/escher/table_view.h @@ -2,28 +2,7 @@ #define ESCHER_TABLE_VIEW_H #include - -class TableViewDataSource { -public: - virtual int numberOfRows() = 0; - virtual int numberOfColumns() = 0; - virtual void willDisplayCellAtLocation(View * cell, int i, int j); - virtual KDCoordinate columnWidth(int i) = 0; - virtual KDCoordinate rowHeight(int j) = 0; - /* return the number of pixels to include in offset to display the column i at - the top */ - virtual KDCoordinate cumulatedWidthFromIndex(int i) = 0; - virtual KDCoordinate cumulatedHeightFromIndex(int j) = 0; - /* return the number of columns (starting with first ones) that can be fully - * displayed in offsetX pixels. - * Caution: if the offset is exactly the size of n columns, the function - * returns n-1. */ - virtual int indexFromCumulatedWidth(KDCoordinate offsetX) = 0; - virtual int indexFromCumulatedHeight(KDCoordinate offsetY) = 0; - virtual View * reusableCell(int index, int type) = 0; - virtual int reusableCellCount(int type) = 0; - virtual int typeAtLocation(int i, int j) = 0; -}; +#include class TableView : public ScrollView { public: diff --git a/escher/include/escher/table_view_data_source.h b/escher/include/escher/table_view_data_source.h new file mode 100644 index 000000000..62dcffc2a --- /dev/null +++ b/escher/include/escher/table_view_data_source.h @@ -0,0 +1,28 @@ +#ifndef ESCHER_TABLE_VIEW_DATA_SOURCE_H +#define ESCHER_TABLE_VIEW_DATA_SOURCE_H + +#include + +class TableViewDataSource { +public: + virtual int numberOfRows() = 0; + virtual int numberOfColumns() = 0; + virtual void willDisplayCellAtLocation(View * cell, int i, int j); + virtual KDCoordinate columnWidth(int i) = 0; + virtual KDCoordinate rowHeight(int j) = 0; + /* return the number of pixels to include in offset to display the column i at + the top */ + virtual KDCoordinate cumulatedWidthFromIndex(int i) = 0; + virtual KDCoordinate cumulatedHeightFromIndex(int j) = 0; + /* return the number of columns (starting with first ones) that can be fully + * displayed in offsetX pixels. + * Caution: if the offset is exactly the size of n columns, the function + * returns n-1. */ + virtual int indexFromCumulatedWidth(KDCoordinate offsetX) = 0; + virtual int indexFromCumulatedHeight(KDCoordinate offsetY) = 0; + virtual View * reusableCell(int index, int type) = 0; + virtual int reusableCellCount(int type) = 0; + virtual int typeAtLocation(int i, int j) = 0; +}; + +#endif \ No newline at end of file diff --git a/escher/src/table_view.cpp b/escher/src/table_view.cpp index 567310328..65b01c2a7 100644 --- a/escher/src/table_view.cpp +++ b/escher/src/table_view.cpp @@ -7,9 +7,6 @@ extern "C" { #define MIN(x,y) ((x)<(y) ? (x) : (y)) -void TableViewDataSource::willDisplayCellAtLocation(View * cell, int i, int j) { -} - TableView::TableView(TableViewDataSource * dataSource, KDCoordinate topMargin, KDCoordinate rightMargin, KDCoordinate bottomMargin, KDCoordinate leftMargin) : ScrollView(&m_contentView, topMargin, rightMargin, bottomMargin, leftMargin), diff --git a/escher/src/table_view_data_source.cpp b/escher/src/table_view_data_source.cpp new file mode 100644 index 000000000..eb728bff9 --- /dev/null +++ b/escher/src/table_view_data_source.cpp @@ -0,0 +1,4 @@ +#include + +void TableViewDataSource::willDisplayCellAtLocation(View * cell, int i, int j) { +}