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