mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 00:11:14 +02:00
components: rework classes
- outsourced some classes cc_item.cpp/h, cc_draw.cpp/h - added extra methodes for simple use of some basic components extra.cpp/h - rework clock handling: use timer class, reworked members for enable/disable clock with external timer events, tryed to fix some display issues related with infoclock and time osd clock in moviebrowser, channellist, menuus - reworked hide/kill handling, removed parameter for hide(), try to use cached backgrounds for other constallations, paint cache, image cache (all beta) - reworked shadow/frame handling, add shadow modes for left/right arrangement, TODO: repaint for existant instances required - reworked color gradient assignment (beta) ... Note: I had a data crash in my local git tree and i tryed to restore my historie, but most was lost. Therefore here the commit is large
This commit is contained in:
@@ -29,13 +29,14 @@
|
||||
#include "cc_item_picture.h"
|
||||
#include "cc_item_text.h"
|
||||
#include "cc_frm_icons.h"
|
||||
#include "cc_frm_clock.h"
|
||||
#include <driver/colorgradient.h>
|
||||
|
||||
//! Sub class of CComponentsForm. Shows a header with prepared items.
|
||||
/*!
|
||||
CComponentsHeader provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows
|
||||
*/
|
||||
class CComponentsHeader : public CComponentsForm
|
||||
class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
||||
{
|
||||
private:
|
||||
///member: init genaral variables, parameters for mostly used properties
|
||||
@@ -44,7 +45,7 @@ class CComponentsHeader : public CComponentsForm
|
||||
const std::string& = "",
|
||||
const int& buttons = 0,
|
||||
CComponentsForm *parent = NULL,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
@@ -56,6 +57,8 @@ class CComponentsHeader : public CComponentsForm
|
||||
CComponentsText * cch_text_obj;
|
||||
///object: context button object, see also addContextButton(), removeContextButtons()
|
||||
CComponentsIconForm * cch_btn_obj;
|
||||
///object: clock object
|
||||
CComponentsFrmClock * cch_cl_obj;
|
||||
|
||||
///property: caption text, see also setCaption()
|
||||
std::string cch_text;
|
||||
@@ -72,6 +75,8 @@ class CComponentsHeader : public CComponentsForm
|
||||
int cch_icon_x;
|
||||
///property: internal width for icon object
|
||||
int cch_icon_w;
|
||||
///property: internal width for clock object
|
||||
int cch_clock_w;
|
||||
///property: internal x-position for caption object
|
||||
int cch_text_x;
|
||||
///property: internal offset of context button icons within context button object
|
||||
@@ -84,6 +89,14 @@ class CComponentsHeader : public CComponentsForm
|
||||
int cch_size_mode;
|
||||
///property: alignment of caption within header, see also setCaptionAlignment(), possible values are CTextBox::CENTER, default = CTextBox::NO_AUTO_LINEBREAK (left)
|
||||
int cch_caption_align;
|
||||
///property: enable/disable of clock, see also enableClock()
|
||||
bool cch_cl_enable;
|
||||
///property: clock format
|
||||
const char* cch_cl_format;
|
||||
///property: secondary clock format
|
||||
const char* cch_cl_sec_format;
|
||||
///property: enable running clock
|
||||
bool cch_cl_enable_run;
|
||||
|
||||
///init font object and recalculates height if required
|
||||
void initCaptionFont(Font* font = NULL);
|
||||
@@ -93,6 +106,8 @@ class CComponentsHeader : public CComponentsForm
|
||||
void initCaption();
|
||||
///sub: init context button object
|
||||
void initButtons();
|
||||
///sub: init clock object
|
||||
void initClock();
|
||||
|
||||
public:
|
||||
enum
|
||||
@@ -108,7 +123,7 @@ class CComponentsHeader : public CComponentsForm
|
||||
const std::string& = "",
|
||||
const int& buttons = 0,
|
||||
CComponentsForm *parent = NULL,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
@@ -116,9 +131,9 @@ class CComponentsHeader : public CComponentsForm
|
||||
virtual ~CComponentsHeader();
|
||||
|
||||
///set caption text, parameters: string, int align_mode (default left)
|
||||
virtual void setCaption(const std::string& caption, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
|
||||
virtual void setCaption(const std::string& caption, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK, const fb_pixel_t& text_color = COL_MENUHEAD_TEXT);
|
||||
///set caption text, parameters: loacle, int align_mode (default left)
|
||||
virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK);
|
||||
virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK, const fb_pixel_t& text_color = COL_MENUHEAD_TEXT);
|
||||
|
||||
///set alignment of caption within header, possible paramters are CTextBox::CENTER, CTextBox::NO_AUTO_LINEBREAK
|
||||
virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;};
|
||||
@@ -181,7 +196,7 @@ class CComponentsHeader : public CComponentsForm
|
||||
};
|
||||
|
||||
///set offset between icons within context button object
|
||||
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;};
|
||||
virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;}
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -189,15 +204,31 @@ class CComponentsHeader : public CComponentsForm
|
||||
CC_HEADER_SIZE_SMALL = 1
|
||||
};
|
||||
///set size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL
|
||||
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();};
|
||||
virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();}
|
||||
|
||||
///init all items within header object
|
||||
virtual void initCCItems();
|
||||
///returns the text object
|
||||
virtual CComponentsText* getTextObject(){return cch_text_obj;};
|
||||
virtual CComponentsText* getTextObject(){return cch_text_obj;}
|
||||
|
||||
///returns the clock object
|
||||
virtual CComponentsFrmClock* getClockObject(){return cch_cl_obj;}
|
||||
|
||||
///enable display of clock, parameter bool enable, const char* format, bool run
|
||||
virtual void enableClock(bool enable = true, const char* format = "%H:%M", const char* sec_format_str = NULL, bool run = false);
|
||||
///disable clock, without parameter
|
||||
virtual void disableClock();
|
||||
|
||||
///paint header
|
||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||
|
||||
///hides item, arg: no_restore see hideCCItem()
|
||||
void hide(){disableClock(); CComponents::hide();}
|
||||
///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer
|
||||
virtual void kill(){disableClock(); CComponentsForm::kill();}
|
||||
|
||||
///set color gradient on/off, returns true if gradient mode was changed
|
||||
virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1);
|
||||
};
|
||||
|
||||
//! Sub class of CComponentsHeader.
|
||||
@@ -213,7 +244,7 @@ class CComponentsHeaderLocalized : public CComponentsHeader
|
||||
const std::string& = "",
|
||||
const int& buttons = 0,
|
||||
CComponentsForm *parent = NULL,
|
||||
bool has_shadow = CC_SHADOW_OFF,
|
||||
int shadow_mode = CC_SHADOW_OFF,
|
||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||
fb_pixel_t color_body = COL_MENUHEAD_PLUS_0,
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
Reference in New Issue
Block a user