mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibGUI: Convert custom widgets and subclasses to ObjectPtr
This commit is contained in:
parent
15a66dc8ab
commit
defafd72bc
30 changed files with 57 additions and 47 deletions
|
@ -5,8 +5,8 @@
|
|||
#include <LibGUI/GWidget.h>
|
||||
|
||||
class VBForm : public GWidget {
|
||||
C_OBJECT(VBForm)
|
||||
friend class VBWidget;
|
||||
|
||||
public:
|
||||
explicit VBForm(const String& name, GWidget* parent = nullptr);
|
||||
virtual ~VBForm() override;
|
||||
|
|
|
@ -6,6 +6,7 @@ class GTableView;
|
|||
class GTextBox;
|
||||
|
||||
class VBPropertiesWindow final : public GWindow {
|
||||
C_OBJECT(VBPropertiesWindow)
|
||||
public:
|
||||
VBPropertiesWindow();
|
||||
virtual ~VBPropertiesWindow() override;
|
||||
|
|
|
@ -23,10 +23,10 @@ int main(int argc, char** argv)
|
|||
{
|
||||
GApplication app(argc, argv);
|
||||
|
||||
auto* propbox = new VBPropertiesWindow;
|
||||
auto propbox = VBPropertiesWindow::construct();
|
||||
|
||||
auto* form1 = new VBForm("Form1");
|
||||
form1->on_widget_selected = [propbox](VBWidget* widget) {
|
||||
auto form1 = VBForm::construct("Form1");
|
||||
form1->on_widget_selected = [&](VBWidget* widget) {
|
||||
propbox->table_view().set_model(widget ? &widget->property_model() : nullptr);
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ int main(int argc, char** argv)
|
|||
file_menu->add_action(GAction::create("Dump Form", [&](auto&) {
|
||||
form1->dump();
|
||||
}));
|
||||
file_menu->add_action(GAction::create("Save Form...", { Mod_Ctrl, Key_S }, [form1](auto&) {
|
||||
file_menu->add_action(GAction::create("Save Form...", { Mod_Ctrl, Key_S }, [&](auto&) {
|
||||
form1->write_to_file("/tmp/form.frm");
|
||||
}));
|
||||
menubar->add_menu(move(file_menu));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue