1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

CLabelGroup: add currentSize method

Might be someone will suggest me better name.
And actually I need method to clean group too.
This commit is contained in:
Arseniy Shestakov
2018-03-23 01:23:18 +07:00
parent ab2b9086d3
commit 14f03e22da
2 changed files with 7 additions and 1 deletions

View File

@@ -266,7 +266,12 @@ CLabelGroup::CLabelGroup(EFonts Font, EAlignment Align, const SDL_Color &Color):
void CLabelGroup::add(int x, int y, const std::string &text)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
new CLabel(x, y, font, align, color, text);
labels.push_back(new CLabel(x, y, font, align, color, text));
}
size_t CLabelGroup::currentSize() const
{
return labels.size();
}
CTextBox::CTextBox(std::string Text, const Rect &rect, int SliderStyle, EFonts Font, EAlignment Align, const SDL_Color &Color):

View File

@@ -67,6 +67,7 @@ class CLabelGroup : public CIntObject
public:
CLabelGroup(EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE);
void add(int x=0, int y=0, const std::string &text = "");
size_t currentSize() const;
};
/// Multi-line label that can display multiple lines of text