CComponentsHeader: rename some members for plausible usage in subclasses

Some members are usable in subclasses, but  current names could be not
suitable or not  plausible with respect to the name of subclass.
This commit is contained in:
2013-05-27 11:57:17 +02:00
parent 40a77ade7c
commit 8e46f63900
4 changed files with 48 additions and 46 deletions

View File

@@ -103,7 +103,7 @@ class CComponentsIconForm : public CComponentsForm
class CComponentsHeader : public CComponentsForm
{
private:
protected:
CComponentsPicture * cch_icon_obj;
CComponentsText * cch_text_obj;
CComponentsIconForm * cch_btn_obj;
@@ -114,13 +114,12 @@ class CComponentsHeader : public CComponentsForm
int cch_icon_x, cch_items_y, cch_text_x, ccif_width, cch_icon_w, cch_buttons, cch_btn_offset;
std::vector<std::string> v_cch_btn;
void initCCHeaderIcon();
void initCCHeaderText();
void initCCHeaderButtons();
void initCCHDefaultButtons();
void initCCButtonFormSize();
void initIcon();
void initCaption();
void initButtons();
void initDefaultButtons();
void initButtonFormSize();
protected:
void initVarHeader();
public:
@@ -146,16 +145,18 @@ 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);
~CComponentsHeader();
virtual void setCaption(const std::string& caption);
virtual void setCaption(neutrino_locale_t caption_locale);
virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;};
virtual void setButtonOffset(const int offset){cch_btn_offset = offset;};
virtual void setIcon(const char* icon_name);
virtual void addButtonIcon(const std::string& button_name);
virtual void removeButtonIcons();
virtual void setDefaultButtons(const int buttons);
virtual void initCCItems();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
void setHeaderText(const std::string& caption);
void setHeaderText(neutrino_locale_t caption_locale);
void setColorHeaderBody(fb_pixel_t text_color){cch_col_text = text_color;};
void setHeaderButtonOffset(const int offset){cch_btn_offset = offset;};
void setHeaderIcon(const char* icon_name);
void addHeaderButton(const std::string& button_name);
void removeHeaderButtons();
void setHeaderDefaultButtons(const int buttons);
void initCCHeaderItems();
};
class CComponentsWindow : public CComponentsForm

View File

@@ -60,8 +60,9 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
cch_text = caption;
cch_icon_name = icon_name;
cch_buttons = buttons;
initCCHDefaultButtons();
initCCHeaderItems();
initDefaultButtons();
initCCItems();
}
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,
@@ -83,8 +84,8 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in
cch_icon_name = icon_name;
cch_buttons = buttons;
initCCHDefaultButtons();
initCCHeaderItems();
initDefaultButtons();
initCCItems();
}
void CComponentsHeader::initVarHeader()
@@ -128,22 +129,22 @@ CComponentsHeader::~CComponentsHeader()
cleanCCForm();
}
void CComponentsHeader::setHeaderText(const std::string& caption)
void CComponentsHeader::setCaption(const std::string& caption)
{
cch_text = caption;
}
void CComponentsHeader::setHeaderText(neutrino_locale_t caption_locale)
void CComponentsHeader::setCaption(neutrino_locale_t caption_locale)
{
cch_text = g_Locale->getText(caption_locale);
}
void CComponentsHeader::setHeaderIcon(const char* icon_name)
void CComponentsHeader::setIcon(const char* icon_name)
{
cch_icon_name = icon_name;
}
void CComponentsHeader::initCCHeaderIcon()
void CComponentsHeader::initIcon()
{
//reset cch_icon_w
cch_icon_w = cch_btn_offset;
@@ -191,21 +192,21 @@ void CComponentsHeader::initCCHeaderIcon()
}
}
void CComponentsHeader::addHeaderButton(const std::string& button_name)
void CComponentsHeader::addButtonIcon(const std::string& button_name)
{
v_cch_btn.push_back(button_name);
initCCHeaderButtons();
initButtons();
}
void CComponentsHeader::removeHeaderButtons()
void CComponentsHeader::removeButtonIcons()
{
v_cch_btn.clear();
cch_btn_obj->removeAllIcons();
initCCHeaderButtons();
initButtons();
}
void CComponentsHeader::initCCHDefaultButtons()
void CComponentsHeader::initDefaultButtons()
{
if (cch_buttons & CC_BTN_EXIT)
v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HOME);
@@ -220,15 +221,15 @@ void CComponentsHeader::initCCHDefaultButtons()
#endif
}
void CComponentsHeader::setHeaderDefaultButtons(const int buttons)
void CComponentsHeader::setDefaultButtons(const int buttons)
{
cch_buttons = buttons;
v_cch_btn.clear();
initCCHDefaultButtons();
initDefaultButtons();
}
// calculate minimal width of icon form
void CComponentsHeader::initCCButtonFormSize()
void CComponentsHeader::initButtonFormSize()
{
ccif_width = 0;
for(size_t i=0; i<v_cch_btn.size(); i++){
@@ -238,13 +239,13 @@ void CComponentsHeader::initCCButtonFormSize()
}
}
void CComponentsHeader::initCCHeaderButtons()
void CComponentsHeader::initButtons()
{
//exit if no button defined
if (v_cch_btn.empty())
return;
initCCButtonFormSize();
initButtonFormSize();
if (cch_btn_obj == NULL){
cch_btn_obj = new CComponentsIconForm();
@@ -267,7 +268,7 @@ void CComponentsHeader::initCCHeaderButtons()
}
}
void CComponentsHeader::initCCHeaderText()
void CComponentsHeader::initCaption()
{
//reset header text position first
cch_text_x = cch_icon_x+cch_icon_w;
@@ -300,22 +301,22 @@ void CComponentsHeader::initCCHeaderText()
}
}
void CComponentsHeader::initCCHeaderItems()
void CComponentsHeader::initCCItems()
{
//init icon
initCCHeaderIcon();
initIcon();
//init text
initCCHeaderText();
initCaption();
//init buttons
initCCHeaderButtons();
initButtons();
}
void CComponentsHeader::paint(bool do_save_bg)
{
//prepare items
initCCHeaderItems();
initCCItems();
//paint form contents
paintForm(do_save_bg);

View File

@@ -106,11 +106,11 @@ void CComponentsWindow::initHeader()
ccw_head->setXPos(0);
ccw_head->setYPos(0);
ccw_head->setWidth(width);
ccw_head->setHeaderIcon(ccw_icon_name);
ccw_head->setHeaderText(ccw_caption);
ccw_head->initCCHeaderItems();
ccw_head->setIcon(ccw_icon_name);
ccw_head->setCaption(ccw_caption);
ccw_head->initCCItems();
ccw_start_y = ccw_head->getHeight();
ccw_head->setHeaderDefaultButtons(ccw_buttons);
ccw_head->setDefaultButtons(ccw_buttons);
}
}