fix satellites positions in the west
[enigma2.git] / lib / gui / ewindowstyle.h
1 #ifndef __lib_gui_ewindowstyle_h
2 #define __lib_gui_ewindowstyle_h
3
4 class eWindow;
5 class eSize;
6 class gFont;
7
8 #include <lib/base/object.h>
9
10 class eWindowStyle: public iObject
11 {
12 public:
13         virtual void handleNewSize(eWindow *wnd, eSize &size, eSize &offset) = 0;
14         virtual void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) = 0;
15         virtual void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) = 0;
16         virtual void setStyle(gPainter &painter, int what) = 0;
17         enum {
18                 styleLabel,
19                 styleListboxSelected,
20                 styleListboxNormal,
21                 styleListboxMarked
22         };
23         
24         virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0;
25         
26         enum {
27                 frameButton,
28                 frameListboxEntry
29         };
30         
31         enum {
32                 fontStatic,
33                 fontButton,
34                 fontTitlebar
35         };
36         
37         virtual RESULT getFont(int what, ePtr<gFont> &font) = 0;
38         virtual ~eWindowStyle() = 0;
39 };
40
41 class eWindowStyleManager: public iObject
42 {
43         DECLARE_REF(eWindowStyleManager);
44 public:
45         eWindowStyleManager();
46         ~eWindowStyleManager();
47         void getStyle(ePtr<eWindowStyle> &style);
48         void setStyle(eWindowStyle *style);
49         static int getInstance(ePtr<eWindowStyleManager> &mgr) { mgr = m_instance; if (!mgr) return -1; return 0; }
50 private:
51         static eWindowStyleManager *m_instance;
52         ePtr<eWindowStyle> m_current_style;
53 };
54
55 TEMPLATE_TYPEDEF(ePtr<eWindowStyleManager>, eWindowStyleManagerPtr);
56
57 class eWindowStyleSimple: public eWindowStyle
58 {
59         DECLARE_REF(eWindowStyleSimple);
60 private:
61         ePtr<gFont> m_fnt;
62         gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color;
63         
64         int m_border_top, m_border_left, m_border_right, m_border_bottom;
65 public:
66         eWindowStyleSimple();
67         void handleNewSize(eWindow *wnd, eSize &size, eSize &offset);
68         void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
69         void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
70         void setStyle(gPainter &painter, int what);
71         void drawFrame(gPainter &painter, const eRect &frame, int what);
72         RESULT getFont(int what, ePtr<gFont> &font);
73 };
74
75 #endif