1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private declarations: as this header is only included by
4 // wxWindows 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_
20 #if defined(__POWERPC__) && defined(__DARWIN__)
21 # include <Carbon/Carbon.h>
22 # define TARGET_CARBON 1
24 # include <Quickdraw.h>
25 # include <Appearance.h>
27 # include <Controls.h>
28 # include <ControlDefinitions.h>
33 #if UNIVERSAL_INTERFACES_VERSION < 0x0340
34 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
37 #include "wx/window.h"
39 class wxMacPortStateHelper
41 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper
)
44 wxMacPortStateHelper( GrafPtr newport
) ;
45 wxMacPortStateHelper() ;
46 ~wxMacPortStateHelper() ;
48 void Setup( GrafPtr newport
) ;
50 bool IsCleared() { return m_clip
== NULL
; }
51 GrafPtr
GetCurrentPort() { return m_currentPort
; }
54 GrafPtr m_currentPort
;
57 ThemeDrawingState m_drawingState
;
64 class WXDLLEXPORT wxMacPortSetter
66 DECLARE_NO_COPY_CLASS(wxMacPortSetter
)
69 wxMacPortSetter( const wxDC
* dc
) ;
72 wxMacPortStateHelper m_ph
;
76 class WXDLLEXPORT wxMacWindowClipper
78 DECLARE_NO_COPY_CLASS(wxMacWindowClipper
)
81 wxMacWindowClipper( const wxWindow
* win
) ;
82 ~wxMacWindowClipper() ;
84 RgnHandle m_formerClip
;
88 class wxMacDrawingHelper
90 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper
)
93 wxMacDrawingHelper( wxWindowMac
* theWindow
, bool clientArea
= false ) ;
94 ~wxMacDrawingHelper() ;
95 bool Ok() { return m_ok
; }
96 void LocalToWindow( Rect
*rect
) { OffsetRect( rect
, m_origin
.h
, m_origin
.v
) ; }
97 void LocalToWindow( Point
*pt
) { AddPt( m_origin
, pt
) ; }
98 void LocalToWindow( RgnHandle rgn
) { OffsetRgn( rgn
, m_origin
.h
, m_origin
.v
) ; }
99 const Point
& GetOrigin() { return m_origin
; }
102 GrafPtr m_formerPort
;
103 GrafPtr m_currentPort
;
104 PenState m_savedPenState
;
109 bool wxMacConvertEventToRecord( EventRef event
, EventRecord
*rec
) ;
112 WXDLLEXPORT wxString
wxMacFSSpec2MacFilename( const FSSpec
*spec
) ;
113 WXDLLEXPORT
void wxMacFilename2FSSpec( const char *path
, FSSpec
*spec
) ;
115 // Mac file names are POSIX (Unix style) under Darwin, so these are not needed
116 WXDLLEXPORT wxString
wxMacFSSpec2UnixFilename( const FSSpec
*spec
) ;
117 WXDLLEXPORT
void wxUnixFilename2FSSpec( const char *path
, FSSpec
*spec
) ;
118 WXDLLEXPORT wxString
wxMac2UnixFilename( const char *s
) ;
119 WXDLLEXPORT wxString
wxUnix2MacFilename( const char *s
);
123 WXDLLEXPORT wxString
wxMacFindFolder(short vRefNum
,
125 Boolean createFolder
);
127 GWorldPtr
wxMacCreateGWorld( int width
, int height
, int depth
) ;
128 void wxMacDestroyGWorld( GWorldPtr gw
) ;
129 PicHandle
wxMacCreatePict( GWorldPtr gw
, GWorldPtr mask
= NULL
) ;
130 CIconHandle
wxMacCreateCIcon(GWorldPtr image
, GWorldPtr mask
, short dstDepth
, short iconSize
) ;
131 void wxMacSetColorTableEntry( CTabHandle newColors
, int index
, int red
, int green
, int blue
) ;
132 CTabHandle
wxMacCreateColorTable( int numColors
) ;
133 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
, int forceType
= 0 ) ;
135 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
136 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
137 #define MAC_WXHMETAFILE(a) (PicHandle(a))
138 #define MAC_WXHICON(a) (CIconHandle(a))
139 #define MAC_WXHCURSOR(a) (CursHandle(a))
140 #define MAC_WXHRGN(a) (RgnHandle(a))
141 #define MAC_WXHWND(a) (WindowPtr(a))
142 #define MAC_WXRECPTR(a) ((Rect*)a)
143 #define MAC_WXPOINTPTR(a) ((Point*)a)
144 #define MAC_WXHMENU(a) ((MenuHandle)a)
147 // converts this string into a carbon foundation string with optional pc 2 mac encoding
148 CFStringRef
wxMacCreateCFString( const wxString
&str
, bool pc2macEncoding
) ;
150 // converts this string into a carbon foundation string with optional pc 2 mac encoding
151 inline CFStringRef
wxMacCreateCFString( const wxString
&str
)
152 { return wxMacCreateCFString( str
, wxApp::s_macDefaultEncodingIsPC
) ; }
154 #endif //TARGET_CARBON