]>
Dogcows Code - chaz/openbox/blob - otk/widget.hh
11 #include "eventhandler.hh"
12 #include "application.hh"
16 class OtkWidget
: public OtkEventHandler
{
20 enum Direction
{ Horizontal
, Vertical
};
22 typedef std::list
<OtkWidget
*> OtkWidgetList
;
24 OtkWidget(OtkWidget
*parent
, Direction
= Horizontal
);
25 OtkWidget(OtkApplication
*app
, Direction direction
= Horizontal
,
26 Cursor cursor
= 0, int bevel_width
= 1);
27 OtkWidget(Style
*style
, Direction direction
= Horizontal
,
28 Cursor cursor
= 0, int bevel_width
= 1);
32 virtual void update(void);
34 int exposeHandler(const XExposeEvent
&e
);
35 int configureHandler(const XConfigureEvent
&e
);
37 inline Window
getWindow(void) const { return _window
; }
38 inline const OtkWidget
*getParent(void) const { return _parent
; }
39 inline const OtkWidgetList
&getChildren(void) const { return _children
; }
40 inline unsigned int getScreen(void) const { return _screen
; }
41 inline const Rect
&getRect(void) const { return _rect
; }
43 void move(const Point
&to
);
44 void move(int x
, int y
);
46 virtual void setWidth(int);
47 virtual void setHeight(int);
49 virtual int width() const { return _rect
.width(); }
50 virtual int height() const { return _rect
.height(); }
52 virtual void resize(const Point
&to
);
53 virtual void resize(int x
, int y
);
55 virtual void setGeometry(const Rect
&new_geom
);
56 virtual void setGeometry(const Point
&topleft
, int width
, int height
);
57 virtual void setGeometry(int x
, int y
, int width
, int height
);
59 inline bool isVisible(void) const { return _visible
; };
60 virtual void show(void);
61 virtual void hide(void);
63 inline bool isFocused(void) const { return _focused
; };
64 virtual void focus(void);
66 inline bool hasGrabbedMouse(void) const { return _grabbed_mouse
; }
68 void ungrabMouse(void);
70 inline bool hasGrabbedKeyboard(void) const { return _grabbed_keyboard
; }
71 bool grabKeyboard(void);
72 void ungrabKeyboard(void);
74 inline BTexture
*getTexture(void) const { return _texture
; }
75 virtual void setTexture(BTexture
*texture
)
76 { _texture
= texture
; _dirty
= true; }
78 virtual void addChild(OtkWidget
*child
, bool front
= false);
79 virtual void removeChild(OtkWidget
*child
);
81 inline bool isStretchableHorz(void) const { return _stretchable_horz
; }
82 void setStretchableHorz(bool s_horz
) { _stretchable_horz
= s_horz
; }
84 inline bool isStretchableVert(void) const { return _stretchable_vert
; }
85 void setStretchableVert(bool s_vert
) { _stretchable_vert
= s_vert
; }
87 inline Cursor
getCursor(void) const { return _cursor
; }
89 inline int getBevelWidth(void) const { return _bevel_width
; }
90 void setBevelWidth(int bevel_width
)
91 { assert(bevel_width
> 0); _bevel_width
= bevel_width
; }
93 inline Direction
getDirection(void) const { return _direction
; }
94 void setDirection(Direction dir
) { _direction
= dir
; }
96 inline Style
*getStyle(void) const { return _style
; }
97 void setStyle(Style
*style
) { _style
= style
; }
99 inline OtkEventDispatcher
*getEventDispatcher(void)
100 { return _event_dispatcher
; }
101 void setEventDispatcher(OtkEventDispatcher
*disp
);
111 void adjustHorz(void);
112 void adjustVert(void);
113 void internalResize(int width
, int height
);
119 OtkWidgetList _children
;
122 Direction _direction
;
131 bool _grabbed_keyboard
;
133 bool _stretchable_vert
;
134 bool _stretchable_horz
;
138 unsigned int _bg_pixel
;
141 unsigned int _screen
;
146 OtkEventDispatcher
*_event_dispatcher
;
151 #endif // __widget_hh
This page took 0.04295 seconds and 5 git commands to generate.