- hopefully fixed some python/refcount stuff (__deref__ is still evil!)
[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, const eSize &size) = 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         };
22         
23         virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0;
24         
25         enum {
26                 frameButton,
27                 frameListboxEntry
28         };
29         virtual ~eWindowStyle() = 0;
30
31 };
32
33 class eWindowStyleSimple: public eWindowStyle
34 {
35         DECLARE_REF(eWindowStyleSimple);
36 private:
37         ePtr<gFont> m_fnt;
38         gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color;
39         
40         int m_border_top, m_border_left, m_border_right, m_border_bottom;
41 public:
42         eWindowStyleSimple();
43         void handleNewSize(eWindow *wnd, const eSize &size);
44         void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
45         void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
46         void setStyle(gPainter &painter, int what);
47         void drawFrame(gPainter &painter, const eRect &frame, int what);
48 };
49
50 class eWindowStyleSkinned: public eWindowStyle
51 {
52         DECLARE_REF(eWindowStyleSkinned);
53 public:
54         eWindowStyleSkinned();
55         void handleNewSize(eWindow *wnd, const eSize &size);
56         void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
57         void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
58         void setStyle(gPainter &painter, int what);
59         void drawFrame(gPainter &painter, const eRect &frame, int what);
60         
61         enum {
62                 bsWindow,
63                 bsButton,
64 #ifndef SWIG
65                 bsMax
66 #endif
67         };
68         
69         enum {
70                 bpTopLeft     =     1,
71                 bpTop         =     2,
72                 bpTopRight    =     4,
73                 bpLeft        =     8,
74                 bpRight       =  0x10,
75                 bpBottomLeft  =  0x20,
76                 bpBottom      =  0x40,
77                 bpBottomRight =  0x80,
78                 bpBackground  = 0x100
79         };
80 private:
81         struct borderSet
82         {
83                 ePtr<gPixmap> m_pixmap[9];
84         };
85         
86         void drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where);
87 };
88
89 #endif