CComponentsWindow: add member showHeader()

Provides show or hide window header


Origin commit data
------------------
Branch: ni/coolstream
Commit: 5323e92a6f
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-10-21 (Mon, 21 Oct 2013)



------------------
This commit was generated by Migit
This commit is contained in:
2013-10-21 21:57:16 +02:00
parent b7373ffdc4
commit 92b6e750a3
2 changed files with 26 additions and 10 deletions

View File

@@ -229,8 +229,10 @@ class CComponentsWindow : public CComponentsForm
const char* ccw_icon_name; const char* ccw_icon_name;
///property: assigned default icon buttons in header, see also getHeaderObject() ///property: assigned default icon buttons in header, see also getHeaderObject()
int ccw_buttons; int ccw_buttons;
///property: value = true, let show footer ///property: value = true, let show footer, see showFooter()
bool ccw_show_footer; bool ccw_show_footer;
///property: value = true, let show header, see showHeader()
bool ccw_show_header;
///initialze header object ///initialze header object
void initHeader(); void initHeader();
@@ -285,8 +287,10 @@ class CComponentsWindow : public CComponentsForm
///add item to body object, also usable is addCCItem() to add items to the windo object ///add item to body object, also usable is addCCItem() to add items to the windo object
void addWindowItem(CComponentsItem* cc_Item); void addWindowItem(CComponentsItem* cc_Item);
/// ///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader()
void showFooter(bool show = true){ccw_show_footer = show;}; void showFooter(bool show = true){ccw_show_footer = show;};
///allow/disallow paint a header, default true, see also ccw_show_header, showFooter()
void showHeader(bool show = true){ccw_show_header = show;};
///set caption in header with string, see also getHeaderObject() ///set caption in header with string, see also getHeaderObject()
void setWindowCaption(const std::string& text){ccw_caption = text;}; void setWindowCaption(const std::string& text){ccw_caption = text;};

View File

@@ -141,7 +141,8 @@ void CComponentsWindow::initVarWindow()
ccw_icon_name = NULL; ccw_icon_name = NULL;
ccw_buttons = 0; //no header buttons ccw_buttons = 0; //no header buttons
ccw_show_footer = true; ccw_show_footer = true;
ccw_show_header = true;
setShadowOnOff(true); setShadowOnOff(true);
} }
@@ -181,9 +182,11 @@ void CComponentsWindow::initBody()
if (ccw_body){ if (ccw_body){
ccw_body->setCornerType(0); ccw_body->setCornerType(0);
int fh = 0; int fh = 0;
int hh = 0;
if (ccw_footer) if (ccw_footer)
fh = ccw_footer->getHeight(); fh = ccw_footer->getHeight();
int hh = ccw_head->getHeight(); if (ccw_head)
hh = ccw_head->getHeight();
int h_body = height - hh - fh - 2*fr_thickness; int h_body = height - hh - fh - 2*fr_thickness;
ccw_body->setDimensionsAll(0, CC_APPEND, width-2*fr_thickness, h_body); ccw_body->setDimensionsAll(0, CC_APPEND, width-2*fr_thickness, h_body);
ccw_body->doPaintBg(false); ccw_body->doPaintBg(false);
@@ -218,22 +221,31 @@ void CComponentsWindow::initCCWItems()
#ifdef DEBUG_CC #ifdef DEBUG_CC
printf("[CComponentsWindow] [%s - %d] init items...\n", __FUNCTION__, __LINE__); printf("[CComponentsWindow] [%s - %d] init items...\n", __FUNCTION__, __LINE__);
#endif #endif
initHeader(); //add header if required
if (ccw_show_header){
initHeader();
}else{
if (ccw_head){
removeCCItem(ccw_head);
ccw_head = NULL;
}
}
//add footer if required //add footer if required
if (ccw_show_footer){ if (ccw_show_footer){
initFooter(); initFooter();
}else{ }else{
if (ccw_footer != NULL){ if (ccw_footer){
removeCCItem(ccw_footer); removeCCItem(ccw_footer);
ccw_footer = NULL; ccw_footer = NULL;
} }
} }
initBody(); initBody();
//add header, body and footer items only one time //add header, body and footer items only one time
if (!ccw_head->isAdded()) if (ccw_head)
addCCItem(ccw_head); if (!ccw_head->isAdded())
addCCItem(ccw_head);
if (!ccw_body->isAdded()) if (!ccw_body->isAdded())
addCCItem(ccw_body); addCCItem(ccw_body);
if (ccw_footer) if (ccw_footer)