mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
VisualBuilder: Add GGroupBox.
The icon currently looks better than a real GGroupBox. I have to fix that.
This commit is contained in:
parent
16990fece3
commit
f0501a0102
Notes:
sideshowbarker
2024-07-19 14:45:23 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/f0501a0102e
4 changed files with 11 additions and 0 deletions
|
@ -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");
|
||||
|
|
|
@ -33,6 +33,7 @@ enum class WidgetType {
|
|||
GProgressBar,
|
||||
GCheckBox,
|
||||
GScrollBar,
|
||||
GGroupBox,
|
||||
};
|
||||
|
||||
class VBWidget : public Retainable<VBWidget>, public Weakable<VBWidget> {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
BIN
Base/res/icons/vbwidgets/groupbox.png
Normal file
BIN
Base/res/icons/vbwidgets/groupbox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 177 B |
Loading…
Reference in a new issue