]> Dogcows Code - chaz/openbox/blobdiff - otk/widget.hh
surface started
[chaz/openbox] / otk / widget.hh
index 5583faca87717338c3a0e9b9e9cb63236ebebd02..1cfa627fb1b34bfa1eb2a3453d3d8d6425c5b864 100644 (file)
@@ -2,6 +2,7 @@
 #ifndef __widget_hh
 #define __widget_hh
 
+#include "surface.hh"
 #include "rect.hh"
 #include "point.hh"
 #include "texture.hh"
@@ -18,7 +19,7 @@ extern "C" {
 
 namespace otk {
 
-class Widget : public EventHandler {
+class Widget : public Surface, public EventHandler {
 
 public:
 
@@ -42,7 +43,7 @@ public:
   inline const Widget *parent(void) const { return _parent; }
   inline const WidgetList &children(void) const { return _children; }
   inline unsigned int screen(void) const { return _screen; }
-  inline const Rect &rect(void) const { return _rect; }
+  inline Rect rect(void) const { return Rect(_pos, size()); }
 
   void move(const Point &to);
   void move(int x, int y);
@@ -50,9 +51,6 @@ public:
   virtual void setWidth(int);
   virtual void setHeight(int);
 
-  virtual int width() const { return _rect.width(); }
-  virtual int height() const { return _rect.height(); }
-
   virtual void resize(const Point &to);
   virtual void resize(int x, int y);
 
@@ -83,13 +81,13 @@ public:
   inline const Color *borderColor(void) const { return _bcolor; }
   virtual void setBorderColor(const Color *color) {
     assert(color); _bcolor = color;
-    XSetWindowBorder(Display::display, _window, color->pixel());
+    XSetWindowBorder(**display, _window, color->pixel());
   }
 
   inline int borderWidth(void) const { return _bwidth; }
   void setBorderWidth(int width) {
     _bwidth = width;
-    XSetWindowBorderWidth(Display::display, _window, width);
+    XSetWindowBorderWidth(**display, _window, width);
   }
 
   virtual void addChild(Widget *child, bool front = false);
@@ -104,7 +102,7 @@ public:
   inline Cursor cursor(void) const { return _cursor; }
   void setCursor(Cursor cursor) {
     _cursor = cursor;
-    XDefineCursor(Display::display, _window, _cursor);
+    XDefineCursor(**display, _window, _cursor);
   }
 
   inline int bevelWidth(void) const { return _bevel_width; }
@@ -159,7 +157,7 @@ protected:
   const Color *_bcolor;
   unsigned int _bwidth;
 
-  Rect _rect;
+  Point _pos;
   unsigned int _screen;
 
   bool _fixed_width;
This page took 0.024268 seconds and 4 git commands to generate.