Added button to navigate to last page
parent
53ecf7042f
commit
ab36cf429f
|
@ -66,6 +66,7 @@ ListView::ListView(const irect *contentRect, const vector<Item> &items) : _conte
|
||||||
_firstPageButton = iRect(_contentRect->x, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
_firstPageButton = iRect(_contentRect->x, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
||||||
_prevPageButton = iRect(_contentRect->x + 150, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
_prevPageButton = iRect(_contentRect->x + 150, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
||||||
_nextPageButton = iRect(_contentRect->x + 300, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
_nextPageButton = iRect(_contentRect->x + 300, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
||||||
|
_lastPageButton = iRect(_contentRect->x + 450, _contentRect->h + _contentRect->y - _footerHeight, 130, _footerHeight, ALIGN_CENTER);
|
||||||
|
|
||||||
drawEntries();
|
drawEntries();
|
||||||
drawFooter();
|
drawFooter();
|
||||||
|
@ -102,10 +103,12 @@ void ListView::drawFooter()
|
||||||
DrawTextRect2(&_prevPageButton, "Prev");
|
DrawTextRect2(&_prevPageButton, "Prev");
|
||||||
FillAreaRect(&_nextPageButton, BLACK);
|
FillAreaRect(&_nextPageButton, BLACK);
|
||||||
DrawTextRect2(&_nextPageButton, "Next");
|
DrawTextRect2(&_nextPageButton, "Next");
|
||||||
|
FillAreaRect(&_lastPageButton, BLACK);
|
||||||
|
DrawTextRect2(&_lastPageButton, "Last");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListView::drawEntry(int itemID)
|
void ListView::drawEntry(int itemID)
|
||||||
{
|
{
|
||||||
FillAreaRect(_entries[itemID].getPosition(), WHITE);
|
FillAreaRect(_entries[itemID].getPosition(), WHITE);
|
||||||
_entries[itemID].draw(_items->at(itemID), _entryFont, _entryFontBold, _entryFontHeight);
|
_entries[itemID].draw(_items->at(itemID), _entryFont, _entryFontBold, _entryFontHeight);
|
||||||
}
|
}
|
||||||
|
@ -152,6 +155,10 @@ int ListView::listClicked(int x, int y)
|
||||||
{
|
{
|
||||||
actualizePage(_shownPage - 1);
|
actualizePage(_shownPage - 1);
|
||||||
}
|
}
|
||||||
|
else if (IsInRect(x, y, &_lastPageButton))
|
||||||
|
{
|
||||||
|
actualizePage(_page);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < _entries.size(); i++)
|
for (unsigned int i = 0; i < _entries.size(); i++)
|
||||||
|
|
|
@ -87,6 +87,7 @@ private:
|
||||||
irect _nextPageButton;
|
irect _nextPageButton;
|
||||||
irect _prevPageButton;
|
irect _prevPageButton;
|
||||||
irect _firstPageButton;
|
irect _firstPageButton;
|
||||||
|
irect _lastPageButton;
|
||||||
int _itemCount = 7;
|
int _itemCount = 7;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
Loading…
Reference in New Issue