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