X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aad6765cbd8916ddeb0362b091663138c2e74df3..e0176dd9fb716ad0a1a8804f0a93e16048f09054:/src/common/gdicmn.cpp diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index cdff69b2fd..5af91e126a 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -217,8 +217,6 @@ bool wxRect::Intersects(const wxRect& rect) const // wxColourDatabase // ============================================================================ -WX_DECLARE_STRING_HASH_MAP( wxColour *, wxStringToColourHashMap ); - // ---------------------------------------------------------------------------- // wxColourDatabase ctor/dtor // ---------------------------------------------------------------------------- @@ -473,6 +471,15 @@ wxString wxColourDatabase::FindName(const wxColour& colour) const wxColour *wxColourDatabase::FindColour(const wxString& name) { + // This function is deprecated, use Find() instead. + // Formerly this function sometimes would return a deletable pointer and + // sometimes a non-deletable one (when returning a colour from the database). + // Trying to delete the latter anyway results in problems, so probably + // nobody ever freed the pointers. Currently it always returns a new + // instance, which means there will be memory leaks. + wxLogDebug(wxT("wxColourDataBase::FindColour():") + wxT(" Please use wxColourDataBase::Find() instead")); + // using a static variable here is not the most elegant solution but unless // we want to make wxStringToColourHashMap public (i.e. move it to the // header) so that we could have a member function returning @@ -481,13 +488,14 @@ wxColour *wxColourDatabase::FindColour(const wxString& name) // // and knowing that this function is going to disappear in the next release // anyhow I don't want to waste time on this + static wxColour s_col; s_col = Find(name); if ( !s_col.Ok() ) return NULL; - return &s_col; + return new wxColour(s_col); } // ============================================================================ @@ -521,6 +529,7 @@ void wxInitializeStockObjects () #endif */ #if defined(__WXMAC__) + // retrieve size of system font for all stock fonts int sizeFont = 12; Str255 fontName ; @@ -529,7 +538,12 @@ void wxInitializeStockObjects () GetThemeFont(kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; sizeFont = fontSize ; +#if __WXMAC_CLASSIC__ wxNORMAL_FONT = new wxFont (fontSize, wxMODERN, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal(fontName) ); +#else + wxNORMAL_FONT = new wxFont () ; + wxNORMAL_FONT->MacCreateThemeFont( kThemeSystemFont ); +#endif #elif defined(__WXPM__) static const int sizeFont = 12; #else @@ -549,8 +563,13 @@ void wxInitializeStockObjects () #elif defined(__WXMAC__) wxSWISS_FONT = new wxFont (sizeFont, wxSWISS, wxNORMAL, wxNORMAL); /* Helv */ wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL); +#if __WXMAC_CLASSIC__ GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; wxSMALL_FONT = new wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal( fontName ) ); +#else + wxSMALL_FONT = new wxFont () ; + wxSMALL_FONT->MacCreateThemeFont( kThemeSmallSystemFont ); +#endif #else wxSMALL_FONT = new wxFont (sizeFont - 2, wxSWISS, wxNORMAL, wxNORMAL); wxITALIC_FONT = new wxFont (sizeFont, wxROMAN, wxITALIC, wxNORMAL);