18 enum Direction { Horizontal, Vertical };
20 typedef std::list<OtkWidget *> OtkWidgetList;
22 OtkWidget(OtkWidget *parent, Direction = Horizontal);
23 OtkWidget(Style *style, Direction direction = Horizontal,
24 Cursor cursor = 0, int bevel_width = 1);
28 virtual void update(void);
30 virtual void expose(const XExposeEvent &e);
32 inline Window getWindow(void) const { return _window; }
33 inline const OtkWidget *getParent(void) const { return _parent; }
34 inline const OtkWidgetList &getChildren(void) const { return _children; }
35 inline unsigned int getScreen(void) const { return _screen; }
36 inline const Rect &getRect(void) const { return _rect; }
38 void move(const Point &to);
39 void move(int x, int y);
41 virtual void setWidth(int);
42 virtual void setHeight(int);
44 virtual void resize(const Point &to);
45 virtual void resize(int x, int y);
47 virtual void setGeometry(const Rect &new_geom);
48 virtual void setGeometry(const Point &topleft, int width, int height);
49 virtual void setGeometry(int x, int y, int width, int height);
51 inline bool isVisible(void) const { return _visible; };
52 virtual void show(void);
53 virtual void hide(void);
55 inline bool isFocused(void) const { return _focused; };
56 virtual void focus(void);
58 inline bool hasGrabbedMouse(void) const { return _grabbed_mouse; }
60 void ungrabMouse(void);
62 inline bool hasGrabbedKeyboard(void) const { return _grabbed_keyboard; }
63 bool grabKeyboard(void);
64 void ungrabKeyboard(void);
66 inline BTexture *getTexture(void) const { return _texture; }
67 virtual void setTexture(BTexture *texture)
68 { _texture = texture; _dirty = true; }
70 virtual void addChild(OtkWidget *child, bool front = false);
71 virtual void removeChild(OtkWidget *child);
73 inline bool isStretchableHorz(void) const { return _stretchable_horz; }
74 void setStretchableHorz(bool s_horz) { _stretchable_horz = s_horz; }
76 inline bool isStretchableVert(void) const { return _stretchable_vert; }
77 void setStretchableVert(bool s_vert) { _stretchable_vert = s_vert; }
79 inline Cursor getCursor(void) const { return _cursor; }
81 inline int getBevelWidth(void) const { return _bevel_width; }
82 void setBevelWidth(int bevel_width)
83 { assert(bevel_width > 0); _bevel_width = bevel_width; }
85 inline Direction getDirection(void) const { return _direction; }
86 void setDirection(Direction dir) { _direction = dir; }
88 inline Style *getStyle(void) const { return _style; }
89 void setStyle(Style *style) { _style = style; }
95 void adjustHorz(void);
96 void adjustVert(void);
97 void internalResize(int width, int height);
103 OtkWidgetList _children;
106 Direction _direction;
114 bool _grabbed_keyboard;
116 bool _stretchable_vert;
117 bool _stretchable_horz;
121 unsigned int _bg_pixel;
124 unsigned int _screen;
135 #endif // __widget_hh