mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
ListBookController - partie 2
This commit is contained in:
@@ -12,11 +12,13 @@ ListBookController::ListBookController(Responder * parentResponder):
|
||||
ViewController(parentResponder),
|
||||
m_tableView(this, this)
|
||||
{
|
||||
m_files[0].name= "Harry Potter 1.txt";
|
||||
m_nbFiles = 1;
|
||||
}
|
||||
|
||||
int ListBookController::numberOfRows() const
|
||||
{
|
||||
return 0;
|
||||
return m_nbFiles;
|
||||
}
|
||||
|
||||
KDCoordinate ListBookController::cellHeight()
|
||||
@@ -26,12 +28,20 @@ KDCoordinate ListBookController::cellHeight()
|
||||
|
||||
HighlightCell * ListBookController::reusableCell(int index)
|
||||
{
|
||||
return nullptr;
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
int ListBookController::reusableCellCount() const
|
||||
{
|
||||
return 0;
|
||||
return NB_CELLS;
|
||||
}
|
||||
|
||||
void ListBookController::willDisplayCellForIndex(HighlightCell * cell, int index)
|
||||
{
|
||||
MessageTableCell* myTextCell = static_cast<MessageTableCell*>(cell);
|
||||
MessageTextView* textView = static_cast<MessageTextView*>(myTextCell->labelView());
|
||||
textView->setText(m_files[index].name);
|
||||
myTextCell->setMessageFont(KDFont::LargeFont);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
#define __LIST_BOOK_CONTROLLER_H__
|
||||
|
||||
#include <escher.h>
|
||||
#include <apps/external/archive.h>
|
||||
|
||||
namespace reader
|
||||
{
|
||||
@@ -16,8 +17,16 @@ public:
|
||||
KDCoordinate cellHeight() override;
|
||||
HighlightCell * reusableCell(int index) override;
|
||||
int reusableCellCount() const override;
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
private:
|
||||
TableView m_tableView;
|
||||
|
||||
static const int NB_FILES = 20;
|
||||
External::Archive::File m_files[NB_FILES];
|
||||
int m_nbFiles = 0;
|
||||
|
||||
static const int NB_CELLS = 6;
|
||||
MessageTableCell m_cells[NB_CELLS];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user