* Use CComponentsInfoBox for menu hint

This commit is contained in:
micha-bbg
2012-07-17 16:51:00 +02:00
parent 5c862f76a9
commit fd1ec29d83
2 changed files with 17 additions and 10 deletions

View File

@@ -324,6 +324,7 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
iconfile = Icon; iconfile = Icon;
details_line = NULL; details_line = NULL;
info_box = NULL;
//handle select values //handle select values
if(w_index > MN_WIDGET_ID_MAX){ if(w_index > MN_WIDGET_ID_MAX){
@@ -393,6 +394,7 @@ CMenuWidget::~CMenuWidget()
#endif #endif
resetWidget(true); resetWidget(true);
delete details_line; delete details_line;
delete info_box;
} }
void CMenuWidget::addItem(CMenuItem* menuItem, const bool defaultselected) void CMenuWidget::addItem(CMenuItem* menuItem, const bool defaultselected)
@@ -1071,7 +1073,6 @@ void CMenuWidget::paintHint(int pos)
if (pos < 0 && !hint_painted) if (pos < 0 && !hint_painted)
return; return;
fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6;
int rad = RADIUS_LARGE; int rad = RADIUS_LARGE;
int xpos = x - ConnectLineBox_Width; int xpos = x - ConnectLineBox_Width;
@@ -1083,8 +1084,8 @@ void CMenuWidget::paintHint(int pos)
if (details_line != NULL) if (details_line != NULL)
details_line->hide(); details_line->hide();
/* clear info box */ /* clear info box */
frameBuffer->paintBackgroundBoxRel(x, ypos2, iwidth+SHADOW_OFFSET, hint_height+SHADOW_OFFSET); if (info_box != NULL)
info_box->hide((pos == -1) ? true : false);
hint_painted = false; hint_painted = false;
} }
if (pos < 0) if (pos < 0)
@@ -1093,8 +1094,11 @@ void CMenuWidget::paintHint(int pos)
CMenuItem* item = items[pos]; CMenuItem* item = items[pos];
printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText(item->hint)); printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText(item->hint));
if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) {
if (info_box != NULL)
info_box->hide(true);
return; return;
}
hint_painted = true; hint_painted = true;
@@ -1113,12 +1117,13 @@ printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText
details_line->setYPos(ypos1a); details_line->setYPos(ypos1a);
details_line->paint(); details_line->paint();
/* box shadow */ if (info_box == NULL)
frameBuffer->paintBoxRel(x+SHADOW_OFFSET, ypos2+SHADOW_OFFSET, width + sb_width, hint_height, COL_MENUCONTENTDARK_PLUS_0, rad); info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, rad);
/* box frame and fill */ else {
frameBuffer->paintBoxFrame(x, ypos2, iwidth, hint_height, 2, col1, rad); info_box->setXPos(x);
/* box frame and fill */ info_box->setYPos(ypos2);
frameBuffer->paintBoxRel(x+2, ypos2+2, iwidth-4, hint_height-4, COL_MENUCONTENTDARK_PLUS_0, rad); }
info_box->paint(rad);
int offset = 10; int offset = 10;
if (!item->hintIcon.empty()) { if (!item->hintIcon.empty()) {

View File

@@ -424,6 +424,8 @@ class CMenuWidget : public CMenuTarget
mn_widget_id_t widget_index; mn_widget_id_t widget_index;
CMenuGlobal *mglobal; CMenuGlobal *mglobal;
CComponentsDetailLine *details_line; CComponentsDetailLine *details_line;
CComponentsInfoBox *info_box;
protected: protected:
std::string nameString; std::string nameString;
neutrino_locale_t name; neutrino_locale_t name;