]> icculus.org git repositories - mikachu/openbox.git/blob - otk/widget.hh
split up widget and basewidget
[mikachu/openbox.git] / otk / widget.hh
1 #ifndef __widget_hh
2 #define __widget_hh
3
4 #include "basewidget.hh"
5 #include "eventdispatcher.hh"
6
7 extern "C" {
8 #include <assert.h>
9 }
10
11 namespace otk {
12
13 class OtkWidget : public OtkBaseWidget, public OtkEventHandler {
14
15 public:
16
17   enum Direction { Horizontal, Vertical };
18
19   OtkWidget(OtkWidget *parent, Direction = Horizontal);
20   OtkWidget(OtkEventDispatcher *event_dispatcher, Style *style,
21             Direction direction = Horizontal, Cursor cursor = 0,
22             int bevel_width = 1);
23
24   virtual ~OtkWidget();
25
26   virtual void update(void);
27
28   void exposeHandler(const XExposeEvent &e);
29   void configureHandler(const XConfigureEvent &e);
30
31   inline bool isStretchableHorz(void) const { return _stretchable_horz; }
32   void setStretchableHorz(bool s_horz = true) { _stretchable_horz = s_horz; }
33
34   inline bool isStretchableVert(void) const { return _stretchable_vert; }
35   void setStretchableVert(bool s_vert = true)  { _stretchable_vert = s_vert; }
36
37   inline Direction getDirection(void) const { return _direction; }
38   void setDirection(Direction dir) { _direction = dir; }
39
40   inline OtkEventDispatcher *getEventDispatcher(void)
41   { return _event_dispatcher; }
42   void setEventDispatcher(OtkEventDispatcher *disp);
43
44 private:
45
46   void adjust(void);
47   void adjustHorz(void);
48   void adjustVert(void);
49   void internalResize(int width, int height);
50
51   Direction _direction;
52
53   bool _stretchable_vert;
54   bool _stretchable_horz;
55
56   OtkEventDispatcher *_event_dispatcher;
57 };
58
59 }
60
61 #endif // __widget_hh