listbox: use CComponentsScrollbar

Origin commit data
------------------
Branch: ni/coolstream
Commit: 9dbbcb5878
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-06-15 (Thu, 15 Jun 2017)

Origin message was:
------------------
- listbox: use CComponentsScrollbar

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-06-15 16:47:19 +02:00
parent b8753315e7
commit 8b0145114f

View File

@@ -67,18 +67,10 @@ void CListBox::paint()
paintItem(count); paintItem(count);
} }
int ypos = y+ theight; int total_pages;
int sb = fheight* listmaxshow; int current_page;
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); getScrollBarData(&total_pages, &current_page, getItemCount(), listmaxshow, selected);
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, fheight*listmaxshow, total_pages, current_page);
int sbc= ((getItemCount()- 1)/ listmaxshow)+ 1;
if (sbc < 1)
sbc = 1;
int sbh= (sb- 4)/ sbc;
int sbs= (selected/listmaxshow);
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs* sbh , 11, sbh, COL_SCROLLBAR_ACTIVE_PLUS_0);
} }
void CListBox::paintHead() void CListBox::paintHead()
@@ -111,8 +103,9 @@ void CListBox::hide()
frameBuffer->paintBackgroundBoxRel(x,y, width,height+ButtonHeight); frameBuffer->paintBackgroundBoxRel(x,y, width,height+ButtonHeight);
} }
unsigned int CListBox::getItemCount() unsigned int CListBox::getItemCount()
{ {
// WTF? Why a fixed value?
return 10; return 10;
} }
@@ -130,8 +123,8 @@ void CListBox::paintItem(unsigned int /*itemNr*/, int paintNr, bool pselected)
getItemColors(color, bgcolor, pselected); getItemColors(color, bgcolor, pselected);
frameBuffer->paintBoxRel(x,ypos, width- 15, getItemHeight(), bgcolor); frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, getItemHeight(), bgcolor);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 10, ypos+ fheight, width-20, "demo", color); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID, ypos + fheight, width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID, "demo", color);
} }
void CListBox::updateSelection(unsigned int newpos) void CListBox::updateSelection(unsigned int newpos)