summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-02 19:02:01 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-02 19:02:01 +0100
commit775ae27a5579812a85957ac1154b6c2e9d2049b4 (patch)
treea7a444e74faa4643582d9a67da35e255b1c2c18f /Userland/Libraries/LibGUI
parent31e04907b4ec0eadd12001694cc9961752e041ae (diff)
downloadserenity-775ae27a5579812a85957ac1154b6c2e9d2049b4.zip
Revert "StatusBar: Allow GML files to set the number of labels to create"
This reverts commit e11ec20650e5182f47675210dcd71e7301c34905. Broke FileManager, Browser, etc.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/StatusBar.cpp27
-rw-r--r--Userland/Libraries/LibGUI/StatusBar.h9
2 files changed, 7 insertions, 29 deletions
diff --git a/Userland/Libraries/LibGUI/StatusBar.cpp b/Userland/Libraries/LibGUI/StatusBar.cpp
index 31db3cb947..c32b45cf0b 100644
--- a/Userland/Libraries/LibGUI/StatusBar.cpp
+++ b/Userland/Libraries/LibGUI/StatusBar.cpp
@@ -44,15 +44,15 @@ StatusBar::StatusBar(int label_count)
layout()->set_margins({ 0, 0, 0, 0 });
layout()->set_spacing(2);
- if (label_count > 0) {
- for (auto i = 0; i < label_count; i++)
- m_labels.append(create_label());
+ if (label_count < 1)
+ label_count = 1;
- m_corner = add<ResizeCorner>();
- }
+ for (auto i = 0; i < label_count; i++)
+ m_labels.append(create_label());
+
+ m_corner = add<ResizeCorner>();
REGISTER_STRING_PROPERTY("text", text, set_text);
- REGISTER_INT_PROPERTY("label_count", label_count, set_label_count);
}
StatusBar::~StatusBar()
@@ -104,19 +104,4 @@ void StatusBar::resize_event(ResizeEvent& event)
Widget::resize_event(event);
}
-void StatusBar::set_label_count(int label_count)
-{
- ASSERT(m_labels.is_empty());
- m_label_count = label_count;
- for (auto i = 0; i < label_count; ++i) {
- m_labels.append(create_label());
- }
- m_corner = add<ResizeCorner>();
-}
-
-NonnullRefPtr<Label> StatusBar::label(int index) const
-{
- return m_labels.at(index);
-}
-
}
diff --git a/Userland/Libraries/LibGUI/StatusBar.h b/Userland/Libraries/LibGUI/StatusBar.h
index 544424703e..9615d9374f 100644
--- a/Userland/Libraries/LibGUI/StatusBar.h
+++ b/Userland/Libraries/LibGUI/StatusBar.h
@@ -39,10 +39,9 @@ public:
String text(int index) const;
void set_text(const StringView&);
void set_text(int index, const StringView&);
- NonnullRefPtr<Label> label(int index) const;
protected:
- explicit StatusBar(int label_count = 0);
+ explicit StatusBar(int label_count = 1);
virtual void paint_event(PaintEvent&) override;
virtual void resize_event(ResizeEvent&) override;
@@ -50,12 +49,6 @@ private:
NonnullRefPtr<Label> create_label();
NonnullRefPtrVector<Label> m_labels;
RefPtr<ResizeCorner> m_corner;
-
- // Used to initialize the number of labels that should
- // be created from a GML file as opposed to the constructor.
- int label_count() const { return m_label_count; }
- void set_label_count(int);
- int m_label_count {};
};
}