This fixed the PicturePlayer to check if a file is local rather than accepting files...
[enigma2.git] / lib / gui / ewidgetdesktop.h
1 #ifndef __lib_gui_ewidgetdesktop_h
2 #define __lib_gui_ewidgetdesktop_h
3
4 #include <lib/gdi/grc.h>
5 #include <lib/base/eptrlist.h>
6
7 class eWidget;
8 class eMainloop;
9 class eTimer;
10
11                 /* an eWidgetDesktopCompBuffer is a composition buffer. in 
12                    immediate composition  mode, we only have one composition 
13                    buffer - the screen.
14                    in buffered mode, we have one buffer for each widget, plus
15                    the screen.
16                    
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. */
20
21 struct eWidgetDesktopCompBuffer
22 {
23         ePoint m_position;
24         eSize m_screen_size;
25         gRegion m_dirty_region;
26         gRegion m_background_region;
27         ePtr<gDC> m_dc;
28         gRGB m_background_color;
29 };
30
31 class eWidgetDesktop: public Object
32 {
33 public:
34         eWidgetDesktop(eSize screen);
35         ~eWidgetDesktop();
36         void addRootWidget(eWidget *root);
37         void removeRootWidget(eWidget *root);
38         
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);
44         
45         void recalcClipRegions(eWidget *root);
46         
47         void invalidate(const gRegion &region);
48         void paint();
49         void setDC(gDC *dc);
50         
51         void setBackgroundColor(gRGB col);
52         void setBackgroundColor(eWidgetDesktopCompBuffer *comp, gRGB col);
53         
54         void setPalette(gPixmap &pm);
55         
56         void setRedrawTask(eMainloop &ml);
57
58         void makeCompatiblePixmap(ePtr<gPixmap> &pm);
59         void makeCompatiblePixmap(gPixmap &pm);
60         
61         enum {
62                 cmImmediate,
63                 cmBuffered
64         };
65         
66         void setCompositionMode(int mode);
67         
68         int getStyleID() { return m_style_id; }
69         void setStyleID(int id) { m_style_id = id; }
70 private:
71         ePtrList<eWidget> m_root;
72         void calcWidgetClipRegion(eWidget *widget, gRegion &parent_visible);
73         void paintBackground(eWidgetDesktopCompBuffer *comp);
74         
75         eMainloop *m_mainloop;
76         eTimer *m_timer;
77         
78         int m_comp_mode;
79         int m_require_redraw;
80         
81         eWidgetDesktopCompBuffer m_screen;
82         
83         void createBufferForWidget(eWidget *widget);
84         void removeBufferForWidget(eWidget *widget);
85         
86         void redrawComposition(int notifed);
87         void notify();
88         
89         void clearVisibility(eWidget *widget);
90         
91         int m_style_id;
92 };
93
94 #endif