X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a8e9860d9fa86d3cf354b0b05739da379d3e9ae1..2cf3a6d7bef6f20bea35062dd3d4dbf0aec9efb5:/src/mac/carbon/brush.cpp diff --git a/src/mac/carbon/brush.cpp b/src/mac/carbon/brush.cpp index 8716a58535..4f56a3a614 100644 --- a/src/mac/carbon/brush.cpp +++ b/src/mac/carbon/brush.cpp @@ -1,32 +1,30 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: brush.cpp +// Name: src/mac/carbon/brush.cpp // Purpose: wxBrush // Author: Stefan Csomor // Modified by: // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "brush.h" -#endif - #include "wx/wxprec.h" -#include "wx/utils.h" #include "wx/brush.h" +#ifndef WX_PRECOMP + #include "wx/utils.h" +#endif + #include "wx/mac/private.h" -#if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) -#endif class WXDLLEXPORT wxBrushRefData: public wxGDIRefData { friend class WXDLLEXPORT wxBrush; + public: wxBrushRefData(); wxBrushRefData(const wxBrushRefData& data); @@ -37,15 +35,16 @@ protected: int m_style; wxBitmap m_stipple ; wxColour m_colour; - + ThemeBrush m_macThemeBrush ; - + ThemeBackgroundKind m_macThemeBackground ; Rect m_macThemeBackgroundExtent ; }; #define M_BRUSHDATA ((wxBrushRefData *)m_refData) + wxBrushRefData::wxBrushRefData() : m_style(wxSOLID) { @@ -68,7 +67,6 @@ wxBrushRefData::~wxBrushRefData() { } -// Brushes wxBrush::wxBrush() { } @@ -93,7 +91,7 @@ wxBrush::wxBrush(const wxBitmap& stipple) M_BRUSHDATA->m_colour = *wxBLACK; M_BRUSHDATA->m_stipple = stipple; - + if (M_BRUSHDATA->m_stipple.GetMask()) M_BRUSHDATA->m_style = wxSTIPPLE_MASK_OPAQUE; else @@ -102,7 +100,7 @@ wxBrush::wxBrush(const wxBitmap& stipple) RealizeResource(); } -wxBrush::wxBrush(ThemeBrush macThemeBrush ) +wxBrush::wxBrush( ThemeBrush macThemeBrush ) { m_refData = new wxBrushRefData; @@ -111,6 +109,7 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush ) RealizeResource(); } + void wxBrush::Unshare() { // Don't change shared data @@ -172,6 +171,10 @@ void wxBrush::MacSetTheme(ThemeBrush macThemeBrush) M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme; M_BRUSHDATA->m_macThemeBrush = macThemeBrush; + RGBColor color ; + GetThemeBrushAsColor( macThemeBrush , 32, true, &color ); + M_BRUSHDATA->m_colour.Set( color.red >> 8 , color.green >> 8 , color.blue >> 8 ); + RealizeResource(); } @@ -181,50 +184,52 @@ void wxBrush::MacSetThemeBackground(unsigned long macThemeBackground, const WXRE M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground; M_BRUSHDATA->m_macThemeBackground = macThemeBackground; - M_BRUSHDATA->m_macThemeBackgroundExtent = *(Rect*)extent ; + M_BRUSHDATA->m_macThemeBackgroundExtent = *(Rect*)extent; + RealizeResource(); } bool wxBrush::RealizeResource() { - return TRUE; + return true; } -unsigned long wxBrush::MacGetThemeBackground( WXRECTPTR extent) const +unsigned long wxBrush::MacGetThemeBackground(WXRECTPTR extent) const { - if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground ) - { - if ( extent ) - *(Rect*)extent = M_BRUSHDATA->m_macThemeBackgroundExtent ; - return M_BRUSHDATA->m_macThemeBackground ; - } - else - { - return 0 ; - } + if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground ) + { + if ( extent ) + *(Rect*)extent = M_BRUSHDATA->m_macThemeBackgroundExtent; + + return M_BRUSHDATA->m_macThemeBackground; + } + else + { + return 0; + } } -short wxBrush::MacGetTheme() const -{ - return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); +short wxBrush::MacGetTheme() const +{ + return (M_BRUSHDATA ? ((M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme) ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack); } -wxColour& wxBrush::GetColour() const +wxColour& wxBrush::GetColour() const { return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); } -int wxBrush::GetStyle() const -{ - return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); +int wxBrush::GetStyle() const +{ + return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0); } -wxBitmap *wxBrush::GetStipple() const -{ - return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); +wxBitmap *wxBrush::GetStipple() const +{ + return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0); } -wxMacBrushKind wxBrush::MacGetBrushKind() const -{ - return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); +wxMacBrushKind wxBrush::MacGetBrushKind() const +{ + return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour); }