]> icculus.org git repositories - mikachu/openbox.git/blob - otk/otk_test.cc
HOOGE improvements. now widgets calculate their size according to the sizes of their...
[mikachu/openbox.git] / otk / otk_test.cc
1 #include "widget.hh"
2 #include "display.hh"
3 #include "configuration.hh"
4 #include "timerqueuemanager.hh"
5 #include "image.hh"
6 #include "style.hh"
7
8 int main(void) {
9   otk::OBDisplay::initialize(NULL);
10   otk::Configuration style_conf(False);
11   otk::OBTimerQueueManager *tm = new otk::OBTimerQueueManager();
12   const otk::ScreenInfo *s_info =
13     otk::OBDisplay::screenInfo(DefaultScreen(otk::OBDisplay::display));
14   otk::BImageControl *ctrl = new otk::BImageControl(tm, s_info, True, 4, 5, 200);
15
16   otk::Style *my_style = new otk::Style(0ul, ctrl);
17
18   const char *sfile = "/usr/local/share/openbox/styles/artwiz";
19   
20   style_conf.setFile(sfile);
21   style_conf.load();
22
23   my_style->load(style_conf);
24
25   otk::OtkWidget foo(my_style);
26   otk::OtkWidget bar(&foo);
27   otk::OtkWidget baz(&foo);
28   otk::OtkWidget blef(&bar);
29
30   foo.setTexture(my_style->getButtonFocus());
31   foo.setGeometry(0, 0, 100, 110);
32
33   bar.setTexture(my_style->getLabelFocus());
34   bar.setGeometry(10, 10, 80, 40);
35
36   baz.setTexture(my_style->getLabelFocus());
37   baz.setGeometry(10, 60, 80, 40);
38
39   blef.setTexture(my_style->getHandleFocus());
40   blef.setGeometry(10, 10, 60, 20);
41
42   foo.show();
43
44   while (1) {
45     if (XPending(otk::OBDisplay::display)) {
46       XEvent e;
47       XNextEvent(otk::OBDisplay::display, &e);
48     } 
49   }
50
51   delete my_style;
52   delete tm;
53   delete ctrl;
54
55   otk::OBDisplay::destroy();
56
57   return 0;
58 }