mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 18:55:07 +00:00
VisualBuilder: Make it possible to insert widgets from the toolbox.
This commit is contained in:
parent
c71ece77fa
commit
75c76f6692
3 changed files with 41 additions and 6 deletions
|
@ -2,14 +2,9 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GApplication.h>
|
||||
#include <LibGUI/GStatusBar.h>
|
||||
#include <LibGUI/GToolBar.h>
|
||||
#include <LibGUI/GMenuBar.h>
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
#include <LibGUI/GAction.h>
|
||||
#include <LibGUI/GFontDatabase.h>
|
||||
#include <LibCore/CFile.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
#include "VBForm.h"
|
||||
#include "VBWidget.h"
|
||||
#include <unistd.h>
|
||||
|
@ -68,6 +63,26 @@ GWindow* make_toolbox_window()
|
|||
|
||||
auto* widget = new GWidget;
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
window->set_main_widget(widget);
|
||||
|
||||
auto* button_button = new GButton(widget);
|
||||
button_button->set_caption("Button");
|
||||
button_button->on_click = [] (GButton&) {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(WidgetType::GButton);
|
||||
};
|
||||
auto* spinbox_button = new GButton(widget);
|
||||
spinbox_button->set_caption("SpinBox");
|
||||
spinbox_button->on_click = [] (GButton&) {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(WidgetType::GSpinBox);
|
||||
};
|
||||
auto* editor_button = new GButton(widget);
|
||||
editor_button->set_caption("TextEditor");
|
||||
editor_button->on_click = [] (GButton&) {
|
||||
if (auto* form = VBForm::current())
|
||||
form->insert_widget(WidgetType::GTextEditor);
|
||||
};
|
||||
return window;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue