mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:15:09 +00:00
HackStudio: Add placeholder code to test widget factory construction
We now use the magical widget registry to factory-construct widgets and place them into the form. This will need all kinds of work, but it's nice that the mechanism is working as intended.
This commit is contained in:
parent
2da058c7f2
commit
f92e0f7d80
2 changed files with 7 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "EditorWrapper.h"
|
||||
#include "FindInFilesWidget.h"
|
||||
#include "FormEditorWidget.h"
|
||||
#include "FormWidget.h"
|
||||
#include "Locator.h"
|
||||
#include "Project.h"
|
||||
#include "TerminalWrapper.h"
|
||||
|
@ -132,8 +133,9 @@ int main(int argc, char** argv)
|
|||
|
||||
GWidgetClassRegistration::for_each([&](const GWidgetClassRegistration& reg) {
|
||||
auto icon_path = String::format("/res/icons/widgets/%s.png", reg.class_name().characters());
|
||||
auto action = GAction::create(reg.class_name(), GraphicsBitmap::load_from_file(icon_path), [&](auto&) {
|
||||
|
||||
auto action = GAction::create(reg.class_name(), GraphicsBitmap::load_from_file(icon_path), [®](auto&) {
|
||||
auto widget = reg.construct(&g_form_editor_widget->form_widget());
|
||||
widget->set_relative_rect(30, 30, 30, 30);
|
||||
});
|
||||
form_widgets_toolbar->add_action(move(action));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue