X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Fwidget.hh;h=1cfa627fb1b34bfa1eb2a3453d3d8d6425c5b864;hb=e3eeac5b6eee29009f3417f309a261d43fd39d27;hp=5583faca87717338c3a0e9b9e9cb63236ebebd02;hpb=8f8acc24933830d4f5784616b9b0c5896bde0b93;p=chaz%2Fopenbox diff --git a/otk/widget.hh b/otk/widget.hh index 5583faca..1cfa627f 100644 --- a/otk/widget.hh +++ b/otk/widget.hh @@ -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;