- bouqueteditor: use CComponentsScrollbar

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2017-06-15 17:21:10 +02:00
committed by Thilo Graf
parent 36ebcb586a
commit c80cc24335
3 changed files with 19 additions and 36 deletions

View File

@@ -66,7 +66,7 @@ CBEBouquetWidget::CBEBouquetWidget()
void CBEBouquetWidget::paintItem(int pos) void CBEBouquetWidget::paintItem(int pos)
{ {
int ypos = y+ theight+0 + pos*iheight; int ypos = y + theight + pos*iheight;
unsigned int current = liststart + pos; unsigned int current = liststart + pos;
bool i_selected = current == selected; bool i_selected = current == selected;
@@ -92,8 +92,8 @@ void CBEBouquetWidget::paintItem(int pos)
} }
if (i_radius) if (i_radius)
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius);
if (current < Bouquets->size()) { if (current < Bouquets->size()) {
if ((i_selected) && (state == beMoving)) if ((i_selected) && (state == beMoving))
@@ -125,17 +125,10 @@ void CBEBouquetWidget::paint()
paintItem(count); paintItem(count);
} }
int ypos = y+ theight; int total_pages;
int sb = iheight* listmaxshow; int current_page;
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); getScrollBarData(&total_pages, &current_page, Bouquets->size(), listmaxshow, selected);
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page);
int sbc= ((Bouquets->size()- 1)/ listmaxshow)+ 1;
int sbs= (selected/listmaxshow);
if (sbc < 1)
sbc = 1;
//scrollbar
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0);
} }
void CBEBouquetWidget::paintHead() void CBEBouquetWidget::paintHead()

View File

@@ -121,8 +121,8 @@ void CBEChannelWidget::paintItem(int pos)
} }
if (i_radius) if (i_radius)
frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, bgcolor, i_radius); frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius);
if ((current == selected) && (state == beMoving)) { if ((current == selected) && (state == beMoving)) {
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight);
@@ -131,13 +131,12 @@ void CBEChannelWidget::paintItem(int pos)
if ((*Channels)[current]->bLocked) { if ((*Channels)[current]->bLocked) {
frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + iconoffset, ypos, iheight);
} }
//g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, (*Channels)[current]->getName(), color);
//FIXME numwidth ? we not show chan numbers //FIXME numwidth ? we not show chan numbers
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, (*Channels)[current]->getName(), color); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, (*Channels)[current]->getName(), color);
if((*Channels)[current]->scrambled) if((*Channels)[current]->scrambled)
frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight);
else if (!(*Channels)[current]->getUrl().empty()) else if (!(*Channels)[current]->getUrl().empty())
frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight);
} }
} }
@@ -159,19 +158,10 @@ void CBEChannelWidget::paint()
paintItem(count); paintItem(count);
} }
int ypos = y+ theight; int total_pages;
int sb = iheight* listmaxshow; int current_page;
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); getScrollBarData(&total_pages, &current_page, Channels->size(), listmaxshow, selected);
paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page);
int sbc= ((Channels->size()- 1)/ listmaxshow)+ 1;
if (sbc < 1)
sbc = 1;
int sbh= (sb- 4)/ sbc;
int sbs= (selected/listmaxshow);
if (sbh)
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_SCROLLBAR_ACTIVE_PLUS_0);
} }
void CBEChannelWidget::paintHead() void CBEChannelWidget::paintHead()

View File

@@ -129,8 +129,8 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
} }
if (i_radius) if (i_radius)
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0);
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius);
if(itemNr < getItemCount()) if(itemNr < getItemCount())
{ {
@@ -141,9 +141,9 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, Channels[itemNr]->getName(), color); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, Channels[itemNr]->getName(), color);
if(Channels[itemNr]->scrambled) if(Channels[itemNr]->scrambled)
frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight);
else if (!Channels[itemNr]->getUrl().empty()) else if (!Channels[itemNr]->getUrl().empty())
frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight);
} }
} }