CComponentsHeader: add possibility to show channellogo

Contains methode setChannelLogo() with parameters
for channel id, channel name and optional
alignment (primary between title and clock). Default
alignment is centered.
Optional parameter to set logo height is available too.

Hope it works on first try. To see how it works, take look
at channellist class.
This commit is contained in:
2017-04-21 22:47:23 +02:00
parent a3bf23d9c9
commit 68835056c3
3 changed files with 124 additions and 27 deletions

View File

@@ -36,9 +36,29 @@
/*!
CComponentsHeader provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows
*/
class CComponentsHeader : public CComponentsForm, public CCTextScreen
{
public:
///logo position options
typedef enum
{
CC_LOGO_RIGHT ,
CC_LOGO_LEFT ,
CC_LOGO_CENTER
}cc_logo_alignment_t;
private:
///required logo data type
typedef struct cch_logo_t
{
uint64_t Id;
std::string Name;
int32_t dx_max;
int32_t dy_max;
cc_logo_alignment_t Align;
} cch_logo_struct_t;
///member: init genaral variables, parameters for mostly used properties
void initVarHeader( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption,
@@ -59,6 +79,11 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
CComponentsIconForm * cch_btn_obj;
///object: clock object
CComponentsFrmClock * cch_cl_obj;
///object: logo object
CComponentsChannelLogoScalable * cch_logo_obj;
///attributes for logos
cch_logo_t cch_logo;
///property: caption text, see also setCaption()
std::string cch_text;
@@ -112,6 +137,9 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
void initButtons();
///sub: init clock object
void initClock();
///sub: init logo object
void initLogo();
///int repaint slot
void initRepaintSlot();
@@ -275,6 +303,30 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
///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);
/**Methode to set channel logo into header body via id and/or channel name
* @param[in] channelId
* @li required channel id as uint64_t
* @param[in] channelIName
* @li required channel name as std::string
* @param[in] alignment
* @li optional alingment parameter as cc_logo_alignment_t (enum)\n
* Possible values are:\n
* CC_LOGO_RIGHT \n
* CC_LOGO_CENTER (default)\n
* CC_LOGO_RIGHT \n
* @param[in] dy
* @li optional logo height, default = -1 (auto)
*/
void setChannelLogo( const uint64_t& channelId,
const std::string& channelName,
cc_logo_alignment_t alignment = CC_LOGO_CENTER,
const int& dy = -1)
{cch_logo.Id = channelId; cch_logo.Name = channelName, cch_logo.Align = alignment, cch_logo.dy_max = dy; initCCItems();}
/**Methode to get channel logo object for direct access to its properties and methodes
* @return CComponentsChannelLogoScalable*
*/
CComponentsChannelLogoScalable* getLogoObject(){return cch_logo_obj;}
};
//! Sub class of CComponentsHeader.