1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

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
4 changed files with 11 additions and 0 deletions

View file

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

View file

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

View file

@ -116,5 +116,12 @@ GWindow* make_toolbox_window()
if (auto* form = VBForm::current()) if (auto* form = VBForm::current())
form->insert_widget(WidgetType::GScrollBar); 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; return window;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B