1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private declarations: as this header is only included by
4 // wxWidgets itself, it may contain identifiers which don't start
6 // Author: Stefan Csomor
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_PRIVATE_H_
15 #define _WX_PRIVATE_H_
21 # include <Carbon/Carbon.h>
23 # include <Quickdraw.h>
24 # include <Appearance.h>
26 # include <Controls.h>
27 # include <ControlDefinitions.h>
32 #if UNIVERSAL_INTERFACES_VERSION < 0x0340
33 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
38 #include "wx/window.h"
40 class wxMacPortStateHelper
42 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper
)
45 wxMacPortStateHelper( GrafPtr newport
) ;
46 wxMacPortStateHelper() ;
47 ~wxMacPortStateHelper() ;
49 void Setup( GrafPtr newport
) ;
51 bool IsCleared() { return m_clip
== NULL
; }
52 GrafPtr
GetCurrentPort() { return m_currentPort
; }
55 GrafPtr m_currentPort
;
58 ThemeDrawingState m_drawingState
;
65 class WXDLLEXPORT wxMacPortSetter
67 DECLARE_NO_COPY_CLASS(wxMacPortSetter
)
70 wxMacPortSetter( const wxDC
* dc
) ;
73 wxMacPortStateHelper m_ph
;
77 class WXDLLEXPORT wxMacWindowClipper
79 DECLARE_NO_COPY_CLASS(wxMacWindowClipper
)
82 wxMacWindowClipper( const wxWindow
* win
) ;
83 ~wxMacWindowClipper() ;
85 RgnHandle m_formerClip
;
89 class wxMacDrawingHelper
91 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper
)
94 wxMacDrawingHelper( wxWindowMac
* theWindow
, bool clientArea
= false ) ;
95 ~wxMacDrawingHelper() ;
96 bool Ok() { return m_ok
; }
97 void LocalToWindow( Rect
*rect
) { OffsetRect( rect
, m_origin
.h
, m_origin
.v
) ; }
98 void LocalToWindow( Point
*pt
) { AddPt( m_origin
, pt
) ; }
99 void LocalToWindow( RgnHandle rgn
) { OffsetRgn( rgn
, m_origin
.h
, m_origin
.v
) ; }
100 const Point
& GetOrigin() { return m_origin
; }
103 GrafPtr m_formerPort
;
104 GrafPtr m_currentPort
;
105 PenState m_savedPenState
;
110 bool wxMacConvertEventToRecord( EventRef event
, EventRecord
*rec
) ;
115 WXDLLEXPORT wxString
wxMacFSSpec2MacFilename( const FSSpec
*spec
) ;
116 WXDLLEXPORT
void wxMacFilename2FSSpec( const char *path
, FSSpec
*spec
) ;
117 WXDLLEXPORT
void wxMacFilename2FSSpec( const wxChar
*path
, FSSpec
*spec
) ;
119 // Mac file names are POSIX (Unix style) under Darwin, so these are not needed
120 WXDLLEXPORT wxString
wxMacFSSpec2UnixFilename( const FSSpec
*spec
) ;
121 WXDLLEXPORT
void wxUnixFilename2FSSpec( const wxChar
*path
, FSSpec
*spec
) ;
122 WXDLLEXPORT wxString
wxMac2UnixFilename( const wxChar
*s
) ;
123 WXDLLEXPORT wxString
wxUnix2MacFilename( const wxChar
*s
);
127 WXDLLEXPORT wxString
wxMacFindFolderNoSeparator(short vRefNum
,
129 Boolean createFolder
);
130 WXDLLEXPORT wxString
wxMacFindFolder(short vRefNum
,
132 Boolean createFolder
);
136 GWorldPtr
wxMacCreateGWorld( int width
, int height
, int depth
) ;
137 void wxMacDestroyGWorld( GWorldPtr gw
) ;
138 PicHandle
wxMacCreatePict( GWorldPtr gw
, GWorldPtr mask
= NULL
) ;
139 CIconHandle
wxMacCreateCIcon(GWorldPtr image
, GWorldPtr mask
, short dstDepth
, short iconSize
) ;
140 void wxMacSetColorTableEntry( CTabHandle newColors
, int index
, int red
, int green
, int blue
) ;
141 CTabHandle
wxMacCreateColorTable( int numColors
) ;
142 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
, int forceType
= 0 ) ;
144 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
145 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
146 #define MAC_WXHMETAFILE(a) (PicHandle(a))
147 #define MAC_WXHICON(a) (CIconHandle(a))
148 #define MAC_WXHCURSOR(a) (CursHandle(a))
149 #define MAC_WXHRGN(a) (RgnHandle(a))
150 #define MAC_WXHWND(a) (WindowPtr(a))
151 #define MAC_WXRECPTR(a) ((Rect*)a)
152 #define MAC_WXPOINTPTR(a) ((Point*)a)
153 #define MAC_WXHMENU(a) ((MenuHandle)a)
157 //---------------------------------------------------------------------------
158 // wxMac string conversions
159 //---------------------------------------------------------------------------
161 void wxMacSetupConverters() ;
162 void wxMacCleanupConverters() ;
164 void wxMacStringToPascal( const wxString
&from
, StringPtr to
) ;
165 wxString
wxMacMakeStringFromPascal( ConstStringPtr from
) ;
167 void wxMacConvertNewlines13To10( char * data
) ;
168 void wxMacConvertNewlines10To13( char * data
) ;
169 void wxMacConvertNewlines13To10( wxString
*data
) ;
170 void wxMacConvertNewlines10To13( wxString
*data
) ;
173 void wxMacConvertNewlines13To10( wxChar
* data
) ;
174 void wxMacConvertNewlines10To13( wxChar
* data
) ;
179 class wxMacCFStringHolder
182 wxMacCFStringHolder()
188 wxMacCFStringHolder(const wxString
&str
, wxFontEncoding encoding
)
192 Assign( str
, encoding
) ;
195 wxMacCFStringHolder(CFStringRef ref
, bool release
= true )
198 m_release
= release
;
201 ~wxMacCFStringHolder()
208 CFStringRef retval
= m_cfs
;
216 if ( m_release
&& m_cfs
)
221 void Assign( const wxString
&str
, wxFontEncoding encoding
) ;
223 operator CFStringRef () { return m_cfs
; }
224 wxString
AsString( wxFontEncoding encoding
= wxFONTENCODING_DEFAULT
) ;
236 wxUint32
wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding
) ;
237 wxFontEncoding
wxMacGetFontEncFromSystemEnc(wxUint32 encoding
) ;