]> Dogcows Code - chaz/openbox/blob - otk/otk_test.cc
more deps
[chaz/openbox] / otk / otk_test.cc
1 #include "focuswidget.hh"
2 #include "button.hh"
3 #include "display.hh"
4 #include "configuration.hh"
5 #include "timerqueuemanager.hh"
6 #include "image.hh"
7 #include "style.hh"
8
9 int main(void) {
10 otk::OBDisplay::initialize(NULL);
11 otk::Configuration style_conf(False);
12 otk::OBTimerQueueManager *tm = new otk::OBTimerQueueManager();
13 const otk::ScreenInfo *s_info =
14 otk::OBDisplay::screenInfo(DefaultScreen(otk::OBDisplay::display));
15 otk::BImageControl *ctrl = new otk::BImageControl(tm, s_info, True, 4, 5, 200);
16
17 otk::Style *my_style = new otk::Style(ctrl);
18
19 style_conf.setFile("/usr/local/share/openbox/styles/artwiz");
20 style_conf.load();
21
22 my_style->load(style_conf);
23
24 otk::OtkFocusWidget foo(my_style);
25 otk::OtkButton iconb(&foo);
26 otk::OtkFocusWidget label(&foo);
27 otk::OtkButton maxb(&foo);
28 otk::OtkButton closeb(&foo);
29
30 foo.setBevelWidth(2);
31 foo.setDirection(otk::OtkWidget::Vertical);
32
33 foo.setHeight(400);
34 foo.setTexture(my_style->getTitleFocus());
35 foo.setUnfocusTexture(my_style->getTitleUnfocus());
36
37 // fixed size
38 iconb.setText("foo");
39 iconb.press();
40
41 // fix width to 60 and let the height be calculated by its parent
42 label.setWidth(60);
43 label.setStretchableVert(true);
44 label.setTexture(my_style->getLabelFocus());
45 label.setUnfocusTexture(my_style->getLabelUnfocus());
46
47 // fixed size
48 maxb.setText("bar");
49
50 // fixed size
51 closeb.setText("fuubar");
52
53 // will recursively unfocus its children
54 //foo.unfocus();
55 foo.update();
56 foo.show();
57
58 while (1) {
59 if (XPending(otk::OBDisplay::display)) {
60 XEvent e;
61 XNextEvent(otk::OBDisplay::display, &e);
62 }
63 }
64
65 delete my_style;
66 delete tm;
67 delete ctrl;
68
69 otk::OBDisplay::destroy();
70
71 return 0;
72 }
This page took 0.035713 seconds and 4 git commands to generate.