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

Add a clock widget.

This commit is contained in:
Andreas Kling 2018-10-12 12:18:59 +02:00
parent 6637dec958
commit 73895ce043
12 changed files with 143 additions and 15 deletions

View file

@ -6,6 +6,7 @@
#include "TerminalWidget.h"
#include "WindowManager.h"
#include "Window.h"
#include "ClockWidget.h"
#include <cstdio>
int main(int c, char** v)
@ -20,38 +21,43 @@ int main(int c, char** v)
auto* fontTestWindow = new Window;
fontTestWindow->setTitle("Font test");
fontTestWindow->setRect({100, 100, 300, 80 });
fontTestWindow->setRect({ 100, 100, 300, 80 });
auto* fontTestWindowWidget = new Widget;
fontTestWindow->setMainWidget(fontTestWindowWidget);
fontTestWindowWidget->setRect({0, 0, 300, 80 });
fontTestWindowWidget->setRect({ 0, 0, 300, 80 });
auto* l1 = new Label(fontTestWindowWidget);
l1->setRect(Rect(0, 0, 300, 20));
l1->setRect({ 0, 0, 300, 20 });
l1->setText("0123456789");
auto* l2 = new Label(fontTestWindowWidget);
l2->setRect(Rect(0, 20, 300, 20));
l2->setRect({ 0, 20, 300, 20 });
l2->setText("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
auto* l3 = new Label(fontTestWindowWidget);
l3->setRect(Rect(0, 40, 300, 20));
l3->setRect({ 0, 40, 300, 20 });
l3->setText("abcdefghijklmnopqrstuvwxyz");
auto* l4 = new Label(fontTestWindowWidget);
l4->setRect(Rect(0, 60, 300, 20));
l4->setRect({ 0, 60, 300, 20 });
l4->setText("!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~");
auto* b = new Button(&w);
b->setRect(Rect(10, 10, 100, 30));
b->setRect({ 10, 10, 100, 30 });
b->setCaption("Button!");
auto* win = new Window;
win->setTitle("Console");
win->setRect({100, 300, 644, 254});
win->setRect({ 100, 300, 644, 254 });
auto* t = new TerminalWidget(nullptr);
win->setMainWidget(t);
auto* clockWin = new Window;
clockWin->setTitle("Clock");
clockWin->setRect({ 500, 50, 100, 40 });
clockWin->setMainWidget(new ClockWidget);
return loop.exec();
}