From 14f03e22da7e3e92b84174c22f290501bfc0e892 Mon Sep 17 00:00:00 2001 From: Arseniy Shestakov Date: Fri, 23 Mar 2018 01:23:18 +0700 Subject: [PATCH] CLabelGroup: add currentSize method Might be someone will suggest me better name. And actually I need method to clean group too. --- client/widgets/TextControls.cpp | 7 ++++++- client/widgets/TextControls.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/widgets/TextControls.cpp b/client/widgets/TextControls.cpp index c2b841efe..676105426 100644 --- a/client/widgets/TextControls.cpp +++ b/client/widgets/TextControls.cpp @@ -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): diff --git a/client/widgets/TextControls.h b/client/widgets/TextControls.h index e3f2821ac..b3b5b1a78 100644 --- a/client/widgets/TextControls.h +++ b/client/widgets/TextControls.h @@ -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