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