1 #ifndef __lib_gui_ewidget_h
2 #define __lib_gui_ewidget_h
4 #include <lib/gdi/grc.h> /* for gRegion */
5 #include <lib/base/eptrlist.h> /* for eSmartPtrList */
6 #include <lib/gui/ewindowstyle.h> /* for eWindowStyle */
10 friend class eWidgetDesktop;
12 eWidget(eWidget *parent);
14 void move(ePoint pos);
15 void resize(eSize size);
17 ePoint position() const { return m_position; }
18 eSize size() const { return m_size; }
20 void invalidate(const gRegion ®ion = gRegion::invalidRegion());
22 /* the window were to attach childs to. Normally, this
23 is "this", but it can be overridden in case a widget
24 has a "client area", which is implemented as a child
25 widget. eWindow overrides this, for example. */
26 virtual eWidget *child() { return this; }
33 int getStyle(ePtr<eWindowStyle> &style) { if (!m_style) return 1; style = m_style; return 0; }
34 void setStyle(eWindowStyle *style) { m_style = style; }
36 void setBackgroundColor(const gRGB &col);
37 void clearBackgroundColor();
40 int isVisible() { return (m_vis & wVisShow) && ((!m_parent) || m_parent->isVisible()); }
44 eWidgetDesktop *m_desktop;
53 ePtrList<eWidget> m_childs;
56 /* will be accounted when there's a client offset */
57 eSize m_client_offset;
60 ePtr<eWindowStyle> m_style;
62 void doPaint(gPainter &painter, const gRegion ®ion);
63 void recalcClipRegionsWhenVisible();
65 gRGB m_background_color;
66 int m_have_background_color;
68 eWidget *m_current_focus, *m_focus_owner;
74 // all in local space!
75 gRegion m_clip_region, m_visible_region, m_visible_with_childs;
86 evtWillChangePosition, /* new size is eRect *data */
96 virtual int event(int event, void *data = 0, void *data2 = 0);
97 void setFocus(eWidget *focus);
100 extern eWidgetDesktop *getDesktop();