summaryrefslogtreecommitdiff
path: root/src/user/mkpopup/main.cpp
blob: 5e3310ccadf12604b08ed2793b02677fbad04a8c (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/label.h>
#include <raleigh/w/vbox.h>
#include <raleigh/window.h>
#include <knob/block.h>

using namespace raleigh;

widget *make_line(const char *str) {
  return new label(str);
}

void main(const char *text) {
  dllist<widget &> box_widgets;

  char *const data = strdup(text);

  char *this_string = data;
  while (*this_string) {
    char *i = this_string;
    while (1) {
      if (!i[0]) {
        box_widgets.add_back(*make_line(this_string));
        this_string = i;
        break;
      }
      if ((i[0] == '\\') && (i[1] == 'n')) {
        i[0] = '\0';
        box_widgets.add_back(*make_line(this_string));
        this_string = i + 2;
        break;
      }
      ++i;
    }
  }

  vbox box(box_widgets);
  padding p(box, 4);
  window w(p);

  w.show();
  start_runtime();
}