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; liststart = 0;
bouquetChannels = NULL; bouquetChannels = NULL;
dline = NULL; dline = NULL;
ibox = NULL; ibox = new CComponentsInfoBox();
} }
CBEChannelSelectWidget::~CBEChannelSelectWidget() CBEChannelSelectWidget::~CBEChannelSelectWidget()
@@ -114,7 +114,7 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
if(itemNr < getItemCount()) { if(itemNr < getItemCount()) {
paintItem2DetailsLine (paintNr, itemNr); initItem2DetailsLine (paintNr, itemNr);
paintDetails(itemNr); paintDetails(itemNr);
} }
@@ -204,8 +204,10 @@ void CBEChannelSelectWidget::paintFoot()
#endif #endif
} }
void CBEChannelSelectWidget::paintDetails(int index) std::string CBEChannelSelectWidget::getInfoText(int index)
{ {
std::string res = "";
std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition());
transponder t; transponder t;
CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t); CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t);
@@ -215,11 +217,24 @@ void CBEChannelSelectWidget::paintDetails(int index)
else else
desc = desc + " (" + satname + ")"; 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); res = satname + "\n" + desc;
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);
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 #define ConnectLineBox_Width 16
@@ -229,26 +244,23 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/)
int ypos1a = ypos1 + (fheight/2)-2; int ypos1a = ypos1 + (fheight/2)-2;
int ypos2a = ypos2 + (info_height/2)-2; int ypos2a = ypos2 + (info_height/2)-2;
// clear details line
if (dline) if (dline)
dline->hide(); dline->kill(); //kill details line
// clear infobox // init Line if detail info (and not valid list pos)
if (ibox)
ibox->hide();
// paint Line if detail info (and not valid list pos)
if (pos >= 0) if (pos >= 0)
{ {
if (dline == NULL) if (dline == NULL)
dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2);
dline->setYPos(ypos1a); dline->setYPos(ypos1a);
dline->paint(true);
//infobox //infobox
if (ibox == NULL) if (ibox){
ibox = new CComponentsInfoBox(x, ypos2, width, info_height); ibox->setDimensionsAll(x, ypos2, width, info_height);
ibox->paint(false,true); ibox->setFrameThickness(2);
ibox->setCornerRadius(RADIUS_LARGE);
ibox->setShadowOnOff(CC_SHADOW_OFF);
}
} }
} }

View File

@@ -54,13 +54,14 @@ class CBEChannelSelectWidget : public CListBox
uint getItemCount(); uint getItemCount();
void paintItem(uint32_t itemNr, int paintNr, bool selected); void paintItem(uint32_t itemNr, int paintNr, bool selected);
void paintDetails(int index); void paintDetails(int index);
void paintItem2DetailsLine (int pos, int ch_index); void initItem2DetailsLine (int pos, int ch_index);
void paintFoot(); void paintFoot();
void onOkKeyPressed(); void onOkKeyPressed();
int footerHeight; int footerHeight;
int info_height; int info_height;
std::string getInfoText(int index);
public: public:
ZapitChannelList Channels; ZapitChannelList Channels;
ZapitChannelList * bouquetChannels; ZapitChannelList * bouquetChannels;