]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/classic/private.h
compilation fix: remove wxRegionContain enum which is now defined in wx/region.h...
[wxWidgets.git] / include / wx / mac / classic / private.h
CommitLineData
52479aef
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: private.h
3// Purpose: Private declarations: as this header is only included by
77ffb593 4// wxWidgets itself, it may contain identifiers which don't start
52479aef
SC
5// with "wx".
6// Author: Stefan Csomor
7// Modified by:
8// Created: 1998-01-01
9// RCS-ID: $Id$
10// Copyright: (c) Stefan Csomor
65571936 11// Licence: wxWindows licence
52479aef
SC
12/////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_PRIVATE_H_
15#define _WX_PRIVATE_H_
16
17#include "wx/defs.h"
18#include "wx/app.h"
19
20#ifdef __DARWIN__
21# include <Carbon/Carbon.h>
22#else
23# include <Quickdraw.h>
24# include <Appearance.h>
25# include <Folders.h>
26# include <Controls.h>
27# include <ControlDefinitions.h>
28# include <LowMem.h>
29# include <Gestalt.h>
30#endif
31
32#if UNIVERSAL_INTERFACES_VERSION < 0x0340
33 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
34#endif
35
36#if wxUSE_GUI
37
38#include "wx/window.h"
39
40class wxMacPortStateHelper
41{
42 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper)
43
44public:
45 wxMacPortStateHelper( GrafPtr newport) ;
46 wxMacPortStateHelper() ;
47 ~wxMacPortStateHelper() ;
48
49 void Setup( GrafPtr newport ) ;
50 void Clear() ;
51 bool IsCleared() { return m_clip == NULL ; }
52 GrafPtr GetCurrentPort() { return m_currentPort ; }
53
54private:
55 GrafPtr m_currentPort ;
56 GrafPtr m_oldPort ;
57 RgnHandle m_clip ;
58 ThemeDrawingState m_drawingState ;
59 short m_textFont ;
60 short m_textSize ;
61 short m_textStyle ;
62 short m_textMode ;
63} ;
64
65class WXDLLEXPORT wxMacPortSetter
66{
67 DECLARE_NO_COPY_CLASS(wxMacPortSetter)
68
69public:
70 wxMacPortSetter( const wxDC* dc ) ;
71 ~wxMacPortSetter() ;
72private:
73 wxMacPortStateHelper m_ph ;
74 const wxDC* m_dc ;
75} ;
76
77class WXDLLEXPORT wxMacWindowClipper
78{
79 DECLARE_NO_COPY_CLASS(wxMacWindowClipper)
80
81public:
82 wxMacWindowClipper( const wxWindow* win ) ;
83 ~wxMacWindowClipper() ;
84private:
85 RgnHandle m_formerClip ;
86 RgnHandle m_newClip ;
87} ;
88
89class wxMacDrawingHelper
90{
91 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper)
92
93public:
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 ; }
101private:
102 Point m_origin ;
103 GrafPtr m_formerPort ;
104 GrafPtr m_currentPort ;
105 PenState m_savedPenState ;
106 bool m_ok ;
107} ;
108
109// app.h
110bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ;
111
112#endif // wxUSE_GUI
113
114// filefn.h
115WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
116WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
117WXDLLEXPORT void wxMacFilename2FSSpec( const wxChar *path , FSSpec *spec ) ;
118# ifndef __DARWIN__
119// Mac file names are POSIX (Unix style) under Darwin, so these are not needed
120WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
6b941b35
SC
121WXDLLEXPORT void wxUnixFilename2FSSpec( const wxChar *path , FSSpec *spec ) ;
122WXDLLEXPORT wxString wxMac2UnixFilename( const wxChar *s) ;
123WXDLLEXPORT wxString wxUnix2MacFilename( const wxChar *s);
52479aef
SC
124# endif
125
126// utils.h
17af82fb
VZ
127WXDLLEXPORT wxString wxMacFindFolderNoSeparator(short vRefNum,
128 OSType folderType,
129 Boolean createFolder);
52479aef
SC
130WXDLLEXPORT wxString wxMacFindFolder(short vRefNum,
131 OSType folderType,
132 Boolean createFolder);
133
134#if wxUSE_GUI
135
136GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
137void wxMacDestroyGWorld( GWorldPtr gw ) ;
138PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
139CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
140void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
141CTabHandle wxMacCreateColorTable( int numColors ) ;
142void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
143
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)
154
155#endif // wxUSE_GUI
156
157//---------------------------------------------------------------------------
158// wxMac string conversions
159//---------------------------------------------------------------------------
160
161void wxMacSetupConverters() ;
162void wxMacCleanupConverters() ;
163
164void wxMacStringToPascal( const wxString&from , StringPtr to ) ;
165wxString wxMacMakeStringFromPascal( ConstStringPtr from ) ;
166
167void wxMacConvertNewlines13To10( char * data ) ;
168void wxMacConvertNewlines10To13( char * data ) ;
169void wxMacConvertNewlines13To10( wxString *data ) ;
170void wxMacConvertNewlines10To13( wxString *data ) ;
171
172#if wxUSE_UNICODE
173void wxMacConvertNewlines13To10( wxChar * data ) ;
174void wxMacConvertNewlines10To13( wxChar * data ) ;
175#endif
176
177#if TARGET_CARBON
178
179class wxMacCFStringHolder
180{
181public:
182 wxMacCFStringHolder()
183 {
184 m_cfs = NULL ;
185 m_release = false ;
186 }
187
188 wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding )
189 {
190 m_cfs = NULL ;
191 m_release = false ;
192 Assign( str , encoding ) ;
193 }
194
195 wxMacCFStringHolder(CFStringRef ref , bool release = true )
196 {
197 m_cfs = ref ;
198 m_release = release ;
199 }
200
201 ~wxMacCFStringHolder()
202 {
203 Release() ;
204 }
205
206 CFStringRef Detach()
207 {
208 CFStringRef retval = m_cfs ;
209 m_release = false ;
210 m_cfs = NULL ;
211 return retval ;
212 }
213
214 void Release()
215 {
216 if ( m_release && m_cfs)
217 CFRelease( m_cfs ) ;
218 m_cfs = NULL ;
219 }
220
221 void Assign( const wxString &str , wxFontEncoding encoding ) ;
222
223 operator CFStringRef () { return m_cfs; }
224 wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
225
226private:
227
228 CFStringRef m_cfs;
229 bool m_release ;
230} ;
231
232#endif
233
234
235
236wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
237wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
238
239
240#endif
241 // _WX_PRIVATE_H_