]> Dogcows Code - chaz/openbox/blob - otk/otk_test.cc
add an OtkAppWidget which are "root windows", i.e. the managed child of root, to...
[chaz/openbox] / otk / otk_test.cc
1 #include "application.hh"
2 #include "focuswidget.hh"
3 #include "appwidget.hh"
4 #include "button.hh"
5
6 int main(int argc, char **argv) {
7 otk::OtkApplication app(argc, argv);
8
9 otk::OtkAppWidget foo(&app);
10
11 foo.resize(600, 500);
12 foo.setTexture(app.getStyle()->getTitleFocus());
13 // foo.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
14
15 foo.setBevelWidth(2);
16 foo.setDirection(otk::OtkWidget::Horizontal);
17
18 otk::OtkFocusWidget left(&foo);
19 otk::OtkFocusWidget right(&foo);
20
21 left.setDirection(otk::OtkWidget::Horizontal);
22 left.setStretchableVert(true);
23 left.setStretchableHorz(true);
24 left.setTexture(app.getStyle()->getTitleFocus());
25 left.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
26
27 right.setDirection(otk::OtkWidget::Vertical);
28 right.setBevelWidth(10);
29 right.setStretchableVert(true);
30 right.setWidth(300);
31 right.setTexture(app.getStyle()->getTitleFocus());
32 right.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
33
34 otk::OtkButton iconb(&left);
35 iconb.resize(40,20);
36 otk::OtkFocusWidget label(&left);
37 otk::OtkButton maxb(&left);
38 otk::OtkButton closeb(&left);
39
40 // fixed size
41 iconb.setText("foo");
42 iconb.press(Button1);
43
44 // fix width to 60 and let the height be calculated by its parent
45 //label.setHeight(20);
46 label.setStretchableVert(true);
47 label.setStretchableHorz(true);
48 label.setTexture(app.getStyle()->getLabelFocus());
49 label.setUnfocusTexture(app.getStyle()->getLabelUnfocus());
50
51 // fixed size
52 maxb.setText("bar");
53
54 // fixed size
55 closeb.setText("fuubar");
56
57 otk::OtkFocusWidget rblef(&right);
58 otk::OtkButton rbutt1(&right);
59 otk::OtkButton rbutt2(&right);
60
61 rblef.setStretchableHorz(true);
62 rblef.setHeight(50);
63 rblef.setTexture(app.getStyle()->getHandleFocus());
64 rblef.setUnfocusTexture(app.getStyle()->getHandleUnfocus());
65
66 rbutt1.setText("this is fucking tight");
67 rbutt2.setText("heh, WOOP");
68
69 // will recursively unfocus its children
70 //foo.unfocus();
71
72 foo.show();
73
74 app.exec();
75
76 return 0;
77 }
This page took 0.039226 seconds and 4 git commands to generate.