CComponentsForm/CComponentsWindow: add new members

CComponentsForm: Overload member removeCCItem so we can use
cc_item as parameter.
CComponentsWindow: add member bool showFooter().
This allows to hide a footer in window.


Origin commit data
------------------
Commit: 4eb26988e9
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-09-08 (Sun, 08 Sep 2013)
This commit is contained in:
2013-09-08 21:31:35 +02:00
parent a9ec86959a
commit 114be445ee
3 changed files with 29 additions and 4 deletions

View File

@@ -254,6 +254,12 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id)
#endif #endif
} }
void CComponentsForm::removeCCItem(CComponentsItem* cc_Item)
{
uint id = getCCItemId(cc_Item);
removeCCItem(id);
}
void CComponentsForm::exchangeCCItem(const uint& cc_item_id_a, const uint& cc_item_id_b) void CComponentsForm::exchangeCCItem(const uint& cc_item_id_a, const uint& cc_item_id_b)
{ {
if (!v_cc_items.empty()) if (!v_cc_items.empty())

View File

@@ -58,6 +58,7 @@ class CComponentsForm : public CComponentsItem
virtual void addCCItem(CComponentsItem* cc_Item); virtual void addCCItem(CComponentsItem* cc_Item);
virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item); virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item);
virtual void removeCCItem(const uint& cc_item_id); virtual void removeCCItem(const uint& cc_item_id);
virtual void removeCCItem(CComponentsItem* cc_Item);
virtual void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item); virtual void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item);
virtual void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item); virtual void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item);
virtual void exchangeCCItem(const uint& item_id_a, const uint& item_id_b); virtual void exchangeCCItem(const uint& item_id_a, const uint& item_id_b);
@@ -222,6 +223,8 @@ 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
bool ccw_show_footer;
///initialze header object ///initialze header object
void initHeader(); void initHeader();
@@ -276,6 +279,9 @@ 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);
///
void showFooter(bool show = true){ccw_show_footer = 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

@@ -140,6 +140,7 @@ void CComponentsWindow::initVarWindow()
ccw_caption = ""; ccw_caption = "";
ccw_icon_name = NULL; ccw_icon_name = NULL;
ccw_buttons = 0; //no header buttons ccw_buttons = 0; //no header buttons
ccw_show_footer = true;
setShadowOnOff(true); setShadowOnOff(true);
} }
@@ -179,7 +180,9 @@ void CComponentsWindow::initBody()
//set body properties //set body properties
if (ccw_body){ if (ccw_body){
ccw_body->setCornerType(0); ccw_body->setCornerType(0);
int fh = ccw_footer->getHeight(); int fh = 0;
if (ccw_footer)
fh = ccw_footer->getHeight();
int hh = ccw_head->getHeight(); int hh = ccw_head->getHeight();
int h_body = height - hh - fh; int h_body = height - hh - fh;
ccw_body->setDimensionsAll(0, CC_APPEND, width, h_body); ccw_body->setDimensionsAll(0, CC_APPEND, width, h_body);
@@ -216,7 +219,16 @@ void CComponentsWindow::initCCWItems()
printf("[CComponentsWindow] [%s - %d] init items...\n", __FUNCTION__, __LINE__); printf("[CComponentsWindow] [%s - %d] init items...\n", __FUNCTION__, __LINE__);
#endif #endif
initHeader(); initHeader();
initFooter();
//add footer if required
if (ccw_show_footer){
initFooter();
}else{
if (ccw_footer != NULL){
removeCCItem(ccw_footer);
ccw_footer = NULL;
}
}
initBody(); initBody();
//add header, body and footer items only one time //add header, body and footer items only one time
@@ -224,8 +236,9 @@ void CComponentsWindow::initCCWItems()
addCCItem(ccw_head); addCCItem(ccw_head);
if (!isAdded(ccw_body)) if (!isAdded(ccw_body))
addCCItem(ccw_body); addCCItem(ccw_body);
if (!isAdded(ccw_footer)) if (ccw_footer)
addCCItem(ccw_footer); if (!isAdded(ccw_footer))
addCCItem(ccw_footer);
} }
void CComponentsWindow::paint(bool do_save_bg) void CComponentsWindow::paint(bool do_save_bg)