]> Dogcows Code - chaz/openbox/blob - otk/otk_test.cc
state the license. killall the old readme data
[chaz/openbox] / otk / otk_test.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #ifdef HAVE_CONFIG_H
4 # include "../config.h"
5 #endif
6
7 #include "application.hh"
8 #include "focuswidget.hh"
9 #include "appwidget.hh"
10 #include "button.hh"
11
12 int main(int argc, char **argv) {
13 otk::Application app(argc, argv);
14
15 otk::AppWidget foo(&app);
16
17 foo.resize(600, 500);
18 foo.setTexture(app.getStyle()->getTitleFocus());
19 // foo.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
20
21 foo.setBevelWidth(2);
22 foo.setDirection(otk::Widget::Horizontal);
23
24 otk::FocusWidget left(&foo);
25 otk::FocusWidget right(&foo);
26
27 left.setDirection(otk::Widget::Horizontal);
28 left.setStretchableVert(true);
29 left.setStretchableHorz(true);
30 left.setTexture(app.getStyle()->getTitleFocus());
31 left.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
32
33 right.setDirection(otk::Widget::Vertical);
34 right.setBevelWidth(10);
35 right.setStretchableVert(true);
36 right.setWidth(300);
37 right.setTexture(app.getStyle()->getTitleFocus());
38 right.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
39
40 otk::Button iconb(&left);
41 iconb.resize(40,20);
42 otk::FocusWidget label(&left);
43 otk::Button maxb(&left);
44 otk::Button closeb(&left);
45
46 // fixed size
47 iconb.setText("foo");
48 iconb.press(Button1);
49
50 // fix width to 60 and let the height be calculated by its parent
51 //label.setHeight(20);
52 label.setStretchableVert(true);
53 label.setStretchableHorz(true);
54 label.setTexture(app.getStyle()->getLabelFocus());
55 label.setUnfocusTexture(app.getStyle()->getLabelUnfocus());
56
57 // fixed size
58 maxb.setText("bar");
59
60 // fixed size
61 closeb.setText("fuubar");
62
63 otk::FocusWidget rblef(&right);
64 otk::Button rbutt1(&right);
65 otk::Button rbutt2(&right);
66
67 rblef.setStretchableHorz(true);
68 rblef.setHeight(50);
69 rblef.setTexture(app.getStyle()->getHandleFocus());
70 rblef.setUnfocusTexture(app.getStyle()->getHandleUnfocus());
71
72 rbutt1.setText("this is fucking tight");
73 rbutt2.setText("heh, WOOP");
74
75 // will recursively unfocus its children
76 //foo.unfocus();
77
78 foo.show();
79
80 app.exec();
81
82 return 0;
83 }
This page took 0.036033 seconds and 4 git commands to generate.