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 bool expose(const XExposeEvent &e);
31 virtual bool configure(const XConfigureEvent &e);
33 inline Window getWindow(void) const { return _window; }
34 inline const OtkWidget *getParent(void) const { return _parent; }
35 inline const OtkWidgetList &getChildren(void) const { return _children; }
36 inline unsigned int getScreen(void) const { return _screen; }
37 inline const Rect &getRect(void) const { return _rect; }
39 void move(const Point &to);
40 void move(int x, int y);
42 virtual void setWidth(int);
43 virtual void setHeight(int);
45 virtual int width() const { return _rect.width(); }
46 virtual int height() const { return _rect.height(); }
48 virtual void resize(const Point &to);
49 virtual void resize(int x, int y);
51 virtual void setGeometry(const Rect &new_geom);
52 virtual void setGeometry(const Point &topleft, int width, int height);
53 virtual void setGeometry(int x, int y, int width, int height);
55 inline bool isVisible(void) const { return _visible; };
56 virtual void show(void);
57 virtual void hide(void);
59 inline bool isFocused(void) const { return _focused; };
60 virtual void focus(void);
62 inline bool hasGrabbedMouse(void) const { return _grabbed_mouse; }
64 void ungrabMouse(void);
66 inline bool hasGrabbedKeyboard(void) const { return _grabbed_keyboard; }
67 bool grabKeyboard(void);
68 void ungrabKeyboard(void);
70 inline BTexture *getTexture(void) const { return _texture; }
71 virtual void setTexture(BTexture *texture)
72 { _texture = texture; _dirty = true; }
74 virtual void addChild(OtkWidget *child, bool front = false);
75 virtual void removeChild(OtkWidget *child);
77 inline bool isStretchableHorz(void) const { return _stretchable_horz; }
78 void setStretchableHorz(bool s_horz) { _stretchable_horz = s_horz; }
80 inline bool isStretchableVert(void) const { return _stretchable_vert; }
81 void setStretchableVert(bool s_vert) { _stretchable_vert = s_vert; }
83 inline Cursor getCursor(void) const { return _cursor; }
85 inline int getBevelWidth(void) const { return _bevel_width; }
86 void setBevelWidth(int bevel_width)
87 { assert(bevel_width > 0); _bevel_width = bevel_width; }
89 inline Direction getDirection(void) const { return _direction; }
90 void setDirection(Direction dir) { _direction = dir; }
92 inline Style *getStyle(void) const { return _style; }
93 void setStyle(Style *style) { _style = style; }
99 void adjustHorz(void);
100 void adjustVert(void);
101 void internalResize(int width, int height);
107 OtkWidgetList _children;
110 Direction _direction;
119 bool _grabbed_keyboard;
121 bool _stretchable_vert;
122 bool _stretchable_horz;
126 unsigned int _bg_pixel;
129 unsigned int _screen;
139 #endif // __widget_hh