]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/corefoundation/cfstring.h
setting focus explicitely when using showmodal
[wxWidgets.git] / include / wx / mac / corefoundation / cfstring.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/mac/corefoundation/cfstring.h
3// Purpose: wxMacCFStringHolder and other string functions
4// Author: Stefan Csomor
5// Modified by:
6// Created: 2004-10-29 (from code in wx/mac/carbon/private.h)
7// RCS-ID: $Id$
8// Copyright: (c) Stefan Csomor
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __DARWIN__
13 #include <CoreFoundation/CFString.h>
14#else
15 #include <CFString.h>
16#endif
17
18void wxMacConvertNewlines13To10( char * data ) ;
19void wxMacConvertNewlines10To13( char * data ) ;
20void wxMacConvertNewlines13To10( wxString *data ) ;
21void wxMacConvertNewlines10To13( wxString *data ) ;
22
23#if wxUSE_UNICODE
24void wxMacConvertNewlines13To10( wxChar * data ) ;
25void wxMacConvertNewlines10To13( wxChar * data ) ;
26#endif
27
28wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
29wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
30void wxMacWakeUp() ;
31
32class wxMacCFStringHolder
33{
34public:
35 wxMacCFStringHolder()
36 {
37 m_cfs = NULL ;
38 m_release = false ;
39 }
40
41 wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding )
42 {
43 m_cfs = NULL ;
44 m_release = false ;
45 Assign( str , encoding ) ;
46 }
47
48 wxMacCFStringHolder(CFStringRef ref , bool release = true )
49 {
50 m_cfs = ref ;
51 m_release = release ;
52 }
53
54 ~wxMacCFStringHolder()
55 {
56 Release() ;
57 }
58
59 CFStringRef Detach()
60 {
61 CFStringRef retval = m_cfs ;
62 m_release = false ;
63 m_cfs = NULL ;
64 return retval ;
65 }
66
67 void Release()
68 {
69 if ( m_release && m_cfs)
70 CFRelease( m_cfs ) ;
71 m_cfs = NULL ;
72 }
73
74 void Assign( const wxString &str , wxFontEncoding encoding ) ;
75
76 operator CFStringRef () { return m_cfs; }
77 wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
78
79private:
80
81 CFStringRef m_cfs;
82 bool m_release ;
83} ;
84