added otkapplication and event stuff, changed other files to accomodate for this...
[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   otk::OtkFocusWidget label(&left);
35   otk::OtkButton maxb(&left);
36   otk::OtkButton closeb(&left);
37   
38   // fixed size
39   iconb.setText("foo");
40   iconb.press();
41
42   // fix width to 60 and let the height be calculated by its parent
43   //label.setHeight(20);
44   label.setStretchableVert(true);
45   label.setStretchableHorz(true);
46   label.setTexture(app.getStyle()->getLabelFocus());
47   label.setUnfocusTexture(app.getStyle()->getLabelUnfocus());
48
49   // fixed size
50   maxb.setText("bar");
51
52   // fixed size
53   closeb.setText("fuubar");
54
55   otk::OtkFocusWidget rblef(&right);
56   otk::OtkButton rbutt1(&right);
57   otk::OtkButton rbutt2(&right);
58
59   rblef.setStretchableHorz(true);
60   rblef.setHeight(50);
61   rblef.setTexture(app.getStyle()->getHandleFocus());
62   rblef.setUnfocusTexture(app.getStyle()->getHandleUnfocus());
63   
64   rbutt1.setText("this is fucking tight");
65   rbutt2.setText("heh, WOOP");
66
67   // will recursively unfocus its children
68   //foo.unfocus();
69
70   foo.show();
71
72   app.exec();
73
74   return 0;
75 }