VisualBuilder: Add GGroupBox.

The icon currently looks better than a real GGroupBox. I have to fix that.
This commit is contained in:
Andreas Kling 2019-04-11 13:46:25 +02:00
parent 16990fece3
commit f0501a0102
Notes: sideshowbarker 2024-07-19 14:45:23 +09:00
4 changed files with 11 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include <LibGUI/GProgressBar.h>
#include <LibGUI/GCheckBox.h>
#include <LibGUI/GScrollBar.h>
#include <LibGUI/GGroupBox.h>
static GWidget* build_gwidget(WidgetType type, GWidget* parent)
{
@ -16,6 +17,8 @@ static GWidget* build_gwidget(WidgetType type, GWidget* parent)
return new GWidget(parent);
case WidgetType::GScrollBar:
return new GScrollBar(Orientation::Vertical, parent);
case WidgetType::GGroupBox:
return new GGroupBox("groupbox_1", parent);
case WidgetType::GLabel: {
auto* label = new GLabel(parent);
label->set_text("label_1");

View file

@ -33,6 +33,7 @@ enum class WidgetType {
GProgressBar,
GCheckBox,
GScrollBar,
GGroupBox,
};
class VBWidget : public Retainable<VBWidget>, public Weakable<VBWidget> {

View file

@ -116,5 +116,12 @@ GWindow* make_toolbox_window()
if (auto* form = VBForm::current())
form->insert_widget(WidgetType::GScrollBar);
};
auto* groupbox_button = new GButton(widget);
groupbox_button->set_tooltip("GGroupBox");
groupbox_button->set_icon(GraphicsBitmap::load_from_file("/res/icons/vbwidgets/groupbox.png"));
groupbox_button->on_click = [] (GButton&) {
if (auto* form = VBForm::current())
form->insert_widget(WidgetType::GGroupBox);
};
return window;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B