]>
Dogcows Code - chaz/openbox/blob - otk/widget.hh
8 #include "eventdispatcher.hh"
9 #include "application.hh"
20 class OtkWidget
: public OtkEventHandler
{
24 enum Direction
{ Horizontal
, Vertical
};
26 typedef std::list
<OtkWidget
*> OtkWidgetList
;
28 OtkWidget(OtkWidget
*parent
, Direction
= Horizontal
);
29 OtkWidget(OtkEventDispatcher
*event_dispatcher
, Style
*style
,
30 Direction direction
= Horizontal
, Cursor cursor
= 0,
35 virtual void update(void);
37 void exposeHandler(const XExposeEvent
&e
);
38 void configureHandler(const XConfigureEvent
&e
);
40 inline Window
getWindow(void) const { return _window
; }
41 inline const OtkWidget
*getParent(void) const { return _parent
; }
42 inline const OtkWidgetList
&getChildren(void) const { return _children
; }
43 inline unsigned int getScreen(void) const { return _screen
; }
44 inline const Rect
&getRect(void) const { return _rect
; }
46 void move(const Point
&to
);
47 void move(int x
, int y
);
49 virtual void setWidth(int);
50 virtual void setHeight(int);
52 virtual int width() const { return _rect
.width(); }
53 virtual int height() const { return _rect
.height(); }
55 virtual void resize(const Point
&to
);
56 virtual void resize(int x
, int y
);
58 virtual void setGeometry(const Rect
&new_geom
);
59 virtual void setGeometry(const Point
&topleft
, int width
, int height
);
60 virtual void setGeometry(int x
, int y
, int width
, int height
);
62 inline bool isVisible(void) const { return _visible
; };
63 virtual void show(bool recursive
= false);
64 virtual void hide(bool recursive
= false);
66 inline bool isFocused(void) const { return _focused
; };
67 virtual void focus(void);
69 inline bool hasGrabbedMouse(void) const { return _grabbed_mouse
; }
71 void ungrabMouse(void);
73 inline bool hasGrabbedKeyboard(void) const { return _grabbed_keyboard
; }
74 bool grabKeyboard(void);
75 void ungrabKeyboard(void);
77 inline BTexture
*getTexture(void) const { return _texture
; }
78 virtual void setTexture(BTexture
*texture
)
79 { _texture
= texture
; _dirty
= true; }
81 virtual void addChild(OtkWidget
*child
, bool front
= false);
82 virtual void removeChild(OtkWidget
*child
);
84 inline bool isStretchableHorz(void) const { return _stretchable_horz
; }
85 void setStretchableHorz(bool s_horz
= true) { _stretchable_horz
= s_horz
; }
87 inline bool isStretchableVert(void) const { return _stretchable_vert
; }
88 void setStretchableVert(bool s_vert
= true) { _stretchable_vert
= s_vert
; }
90 inline Cursor
getCursor(void) const { return _cursor
; }
92 inline int getBevelWidth(void) const { return _bevel_width
; }
93 void setBevelWidth(int bevel_width
)
94 { assert(bevel_width
> 0); _bevel_width
= bevel_width
; }
96 inline Direction
getDirection(void) const { return _direction
; }
97 void setDirection(Direction dir
) { _direction
= dir
; }
99 inline Style
*getStyle(void) const { return _style
; }
100 void setStyle(Style
*style
) { assert(style
); _style
= style
; }
102 inline OtkEventDispatcher
*getEventDispatcher(void)
103 { return _event_dispatcher
; }
104 void setEventDispatcher(OtkEventDispatcher
*disp
);
106 void unmanaged(void) { _unmanaged
= true; }
116 void adjustHorz(void);
117 void adjustVert(void);
118 void internalResize(int width
, int height
);
124 OtkWidgetList _children
;
127 Direction _direction
;
136 bool _grabbed_keyboard
;
138 bool _stretchable_vert
;
139 bool _stretchable_horz
;
143 unsigned int _bg_pixel
;
146 unsigned int _screen
;
153 OtkEventDispatcher
*_event_dispatcher
;
154 OtkApplication
*_application
;
159 #endif // __widget_hh
This page took 0.038267 seconds and 4 git commands to generate.