1 #ifndef __lib_gui_ewidgetdesktop_h
2 #define __lib_gui_ewidgetdesktop_h
4 #include <lib/gdi/grc.h>
5 #include <lib/base/eptrlist.h>
11 /* an eWidgetDesktopCompBuffer is a composition buffer. in
12 immediate composition mode, we only have one composition
14 in buffered mode, we have one buffer for each widget, plus
17 even in buffered mode, we have a background region, because
18 a window can be arbitrary shaped. the screen size acts as a bounding
19 box in these cases. */
21 struct eWidgetDesktopCompBuffer
25 gRegion m_dirty_region;
26 gRegion m_background_region;
28 gRGB m_background_color;
31 class eWidgetDesktop: public Object
34 eWidgetDesktop(eSize screen);
36 void addRootWidget(eWidget *root);
37 void removeRootWidget(eWidget *root);
39 /* try to move widget content. */
40 /* returns -1 if there's no move support. */
41 /* call this after recalcClipRegions for that widget. */
42 /* you probably want to invalidate if -1 was returned. */
43 int movedWidget(eWidget *root);
45 void recalcClipRegions(eWidget *root);
47 void invalidateWidgetLayer(const gRegion ®ion, const eWidget *widget, int layer);
48 void invalidateWidget(const gRegion ®ion, const eWidget *widget, int layer = -1);
49 void invalidate(const gRegion ®ion, const eWidget *widget = 0, int layer = -1);
50 void paintLayer(eWidget *widget, int layer);
54 void setBackgroundColor(gRGB col);
55 void setBackgroundColor(eWidgetDesktopCompBuffer *comp, gRGB col);
57 void setPalette(gPixmap &pm);
59 void setRedrawTask(eMainloop &ml);
61 void makeCompatiblePixmap(ePtr<gPixmap> &pm);
62 void makeCompatiblePixmap(gPixmap &pm);
69 void setCompositionMode(int mode);
71 int getStyleID() { return m_style_id; }
72 void setStyleID(int id) { m_style_id = id; }
74 void resize(eSize size);
75 eSize size() const { return m_screen.m_screen_size; }
77 ePtrList<eWidget> m_root;
78 void calcWidgetClipRegion(eWidget *widget, gRegion &parent_visible);
79 void paintBackground(eWidgetDesktopCompBuffer *comp);
81 eMainloop *m_mainloop;
87 eWidgetDesktopCompBuffer m_screen;
89 void createBufferForWidget(eWidget *widget, int layer);
90 void removeBufferForWidget(eWidget *widget, int layer);
92 void redrawComposition(int notifed);
95 void clearVisibility(eWidget *widget);