CComponentsIconForm: add member to add any number of identical icons

This commit is contained in:
2018-03-14 10:21:50 +01:00
parent 56bf501e3d
commit 9d7f8a21f9
2 changed files with 13 additions and 2 deletions

View File

@@ -93,6 +93,16 @@ void CComponentsIconForm::addIcon(std::vector<std::string> icon_name)
addIcon(icon_name[i]); addIcon(icon_name[i]);
} }
void CComponentsIconForm::addIcons(const std::string& icon_name, const size_t& count)
{
if (count == 0){
dprintf(DEBUG_<NORMAL "[CComponentsIconForm]\t[%s - %d], NOTE: no count of items defined...\n", __func__, __LINE__);
return;
}
for (size_t i = 1; i <= count; i++)
addIcon(icon_name);
}
void CComponentsIconForm::insertIcon(const uint& icon_id, const std::string& icon_name) void CComponentsIconForm::insertIcon(const uint& icon_id, const std::string& icon_name)
{ {
//create new cc-picture item object //create new cc-picture item object

View File

@@ -3,7 +3,7 @@
Copyright (C) 2001 by Steffen Hehn 'McClean' Copyright (C) 2001 by Steffen Hehn 'McClean'
Classes for generic GUI-related components. Classes for generic GUI-related components.
Copyright (C) 2012, 2013, 2014, Thilo Graf 'dbt' Copyright (C) 2012-2018, Thilo Graf 'dbt'
License: GPL License: GPL
@@ -44,7 +44,7 @@ class CComponentsIconForm : public CComponentsFrmChain
public: public:
CComponentsIconForm(CComponentsForm *parent = NULL); CComponentsIconForm(CComponentsForm *parent = NULL);
CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h, CComponentsIconForm( const int &x_pos, const int &y_pos, const int &w, const int &h,
const std::vector<std::string> &v_icon_names, const std::vector<std::string> &v_icon_names = std::vector<std::string>(),
CComponentsForm *parent = NULL, CComponentsForm *parent = NULL,
int shadow_mode = CC_SHADOW_OFF, int shadow_mode = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_FRAME_PLUS_0, fb_pixel_t color_frame = COL_FRAME_PLUS_0,
@@ -54,6 +54,7 @@ class CComponentsIconForm : public CComponentsFrmChain
void addIcon(const std::string& icon_name); void addIcon(const std::string& icon_name);
void addIcon(std::vector<std::string> icon_name); void addIcon(std::vector<std::string> icon_name);
void addIcons(const std::string& icon_name, const size_t& count = 1);
void removeIcons(){v_icons.clear();}; void removeIcons(){v_icons.clear();};
void insertIcon(const uint& icon_id, const std::string& icon_name); void insertIcon(const uint& icon_id, const std::string& icon_name);
void removeIcon(const uint& icon_id); void removeIcon(const uint& icon_id);