1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

Demos: Add a HelloWorld2 demo.

This is a simple test app with its UI generated from a VisualBuilder form.
The name is probably silly, but who cares. :^)
This commit is contained in:
Andreas Kling 2019-07-10 21:13:29 +02:00
parent b3d431e390
commit 0bf5c6fa3a
6 changed files with 58 additions and 0 deletions

1
Demos/HelloWorld2/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
UI_*.h

View file

@ -0,0 +1 @@
{"name":"HelloWorld2","widgets":[{"name":"w1","tooltip":null,"backcolor":"#d4d0c8ff","forecolor":"#000000ff","text":"Hello world!","class":"GLabel","autofill":true,"enabled":true,"visible":true,"x":5,"height":26,"y":5,"width":121},{"name":"w2","tooltip":null,"backcolor":"#d4d0c8ff","forecolor":"#000000ff","text":"Lefty","class":"GButton","autofill":false,"enabled":true,"visible":true,"x":5,"height":26,"y":40,"width":51},{"name":"w3","tooltip":null,"backcolor":"#d4d0c8ff","forecolor":"#000000ff","text":"Righty","class":"GButton","autofill":false,"enabled":true,"visible":true,"x":80,"height":26,"y":40,"width":51},{"name":"w4","enabled":true,"forecolor":"#000000ff","checked":false,"autofill":false,"x":150,"tooltip":null,"height":26,"width":91,"y":5,"class":"GCheckBox","text":"Awesome","backcolor":"#d4d0c8ff","visible":true},{"name":"w5","enabled":true,"forecolor":"#000000ff","checked":false,"autofill":false,"x":150,"tooltip":null,"height":26,"width":51,"y":30,"class":"GCheckBox","text":"Cool","backcolor":"#d4d0c8ff","visible":true}]}

View file

@ -0,0 +1,27 @@
include ../../Makefile.common
OBJS = \
main.o
APP = HelloWorld2
DEFINES += -DUSERLAND
all: $(APP)
main.cpp: UI_HelloWorld2.h
UI_HelloWorld2.h: HelloWorld2.frm
../../DevTools/FormCompiler/FormCompiler $< > $@
$(APP): $(OBJS)
$(LD) -o $(APP) $(LDFLAGS) $(OBJS) -lgui -lcore -lc
.cpp.o:
@echo "CXX $<"; $(CXX) $(CXXFLAGS) -o $@ -c $<
-include $(OBJS:%.o=%.d)
clean:
@echo "CLEAN"; rm -f $(APP) $(OBJS) *.d

View file

@ -0,0 +1,26 @@
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
#include <LibGUI/GButton.h>
#include <LibGUI/GLabel.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
#include "UI_HelloWorld2.h"
int main(int argc, char** argv)
{
GApplication app(argc, argv);
auto* window = new GWindow;
window->set_rect(100, 100, 240, 160);
window->set_title("Hello World!");
auto* ui = new UI_HelloWorld2;
window->set_main_widget(ui->main_widget);
ui->w3->on_click = [&](auto&) {
app.quit();
};
window->show();
return app.exec();
}