summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/BreadcrumbBar.cpp2
-rw-r--r--Libraries/LibGUI/Button.cpp2
-rw-r--r--Libraries/LibGUI/CheckBox.cpp2
-rw-r--r--Libraries/LibGUI/ColorInput.cpp2
-rw-r--r--Libraries/LibGUI/ComboBox.cpp2
-rw-r--r--Libraries/LibGUI/Frame.cpp2
-rw-r--r--Libraries/LibGUI/GroupBox.cpp2
-rw-r--r--Libraries/LibGUI/ImageWidget.cpp2
-rw-r--r--Libraries/LibGUI/Label.cpp2
-rw-r--r--Libraries/LibGUI/LinkLabel.cpp2
-rw-r--r--Libraries/LibGUI/ListView.cpp2
-rw-r--r--Libraries/LibGUI/OpacitySlider.cpp2
-rw-r--r--Libraries/LibGUI/ProgressBar.cpp2
-rw-r--r--Libraries/LibGUI/RadioButton.cpp2
-rw-r--r--Libraries/LibGUI/ScrollBar.cpp2
-rw-r--r--Libraries/LibGUI/Slider.cpp4
-rw-r--r--Libraries/LibGUI/SpinBox.cpp2
-rw-r--r--Libraries/LibGUI/Splitter.cpp3
-rw-r--r--Libraries/LibGUI/StatusBar.cpp2
-rw-r--r--Libraries/LibGUI/TabWidget.cpp2
-rw-r--r--Libraries/LibGUI/TextBox.cpp2
-rw-r--r--Libraries/LibGUI/TextEditor.cpp2
-rw-r--r--Libraries/LibGUI/ToolBar.cpp2
-rw-r--r--Libraries/LibGUI/ToolBarContainer.cpp2
-rw-r--r--Libraries/LibGUI/TreeView.cpp2
-rw-r--r--Libraries/LibGUI/Widget.cpp55
-rw-r--r--Libraries/LibGUI/Widget.h7
27 files changed, 59 insertions, 56 deletions
diff --git a/Libraries/LibGUI/BreadcrumbBar.cpp b/Libraries/LibGUI/BreadcrumbBar.cpp
index 690db38466..3670ad59ce 100644
--- a/Libraries/LibGUI/BreadcrumbBar.cpp
+++ b/Libraries/LibGUI/BreadcrumbBar.cpp
@@ -29,6 +29,8 @@
#include <LibGUI/Button.h>
#include <LibGfx/Font.h>
+REGISTER_WIDGET(GUI, BreadcrumbBar)
+
namespace GUI {
// FIXME: Move this somewhere else
diff --git a/Libraries/LibGUI/Button.cpp b/Libraries/LibGUI/Button.cpp
index d1f20f4b80..94f7db79ae 100644
--- a/Libraries/LibGUI/Button.cpp
+++ b/Libraries/LibGUI/Button.cpp
@@ -34,6 +34,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, Button)
+
namespace GUI {
Button::Button(String text)
diff --git a/Libraries/LibGUI/CheckBox.cpp b/Libraries/LibGUI/CheckBox.cpp
index c2329d5abe..b2f4a10456 100644
--- a/Libraries/LibGUI/CheckBox.cpp
+++ b/Libraries/LibGUI/CheckBox.cpp
@@ -31,6 +31,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, CheckBox)
+
namespace GUI {
static const int s_box_width = 13;
diff --git a/Libraries/LibGUI/ColorInput.cpp b/Libraries/LibGUI/ColorInput.cpp
index 94a5e22203..f37522a1d9 100644
--- a/Libraries/LibGUI/ColorInput.cpp
+++ b/Libraries/LibGUI/ColorInput.cpp
@@ -30,6 +30,8 @@
#include <LibGUI/Painter.h>
#include <LibGfx/Palette.h>
+REGISTER_WIDGET(GUI, ColorInput)
+
namespace GUI {
ColorInput::ColorInput()
diff --git a/Libraries/LibGUI/ComboBox.cpp b/Libraries/LibGUI/ComboBox.cpp
index 538f132820..73721a4357 100644
--- a/Libraries/LibGUI/ComboBox.cpp
+++ b/Libraries/LibGUI/ComboBox.cpp
@@ -33,6 +33,8 @@
#include <LibGUI/TextBox.h>
#include <LibGUI/Window.h>
+REGISTER_WIDGET(GUI, ComboBox)
+
namespace GUI {
class ComboBoxEditor final : public TextEditor {
diff --git a/Libraries/LibGUI/Frame.cpp b/Libraries/LibGUI/Frame.cpp
index de0fba6270..47a82b6e14 100644
--- a/Libraries/LibGUI/Frame.cpp
+++ b/Libraries/LibGUI/Frame.cpp
@@ -29,6 +29,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, Frame)
+
namespace GUI {
Frame::Frame()
diff --git a/Libraries/LibGUI/GroupBox.cpp b/Libraries/LibGUI/GroupBox.cpp
index 7b10ada0d2..4a60905452 100644
--- a/Libraries/LibGUI/GroupBox.cpp
+++ b/Libraries/LibGUI/GroupBox.cpp
@@ -30,6 +30,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, GroupBox)
+
namespace GUI {
GroupBox::GroupBox(const StringView& title)
diff --git a/Libraries/LibGUI/ImageWidget.cpp b/Libraries/LibGUI/ImageWidget.cpp
index 69b251f4a0..ca3a736ad6 100644
--- a/Libraries/LibGUI/ImageWidget.cpp
+++ b/Libraries/LibGUI/ImageWidget.cpp
@@ -30,6 +30,8 @@
#include <LibGfx/Bitmap.h>
#include <LibGfx/ImageDecoder.h>
+REGISTER_WIDGET(GUI, ImageWidget)
+
namespace GUI {
ImageWidget::ImageWidget(const StringView&)
diff --git a/Libraries/LibGUI/Label.cpp b/Libraries/LibGUI/Label.cpp
index 605072c36a..de4508f421 100644
--- a/Libraries/LibGUI/Label.cpp
+++ b/Libraries/LibGUI/Label.cpp
@@ -30,6 +30,8 @@
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
+REGISTER_WIDGET(GUI, Label)
+
namespace GUI {
Label::Label(String text)
diff --git a/Libraries/LibGUI/LinkLabel.cpp b/Libraries/LibGUI/LinkLabel.cpp
index a3045f2e70..db6dd09188 100644
--- a/Libraries/LibGUI/LinkLabel.cpp
+++ b/Libraries/LibGUI/LinkLabel.cpp
@@ -31,6 +31,8 @@
#include <LibGfx/Font.h>
#include <LibGfx/Palette.h>
+REGISTER_WIDGET(GUI, LinkLabel)
+
namespace GUI {
LinkLabel::LinkLabel(String text)
diff --git a/Libraries/LibGUI/ListView.cpp b/Libraries/LibGUI/ListView.cpp
index 0c76f85acb..4b304f6751 100644
--- a/Libraries/LibGUI/ListView.cpp
+++ b/Libraries/LibGUI/ListView.cpp
@@ -30,6 +30,8 @@
#include <LibGUI/ScrollBar.h>
#include <LibGfx/Palette.h>
+REGISTER_WIDGET(GUI, ListView)
+
namespace GUI {
ListView::ListView()
diff --git a/Libraries/LibGUI/OpacitySlider.cpp b/Libraries/LibGUI/OpacitySlider.cpp
index 3bfb7e0938..2766226203 100644
--- a/Libraries/LibGUI/OpacitySlider.cpp
+++ b/Libraries/LibGUI/OpacitySlider.cpp
@@ -29,6 +29,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, OpacitySlider)
+
namespace GUI {
OpacitySlider::OpacitySlider(Gfx::Orientation orientation)
diff --git a/Libraries/LibGUI/ProgressBar.cpp b/Libraries/LibGUI/ProgressBar.cpp
index 227016c00c..0e6cd4acbe 100644
--- a/Libraries/LibGUI/ProgressBar.cpp
+++ b/Libraries/LibGUI/ProgressBar.cpp
@@ -30,6 +30,8 @@
#include <LibGUI/ProgressBar.h>
#include <LibGfx/Palette.h>
+REGISTER_WIDGET(GUI, ProgressBar)
+
namespace GUI {
ProgressBar::ProgressBar()
diff --git a/Libraries/LibGUI/RadioButton.cpp b/Libraries/LibGUI/RadioButton.cpp
index bafefffa07..0ee428fe3c 100644
--- a/Libraries/LibGUI/RadioButton.cpp
+++ b/Libraries/LibGUI/RadioButton.cpp
@@ -31,6 +31,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, RadioButton)
+
namespace GUI {
RadioButton::RadioButton(String text)
diff --git a/Libraries/LibGUI/ScrollBar.cpp b/Libraries/LibGUI/ScrollBar.cpp
index 93da0c3d62..ad8bf27e48 100644
--- a/Libraries/LibGUI/ScrollBar.cpp
+++ b/Libraries/LibGUI/ScrollBar.cpp
@@ -31,6 +31,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, ScrollBar)
+
namespace GUI {
static const char* s_up_arrow_bitmap_data = {
diff --git a/Libraries/LibGUI/Slider.cpp b/Libraries/LibGUI/Slider.cpp
index 6989f251c2..9aac47ee11 100644
--- a/Libraries/LibGUI/Slider.cpp
+++ b/Libraries/LibGUI/Slider.cpp
@@ -31,6 +31,10 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, HorizontalSlider)
+REGISTER_WIDGET(GUI, Slider)
+REGISTER_WIDGET(GUI, VerticalSlider)
+
namespace GUI {
Slider::Slider(Orientation orientation)
diff --git a/Libraries/LibGUI/SpinBox.cpp b/Libraries/LibGUI/SpinBox.cpp
index 9c608df3ad..943497c918 100644
--- a/Libraries/LibGUI/SpinBox.cpp
+++ b/Libraries/LibGUI/SpinBox.cpp
@@ -28,6 +28,8 @@
#include <LibGUI/SpinBox.h>
#include <LibGUI/TextBox.h>
+REGISTER_WIDGET(GUI, SpinBox)
+
namespace GUI {
SpinBox::SpinBox()
diff --git a/Libraries/LibGUI/Splitter.cpp b/Libraries/LibGUI/Splitter.cpp
index 7c81cff3b0..246ade1ac4 100644
--- a/Libraries/LibGUI/Splitter.cpp
+++ b/Libraries/LibGUI/Splitter.cpp
@@ -30,6 +30,9 @@
#include <LibGUI/Window.h>
#include <LibGfx/Palette.h>
+REGISTER_WIDGET(GUI, HorizontalSplitter)
+REGISTER_WIDGET(GUI, VerticalSplitter)
+
namespace GUI {
Splitter::Splitter(Orientation orientation)
diff --git a/Libraries/LibGUI/StatusBar.cpp b/Libraries/LibGUI/StatusBar.cpp
index 61484b0fc3..c32b45cf0b 100644
--- a/Libraries/LibGUI/StatusBar.cpp
+++ b/Libraries/LibGUI/StatusBar.cpp
@@ -33,6 +33,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, StatusBar)
+
namespace GUI {
StatusBar::StatusBar(int label_count)
diff --git a/Libraries/LibGUI/TabWidget.cpp b/Libraries/LibGUI/TabWidget.cpp
index 83aa025b5e..4bafddd049 100644
--- a/Libraries/LibGUI/TabWidget.cpp
+++ b/Libraries/LibGUI/TabWidget.cpp
@@ -35,6 +35,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, TabWidget)
+
namespace GUI {
TabWidget::TabWidget()
diff --git a/Libraries/LibGUI/TextBox.cpp b/Libraries/LibGUI/TextBox.cpp
index dd9743bb42..046f8d13a7 100644
--- a/Libraries/LibGUI/TextBox.cpp
+++ b/Libraries/LibGUI/TextBox.cpp
@@ -26,6 +26,8 @@
#include <LibGUI/TextBox.h>
+REGISTER_WIDGET(GUI, TextBox)
+
namespace GUI {
TextBox::TextBox()
diff --git a/Libraries/LibGUI/TextEditor.cpp b/Libraries/LibGUI/TextEditor.cpp
index 0e44875c7c..fe662612b4 100644
--- a/Libraries/LibGUI/TextEditor.cpp
+++ b/Libraries/LibGUI/TextEditor.cpp
@@ -51,6 +51,8 @@
//#define DEBUG_TEXTEDITOR
+REGISTER_WIDGET(GUI, TextEditor)
+
namespace GUI {
TextEditor::TextEditor(Type type)
diff --git a/Libraries/LibGUI/ToolBar.cpp b/Libraries/LibGUI/ToolBar.cpp
index 71994eabdc..c2486ee884 100644
--- a/Libraries/LibGUI/ToolBar.cpp
+++ b/Libraries/LibGUI/ToolBar.cpp
@@ -35,6 +35,8 @@
#include <LibGUI/ToolBar.h>
#include <LibGfx/Palette.h>
+REGISTER_WIDGET(GUI, ToolBar)
+
namespace GUI {
ToolBar::ToolBar(Orientation orientation, int button_size)
diff --git a/Libraries/LibGUI/ToolBarContainer.cpp b/Libraries/LibGUI/ToolBarContainer.cpp
index 717bfb34d4..753691e51b 100644
--- a/Libraries/LibGUI/ToolBarContainer.cpp
+++ b/Libraries/LibGUI/ToolBarContainer.cpp
@@ -30,6 +30,8 @@
#include <LibGfx/Palette.h>
#include <LibGfx/StylePainter.h>
+REGISTER_WIDGET(GUI, ToolBarContainer)
+
namespace GUI {
void ToolBarContainer::child_event(Core::ChildEvent& event)
diff --git a/Libraries/LibGUI/TreeView.cpp b/Libraries/LibGUI/TreeView.cpp
index 80f2bef9f6..0ba87e5617 100644
--- a/Libraries/LibGUI/TreeView.cpp
+++ b/Libraries/LibGUI/TreeView.cpp
@@ -34,6 +34,8 @@
//#define DEBUG_ITEM_RECTS
+REGISTER_WIDGET(GUI, TreeView)
+
namespace GUI {
struct TreeView::MetadataForIndex {
diff --git a/Libraries/LibGUI/Widget.cpp b/Libraries/LibGUI/Widget.cpp
index d7fbd00dd4..5a60d1c87e 100644
--- a/Libraries/LibGUI/Widget.cpp
+++ b/Libraries/LibGUI/Widget.cpp
@@ -29,34 +29,11 @@
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
-#include <LibGUI/BreadcrumbBar.h>
-#include <LibGUI/Button.h>
-#include <LibGUI/CheckBox.h>
-#include <LibGUI/ColorInput.h>
-#include <LibGUI/ComboBox.h>
#include <LibGUI/Event.h>
#include <LibGUI/GMLParser.h>
-#include <LibGUI/GroupBox.h>
-#include <LibGUI/ImageWidget.h>
-#include <LibGUI/Label.h>
#include <LibGUI/Layout.h>
-#include <LibGUI/LinkLabel.h>
-#include <LibGUI/ListView.h>
#include <LibGUI/Menu.h>
-#include <LibGUI/OpacitySlider.h>
#include <LibGUI/Painter.h>
-#include <LibGUI/ProgressBar.h>
-#include <LibGUI/RadioButton.h>
-#include <LibGUI/ScrollBar.h>
-#include <LibGUI/Slider.h>
-#include <LibGUI/SpinBox.h>
-#include <LibGUI/Splitter.h>
-#include <LibGUI/StatusBar.h>
-#include <LibGUI/TabWidget.h>
-#include <LibGUI/TextBox.h>
-#include <LibGUI/ToolBar.h>
-#include <LibGUI/ToolBarContainer.h>
-#include <LibGUI/TreeView.h>
#include <LibGUI/Widget.h>
#include <LibGUI/Window.h>
#include <LibGUI/WindowServerConnection.h>
@@ -66,38 +43,10 @@
#include <LibGfx/Palette.h>
#include <unistd.h>
-namespace GUI {
-
-REGISTER_WIDGET(GUI, BreadcrumbBar)
-REGISTER_WIDGET(GUI, Button)
-REGISTER_WIDGET(GUI, CheckBox)
-REGISTER_WIDGET(GUI, ColorInput)
-REGISTER_WIDGET(GUI, ComboBox)
-REGISTER_WIDGET(GUI, Frame)
-REGISTER_WIDGET(GUI, GroupBox)
-REGISTER_WIDGET(GUI, HorizontalSlider)
-REGISTER_WIDGET(GUI, HorizontalSplitter)
-REGISTER_WIDGET(GUI, ImageWidget)
-REGISTER_WIDGET(GUI, Label)
-REGISTER_WIDGET(GUI, LinkLabel)
-REGISTER_WIDGET(GUI, ListView)
-REGISTER_WIDGET(GUI, OpacitySlider)
-REGISTER_WIDGET(GUI, ProgressBar)
-REGISTER_WIDGET(GUI, RadioButton)
-REGISTER_WIDGET(GUI, ScrollBar)
-REGISTER_WIDGET(GUI, Slider)
-REGISTER_WIDGET(GUI, SpinBox)
-REGISTER_WIDGET(GUI, StatusBar)
-REGISTER_WIDGET(GUI, TabWidget)
-REGISTER_WIDGET(GUI, TextBox)
-REGISTER_WIDGET(GUI, TextEditor)
-REGISTER_WIDGET(GUI, ToolBar)
-REGISTER_WIDGET(GUI, ToolBarContainer)
-REGISTER_WIDGET(GUI, TreeView)
-REGISTER_WIDGET(GUI, VerticalSlider)
-REGISTER_WIDGET(GUI, VerticalSplitter)
REGISTER_WIDGET(GUI, Widget)
+namespace GUI {
+
static HashMap<String, WidgetClassRegistration*>& widget_classes()
{
static HashMap<String, WidgetClassRegistration*>* map;
diff --git a/Libraries/LibGUI/Widget.h b/Libraries/LibGUI/Widget.h
index cde61ef20e..786eb8c371 100644
--- a/Libraries/LibGUI/Widget.h
+++ b/Libraries/LibGUI/Widget.h
@@ -39,9 +39,10 @@
#include <LibGfx/Rect.h>
#include <LibGfx/StandardCursor.h>
-#define REGISTER_WIDGET(namespace_, class_name) \
- extern GUI::WidgetClassRegistration registration_##class_name; \
- GUI::WidgetClassRegistration registration_##class_name(#namespace_ "::" #class_name, []() { return namespace_::class_name::construct(); });
+#define REGISTER_WIDGET(namespace_, class_name) \
+ namespace { \
+ GUI::WidgetClassRegistration registration_##class_name(#namespace_ "::" #class_name, []() { return namespace_::class_name::construct(); }); \
+ }
namespace GUI {