mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
CComponentsHeader: Use color gradient for paint header
Conflicts: src/gui/widget/menue.cpp
This commit is contained in:
@@ -116,6 +116,9 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
|||||||
cch_text_x = cch_offset;
|
cch_text_x = cch_offset;
|
||||||
cch_buttons_space = cch_offset;
|
cch_buttons_space = cch_offset;
|
||||||
|
|
||||||
|
gradientBuf = NULL;
|
||||||
|
paintGradient = false;
|
||||||
|
|
||||||
addContextButton(buttons);
|
addContextButton(buttons);
|
||||||
initCCItems();
|
initCCItems();
|
||||||
initParent(parent);
|
initParent(parent);
|
||||||
@@ -125,6 +128,8 @@ CComponentsHeader::~CComponentsHeader()
|
|||||||
{
|
{
|
||||||
dprintf(DEBUG_DEBUG, "[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__);
|
dprintf(DEBUG_DEBUG, "[~CComponentsHeader] [%s - %d] delete...\n", __func__, __LINE__);
|
||||||
v_cch_btn.clear();
|
v_cch_btn.clear();
|
||||||
|
if (gradientBuf)
|
||||||
|
free(gradientBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsHeader::setCaption(const std::string& caption, const int& align_mode)
|
void CComponentsHeader::setCaption(const std::string& caption, const int& align_mode)
|
||||||
@@ -369,7 +374,7 @@ void CComponentsHeader::initCaption()
|
|||||||
if (cch_caption_align == CTextBox::CENTER)
|
if (cch_caption_align == CTextBox::CENTER)
|
||||||
cch_text_x = CC_CENTERED;
|
cch_text_x = CC_CENTERED;
|
||||||
cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height);
|
cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, cc_text_w, height);
|
||||||
cch_text_obj->doPaintBg(true);
|
cch_text_obj->doPaintBg(false);
|
||||||
cch_text_obj->setText(cch_text, cch_caption_align, cch_font);
|
cch_text_obj->setText(cch_text, cch_caption_align, cch_font);
|
||||||
cch_text_obj->forceTextPaint(); //here required
|
cch_text_obj->forceTextPaint(); //here required
|
||||||
cch_text_obj->setTextColor(cch_col_text);
|
cch_text_obj->setTextColor(cch_col_text);
|
||||||
@@ -386,6 +391,17 @@ void CComponentsHeader::initCaption()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CComponentsHeader::initGradient()
|
||||||
|
{
|
||||||
|
if (gradientBuf == NULL) {
|
||||||
|
CColorGradient ccGradient;
|
||||||
|
gradientBuf = ccGradient.gradientOneColor(col_body, NULL, height, CColorGradient::gradientLight2Dark, CColorGradient::light);
|
||||||
|
}
|
||||||
|
cc_gradientData.gradientBuf = gradientBuf;
|
||||||
|
cc_gradientData.direction = CFrameBuffer::gradientVertical;
|
||||||
|
cc_gradientData.mode = CFrameBuffer::pbrg_noOption;
|
||||||
|
}
|
||||||
|
|
||||||
void CComponentsHeader::initCCItems()
|
void CComponentsHeader::initCCItems()
|
||||||
{
|
{
|
||||||
//set size
|
//set size
|
||||||
@@ -399,6 +415,10 @@ void CComponentsHeader::initCCItems()
|
|||||||
|
|
||||||
//init text
|
//init text
|
||||||
initCaption();
|
initCaption();
|
||||||
|
|
||||||
|
//init color gradient
|
||||||
|
if (paintGradient)
|
||||||
|
initGradient();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsHeader::paint(bool do_save_bg)
|
void CComponentsHeader::paint(bool do_save_bg)
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "cc_item_picture.h"
|
#include "cc_item_picture.h"
|
||||||
#include "cc_item_text.h"
|
#include "cc_item_text.h"
|
||||||
#include "cc_frm_icons.h"
|
#include "cc_frm_icons.h"
|
||||||
|
#include <driver/colorgradient.h>
|
||||||
|
|
||||||
//! Sub class of CComponentsForm. Shows a header with prepared items.
|
//! Sub class of CComponentsForm. Shows a header with prepared items.
|
||||||
/*!
|
/*!
|
||||||
@@ -48,6 +49,9 @@ class CComponentsHeader : public CComponentsForm
|
|||||||
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
||||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
|
|
||||||
|
fb_pixel_t *gradientBuf;
|
||||||
|
bool paintGradient;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///object: icon object, see also setIcon()
|
///object: icon object, see also setIcon()
|
||||||
CComponentsPicture * cch_icon_obj;
|
CComponentsPicture * cch_icon_obj;
|
||||||
@@ -92,6 +96,8 @@ class CComponentsHeader : public CComponentsForm
|
|||||||
void initCaption();
|
void initCaption();
|
||||||
///sub: init context button object
|
///sub: init context button object
|
||||||
void initButtons();
|
void initButtons();
|
||||||
|
///sub: init color gradient
|
||||||
|
void initGradient();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
@@ -197,6 +203,9 @@ class CComponentsHeader : public CComponentsForm
|
|||||||
|
|
||||||
///paint header
|
///paint header
|
||||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
|
|
||||||
|
//set color gradient an/off
|
||||||
|
virtual void setPaintGradient(bool g) { paintGradient = g; };
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Sub class of CComponentsHeader.
|
//! Sub class of CComponentsHeader.
|
||||||
|
@@ -1099,6 +1099,7 @@ void CMenuWidget::paint()
|
|||||||
|
|
||||||
// paint head
|
// paint head
|
||||||
CComponentsHeader header(x, y, width + sb_width, hheight, getName(), iconfile);
|
CComponentsHeader header(x, y, width + sb_width, hheight, getName(), iconfile);
|
||||||
|
header.setPaintGradient(true);
|
||||||
header.setShadowOnOff(CC_SHADOW_ON);
|
header.setShadowOnOff(CC_SHADOW_ON);
|
||||||
header.setOffset(10);
|
header.setOffset(10);
|
||||||
header.paint(CC_SAVE_SCREEN_NO);
|
header.paint(CC_SAVE_SCREEN_NO);
|
||||||
|
Reference in New Issue
Block a user