mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
bedit: use inherited version of paintDetails() and dline/ibox objects
This moves full identicaly code into base class. TODO: There are more similar parts.
This commit is contained in:
@@ -85,6 +85,7 @@ class CBEBouquetWidget : public CBEGlobals, public CMenuTarget, public CListHelp
|
||||
void discardChanges();
|
||||
|
||||
std::string inputName(const char* const defaultName, const neutrino_locale_t caption);
|
||||
std::string getInfoText(int /*index*/){};
|
||||
|
||||
public:
|
||||
CBEBouquetWidget();
|
||||
|
@@ -55,8 +55,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou
|
||||
caption = Caption;
|
||||
bouquet = Bouquet;
|
||||
mode = CZapitClient::MODE_TV;
|
||||
dline = NULL;
|
||||
ibox = NULL;
|
||||
|
||||
Channels = NULL;
|
||||
|
||||
int iw, ih;
|
||||
@@ -76,8 +75,6 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou
|
||||
|
||||
CBEChannelWidget::~CBEChannelWidget()
|
||||
{
|
||||
delete dline;
|
||||
delete ibox;
|
||||
}
|
||||
|
||||
void CBEChannelWidget::paintItem(int pos)
|
||||
@@ -178,54 +175,6 @@ void CBEChannelWidget::paintFoot()
|
||||
footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelWidgetButtons);
|
||||
}
|
||||
|
||||
void CBEChannelWidget::paintDetails(int pos, int current)
|
||||
{
|
||||
int xpos = x - DETAILSLINE_WIDTH;
|
||||
int ypos1 = y + header_height + pos*item_height;
|
||||
int ypos2 = y + height - info_height - OFFSET_SHADOW;
|
||||
int ypos1a = ypos1 + (item_height/2);
|
||||
int ypos2a = ypos2 + (info_height/2);
|
||||
|
||||
if (dline)
|
||||
dline->kill();
|
||||
|
||||
if (pos >= 0)
|
||||
{
|
||||
if (dline == NULL)
|
||||
dline = new CComponentsDetailsLine();
|
||||
|
||||
if (dline)
|
||||
{
|
||||
dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2);
|
||||
dline->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
if (ibox == NULL)
|
||||
{
|
||||
ibox = new CComponentsInfoBox();
|
||||
|
||||
if (ibox)
|
||||
{
|
||||
ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0);
|
||||
ibox->setTextColor(COL_MENUCONTENTDARK_TEXT);
|
||||
ibox->setFrameThickness(FRAME_WIDTH_MIN);
|
||||
ibox->setCorner(RADIUS_LARGE);
|
||||
ibox->enableShadow(CC_SHADOW_ON);
|
||||
}
|
||||
}
|
||||
|
||||
if (ibox)
|
||||
{
|
||||
if (ibox->isPainted())
|
||||
ibox->hide();
|
||||
|
||||
ibox->setDimensionsAll(x, ypos2, width, info_height);
|
||||
ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font);
|
||||
ibox->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CBEChannelWidget::hide()
|
||||
{
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
|
||||
|
@@ -38,9 +38,6 @@
|
||||
class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelpers
|
||||
{
|
||||
private:
|
||||
CComponentsDetailsLine *dline;
|
||||
CComponentsInfoBox *ibox;
|
||||
|
||||
enum state_
|
||||
{
|
||||
beDefault,
|
||||
@@ -64,7 +61,7 @@ class CBEChannelWidget : public CBEGlobals, public CMenuTarget, public CListHelp
|
||||
void paintItem(int pos);
|
||||
void paintItems();
|
||||
void paintFoot();
|
||||
void paintDetails(int pos, int current);
|
||||
|
||||
void hide();
|
||||
void updateSelection(unsigned int newpos);
|
||||
|
||||
|
@@ -48,8 +48,6 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZap
|
||||
liststart = 0;
|
||||
channellist_sort_mode = SORT_ALPHA;
|
||||
bouquetChannels = NULL;
|
||||
dline = NULL;
|
||||
ibox = NULL;
|
||||
|
||||
int iw, ih;
|
||||
action_icon_width = 0;
|
||||
@@ -64,8 +62,6 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZap
|
||||
|
||||
CBEChannelSelectWidget::~CBEChannelSelectWidget()
|
||||
{
|
||||
delete dline;
|
||||
delete ibox;
|
||||
}
|
||||
|
||||
void CBEChannelSelectWidget::paintItem(int pos)
|
||||
@@ -184,54 +180,6 @@ void CBEChannelSelectWidget::paintFoot()
|
||||
footer.paintButtons(x, y + header_height + body_height, width, footer_height, numbuttons, CBEChannelSelectButtons);
|
||||
}
|
||||
|
||||
void CBEChannelSelectWidget::paintDetails(int pos, int current)
|
||||
{
|
||||
int xpos = x - DETAILSLINE_WIDTH;
|
||||
int ypos1 = y + header_height + pos*item_height;
|
||||
int ypos2 = y + height - info_height - OFFSET_SHADOW;
|
||||
int ypos1a = ypos1 + (item_height/2);
|
||||
int ypos2a = ypos2 + (info_height/2);
|
||||
|
||||
if (dline)
|
||||
dline->kill();
|
||||
|
||||
if (pos >= 0)
|
||||
{
|
||||
if (dline == NULL)
|
||||
dline = new CComponentsDetailsLine();
|
||||
|
||||
if (dline)
|
||||
{
|
||||
dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2);
|
||||
dline->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
if (ibox == NULL)
|
||||
{
|
||||
ibox = new CComponentsInfoBox();
|
||||
|
||||
if (ibox)
|
||||
{
|
||||
ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0);
|
||||
ibox->setTextColor(COL_MENUCONTENTDARK_TEXT);
|
||||
ibox->setFrameThickness(FRAME_WIDTH_MIN);
|
||||
ibox->setCorner(RADIUS_LARGE);
|
||||
ibox->enableShadow(CC_SHADOW_ON);
|
||||
}
|
||||
}
|
||||
|
||||
if (ibox)
|
||||
{
|
||||
if (ibox->isPainted())
|
||||
ibox->hide();
|
||||
|
||||
ibox->setDimensionsAll(x, ypos2, width, info_height);
|
||||
ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font);
|
||||
ibox->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CBEChannelSelectWidget::hide()
|
||||
{
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, width + OFFSET_SHADOW, height + OFFSET_SHADOW);
|
||||
|
@@ -37,9 +37,6 @@
|
||||
class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CListHelpers
|
||||
{
|
||||
private:
|
||||
CComponentsDetailsLine *dline;
|
||||
CComponentsInfoBox *ibox;
|
||||
|
||||
enum {
|
||||
SORT_ALPHA,
|
||||
SORT_FREQ,
|
||||
@@ -64,7 +61,7 @@ class CBEChannelSelectWidget : public CBEGlobals, public CMenuTarget, public CLi
|
||||
void paintItem(int pos);
|
||||
void paintItems();
|
||||
void paintFoot();
|
||||
void paintDetails(int pos, int current);
|
||||
|
||||
void hide();
|
||||
void updateSelection(unsigned int newpos);
|
||||
|
||||
|
@@ -54,8 +54,59 @@ CBEGlobals::CBEGlobals()
|
||||
y = getScreenStartY(height);
|
||||
|
||||
timeout = g_settings.timing[SNeutrinoSettings::TIMING_MENU];
|
||||
|
||||
dline = NULL;
|
||||
ibox = NULL;
|
||||
}
|
||||
|
||||
CBEGlobals::~CBEGlobals()
|
||||
{
|
||||
delete dline;
|
||||
delete ibox;
|
||||
}
|
||||
|
||||
void CBEGlobals::paintDetails(int pos, int current)
|
||||
{
|
||||
int xpos = x - DETAILSLINE_WIDTH;
|
||||
int ypos1 = y + header_height + pos*item_height;
|
||||
int ypos2 = y + height - info_height - OFFSET_SHADOW;
|
||||
int ypos1a = ypos1 + (item_height/2);
|
||||
int ypos2a = ypos2 + (info_height/2);
|
||||
|
||||
if (pos >= 0)
|
||||
{
|
||||
if (dline == NULL)
|
||||
dline = new CComponentsDetailsLine();
|
||||
dline->setDimensionsAll(xpos, ypos1a, ypos2a, item_height/2, info_height - RADIUS_LARGE*2);
|
||||
|
||||
dline->paint();
|
||||
|
||||
if (ibox == NULL)
|
||||
ibox = new CComponentsInfoBox();
|
||||
ibox->setColorBody(COL_MENUCONTENTDARK_PLUS_0);
|
||||
ibox->setTextColor(COL_MENUCONTENTDARK_TEXT);
|
||||
ibox->setFrameThickness(FRAME_WIDTH_MIN);
|
||||
ibox->setCorner(RADIUS_LARGE);
|
||||
ibox->enableShadow();
|
||||
ibox->enableColBodyGradient(g_settings.theme.menu_Hint_gradient, COL_MENUFOOT_PLUS_0, g_settings.theme.menu_Hint_gradient_direction);// COL_MENUFOOT_PLUS_0 is default footer color
|
||||
ibox->setDimensionsAll(x, ypos2, width, info_height);
|
||||
ibox->setText(getInfoText(current), CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, info_font);
|
||||
|
||||
ibox->paint();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dline)
|
||||
{
|
||||
if (dline->isPainted())
|
||||
dline->hide();
|
||||
}
|
||||
if (ibox)
|
||||
{
|
||||
if (ibox->isPainted())
|
||||
ibox->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -28,9 +28,16 @@
|
||||
|
||||
class CBEGlobals
|
||||
{
|
||||
protected:
|
||||
CComponentsDetailsLine *dline;
|
||||
CComponentsInfoBox *ibox;
|
||||
|
||||
virtual std::string getInfoText(int index) = 0;
|
||||
void paintDetails(int pos, int current);
|
||||
|
||||
public:
|
||||
CBEGlobals();
|
||||
~CBEGlobals();
|
||||
virtual ~CBEGlobals();
|
||||
|
||||
CFrameBuffer *frameBuffer;
|
||||
|
||||
|
Reference in New Issue
Block a user