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>
11 class eWidgetDesktop;class eWidgetDesktop;
15 friend class eWidgetDesktop;
17 eWidget(eWidget *parent);
20 void move(ePoint pos);
21 void resize(eSize size);
23 ePoint position() const { return m_position; }
24 eSize size() const { return m_size; }
26 void invalidate(const gRegion ®ion = gRegion::invalidRegion());
28 /* the window were to attach childs to. Normally, this
29 is "this", but it can be overridden in case a widget
30 has a "client area", which is implemented as a child
31 widget. eWindow overrides this, for example. */
32 virtual eWidget *child() { return this; }
39 SWIG_VOID(int) getStyle(ePtr<eWindowStyle> &SWIG_NAMED_OUTPUT(style)) { if (!m_style) return 1; style = m_style; return 0; }
40 void setStyle(eWindowStyle *style) { m_style = style; }
42 void setBackgroundColor(const gRGB &col);
43 void clearBackgroundColor();
45 void setZPosition(int z);
46 void setTransparent(int transp);
49 int isVisible() { return (m_vis & wVisShow) && ((!m_parent) || m_parent->isVisible()); }
52 int isTransparent() { return m_vis & wVisTransparent; }
54 ePoint getAbsolutePosition();
56 eWidgetAnimation m_animation;
58 eWidgetDesktop *m_desktop;
69 ePtrList<eWidget> m_childs;
72 /* will be accounted when there's a client offset */
73 eSize m_client_offset;
76 ePtr<eWindowStyle> m_style;
78 void insertIntoParent();
79 void doPaint(gPainter &painter, const gRegion ®ion, int layer);
80 void recalcClipRegionsWhenVisible();
84 gRGB m_background_color;
85 int m_have_background_color;
87 eWidget *m_current_focus, *m_focus_owner;
90 int m_notify_child_on_position_change;
95 // all in local space!
96 gRegion m_clip_region, m_visible_region, m_visible_with_childs;
97 struct eWidgetDesktopCompBuffer *m_comp_buffer[MAX_LAYER];
106 evtParentChangedPosition,
108 evtParentVisibilityChanged,
109 evtWillChangePosition, /* new size is eRect *data */
119 virtual int event(int event, void *data = 0, void *data2 = 0);
120 void setFocus(eWidget *focus);
122 /* enable this if you need the absolute position of the widget */
123 void setPositionNotifyChild(int n) { m_notify_child_on_position_change = 1; }
125 void notifyShowHide();
128 extern eWidgetDesktop *getDesktop(int which);