- default fonts handled in windowstyle
[openblackhole/openblackhole-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                 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 eWindowStyleSimple: public eWindowStyle
42 {
43         DECLARE_REF(eWindowStyleSimple);
44 private:
45         ePtr<gFont> m_fnt;
46         gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color;
47         
48         int m_border_top, m_border_left, m_border_right, m_border_bottom;
49 public:
50         eWindowStyleSimple();
51         void handleNewSize(eWindow *wnd, const eSize &size);
52         void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
53         void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
54         void setStyle(gPainter &painter, int what);
55         void drawFrame(gPainter &painter, const eRect &frame, int what);
56         RESULT getFont(int what, ePtr<gFont> &font);
57 };
58
59 #if 0
60 class eWindowStyleSkinned: public eWindowStyle
61 {
62         DECLARE_REF(eWindowStyleSkinned);
63 public:
64         eWindowStyleSkinned();
65         void handleNewSize(eWindow *wnd, const eSize &size);
66         void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
67         void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
68         void setStyle(gPainter &painter, int what);
69         void drawFrame(gPainter &painter, const eRect &frame, int what);
70         
71         enum {
72                 bsWindow,
73                 bsButton,
74 #ifndef SWIG
75                 bsMax
76 #endif
77         };
78         
79         enum {
80                 bpTopLeft     =     1,
81                 bpTop         =     2,
82                 bpTopRight    =     4,
83                 bpLeft        =     8,
84                 bpRight       =  0x10,
85                 bpBottomLeft  =  0x20,
86                 bpBottom      =  0x40,
87                 bpBottomRight =  0x80,
88                 bpBackground  = 0x100
89         };
90 private:
91         struct borderSet
92         {
93                 ePtr<gPixmap> m_pixmap[9];
94         };
95         
96         void drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where);
97 };
98 #endif
99
100 #endif