CComponentsHeader: fix broken addHeaderButton() and removeHeaderButtons()

Simple push_back() has no effect, buttons must be initialized and destroy
of cch_btn_obj is an easy way for clean up.
This commit is contained in:
2012-11-25 15:41:27 +01:00
parent 79dd6456b0
commit 9150088088

View File

@@ -1826,14 +1826,21 @@ void CComponentsHeader::initCCHeaderIcon()
void CComponentsHeader::addHeaderButton(const std::string& button_name)
{
if (cch_btn_obj){
delete cch_btn_obj;
cch_btn_obj = NULL;
}
v_cch_btn.push_back(button_name);
initCCHeaderButtons();
}
void CComponentsHeader::removeHeaderButtons()
{
v_cch_btn.clear();
if (cch_btn_obj)
cch_btn_obj->removeAllIcons();
if (cch_btn_obj){
delete cch_btn_obj;
cch_btn_obj = NULL;
}
}
void CComponentsHeader::initCCHDefaultButtons()