1 #ifndef __lib_gui_ewindowstyle_h
2 #define __lib_gui_ewindowstyle_h
8 #include <lib/base/object.h>
10 class eWindowStyle: public iObject
13 virtual void handleNewSize(eWindow *wnd, eSize &size, eSize &offset) = 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;
22 styleListboxMarkedAndSelected
25 virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0;
38 virtual RESULT getFont(int what, ePtr<gFont> &font) = 0;
39 virtual ~eWindowStyle() = 0;
42 class eWindowStyleManager: public iObject
44 DECLARE_REF(eWindowStyleManager);
46 eWindowStyleManager();
47 ~eWindowStyleManager();
51 eWindowStyleManager();
52 ~eWindowStyleManager();
54 void getStyle(int style_id, ePtr<eWindowStyle> &style);
55 void setStyle(int style_id, eWindowStyle *style);
56 static int getInstance(ePtr<eWindowStyleManager> &mgr) { mgr = m_instance; if (!mgr) return -1; return 0; }
58 static eWindowStyleManager *m_instance;
59 std::map<int, ePtr<eWindowStyle> > m_current_style;
62 TEMPLATE_TYPEDEF(ePtr<eWindowStyleManager>, eWindowStyleManagerPtr);
64 class eWindowStyleSimple: public eWindowStyle
66 DECLARE_REF(eWindowStyleSimple);
69 gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color;
71 int m_border_top, m_border_left, m_border_right, m_border_bottom;
74 void handleNewSize(eWindow *wnd, eSize &size, eSize &offset);
75 void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title);
76 void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
77 void setStyle(gPainter &painter, int what);
78 void drawFrame(gPainter &painter, const eRect &frame, int what);
79 RESULT getFont(int what, ePtr<gFont> &font);