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);
18 void move(ePoint pos);
19 void resize(eSize size);
21 ePoint position() const { return m_position; }
22 eSize size() const { return m_size; }
24 void invalidate(const gRegion ®ion = gRegion::invalidRegion());
26 /* the window were to attach childs to. Normally, this
27 is "this", but it can be overridden in case a widget
28 has a "client area", which is implemented as a child
29 widget. eWindow overrides this, for example. */
30 virtual eWidget *child() { return this; }
37 int getStyle(ePtr<eWindowStyle> &style) { if (!m_style) return 1; style = m_style; return 0; }
38 void setStyle(eWindowStyle *style) { m_style = style; }
40 void setBackgroundColor(const gRGB &col);
41 void clearBackgroundColor();
43 void setZPosition(int z);
44 void setTransparent(int transp);
47 int isVisible() { return (m_vis & wVisShow) && ((!m_parent) || m_parent->isVisible()); }
50 int isTransparent() { return m_vis & wVisTransparent; }
52 ePoint getAbsolutePosition();
54 eWidgetAnimation m_animation;
56 eWidgetDesktop *m_desktop;
65 ePtrList<eWidget> m_childs;
68 /* will be accounted when there's a client offset */
69 eSize m_client_offset;
72 ePtr<eWindowStyle> m_style;
74 void insertIntoParent();
75 void doPaint(gPainter &painter, const gRegion ®ion);
76 void recalcClipRegionsWhenVisible();
80 gRGB m_background_color;
81 int m_have_background_color;
83 eWidget *m_current_focus, *m_focus_owner;
86 int m_notify_child_on_position_change;
91 // all in local space!
92 gRegion m_clip_region, m_visible_region, m_visible_with_childs;
93 struct eWidgetDesktopCompBuffer *m_comp_buffer;
102 evtParentChangedPosition,
106 evtWillChangePosition, /* new size is eRect *data */
116 virtual int event(int event, void *data = 0, void *data2 = 0);
117 void setFocus(eWidget *focus);
119 /* enable this if you need the absolute position of the widget */
120 void setPositionNotifyChild(int n) { m_notify_child_on_position_change = 1; }
123 extern eWidgetDesktop *getDesktop(int which);