Merge branch 'pootle-import' into experimental
[vuplus_dvbapp] / 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_ENUMS
11 {
12 #ifdef SWIG
13         eWindowStyle_ENUMS();
14         ~eWindowStyle_ENUMS();
15 #endif
16 public:
17         enum {
18                 styleLabel,
19                 styleListboxSelected,
20                 styleListboxNormal,
21                 styleListboxMarked,
22                 styleListboxMarkedAndSelected
23         };
24
25         enum {
26                 frameButton,
27                 frameListboxEntry
28         };
29
30         enum {
31                 fontStatic,
32                 fontButton,
33                 fontTitlebar
34         };
35 };
36
37 SWIG_IGNORE(eWindowStyle);
38 class eWindowStyle: public eWindowStyle_ENUMS, public iObject
39 {
40 #ifdef SWIG
41         eWindowStyle();
42 #endif
43 public:
44 #ifndef SWIG
45         virtual void handleNewSize(eWindow *wnd, eSize &size, eSize &offset) = 0;
46         virtual void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) = 0;
47         virtual void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) = 0;
48         virtual void setStyle(gPainter &painter, int what) = 0;
49         virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0;
50         virtual RESULT getFont(int what, ePtr<gFont> &font) = 0;
51 #endif
52         virtual ~eWindowStyle() = 0;
53 };
54 SWIG_TEMPLATE_TYPEDEF(ePtr<eWindowStyle>, eWindowStylePtr);
55
56 SWIG_IGNORE(eWindowStyleManager);
57 class eWindowStyleManager: public iObject
58 {
59         DECLARE_REF(eWindowStyleManager);
60 #ifdef SWIG
61         eWindowStyleManager();
62         ~eWindowStyleManager();
63 #endif
64 public:
65 #ifndef SWIG
66         eWindowStyleManager();
67         ~eWindowStyleManager();
68         static SWIG_VOID(int) getInstance(ePtr<eWindowStyleManager> &SWIG_NAMED_OUTPUT(mgr)) { mgr = m_instance; if (!mgr) return -1; return 0; }
69 #endif
70         void getStyle(int style_id, ePtr<eWindowStyle> &SWIG_OUTPUT);
71         void setStyle(int style_id, eWindowStyle *style);
72 private:
73         static eWindowStyleManager *m_instance;
74         std::map<int, ePtr<eWindowStyle> > m_current_style;
75 };
76 SWIG_TEMPLATE_TYPEDEF(ePtr<eWindowStyleManager>, eWindowStyleManager);
77 SWIG_EXTEND(ePtr<eWindowStyleManager>,
78         static ePtr<eWindowStyleManager> getInstance()
79         {
80                 extern ePtr<eWindowStyleManager> NewWindowStylePtr(void);
81                 return NewWindowStylePtr();
82         }
83 );
84
85 #ifndef SWIG
86 class eWindowStyleSimple: public eWindowStyle
87 {
88         DECLARE_REF(eWindowStyleSimple);
89         ePtr<gFont> m_fnt;
90         gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color;
91         
92         int m_border_top, m_border_left, m_border_right, m_border_bottom;
93 public:
94         eWindowStyleSimple();
95         void handleNewSize(eWindow *wnd, eSize &size, eSize &offset);
96         void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
97         void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
98         void setStyle(gPainter &painter, int what);
99         void drawFrame(gPainter &painter, const eRect &frame, int what);
100         RESULT getFont(int what, ePtr<gFont> &font);
101 };
102 #endif
103
104 #endif