implement wxLocale::GetInfo() using CFLocale (modified patch 1760939)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-04 16:01:05 +00:00
parent ae6c6c356b
commit dff6cf576a
2 changed files with 36 additions and 4 deletions

View File

@@ -248,6 +248,7 @@ wxMac:
- Fix duplicate (empty) help menu in non-English programs (Andreas Jacobs). - Fix duplicate (empty) help menu in non-English programs (Andreas Jacobs).
- Allow accelerators to be used with buttons too (Ryan Wilcox). - Allow accelerators to be used with buttons too (Ryan Wilcox).
- Support resource forks in wxCopyFile() (Hank Schultz). - Support resource forks in wxCopyFile() (Hank Schultz).
- Implement wxLocale::GetInfo() using CFLocale
wxMSW: wxMSW:

View File

@@ -73,7 +73,12 @@
#include "wx/filesys.h" #include "wx/filesys.h"
#if defined(__WXMAC__) #if defined(__WXMAC__)
#include "wx/mac/private.h" // includes mac headers #include "wx/mac/private.h" // includes mac headers
#endif
#if defined(__WXOSX__)
#include "wx/mac/corefoundation/cfstring.h"
#include "wx/mac/corefoundation/cfref.h"
#endif #endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -2860,7 +2865,7 @@ bool wxLocale::AddCatalog(const wxString& szDomain,
// accessors for locale-dependent data // accessors for locale-dependent data
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __WXMSW__ #if defined(__WXMSW__)
/* static */ /* static */
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat)) wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
@@ -2900,7 +2905,33 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
return str; return str;
} }
#else // !__WXMSW__ #elif defined(__WXOSX__)
/* static */
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory WXUNUSED(cat))
{
wxCFRef<CFLocaleRef> userLocaleRef(CFLocaleCopyCurrent());
CFTypeRef cfstr;
switch ( index )
{
case wxLOCALE_THOUSANDS_SEP:
cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleGroupingSeparator);
break;
case wxLOCALE_DECIMAL_POINT:
cfstr = CFLocaleGetValue(userLocaleRef, kCFLocaleDecimalSeparator);
break;
default:
wxFAIL_MSG( "Unknown locale info" );
}
wxMacCFStringHolder
str(CFStringCreateCopy(NULL, static_cast<CFStringRef>(cfstr)));
return str.AsString();
}
#else // !__WXMSW__ && !__WXMAC__
/* static */ /* static */
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat) wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat)
@@ -2937,7 +2968,7 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat)
} }
} }
#endif // __WXMSW__/!__WXMSW__ #endif // platform
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// global functions and variables // global functions and variables