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