From: Stefan Csomor Date: Sat, 29 Dec 2001 09:57:11 +0000 (+0000) Subject: corrections for theme brush alignments X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5b36f53bd13793a2fe63468bc0ab99ab79503695 corrections for theme brush alignments git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13222 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/mac/brush.h b/include/wx/mac/brush.h index 9be385ab7a..fa36e7f184 100644 --- a/include/wx/mac/brush.h +++ b/include/wx/mac/brush.h @@ -22,6 +22,13 @@ class WXDLLEXPORT wxBrush; +typedef enum +{ + kwxMacBrushColour , + kwxMacBrushTheme , + kwxMacBrushThemeBackground +} wxMacBrushKind ; + class WXDLLEXPORT wxBrushRefData: public wxGDIRefData { friend class WXDLLEXPORT wxBrush; @@ -31,13 +38,15 @@ public: ~wxBrushRefData(); protected: + wxMacBrushKind m_macBrushKind ; int m_style; wxBitmap m_stipple ; wxColour m_colour; - bool m_isMacTheme ; + ThemeBrush m_macThemeBrush ; - bool m_isMacThemeBackground ; + ThemeBackgroundKind m_macThemeBackground ; + Rect m_macThemeBackgroundExtent ; }; #define M_BRUSHDATA ((wxBrushRefData *)m_refData) @@ -60,16 +69,16 @@ public: virtual void SetStyle(int style) ; virtual void SetStipple(const wxBitmap& stipple) ; virtual void SetMacTheme(ThemeBrush macThemeBrush) ; - virtual void SetMacThemeBackground(ThemeBackgroundKind macThemeBackground ) ; + virtual void SetMacThemeBackground(ThemeBackgroundKind macThemeBackground , const Rect &extent) ; inline wxBrush& operator = (const wxBrush& brush) { if (*this == brush) return (*this); Ref(brush); return *this; } inline bool operator == (const wxBrush& brush) { return m_refData == brush.m_refData; } inline bool operator != (const wxBrush& brush) { return m_refData != brush.m_refData; } - inline bool IsMacTheme() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_isMacTheme : false); }; - inline bool IsMacThemeBackground() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_isMacThemeBackground : false); }; - inline ThemeBackgroundKind GetMacThemeBackground() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_isMacThemeBackground ? M_BRUSHDATA->m_macThemeBackground : 0) : 0); }; - inline ThemeBrush GetMacTheme() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_isMacTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); }; + inline wxMacBrushKind MacGetBrushKind() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); }; + + ThemeBackgroundKind GetMacThemeBackground(Rect *extent) const ; + inline ThemeBrush GetMacTheme() const { return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); }; inline wxColour& GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); }; inline int GetStyle() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); }; inline wxBitmap *GetStipple() const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); }; diff --git a/include/wx/mac/dc.h b/include/wx/mac/dc.h index 7412c44da1..06bf7595ba 100644 --- a/include/wx/mac/dc.h +++ b/include/wx/mac/dc.h @@ -118,7 +118,7 @@ class WXDLLEXPORT wxDC: public wxDCBase wxCoord XDEV2LOG(wxCoord x) const { - long new_x = x - m_deviceOriginX; + long new_x = x - m_deviceOriginX ; if (new_x > 0) return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; else @@ -133,7 +133,7 @@ class WXDLLEXPORT wxDC: public wxDCBase } wxCoord YDEV2LOG(wxCoord y) const { - long new_y = y - m_deviceOriginY; + long new_y = y - m_deviceOriginY ; if (new_y > 0) return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; else @@ -150,9 +150,9 @@ class WXDLLEXPORT wxDC: public wxDCBase { long new_x = x - m_logicalOriginX; if (new_x > 0) - return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; + return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX ; else - return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; + return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX ; } wxCoord XLOG2DEVREL(wxCoord x) const { @@ -163,11 +163,11 @@ class WXDLLEXPORT wxDC: public wxDCBase } wxCoord YLOG2DEV(wxCoord y) const { - long new_y = y - m_logicalOriginY; + long new_y = y - m_logicalOriginY ; if (new_y > 0) - return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; + return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY ; else - return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; + return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY ; } wxCoord YLOG2DEVREL(wxCoord y) const { @@ -176,9 +176,25 @@ class WXDLLEXPORT wxDC: public wxDCBase else return (wxCoord)((double)(y) * m_scaleY - 0.5); } + wxCoord XLOG2DEVMAC(wxCoord x) const + { + long new_x = x - m_logicalOriginX; + if (new_x > 0) + return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.h ; + else + return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX + m_macLocalOrigin.h ; + } + wxCoord YLOG2DEVMAC(wxCoord y) const + { + long new_y = y - m_logicalOriginY ; + if (new_y > 0) + return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.v ; + else + return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY + m_macLocalOrigin.v ; + } RgnHandle MacGetCurrentClipRgn() { return m_macCurrentClipRgn ; } - static MacSetupBackgroundForCurrentPort(const wxBrush& background ) ; + static void MacSetupBackgroundForCurrentPort(const wxBrush& background ) ; // protected: diff --git a/include/wx/mac/toplevel.h b/include/wx/mac/toplevel.h index 967da1545a..c005292f65 100644 --- a/include/wx/mac/toplevel.h +++ b/include/wx/mac/toplevel.h @@ -70,7 +70,6 @@ public: const wxString& name ) ; static WindowRef MacGetWindowInUpdate() { return s_macWindowInUpdate ; } virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) ; - virtual void MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ; virtual void Clear() ; virtual ControlHandle MacGetContainerForEmbedding() ; WindowRef MacGetWindowRef() { return m_macWindow ; } diff --git a/include/wx/mac/window.h b/include/wx/mac/window.h index 259366a6ce..572b799431 100644 --- a/include/wx/mac/window.h +++ b/include/wx/mac/window.h @@ -219,7 +219,7 @@ public : virtual bool MacDispatchMouseEvent(wxMouseEvent& event ) ; - virtual void MacPaintBorders() ; + virtual void MacPaintBorders( int left , int top ) ; WindowRef MacGetRootWindow() const ; wxTopLevelWindowMac* MacGetTopLevelWindow() const ; @@ -240,18 +240,10 @@ public : // for compatibility void MacUpdateImmediately() { Update() ; } -/* - bool MacSetupFocusPort() ; - bool MacSetupDrawingPort() ; - bool MacSetupFocusClientPort() ; - bool MacSetupDrawingClientPort() ; -*/ - virtual bool MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* rootwin ) ; virtual bool MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* rootwin ) ; virtual void MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) ; virtual void MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ; - virtual void MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) ; const wxBrush& MacGetBackgroundBrush() ; const wxRegion& MacGetVisibleRegion() ; bool MacIsWindowScrollbar( const wxScrollBar* sb ) { return (m_hScrollBar == sb || m_vScrollBar == sb) ; } @@ -317,56 +309,18 @@ private: DECLARE_EVENT_TABLE() }; -/* -class wxMacFocusHelper -{ -public : - wxMacFocusHelper( wxWindowMac * theWindow ) ; - ~wxMacFocusHelper() ; - bool Ok() { return m_ok ; } - -private : - GrafPtr m_formerPort ; - GrafPtr m_currentPort ; - bool m_ok ; -} ; -*/ - class wxMacDrawingHelper { public : - wxMacDrawingHelper( wxWindowMac * theWindow ) ; + wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ; ~wxMacDrawingHelper() ; bool Ok() { return m_ok ; } - -private : - GrafPtr m_formerPort ; - GrafPtr m_currentPort ; - PenState m_savedPenState ; - bool m_ok ; -} ; -/* -class wxMacFocusClientHelper -{ -public : - wxMacFocusClientHelper( wxWindowMac * theWindow ) ; - ~wxMacFocusClientHelper() ; - bool Ok() { return m_ok ; } - -private : - GrafPtr m_formerPort ; - GrafPtr m_currentPort ; - bool m_ok ; -} ; -*/ -class wxMacDrawingClientHelper -{ -public : - wxMacDrawingClientHelper( wxWindowMac * theWindow ) ; - ~wxMacDrawingClientHelper() ; - bool Ok() { return m_ok ; } - + void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; } + void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; } + void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; } + const Point& GetOrigin() { return m_origin ; } private : + Point m_origin ; GrafPtr m_formerPort ; GrafPtr m_currentPort ; PenState m_savedPenState ;