]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/private.h
removing dependancy on mac headers from public wx headers
[wxWidgets.git] / include / wx / mac / private.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: private.h
3 // Purpose: Private declarations: as this header is only included by
4 // wxWindows itself, it may contain identifiers which don't start
5 // with "wx".
6 // Author: Stefan Csomor
7 // Modified by:
8 // Created: ??/??/98
9 // RCS-ID: $Id$
10 // Copyright: (c) Stefan Csomor
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_PRIVATE_H_
15 #define _WX_PRIVATE_H_
16
17 #include "wx/defs.h"
18
19 #if defined(__POWERPC__) && defined(__DARWIN__)
20 #include <Carbon/Carbon.h>
21 #else
22 #include "MacHeaders.c"
23 #endif
24 #if UNIVERSAL_INTERFACES_VERSION < 0x0340
25 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
26 #endif
27
28 class wxMacPortStateHelper
29 {
30 public :
31 wxMacPortStateHelper( GrafPtr newport) ;
32 wxMacPortStateHelper() ;
33 ~wxMacPortStateHelper() ;
34
35 void Setup( GrafPtr newport ) ;
36 void Clear() ;
37 bool IsCleared() { return m_clip == NULL ; }
38 GrafPtr GetCurrentPort() { return m_currentPort ; }
39
40 private :
41 GrafPtr m_currentPort ;
42 GrafPtr m_oldPort ;
43 RgnHandle m_clip ;
44 ThemeDrawingState m_drawingState ;
45 short m_textFont ;
46 short m_textSize ;
47 short m_textStyle ;
48 short m_textMode ;
49 } ;
50
51 class WXDLLEXPORT wxMacPortSetter
52 {
53 public :
54 wxMacPortSetter( const wxDC* dc ) ;
55 ~wxMacPortSetter() ;
56 private :
57 wxMacPortStateHelper m_ph ;
58 } ;
59
60 class wxMacDrawingHelper
61 {
62 public :
63 wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
64 ~wxMacDrawingHelper() ;
65 bool Ok() { return m_ok ; }
66 void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
67 void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
68 void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
69 const Point& GetOrigin() { return m_origin ; }
70 private :
71 Point m_origin ;
72 GrafPtr m_formerPort ;
73 GrafPtr m_currentPort ;
74 PenState m_savedPenState ;
75 bool m_ok ;
76 } ;
77
78
79 // filefn.h
80 WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
81 WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
82 # ifndef __DARWIN__
83 // Mac file names are POSIX (Unix style) under Darwin, so these are not needed
84 WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
85 WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ;
86 WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ;
87 WXDLLEXPORT wxString wxUnix2MacFilename( const char *s);
88 # endif
89
90 // utils.h
91 WXDLLEXPORT wxString wxMacFindFolder(short vRefNum,
92 OSType folderType,
93 Boolean createFolder);
94
95 GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
96 void wxMacDestroyGWorld( GWorldPtr gw ) ;
97 PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
98 CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
99 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
100 CTabHandle wxMacCreateColorTable( int numColors ) ;
101
102 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
103 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
104 #define MAC_WXHMETAFILE(a) (PicHandle(a))
105 #define MAC_WXHICON(a) (CIconHandle(a))
106 #define MAC_WXHCURSOR(a) (CursHandle(a))
107 #define MAC_WXHRGN(a) (RgnHandle(a))
108 #define MAC_WXHWND(a) (WindowPtr(a))
109 #define MAC_WXRECPTR(a) ((Rect*)a)
110 #define MAC_WXPOINTPTR(a) ((Point*)a)
111 #define MAC_WXHMENU(a) ((MenuHandle)a)
112 #endif
113 // _WX_PRIVATE_H_