1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:28:11 +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();
}

View file

@ -77,6 +77,7 @@ cp ../Applications/TextEditor/TextEditor mnt/bin/TextEditor
cp ../Applications/PaintBrush/PaintBrush mnt/bin/PaintBrush
cp ../Applications/QuickShow/QuickShow mnt/bin/QuickShow
cp ../Demos/HelloWorld/HelloWorld mnt/bin/HelloWorld
cp ../Demos/HelloWorld2/HelloWorld2 mnt/bin/HelloWorld2
cp ../Demos/RetroFetch/RetroFetch mnt/bin/RetroFetch
cp ../Demos/WidgetGallery/WidgetGallery mnt/bin/WidgetGallery
cp ../Demos/Fire/Fire mnt/bin/Fire
@ -94,6 +95,7 @@ echo -n "installing shortcuts... "
ln -s Downloader mnt/bin/dl
ln -s FileManager mnt/bin/fm
ln -s HelloWorld mnt/bin/hw
ln -s HelloWorld2 mnt/bin/hw2
ln -s IRCClient mnt/bin/irc
ln -s Minesweeper mnt/bin/ms
ln -s Shell mnt/bin/sh

View file

@ -40,6 +40,7 @@ build_targets="$build_targets ../Games/Minesweeper"
build_targets="$build_targets ../Games/Snake"
build_targets="$build_targets ../Shell"
build_targets="$build_targets ../Demos/HelloWorld"
build_targets="$build_targets ../Demos/HelloWorld2"
build_targets="$build_targets ../Demos/RetroFetch"
build_targets="$build_targets ../Demos/WidgetGallery"
build_targets="$build_targets ../Demos/Fire"