mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
VisualBuilder: Support loading a saved form from JSON.
The form to load is specified on the command line, e.g "vb test.frm".
This commit is contained in:
parent
57a589a6e7
commit
b729b5fc64
5 changed files with 72 additions and 17 deletions
|
@ -11,7 +11,7 @@
|
|||
#include <LibGUI/GSpinBox.h>
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
|
||||
static String to_class_name(VBWidgetType type)
|
||||
String to_class_name(VBWidgetType type)
|
||||
{
|
||||
switch (type) {
|
||||
case VBWidgetType::GWidget:
|
||||
|
@ -41,6 +41,33 @@ static String to_class_name(VBWidgetType type)
|
|||
}
|
||||
}
|
||||
|
||||
VBWidgetType widget_type_from_class_name(const StringView& name)
|
||||
{
|
||||
if (name == "GWidget")
|
||||
return VBWidgetType::GWidget;
|
||||
if (name == "GButton")
|
||||
return VBWidgetType::GButton;
|
||||
if (name == "GLabel")
|
||||
return VBWidgetType::GLabel;
|
||||
if (name == "GSpinBox")
|
||||
return VBWidgetType::GSpinBox;
|
||||
if (name == "GTextEditor")
|
||||
return VBWidgetType::GTextEditor;
|
||||
if (name == "GProgressBar")
|
||||
return VBWidgetType::GProgressBar;
|
||||
if (name == "GCheckBox")
|
||||
return VBWidgetType::GCheckBox;
|
||||
if (name == "GRadioButton")
|
||||
return VBWidgetType::GRadioButton;
|
||||
if (name == "GScrollBar")
|
||||
return VBWidgetType::GScrollBar;
|
||||
if (name == "GGroupBox")
|
||||
return VBWidgetType::GGroupBox;
|
||||
if (name == "GSlider")
|
||||
return VBWidgetType::GSlider;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
static GWidget* build_gwidget(VBWidgetType type, GWidget* parent)
|
||||
{
|
||||
switch (type) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue