mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
paintButtons: add max txt length option
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1960 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Commit: 2b72b7c57e
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2011-12-08 (Thu, 08 Dec 2011)
This commit is contained in:
@@ -160,6 +160,9 @@ void CBEBouquetWidget::paintFoot()
|
||||
Button[2] = CBEBouquetWidgetButtons[2];
|
||||
Button[3].button = NEUTRINO_ICON_BUTTON_BLUE;
|
||||
|
||||
const neutrino_locale_t button_ids[] = {LOCALE_BOUQUETEDITOR_RENAME,LOCALE_BOUQUETEDITOR_HIDE,LOCALE_BOUQUETEDITOR_LOCK};
|
||||
const std::vector<neutrino_locale_t> buttonID_rest (button_ids, button_ids + sizeof(button_ids) / sizeof(neutrino_locale_t) );
|
||||
|
||||
fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
|
||||
|
||||
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);
|
||||
@@ -182,7 +185,7 @@ void CBEBouquetWidget::paintFoot()
|
||||
Button[3].locale = LOCALE_BOUQUETEDITOR_LOCK;
|
||||
break;
|
||||
}
|
||||
::paintButtons(x, y+height, width, 4, Button, ButtonHeight);
|
||||
::paintButtons(x, y+height, width, 4, Button, ButtonHeight,0,false,COL_INFOBAR_SHADOW,NULL,0,true, buttonID_rest);
|
||||
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, x + width - 10 - icol_w, y + height, ButtonHeight);
|
||||
}
|
||||
|
||||
|
@@ -70,7 +70,8 @@ int paintButtons( const int &x,
|
||||
const unsigned char fcolor,
|
||||
const char * alt_buttontext,
|
||||
const uint &buttontext_id,
|
||||
bool show)
|
||||
bool show,
|
||||
const std::vector<neutrino_locale_t>& all_buttontext_id)
|
||||
{
|
||||
CFrameBuffer *frameBuffer = CFrameBuffer::getInstance();
|
||||
Font * font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL];
|
||||
@@ -114,7 +115,18 @@ int paintButtons( const int &x,
|
||||
int fwidth = font->getRenderWidth(buttontext, true);
|
||||
w_max_text = std::max(w_max_text, fwidth);
|
||||
}
|
||||
|
||||
if(!all_buttontext_id.empty())
|
||||
{
|
||||
for(vector<neutrino_locale_t>::const_iterator it = all_buttontext_id.begin(); it != all_buttontext_id.end(); ++it)
|
||||
{
|
||||
//text
|
||||
const char * buttontext = *it ? g_Locale->getText( *it ) : "";
|
||||
|
||||
//text width
|
||||
int fwidth = font->getRenderWidth(buttontext, true);
|
||||
w_max_text = std::max(w_max_text, fwidth);
|
||||
}
|
||||
}
|
||||
//calculate button width
|
||||
w_button = buttonwidth == 0 ? (w_max_icon + w_space + w_max_text) : buttonwidth;
|
||||
|
||||
|
@@ -27,6 +27,8 @@
|
||||
#include <system/localize.h>
|
||||
#include <gui/color.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
typedef struct button_label
|
||||
{
|
||||
const char * button;
|
||||
@@ -44,6 +46,7 @@ int paintButtons( const int &x,
|
||||
const unsigned char fcolor = COL_INFOBAR_SHADOW,
|
||||
const char * alt_buttontext = NULL,
|
||||
const uint &buttontext_id = 0,
|
||||
bool show = true);
|
||||
bool show = true,
|
||||
const std::vector<neutrino_locale_t>& all_buttontext_id = std::vector<neutrino_locale_t>());
|
||||
|
||||
#endif /* __gui_widget_buttons_h__ */
|
||||
|
Reference in New Issue
Block a user