]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/core/cfstring.h
adding magnification API into the wxWindow classes for best retina support
[wxWidgets.git] / include / wx / osx / core / cfstring.h
CommitLineData
5c6eb3a8 1/////////////////////////////////////////////////////////////////////////////
233f5738 2// Name: wx/osx/core/cfstring.h
5c6eb3a8
SC
3// Purpose: wxCFStringRef 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// Usage: Darwin (base library)
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef __WX_CFSTRINGHOLDER_H__
14#define __WX_CFSTRINGHOLDER_H__
15
16#include <CoreFoundation/CFString.h>
17
18#include "wx/dlimpexp.h"
19#include "wx/fontenc.h"
ef0e9220 20#include "wx/osx/core/cfref.h"
5c6eb3a8 21
456057f8 22#ifdef WORDS_BIGENDIAN
f5f17248
SC
23 #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32BE
24#else
25 #define kCFStringEncodingUTF32Native kCFStringEncodingUTF32LE
26#endif
27
5c6eb3a8
SC
28class WXDLLIMPEXP_FWD_BASE wxString;
29
30WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( wxString *data ) ;
31WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( wxString *data ) ;
32
33WXDLLIMPEXP_BASE void wxMacConvertNewlines13To10( char * data ) ;
34WXDLLIMPEXP_BASE void wxMacConvertNewlines10To13( char * data ) ;
35
36WXDLLIMPEXP_BASE wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
37WXDLLIMPEXP_BASE wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
38WXDLLIMPEXP_BASE void wxMacWakeUp() ;
39
40class WXDLLIMPEXP_BASE wxCFStringRef : public wxCFRef< CFStringRef >
41{
42public:
43 wxCFStringRef()
44 {
45 }
46
47 wxCFStringRef(const wxString &str,
48 wxFontEncoding encoding = wxFONTENCODING_DEFAULT) ;
49
eefe52da
SC
50#if wxOSX_USE_COCOA_OR_IPHONE
51 wxCFStringRef(NSString* ref)
03647350 52 : wxCFRef< CFStringRef >((CFStringRef) ref)
eefe52da
SC
53 {
54 }
55#endif
56
5c6eb3a8 57 wxCFStringRef(CFStringRef ref)
03647350 58 : wxCFRef< CFStringRef >(ref)
5c6eb3a8
SC
59 {
60 }
61
62 wxCFStringRef(const wxCFStringRef& otherRef )
03647350 63 : wxCFRef< CFStringRef >(otherRef)
5c6eb3a8
SC
64 {
65 }
66
67 ~wxCFStringRef()
68 {
69 }
70
f66ecdc4 71 wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) const;
03647350 72
f66ecdc4 73 static wxString AsString( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
40aa05e0 74 static wxString AsStringWithNormalizationFormC( CFStringRef ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
f66ecdc4
SC
75#if wxOSX_USE_COCOA_OR_IPHONE
76 static wxString AsString( NSString* ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
4ccde09b 77 static wxString AsStringWithNormalizationFormC( NSString* ref, wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
f66ecdc4 78#endif
5c6eb3a8 79
eefe52da
SC
80#if wxOSX_USE_COCOA_OR_IPHONE
81 NSString* AsNSString() const { return (NSString*)(CFStringRef) *this; }
82#endif
5c6eb3a8
SC
83private:
84} ;
85
86// corresponding class for holding UniChars (native unicode characters)
87
88class WXDLLIMPEXP_BASE wxMacUniCharBuffer
89{
90public :
91 wxMacUniCharBuffer( const wxString &str ) ;
92
93 ~wxMacUniCharBuffer() ;
94
95 UniCharPtr GetBuffer() ;
96
97 UniCharCount GetChars() ;
98
99private :
100 UniCharPtr m_ubuf ;
101 UniCharCount m_chars ;
102};
103#endif //__WXCFSTRINGHOLDER_H__