mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
implement progressbar into cc_frm_header
This commit is contained in:
@@ -152,6 +152,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
||||
cch_btn_obj = NULL;
|
||||
cch_cl_obj = NULL;
|
||||
cch_logo_obj = NULL;
|
||||
cch_pb_obj = NULL;
|
||||
cch_logo.Id = 0;
|
||||
cch_logo.Name = "";
|
||||
cch_logo.dy_max = -1;
|
||||
@@ -171,6 +172,11 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
||||
cch_cl_sec_format = cch_cl_format;
|
||||
cch_cl_enable_run = false;
|
||||
|
||||
cch_pb_x = cch_offset;
|
||||
cch_pb_w = 100;
|
||||
cch_pb_percent = 0;
|
||||
cch_pb_enable = false;
|
||||
|
||||
addContextButton(buttons);
|
||||
initCCItems();
|
||||
initParent(parent);
|
||||
@@ -317,14 +323,16 @@ void CComponentsHeader::initLogo()
|
||||
*/
|
||||
if (next_item)
|
||||
{
|
||||
if (next_item->getItemType() == CC_ITEMTYPE_FRM_ICONFORM)
|
||||
if (next_item->getItemType() == CC_ITEMTYPE_FRM_CLOCK)
|
||||
{
|
||||
/*
|
||||
* Either clock is present or buttons are enabled,
|
||||
* different order of objects are required, not optimal
|
||||
* but works at the moment.
|
||||
*/
|
||||
if (cch_cl_obj)
|
||||
if (cch_pb_obj)
|
||||
next_item = cch_pb_obj;
|
||||
else if (cch_cl_obj)
|
||||
next_item = cch_cl_obj;
|
||||
else
|
||||
next_item = cch_btn_obj;
|
||||
@@ -393,6 +401,71 @@ void CComponentsHeader::initLogo()
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsHeader::initProgressBar()
|
||||
{
|
||||
//exit here if progressbar was disabled
|
||||
if (!cch_pb_enable){
|
||||
if (cch_pb_obj){
|
||||
removeCCItem(cch_pb_obj);
|
||||
cch_pb_obj = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//create instance for header progressbar object and add to container
|
||||
if (cch_pb_obj == NULL){
|
||||
dprintf(DEBUG_DEBUG, "[CComponentsHeader]\n [%s - %d] init progressbar...\n", __func__, __LINE__);
|
||||
cch_pb_obj = new CProgressBar(cch_pb_x, cch_items_y, cch_pb_w, height/2, col_frame, col_body_std, col_shadow, COL_PROGRESSBAR_ACTIVE_PLUS_0, COL_PROGRESSBAR_PASSIVE_PLUS_0, 40, 100, 70, this);
|
||||
cch_pb_obj->setType(CProgressBar::PB_REDRIGHT);
|
||||
}
|
||||
|
||||
CComponentsItem *next_item;
|
||||
|
||||
if (cch_cl_obj)
|
||||
next_item = cch_cl_obj;
|
||||
else
|
||||
next_item = cch_btn_obj;
|
||||
|
||||
cch_pb_x = next_item ? next_item->getXPos() - cch_pb_obj->getWidth() - cch_offset : width - cch_pb_obj->getWidth() - cch_offset;
|
||||
cch_pb_obj->setXPos(cch_pb_x);
|
||||
|
||||
cch_pb_w = cch_pb_obj->getWidth();
|
||||
}
|
||||
|
||||
void CComponentsHeader::enableProgessBar(int percent)
|
||||
{
|
||||
cch_pb_enable = true;
|
||||
cch_pb_percent = percent;
|
||||
|
||||
initCCItems();
|
||||
|
||||
if (cch_pb_obj){
|
||||
cch_pb_obj->setValues(percent, 100);
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsHeader::setProgessBar(int percent)
|
||||
{
|
||||
cch_pb_percent = percent;
|
||||
|
||||
if (cch_pb_obj){
|
||||
cch_pb_obj->setValues(percent, 100);
|
||||
}
|
||||
}
|
||||
|
||||
void CComponentsHeader::disableProgessBar()
|
||||
{
|
||||
cch_pb_enable = false;
|
||||
if (!cch_pb_enable){
|
||||
if (cch_pb_obj){
|
||||
removeCCItem(cch_pb_obj);
|
||||
cch_pb_obj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
initCCItems();
|
||||
}
|
||||
|
||||
void CComponentsHeader::addContextButton(const std::string& icon_name)
|
||||
{
|
||||
v_cch_btn.push_back(icon_name);
|
||||
@@ -692,6 +765,9 @@ void CComponentsHeader::initCCItems()
|
||||
//init text
|
||||
initCaption();
|
||||
|
||||
//init progressbar
|
||||
initProgressBar();
|
||||
|
||||
//init logo
|
||||
initLogo();
|
||||
}
|
||||
|
@@ -99,6 +99,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
|
||||
CComponentsFrmClock * cch_cl_obj;
|
||||
///object: logo object
|
||||
CComponentsChannelLogo * cch_logo_obj;
|
||||
///object: progressbar object
|
||||
CProgressBar * cch_pb_obj;
|
||||
|
||||
///attributes for logos
|
||||
cch_logo_t cch_logo;
|
||||
@@ -124,6 +126,14 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
|
||||
int cch_clock_w;
|
||||
///property: internal x-position for caption object
|
||||
int cch_text_x;
|
||||
///property: internal x-position for progressbar object
|
||||
int cch_pb_x;
|
||||
///property: internal width for progressbar object
|
||||
int cch_pb_w;
|
||||
///property: internal progressbar percent for progressbar object
|
||||
int cch_pb_percent;
|
||||
///property: enable/disable progressbar object
|
||||
bool cch_pb_enable;
|
||||
///property: internal offset of context button icons within context button object
|
||||
int cch_buttons_space;
|
||||
///property: internal offset for header items
|
||||
@@ -159,6 +169,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
|
||||
void initClock();
|
||||
///sub: init logo object
|
||||
void initLogo();
|
||||
///sub: init progressbar object
|
||||
void initProgressBar();
|
||||
|
||||
///int repaint slot
|
||||
void initRepaintSlot();
|
||||
@@ -362,6 +374,19 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
|
||||
* @return CComponentsChannelLogo*
|
||||
*/
|
||||
CComponentsChannelLogo* getChannelLogoObject(){return cch_logo_obj;}
|
||||
/**Methode to get progessbar object for direct access to its properties and methodes
|
||||
* @return CProgressBar*
|
||||
*/
|
||||
CProgressBar* getProgressBarObject(){return cch_pb_obj;}
|
||||
|
||||
///enable display of progressbar, parameter int percent
|
||||
void enableProgessBar(int percent);
|
||||
///set value of progressbar, parameter int percent
|
||||
void setProgessBar(int percent);
|
||||
///get value of progressbar, return int percent
|
||||
int getProgessBar(){return cch_pb_percent;}
|
||||
///disable progressbar, without parameter
|
||||
void disableProgessBar();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user