summaryrefslogtreecommitdiff
path: root/src/user/rhello/main.cpp
blob: c92b430bc2a0504e3131b683a7c34443df4f18d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <raleigh/w/padding.h>
#include <raleigh/w/button.h>
#include <raleigh/w/label.h>
#include <raleigh/w/vbox.h>

#include <raleigh/runtime.h>
#include <raleigh/window.h>

#include <popups/info.h>
#include <pland/pcrt.h>

using namespace raleigh;

window *p_w;

void onclick(button &from) {
  p_w->show();
}

void main() {
  label l("Hello, world! Close me with Alt+F4.");
  padding pl(l, 2);

  label bl("Click me!");
  padding pbl(bl, 4);
  button b(pbl, &onclick);
  padding pb(b, 2);

  dllist<widget &> wl;
  wl.add_front(pb);
  wl.add_front(pl);
  vbox vb(wl);
  padding pvb(vb, 2);

  window w(pvb, RGB(bf, bf, bf), (bool (*)(window &))&__pcrt_quit);

  label p_l("You clicked that button!");
  padding p_pl(p_l, 4);
  p_w = new window(p_pl);

  w.show();
  start_runtime();
}