X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/8ade23537a682d4b0c9709d533b25702bde2ee23..fca263d581290c94fdfe4d7baae85d9532e27524:/lib/gui/ewindowstyle.h diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h index 74ff88d5..4824aad6 100644 --- a/lib/gui/ewindowstyle.h +++ b/lib/gui/ewindowstyle.h @@ -10,14 +10,16 @@ class gFont; class eWindowStyle: public iObject { public: - virtual void handleNewSize(eWindow *wnd, const eSize &size) = 0; + virtual void handleNewSize(eWindow *wnd, eSize &size, eSize &offset) = 0; virtual void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) = 0; virtual void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) = 0; virtual void setStyle(gPainter &painter, int what) = 0; enum { styleLabel, styleListboxSelected, - styleListboxNormal + styleListboxNormal, + styleListboxMarked, + styleListboxMarkedAndSelected }; virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0; @@ -26,13 +28,42 @@ public: frameButton, frameListboxEntry }; + + enum { + fontStatic, + fontButton, + fontTitlebar + }; + + virtual RESULT getFont(int what, ePtr &font) = 0; virtual ~eWindowStyle() = 0; +}; +class eWindowStyleManager: public iObject +{ + DECLARE_REF(eWindowStyleManager); +#ifdef SWIG + eWindowStyleManager(); + ~eWindowStyleManager(); +#endif +public: +#ifndef SWIG + eWindowStyleManager(); + ~eWindowStyleManager(); +#endif + void getStyle(int style_id, ePtr &style); + void setStyle(int style_id, eWindowStyle *style); + static int getInstance(ePtr &mgr) { mgr = m_instance; if (!mgr) return -1; return 0; } +private: + static eWindowStyleManager *m_instance; + std::map > m_current_style; }; +TEMPLATE_TYPEDEF(ePtr, eWindowStyleManagerPtr); + class eWindowStyleSimple: public eWindowStyle { - DECLARE_REF; + DECLARE_REF(eWindowStyleSimple); private: ePtr m_fnt; gColor m_border_color_tl, m_border_color_br, m_title_color_back, m_title_color, m_background_color; @@ -40,11 +71,12 @@ private: int m_border_top, m_border_left, m_border_right, m_border_bottom; public: eWindowStyleSimple(); - void handleNewSize(eWindow *wnd, const eSize &size); + void handleNewSize(eWindow *wnd, eSize &size, eSize &offset); void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title); void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size); void setStyle(gPainter &painter, int what); void drawFrame(gPainter &painter, const eRect &frame, int what); + RESULT getFont(int what, ePtr &font); }; #endif