CComponentsHeader/Icon: use inherited destructor

Inherited destructor contains identic code.


Origin commit data
------------------
Commit: da356d94da
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-03-10 (Sun, 10 Mar 2013)
This commit is contained in:
2013-03-10 21:22:07 +01:00
parent 078e3414cc
commit b35eeb6c3c
4 changed files with 17 additions and 19 deletions

View File

@@ -394,6 +394,7 @@ class CComponentsForm : public CComponentsItem
virtual int getCCItemId(CComponentsItem* cc_Item); virtual int getCCItemId(CComponentsItem* cc_Item);
virtual CComponentsItem* getCCItem(const uint& cc_item_id); virtual CComponentsItem* getCCItem(const uint& cc_item_id);
virtual void paintCCItems(); virtual void paintCCItems();
virtual void cleanCCForm();
}; };
class CComponentsIconForm : public CComponentsForm class CComponentsIconForm : public CComponentsForm
@@ -410,6 +411,7 @@ class CComponentsIconForm : public CComponentsForm
CComponentsIconForm(); CComponentsIconForm();
CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> v_icon_names, bool has_shadow = CC_SHADOW_OFF, CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector<std::string> v_icon_names, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
// ~CComponentsIconForm(); //inherited from CComponentsForm
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void initCCIcons(); void initCCIcons();
@@ -479,8 +481,7 @@ class CComponentsHeader : public CComponentsForm
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, const int buttons = 0,bool has_shadow = CC_SHADOW_OFF, CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, const int buttons = 0,bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
// ~CComponentsHeader(); //inherited from CComponentsForm
// ~CComponentsHeader();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void setHeaderText(const std::string& caption); void setHeaderText(const std::string& caption);
@@ -512,7 +513,7 @@ class CComponentsWindow : public CComponentsForm
CC_WINDOW_ITEM_HEADER = 0 CC_WINDOW_ITEM_HEADER = 0
}; };
CComponentsWindow(); CComponentsWindow();
~CComponentsWindow(); ~CComponentsWindow();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void setWindowCaption(const std::string& text){ccw_caption = text;}; void setWindowCaption(const std::string& text){ccw_caption = text;};

View File

@@ -61,6 +61,11 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w,
} }
CComponentsForm::~CComponentsForm() CComponentsForm::~CComponentsForm()
{
cleanCCForm();
}
void CComponentsForm::cleanCCForm()
{ {
#ifdef DEBUG_CC #ifdef DEBUG_CC
printf("[CComponents] calling %s...\n", __FUNCTION__); printf("[CComponents] calling %s...\n", __FUNCTION__);

View File

@@ -86,16 +86,7 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
initCCHItems(); initCCHItems();
} }
#if 0
CComponentsHeader::~CComponentsHeader()
{
hide();
clearSavedScreen();
clearCCItems();
clear();
}
#endif
void CComponentsHeader::initVarHeader() void CComponentsHeader::initVarHeader()
{ {
//CComponentsHeader //CComponentsHeader

View File

@@ -42,6 +42,13 @@ CComponentsWindow::CComponentsWindow()
initVarWindow(); initVarWindow();
} }
CComponentsWindow::~CComponentsWindow()
{
if (ccw_head)
delete ccw_head;
cleanCCForm();
}
void CComponentsWindow::initVarWindow() void CComponentsWindow::initVarWindow()
{ {
//CComponentsForm //CComponentsForm
@@ -61,12 +68,6 @@ void CComponentsWindow::initVarWindow()
setShadowOnOff(true); setShadowOnOff(true);
} }
CComponentsWindow::~CComponentsWindow()
{
if (ccw_head)
delete ccw_head;
}
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text) void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text)
{ {
ccw_caption = g_Locale->getText(locale_text); ccw_caption = g_Locale->getText(locale_text);