allow using a pixmap as background for slider
[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                 styleListboxMarkedAndSelected
23         };
24         
25         virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0;
26         
27         enum {
28                 frameButton,
29                 frameListboxEntry
30         };
31         
32         enum {
33                 fontStatic,
34                 fontButton,
35                 fontTitlebar
36         };
37         
38         virtual RESULT getFont(int what, ePtr<gFont> &font) = 0;
39         virtual ~eWindowStyle() = 0;
40 };
41
42 class eWindowStyleManager: public iObject
43 {
44         DECLARE_REF(eWindowStyleManager);
45 #ifdef SWIG
46         eWindowStyleManager();
47         ~eWindowStyleManager();
48 #endif
49 public:
50 #ifndef SWIG
51         eWindowStyleManager();
52         ~eWindowStyleManager();
53 #endif
54         void getStyle(ePtr<eWindowStyle> &style);
55         void setStyle(eWindowStyle *style);
56         static int getInstance(ePtr<eWindowStyleManager> &mgr) { mgr = m_instance; if (!mgr) return -1; return 0; }
57 private:
58         static eWindowStyleManager *m_instance;
59         ePtr<eWindowStyle> m_current_style;
60 };
61
62 TEMPLATE_TYPEDEF(ePtr<eWindowStyleManager>, eWindowStyleManagerPtr);
63
64 class eWindowStyleSimple: public eWindowStyle
65 {
66         DECLARE_REF(eWindowStyleSimple);
67 private:
68         ePtr<gFont> m_fnt;
69         gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color;
70         
71         int m_border_top, m_border_left, m_border_right, m_border_bottom;
72 public:
73         eWindowStyleSimple();
74         void handleNewSize(eWindow *wnd, eSize &size, eSize &offset);
75         void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
76         void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
77         void setStyle(gPainter &painter, int what);
78         void drawFrame(gPainter &painter, const eRect &frame, int what);
79         RESULT getFont(int what, ePtr<gFont> &font);
80 };
81
82 #endif