mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 17:01:15 +02:00
CComponentsHeader: move init of items ito cobstructors
Inherited methodes like insertCCItem, removeCCItem ... don't work nice, if cc-items are ititialized too late. If we init in constructors, we can manipulate header items, otherwise not. clearCCItems() is to find in the destructor, and should be called with delete. Handle with care!
This commit is contained in:
@@ -1607,7 +1607,7 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I
|
||||
void CComponentsForm::removeCCItem(const uint& cc_item_id)
|
||||
{
|
||||
if (!v_cc_items.empty()){
|
||||
if (v_cc_items.at(cc_item_id)) {
|
||||
if (v_cc_items[cc_item_id]) {
|
||||
delete v_cc_items[cc_item_id];
|
||||
v_cc_items[cc_item_id] = NULL;
|
||||
v_cc_items.erase(v_cc_items.begin()+cc_item_id);
|
||||
@@ -1718,6 +1718,8 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
|
||||
cch_text = caption;
|
||||
cch_icon_name = icon_name;
|
||||
cch_buttons = buttons;
|
||||
initCCHDefaultButtons();
|
||||
initCCHItems();
|
||||
}
|
||||
|
||||
CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow,
|
||||
@@ -1738,6 +1740,8 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
|
||||
cch_locale_text = caption_locale;
|
||||
cch_icon_name = icon_name;
|
||||
cch_buttons = buttons;
|
||||
initCCHDefaultButtons();
|
||||
initCCHItems();
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -1772,8 +1776,7 @@ void CComponentsHeader::initVarHeader()
|
||||
|
||||
//CComponentsForm
|
||||
initVarForm();
|
||||
height = cch_font->getHeight();
|
||||
|
||||
height = cch_font->getHeight();
|
||||
col_body = COL_MENUHEAD_PLUS_0;
|
||||
corner_rad = RADIUS_LARGE,
|
||||
corner_type = CORNER_TOP;
|
||||
@@ -1858,8 +1861,6 @@ void CComponentsHeader::initCCButtonFormSize()
|
||||
|
||||
void CComponentsHeader::initCCHeaderButtons()
|
||||
{
|
||||
initCCHDefaultButtons();
|
||||
|
||||
//exit if no button defined
|
||||
if (v_cch_btn.empty())
|
||||
return;
|
||||
@@ -1890,8 +1891,10 @@ void CComponentsHeader::initCCHeaderText()
|
||||
|
||||
void CComponentsHeader::initCCHItems()
|
||||
{
|
||||
//clean up first possible old item objects, includes delete and clean up vector
|
||||
clearCCItems();
|
||||
#if 0
|
||||
//clean up first possible old item objects, includes delete and clean up vector
|
||||
clearCCItems();
|
||||
#endif
|
||||
|
||||
//init icon
|
||||
initCCHeaderIcon();
|
||||
@@ -1917,9 +1920,6 @@ void CComponentsHeader::paint(bool do_save_bg)
|
||||
//paint body
|
||||
paintInit(do_save_bg);
|
||||
|
||||
//init default header ccitems
|
||||
initCCHItems();
|
||||
|
||||
//paint
|
||||
paintCCItems();
|
||||
}
|
||||
|
Reference in New Issue
Block a user