mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 13:15:07 +00:00
VisualBuilder: Move properties window to its own class.
This commit is contained in:
parent
21d4b1c2fc
commit
ec841f3a23
4 changed files with 43 additions and 22 deletions
|
@ -4,6 +4,7 @@ OBJS = \
|
|||
VBWidgetRegistry.o \
|
||||
VBWidgetPropertyModel.o \
|
||||
VBProperty.o \
|
||||
VBPropertiesWindow.o \
|
||||
main.o
|
||||
|
||||
APP = VisualBuilder
|
||||
|
|
21
Applications/VisualBuilder/VBPropertiesWindow.cpp
Normal file
21
Applications/VisualBuilder/VBPropertiesWindow.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "VBPropertiesWindow.h"
|
||||
#include <LibGUI/GWidget.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
|
||||
VBPropertiesWindow::VBPropertiesWindow()
|
||||
{
|
||||
set_title("Properties");
|
||||
set_rect(780, 200, 200, 280);
|
||||
|
||||
auto* widget = new GWidget;
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
set_main_widget(widget);
|
||||
|
||||
m_table_view = new GTableView(widget);
|
||||
}
|
||||
|
||||
VBPropertiesWindow::~VBPropertiesWindow()
|
||||
{
|
||||
}
|
17
Applications/VisualBuilder/VBPropertiesWindow.h
Normal file
17
Applications/VisualBuilder/VBPropertiesWindow.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GWindow.h>
|
||||
|
||||
class GTableView;
|
||||
|
||||
class VBPropertiesWindow final : public GWindow {
|
||||
public:
|
||||
VBPropertiesWindow();
|
||||
virtual ~VBPropertiesWindow() override;
|
||||
|
||||
GTableView& table_view() { return *m_table_view; }
|
||||
const GTableView& table_view() const { return *m_table_view; }
|
||||
|
||||
private:
|
||||
GTableView* m_table_view { nullptr };
|
||||
};
|
|
@ -9,25 +9,23 @@
|
|||
#include "VBForm.h"
|
||||
#include "VBWidget.h"
|
||||
#include "VBWidgetPropertyModel.h"
|
||||
#include "VBPropertiesWindow.h"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static GWindow* make_toolbox_window();
|
||||
static GWindow* make_properties_window();
|
||||
|
||||
GTableView* g_property_table_view;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
GApplication app(argc, argv);
|
||||
|
||||
auto* propbox = make_properties_window();
|
||||
auto* propbox = new VBPropertiesWindow;
|
||||
|
||||
auto* form1 = new VBForm("Form1");
|
||||
form1->on_widget_selected = [] (VBWidget* widget) {
|
||||
g_property_table_view->set_model(widget ? &widget->property_model() : nullptr);
|
||||
form1->on_widget_selected = [propbox] (VBWidget* widget) {
|
||||
propbox->table_view().set_model(widget ? &widget->property_model() : nullptr);
|
||||
};
|
||||
|
||||
auto menubar = make<GMenuBar>();
|
||||
|
@ -137,19 +135,3 @@ GWindow* make_toolbox_window()
|
|||
};
|
||||
return window;
|
||||
}
|
||||
|
||||
GWindow* make_properties_window()
|
||||
{
|
||||
auto* window = new GWindow;
|
||||
window->set_title("Properties");
|
||||
window->set_rect(780, 200, 200, 280);
|
||||
|
||||
auto* widget = new GWidget;
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
window->set_main_widget(widget);
|
||||
|
||||
g_property_table_view = new GTableView(widget);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue