openbox/otk/otk_test.cc

84 lines
2.1 KiB
C++
Raw Normal View History

// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif
#include "application.hh"
#include "focuswidget.hh"
#include "appwidget.hh"
2002-11-14 11:44:14 +00:00
#include "button.hh"
2002-11-11 03:49:09 +00:00
int main(int argc, char **argv) {
otk::Application app(argc, argv);
2002-11-11 03:49:09 +00:00
otk::AppWidget foo(&app);
2002-11-11 03:49:09 +00:00
2002-11-15 05:02:07 +00:00
foo.resize(600, 500);
2003-01-23 09:11:34 +00:00
foo.setTexture(app.getStyle()->titlebarFocusBackground());
2003-01-22 22:46:16 +00:00
// foo.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
2002-11-11 03:49:09 +00:00
2002-11-15 05:02:07 +00:00
foo.setBevelWidth(2);
foo.setDirection(otk::Widget::Horizontal);
2002-11-15 05:02:07 +00:00
otk::FocusWidget left(&foo);
otk::FocusWidget right(&foo);
2002-11-15 05:02:07 +00:00
left.setDirection(otk::Widget::Horizontal);
2002-11-15 05:02:07 +00:00
left.setStretchableVert(true);
left.setStretchableHorz(true);
2003-01-22 22:46:16 +00:00
left.setTexture(app.getStyle()->titlebarFocusBackground());
left.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
2002-11-15 05:02:07 +00:00
right.setDirection(otk::Widget::Vertical);
2002-11-15 05:02:07 +00:00
right.setBevelWidth(10);
right.setStretchableVert(true);
right.setWidth(300);
2003-01-22 22:46:16 +00:00
right.setTexture(app.getStyle()->titlebarFocusBackground());
right.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
otk::Button iconb(&left);
2002-11-16 13:21:24 +00:00
iconb.resize(40,20);
2003-01-22 23:17:28 +00:00
/* otk::FocusWidget label(&left);
otk::Button maxb(&left);
otk::Button closeb(&left);
2002-11-15 05:02:07 +00:00
// fixed size
2002-11-14 11:44:14 +00:00
iconb.setText("foo");
2002-11-16 13:21:24 +00:00
iconb.press(Button1);
2002-11-11 03:49:09 +00:00
2002-11-13 10:39:04 +00:00
// fix width to 60 and let the height be calculated by its parent
2002-11-15 05:02:07 +00:00
//label.setHeight(20);
2002-11-13 10:39:04 +00:00
label.setStretchableVert(true);
2002-11-15 05:02:07 +00:00
label.setStretchableHorz(true);
2003-01-22 22:46:16 +00:00
label.setTexture(app.getStyle()->labelFocusBackground());
label.setUnfocusTexture(app.getStyle()->labelUnfocusBackground());
2002-11-11 03:49:09 +00:00
// fixed size
2002-11-14 11:44:14 +00:00
maxb.setText("bar");
// fixed size
2002-11-14 11:44:14 +00:00
closeb.setText("fuubar");
2003-01-22 23:17:28 +00:00
*/
otk::FocusWidget rblef(&right);
otk::Button rbutt1(&right);
otk::Button rbutt2(&right);
2002-11-15 05:02:07 +00:00
rblef.setStretchableHorz(true);
rblef.setHeight(50);
2003-01-22 22:46:16 +00:00
rblef.setTexture(app.getStyle()->handleFocusBackground());
rblef.setUnfocusTexture(app.getStyle()->handleUnfocusBackground());
2002-11-15 05:02:07 +00:00
rbutt1.setText("this is fucking tight");
rbutt2.setText("heh, WOOP");
// will recursively unfocus its children
2002-11-13 10:39:04 +00:00
//foo.unfocus();
2002-11-11 03:49:09 +00:00
foo.show();
2003-01-22 22:46:16 +00:00
app.run();
2002-11-11 08:42:19 +00:00
2002-11-11 03:49:09 +00:00
return 0;
}