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; }
25 eSize csize() const { return m_client_size; }
27 void invalidate(const gRegion ®ion = gRegion::invalidRegion());
29 /* the window were to attach childs to. Normally, this
30 is "this", but it can be overridden in case a widget
31 has a "client area", which is implemented as a child
32 widget. eWindow overrides this, for example. */
33 virtual eWidget *child() { return this; }
40 SWIG_VOID(int) getStyle(ePtr<eWindowStyle> &SWIG_NAMED_OUTPUT(style)) { if (!m_style) return 1; style = m_style; return 0; }
41 void setStyle(eWindowStyle *style) { m_style = style; }
43 void setBackgroundColor(const gRGB &col);
44 void clearBackgroundColor();
46 void setZPosition(int z);
47 void setTransparent(int transp);
50 int isVisible() { return (m_vis & wVisShow) && ((!m_parent) || m_parent->isVisible()); }
53 int isTransparent() { return m_vis & wVisTransparent; }
55 ePoint getAbsolutePosition();
57 eWidgetAnimation m_animation;
59 eWidgetDesktop *m_desktop;
70 ePtrList<eWidget> m_childs;
72 eSize m_size, m_client_size;
73 /* will be accounted when there's a client offset */
74 eSize m_client_offset;
77 ePtr<eWindowStyle> m_style;
79 void insertIntoParent();
80 void doPaint(gPainter &painter, const gRegion ®ion, int layer);
81 void recalcClipRegionsWhenVisible();
85 gRGB m_background_color;
86 int m_have_background_color;
88 eWidget *m_current_focus, *m_focus_owner;
91 int m_notify_child_on_position_change;
96 // all in local space!
97 gRegion m_clip_region, m_visible_region, m_visible_with_childs;
98 struct eWidgetDesktopCompBuffer *m_comp_buffer[MAX_LAYER];
107 evtParentChangedPosition,
109 evtParentVisibilityChanged,
110 evtWillChangePosition, /* new size is eRect *data */
120 virtual int event(int event, void *data = 0, void *data2 = 0);
121 void setFocus(eWidget *focus);
123 /* enable this if you need the absolute position of the widget */
124 void setPositionNotifyChild(int n) { m_notify_child_on_position_change = 1; }
126 void notifyShowHide();
129 extern eWidgetDesktop *getDesktop(int which);