LibGUI: Make the GLabel constructors protected

You should use GLabel::construct(...) to create new GLabels instead of
invoking the constructor directly via "new".
This commit is contained in:
Andreas Kling 2019-09-21 14:22:49 +02:00
parent 2e76ac3aff
commit 4381dd2640
Notes: sideshowbarker 2024-07-19 12:02:26 +09:00

View File

@ -8,8 +8,6 @@ class GraphicsBitmap;
class GLabel : public GFrame { class GLabel : public GFrame {
C_OBJECT(GLabel) C_OBJECT(GLabel)
public: public:
explicit GLabel(GWidget* parent = nullptr);
GLabel(const StringView& text, GWidget* parent = nullptr);
virtual ~GLabel() override; virtual ~GLabel() override;
String text() const { return m_text; } String text() const { return m_text; }
@ -27,9 +25,13 @@ public:
void size_to_fit(); void size_to_fit();
private: protected:
explicit GLabel(GWidget* parent = nullptr);
GLabel(const StringView& text, GWidget* parent = nullptr);
virtual void paint_event(GPaintEvent&) override; virtual void paint_event(GPaintEvent&) override;
private:
String m_text; String m_text;
RefPtr<GraphicsBitmap> m_icon; RefPtr<GraphicsBitmap> m_icon;
TextAlignment m_text_alignment { TextAlignment::Center }; TextAlignment m_text_alignment { TextAlignment::Center };