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 */
7 #include <lib/gui/ewidgetanimation.h>
9 class eWidgetDesktop;class eWidgetDesktop;
13 friend class eWidgetDesktop;
15 eWidget(eWidget *parent);
17 void move(ePoint pos);
18 void resize(eSize size);
20 ePoint position() const { return m_position; }
21 eSize size() const { return m_size; }
23 void invalidate(const gRegion ®ion = gRegion::invalidRegion());
25 /* the window were to attach childs to. Normally, this
26 is "this", but it can be overridden in case a widget
27 has a "client area", which is implemented as a child
28 widget. eWindow overrides this, for example. */
29 virtual eWidget *child() { return this; }
36 int getStyle(ePtr<eWindowStyle> &style) { if (!m_style) return 1; style = m_style; return 0; }
37 void setStyle(eWindowStyle *style) { m_style = style; }
39 void setBackgroundColor(const gRGB &col);
40 void clearBackgroundColor();
42 void setZPosition(int z);
43 void setTransparent(int transp);
46 int isVisible() { return (m_vis & wVisShow) && ((!m_parent) || m_parent->isVisible()); }
49 int isTransparent() { return m_vis & wVisTransparent; }
51 ePoint getAbsolutePosition();
53 eWidgetAnimation m_animation;
55 eWidgetDesktop *m_desktop;
64 ePtrList<eWidget> m_childs;
67 /* will be accounted when there's a client offset */
68 eSize m_client_offset;
71 ePtr<eWindowStyle> m_style;
73 void insertIntoParent();
74 void doPaint(gPainter &painter, const gRegion ®ion);
75 void recalcClipRegionsWhenVisible();
79 gRGB m_background_color;
80 int m_have_background_color;
82 eWidget *m_current_focus, *m_focus_owner;
91 // all in local space!
92 gRegion m_clip_region, m_visible_region, m_visible_with_childs;
93 struct eWidgetDesktopCompBuffer *m_comp_buffer;
104 evtWillChangePosition, /* new size is eRect *data */
114 virtual int event(int event, void *data = 0, void *data2 = 0);
115 void setFocus(eWidget *focus);
118 extern eWidgetDesktop *getDesktop(int which);