]> Dogcows Code - chaz/openbox/blob - otk/otk_test.cc
widget update fix
[chaz/openbox] / otk / otk_test.cc
1 #include "widget.hh"
2 #include "focuswidget.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::OtkFocusWidget iconb(&foo);
26 otk::OtkFocusWidget label(&foo);
27 otk::OtkFocusWidget maxb(&foo);
28 otk::OtkFocusWidget 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.resize(15, 15);
39 iconb.setTexture(my_style->getButtonFocus());
40 iconb.setUnfocusTexture(my_style->getButtonUnfocus());
41
42 // fix width to 60 and let the height be calculated by its parent
43 label.setWidth(60);
44 label.setStretchableVert(true);
45 label.setTexture(my_style->getLabelFocus());
46 label.setUnfocusTexture(my_style->getLabelUnfocus());
47
48 // fixed size
49 maxb.resize(15, 15);
50 maxb.setTexture(my_style->getButtonFocus());
51 maxb.setUnfocusTexture(my_style->getButtonUnfocus());
52
53 // fixed size
54 closeb.resize(15, 15);
55 closeb.setTexture(my_style->getButtonFocus());
56 closeb.setUnfocusTexture(my_style->getButtonUnfocus());
57
58 // will recursively unfocus its children
59 //foo.unfocus();
60 foo.show();
61
62 while (1) {
63 if (XPending(otk::OBDisplay::display)) {
64 XEvent e;
65 XNextEvent(otk::OBDisplay::display, &e);
66 }
67 }
68
69 delete my_style;
70 delete tm;
71 delete ctrl;
72
73 otk::OBDisplay::destroy();
74
75 return 0;
76 }
This page took 0.040791 seconds and 4 git commands to generate.