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