summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-07-10 21:13:29 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-07-10 21:13:29 +0200
commit0bf5c6fa3ae9bfbb560fbebfa5712c4ca60ed10b (patch)
treef3f548f033453281930f4177cc313b3dc7a38637
parentb3d431e3906014644e936232029f9a8a11332e68 (diff)
downloadserenity-0bf5c6fa3ae9bfbb560fbebfa5712c4ca60ed10b.zip
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. :^)
-rw-r--r--Demos/HelloWorld2/.gitignore1
-rw-r--r--Demos/HelloWorld2/HelloWorld2.frm1
-rw-r--r--Demos/HelloWorld2/Makefile27
-rw-r--r--Demos/HelloWorld2/main.cpp26
-rwxr-xr-xKernel/build-root-filesystem.sh2
-rwxr-xr-xKernel/makeall.sh1
6 files changed, 58 insertions, 0 deletions
diff --git a/Demos/HelloWorld2/.gitignore b/Demos/HelloWorld2/.gitignore
new file mode 100644
index 0000000000..0e7af5b54f
--- /dev/null
+++ b/Demos/HelloWorld2/.gitignore
@@ -0,0 +1 @@
+UI_*.h
diff --git a/Demos/HelloWorld2/HelloWorld2.frm b/Demos/HelloWorld2/HelloWorld2.frm
new file mode 100644
index 0000000000..932975dfe4
--- /dev/null
+++ b/Demos/HelloWorld2/HelloWorld2.frm
@@ -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}]}
diff --git a/Demos/HelloWorld2/Makefile b/Demos/HelloWorld2/Makefile
new file mode 100644
index 0000000000..e80c421368
--- /dev/null
+++ b/Demos/HelloWorld2/Makefile
@@ -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
+
diff --git a/Demos/HelloWorld2/main.cpp b/Demos/HelloWorld2/main.cpp
new file mode 100644
index 0000000000..1d3830c17c
--- /dev/null
+++ b/Demos/HelloWorld2/main.cpp
@@ -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();
+}
diff --git a/Kernel/build-root-filesystem.sh b/Kernel/build-root-filesystem.sh
index 9bddcafc71..b523f03a58 100755
--- a/Kernel/build-root-filesystem.sh
+++ b/Kernel/build-root-filesystem.sh
@@ -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
diff --git a/Kernel/makeall.sh b/Kernel/makeall.sh
index 8ad9fa7f09..331629263b 100755
--- a/Kernel/makeall.sh
+++ b/Kernel/makeall.sh
@@ -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"