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_
19 #if defined(__POWERPC__) && defined(__DARWIN__)
20 # include <Carbon/Carbon.h>
21 # define TARGET_CARBON 1
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/"
36 #include "wx/window.h"
38 class wxMacPortStateHelper
40 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper
)
43 wxMacPortStateHelper( GrafPtr newport
) ;
44 wxMacPortStateHelper() ;
45 ~wxMacPortStateHelper() ;
47 void Setup( GrafPtr newport
) ;
49 bool IsCleared() { return m_clip
== NULL
; }
50 GrafPtr
GetCurrentPort() { return m_currentPort
; }
53 GrafPtr m_currentPort
;
56 ThemeDrawingState m_drawingState
;
63 class WXDLLEXPORT wxMacPortSetter
65 DECLARE_NO_COPY_CLASS(wxMacPortSetter
)
68 wxMacPortSetter( const wxDC
* dc
) ;
71 wxMacPortStateHelper m_ph
;
75 class wxMacDrawingHelper
77 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper
)
80 wxMacDrawingHelper( wxWindowMac
* theWindow
, bool clientArea
= false ) ;
81 ~wxMacDrawingHelper() ;
82 bool Ok() { return m_ok
; }
83 void LocalToWindow( Rect
*rect
) { OffsetRect( rect
, m_origin
.h
, m_origin
.v
) ; }
84 void LocalToWindow( Point
*pt
) { AddPt( m_origin
, pt
) ; }
85 void LocalToWindow( RgnHandle rgn
) { OffsetRgn( rgn
, m_origin
.h
, m_origin
.v
) ; }
86 const Point
& GetOrigin() { return m_origin
; }
89 GrafPtr m_formerPort
;
90 GrafPtr m_currentPort
;
91 PenState m_savedPenState
;
96 bool wxMacConvertEventToRecord( EventRef event
, EventRecord
*rec
) ;
99 WXDLLEXPORT wxString
wxMacFSSpec2MacFilename( const FSSpec
*spec
) ;
100 WXDLLEXPORT
void wxMacFilename2FSSpec( const char *path
, FSSpec
*spec
) ;
102 // Mac file names are POSIX (Unix style) under Darwin, so these are not needed
103 WXDLLEXPORT wxString
wxMacFSSpec2UnixFilename( const FSSpec
*spec
) ;
104 WXDLLEXPORT
void wxUnixFilename2FSSpec( const char *path
, FSSpec
*spec
) ;
105 WXDLLEXPORT wxString
wxMac2UnixFilename( const char *s
) ;
106 WXDLLEXPORT wxString
wxUnix2MacFilename( const char *s
);
110 WXDLLEXPORT wxString
wxMacFindFolder(short vRefNum
,
112 Boolean createFolder
);
114 GWorldPtr
wxMacCreateGWorld( int width
, int height
, int depth
) ;
115 void wxMacDestroyGWorld( GWorldPtr gw
) ;
116 PicHandle
wxMacCreatePict( GWorldPtr gw
, GWorldPtr mask
= NULL
) ;
117 CIconHandle
wxMacCreateCIcon(GWorldPtr image
, GWorldPtr mask
, short dstDepth
, short iconSize
) ;
118 void wxMacSetColorTableEntry( CTabHandle newColors
, int index
, int red
, int green
, int blue
) ;
119 CTabHandle
wxMacCreateColorTable( int numColors
) ;
120 void wxMacCreateBitmapButton( ControlButtonContentInfo
*info
, const wxBitmap
& bitmap
) ;
122 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
123 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
124 #define MAC_WXHMETAFILE(a) (PicHandle(a))
125 #define MAC_WXHICON(a) (CIconHandle(a))
126 #define MAC_WXHCURSOR(a) (CursHandle(a))
127 #define MAC_WXHRGN(a) (RgnHandle(a))
128 #define MAC_WXHWND(a) (WindowPtr(a))
129 #define MAC_WXRECPTR(a) ((Rect*)a)
130 #define MAC_WXPOINTPTR(a) ((Point*)a)
131 #define MAC_WXHMENU(a) ((MenuHandle)a)