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