Rune - Further Object abstraction work
[rune.git] / tests / gfxinput2.d
1 #!/usr/local/bin/rune -x
2 #
3 #       Graphical test
4
5 import "sys";
6 import <stdio>;
7 import <gfx>;
8 import <gadgets>;
9
10 alias stdio.File @stdout = stdio.stdout;
11
12 typedef gfx.Event               Event;
13 typedef gfx.Frame               Frame;
14
15 subclass MyInput from gadgets.InputFrame {
16     refine public global const int BUFSIZE = 10;
17
18     refine public method
19     void
20     inputExecute(string_p text)
21     {
22         stdout->show("ENTER! ", text);
23         stdout->show("BUFSIZE 10? ", this->BUFSIZE);
24         // sizeof() for this->buf is unhappy
25         //      , sizeof(this->buf)
26     }
27     int z;
28 }
29
30 typedef int myint_t = -44;
31
32 int
33 main(int ac, string_p *av)
34 {
35     Frame @frame;
36     Frame @frame1;
37     MyInput @input;
38     int i;
39     int j;
40     myint_t x;
41
42     frame.createFrame("BODY", gfx.root, 0, 0, BODY);
43     frame->setBGColor(255, 129, 0);
44     for (i = 0; i < 15; ++i) {
45         stdio.stdout->efd.write("X", 1);
46         frame1.createFrame("LEFT", frame, 0, 0, LEFT);
47         for (j = 0; j < 60; ++j) {
48             input.createInput(frame1, 0, 0, ABOVE, "Input:");
49             if (i == 0 && j == 0) {
50                 stdio.stdout->show("MYINPUT ",
51                     input->BUFSIZE, sizeof(input->buf));
52             }
53             input->setBlinking(1);
54         }
55     }
56     frame->recalc();
57     frame->flush();
58     Thread.waitThreads();               # wait until all threads have exited
59     return(0);
60 }