X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fgui%2Fewindowstyle.h;h=c204a0344273ad0f1c8788428fa247c4e4e72d00;hp=6431c2428003f4984f005f4c61eb19796ec9a78f;hb=6629073331fbe67edfa9f4d591c9df6e41c465a6;hpb=dba614edd2aad3c17e244914eaef3809d8300cb1 diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h index 6431c24..c204a03 100644 --- a/lib/gui/ewindowstyle.h +++ b/lib/gui/ewindowstyle.h @@ -7,29 +7,82 @@ class gFont; #include -class eWindowStyle: public iObject +class eWindowStyle_ENUMS { +#ifdef SWIG + eWindowStyle_ENUMS(); + ~eWindowStyle_ENUMS(); +#endif public: - virtual void handleNewSize(eWindow *wnd, const eSize &size) = 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; - + enum { frameButton, frameListboxEntry }; + + enum { + fontStatic, + fontButton, + fontTitlebar + }; +}; + +SWIG_IGNORE(eWindowStyle); +class eWindowStyle: public eWindowStyle_ENUMS, public iObject +{ +#ifdef SWIG + eWindowStyle(); +#endif +public: +#ifndef SWIG + 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; + virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0; + virtual RESULT getFont(int what, ePtr &font) = 0; +#endif virtual ~eWindowStyle() = 0; +}; +SWIG_TEMPLATE_TYPEDEF(ePtr, eWindowStylePtr); +SWIG_IGNORE(eWindowStyleManager); +class eWindowStyleManager: public iObject +{ + DECLARE_REF(eWindowStyleManager); +#ifdef SWIG + eWindowStyleManager(); + ~eWindowStyleManager(); +#endif +public: +#ifndef SWIG + eWindowStyleManager(); + ~eWindowStyleManager(); + static SWIG_VOID(int) getInstance(ePtr &SWIG_NAMED_OUTPUT(mgr)) { mgr = m_instance; if (!mgr) return -1; return 0; } +#endif + void getStyle(int style_id, ePtr &SWIG_OUTPUT); + void setStyle(int style_id, eWindowStyle *style); +private: + static eWindowStyleManager *m_instance; + std::map > m_current_style; }; +SWIG_TEMPLATE_TYPEDEF(ePtr, eWindowStyleManager); +SWIG_EXTEND(ePtr, + static ePtr getInstance() + { + extern ePtr NewWindowStylePtr(void); + return NewWindowStylePtr(); + } +); +#ifndef SWIG class eWindowStyleSimple: public eWindowStyle { DECLARE_REF(eWindowStyleSimple); @@ -40,50 +93,13 @@ 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); }; - -class eWindowStyleSkinned: public eWindowStyle -{ - DECLARE_REF(eWindowStyleSkinned); -public: - eWindowStyleSkinned(); - void handleNewSize(eWindow *wnd, const eSize &size); - 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); - - enum { - bsWindow, - bsButton, -#ifndef SWIG - bsMax #endif - }; - - enum { - bpTopLeft = 1, - bpTop = 2, - bpTopRight = 4, - bpLeft = 8, - bpRight = 0x10, - bpBottomLeft = 0x20, - bpBottom = 0x40, - bpBottomRight = 0x80, - bpBackground = 0x100 - }; -private: - struct borderSet - { - ePtr m_pixmap[9]; - }; - - void drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where); -}; #endif