CBEChannelSelectWidget: use CComponentsInfoBox to paint infobox

This commit is contained in:
2012-08-25 20:42:18 +02:00
parent 61ed9d4862
commit 1a09bd719a
2 changed files with 33 additions and 20 deletions

View File

@@ -73,7 +73,7 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsi
liststart = 0;
bouquetChannels = NULL;
dline = NULL;
ibox = NULL;
ibox = new CComponentsInfoBox();
}
CBEChannelSelectWidget::~CBEChannelSelectWidget()
@@ -114,7 +114,7 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
if(itemNr < getItemCount()) {
paintItem2DetailsLine (paintNr, itemNr);
initItem2DetailsLine (paintNr, itemNr);
paintDetails(itemNr);
}
@@ -204,8 +204,10 @@ void CBEChannelSelectWidget::paintFoot()
#endif
}
void CBEChannelSelectWidget::paintDetails(int index)
std::string CBEChannelSelectWidget::getInfoText(int index)
{
std::string res = "";
std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition());
transponder t;
CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t);
@@ -214,12 +216,25 @@ void CBEChannelSelectWidget::paintDetails(int index)
desc = desc + " (" + std::string(Channels[index]->pname) + ")";
else
desc = desc + " (" + satname + ")";
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight+INFO_BOX_Y_OFFSET, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight+INFO_BOX_Y_OFFSET, width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true);
res = satname + "\n" + desc;
return res;
}
void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/)
void CBEChannelSelectWidget::paintDetails(int index)
{
//details line
dline->paint();
std::string str = getInfoText(index);
//info box
ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]);
ibox->paint(false);
}
void CBEChannelSelectWidget::initItem2DetailsLine (int pos, int /*ch_index*/)
{
#define ConnectLineBox_Width 16
@@ -229,26 +244,23 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/)
int ypos1a = ypos1 + (fheight/2)-2;
int ypos2a = ypos2 + (info_height/2)-2;
// clear details line
if (dline)
dline->hide();
dline->kill(); //kill details line
// clear infobox
if (ibox)
ibox->hide();
// paint Line if detail info (and not valid list pos)
// init Line if detail info (and not valid list pos)
if (pos >= 0)
{
if (dline == NULL)
dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2);
dline->setYPos(ypos1a);
dline->paint(true);
//infobox
if (ibox == NULL)
ibox = new CComponentsInfoBox(x, ypos2, width, info_height);
ibox->paint(false,true);
if (ibox){
ibox->setDimensionsAll(x, ypos2, width, info_height);
ibox->setFrameThickness(2);
ibox->setCornerRadius(RADIUS_LARGE);
ibox->setShadowOnOff(CC_SHADOW_OFF);
}
}
}