]> Dogcows Code - chaz/openbox/blobdiff - otk/otk_test.cc
use bevel width on the top/bottom too
[chaz/openbox] / otk / otk_test.cc
index f36fcf99adda0204879596ac236e95e8fab84fde..fb4db8352df5e40f379fc06af9365340ffa4b384 100644 (file)
@@ -1,74 +1,83 @@
+// -*- 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"
 #include "button.hh"
-#include "display.hh"
-#include "configuration.hh"
-#include "timerqueuemanager.hh"
-#include "image.hh"
-#include "style.hh"
 
-int main(void) {
-  otk::OBDisplay::initialize(NULL);
-  otk::Configuration style_conf(False);
-  otk::OBTimerQueueManager *tm = new otk::OBTimerQueueManager();
-  const otk::ScreenInfo *s_info =
-    otk::OBDisplay::screenInfo(DefaultScreen(otk::OBDisplay::display));
-  otk::BImageControl *ctrl = new otk::BImageControl(tm, s_info, True, 4, 5, 200);
+int main(int argc, char **argv) {
+  otk::Application app(argc, argv);
+
+  otk::AppWidget foo(&app);
 
-  otk::Style *my_style = new otk::Style(ctrl);
+  foo.resize(600, 500);
+  foo.setTexture(app.getStyle()->titlebarFocusBackground());
+//  foo.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
 
-  style_conf.setFile("/usr/local/share/openbox/styles/artwiz");
-  style_conf.load();
+  foo.setBevelWidth(2);
+  foo.setDirection(otk::Widget::Horizontal);
 
-  my_style->load(style_conf);
+  otk::FocusWidget left(&foo);
+  otk::FocusWidget right(&foo);
 
-  otk::OtkFocusWidget foo(my_style);
-  otk::OtkButton iconb(&foo);
-  otk::OtkFocusWidget label(&foo);
-  otk::OtkButton maxb(&foo);
-  otk::OtkButton closeb(&foo);
+  left.setDirection(otk::Widget::Horizontal);
+  left.setStretchableVert(true);
+  left.setStretchableHorz(true);
+  left.setTexture(app.getStyle()->titlebarFocusBackground());
+  left.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
+  right.setDirection(otk::Widget::Vertical);
+  right.setBevelWidth(10);
+  right.setStretchableVert(true);
+  right.setWidth(300);
+  right.setTexture(app.getStyle()->titlebarFocusBackground());
+  right.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
+  otk::Button iconb(&left);
+  iconb.resize(40,20);
 
-  foo.setBevelWidth(2);
-  foo.setDirection(otk::OtkWidget::Vertical);
+/*  otk::FocusWidget label(&left);
+  otk::Button maxb(&left);
+  otk::Button closeb(&left);
   
-  foo.setHeight(400);
-  foo.setTexture(my_style->getTitleFocus());
-  foo.setUnfocusTexture(my_style->getTitleUnfocus());
-
   // fixed size
   iconb.setText("foo");
-  iconb.press();
+  iconb.press(Button1);
 
   // fix width to 60 and let the height be calculated by its parent
-  label.setWidth(60);
+  //label.setHeight(20);
   label.setStretchableVert(true);
-  label.setTexture(my_style->getLabelFocus());
-  label.setUnfocusTexture(my_style->getLabelUnfocus());
+  label.setStretchableHorz(true);
+  label.setTexture(app.getStyle()->labelFocusBackground());
+  label.setUnfocusTexture(app.getStyle()->labelUnfocusBackground());
 
   // fixed size
   maxb.setText("bar");
 
   // fixed size
   closeb.setText("fuubar");
+*/
+  otk::FocusWidget rblef(&right);
+  otk::Button rbutt1(&right);
+  otk::Button rbutt2(&right);
+
+  rblef.setStretchableHorz(true);
+  rblef.setHeight(50);
+  rblef.setTexture(app.getStyle()->handleFocusBackground());
+  rblef.setUnfocusTexture(app.getStyle()->handleUnfocusBackground());
+  
+  rbutt1.setText("this is fucking tight");
+  rbutt2.setText("heh, WOOP");
 
   // will recursively unfocus its children
   //foo.unfocus();
-  foo.update();
-  foo.show();
 
-  while (1) {
-    if (XPending(otk::OBDisplay::display)) {
-      XEvent e;
-      XNextEvent(otk::OBDisplay::display, &e);
-      if (e.type == Expose)
-        foo.expose(e.xexpose);
-    } 
-  }
-
-  delete my_style;
-  delete tm;
-  delete ctrl;
+  foo.show();
 
-  otk::OBDisplay::destroy();
+  app.run();
 
   return 0;
 }
This page took 0.029444 seconds and 4 git commands to generate.