]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/private.h
a0f211607a25bf9f5b9531fad0b30f9f3913ecce
[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 # define TARGET_CARBON 1
22 #else
23 # include "MacHeaders.c"
24 #endif
25 #if UNIVERSAL_INTERFACES_VERSION < 0x0340
26 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
27 #endif
28
29 #include "wx/window.h"
30
31 class wxMacPortStateHelper
32 {
33 public :
34 wxMacPortStateHelper( GrafPtr newport) ;
35 wxMacPortStateHelper() ;
36 ~wxMacPortStateHelper() ;
37
38 void Setup( GrafPtr newport ) ;
39 void Clear() ;
40 bool IsCleared() { return m_clip == NULL ; }
41 GrafPtr GetCurrentPort() { return m_currentPort ; }
42
43 private :
44 GrafPtr m_currentPort ;
45 GrafPtr m_oldPort ;
46 RgnHandle m_clip ;
47 ThemeDrawingState m_drawingState ;
48 short m_textFont ;
49 short m_textSize ;
50 short m_textStyle ;
51 short m_textMode ;
52 } ;
53
54 class WXDLLEXPORT wxMacPortSetter
55 {
56 public :
57 wxMacPortSetter( const wxDC* dc ) ;
58 ~wxMacPortSetter() ;
59 private :
60 wxMacPortStateHelper m_ph ;
61 } ;
62
63 class wxMacDrawingHelper
64 {
65 public :
66 wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
67 ~wxMacDrawingHelper() ;
68 bool Ok() { return m_ok ; }
69 void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
70 void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
71 void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
72 const Point& GetOrigin() { return m_origin ; }
73 private :
74 Point m_origin ;
75 GrafPtr m_formerPort ;
76 GrafPtr m_currentPort ;
77 PenState m_savedPenState ;
78 bool m_ok ;
79 } ;
80
81
82 // filefn.h
83 WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
84 WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
85 # ifndef __DARWIN__
86 // Mac file names are POSIX (Unix style) under Darwin, so these are not needed
87 WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
88 WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ;
89 WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ;
90 WXDLLEXPORT wxString wxUnix2MacFilename( const char *s);
91 # endif
92
93 // utils.h
94 WXDLLEXPORT wxString wxMacFindFolder(short vRefNum,
95 OSType folderType,
96 Boolean createFolder);
97
98 GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
99 void wxMacDestroyGWorld( GWorldPtr gw ) ;
100 PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
101 CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
102 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
103 CTabHandle wxMacCreateColorTable( int numColors ) ;
104
105 #define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
106 #define MAC_WXHBITMAP(a) (GWorldPtr(a))
107 #define MAC_WXHMETAFILE(a) (PicHandle(a))
108 #define MAC_WXHICON(a) (CIconHandle(a))
109 #define MAC_WXHCURSOR(a) (CursHandle(a))
110 #define MAC_WXHRGN(a) (RgnHandle(a))
111 #define MAC_WXHWND(a) (WindowPtr(a))
112 #define MAC_WXRECPTR(a) ((Rect*)a)
113 #define MAC_WXPOINTPTR(a) ((Point*)a)
114 #define MAC_WXHMENU(a) ((MenuHandle)a)
115 #endif
116 // _WX_PRIVATE_H_