]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/private.h
We surely don't need two debugging sections,
[wxWidgets.git] / include / wx / mac / private.h
CommitLineData
0dbd6262
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: private.h
5273bf2f
SC
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
0dbd6262
SC
7// Modified by:
8// Created: ??/??/98
9// RCS-ID: $Id$
5273bf2f 10// Copyright: (c) Stefan Csomor
0dbd6262
SC
11// Licence: wxWindows licence
12/////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_PRIVATE_H_
15#define _WX_PRIVATE_H_
16
17#include "wx/defs.h"
9f67b776 18#include "wx/app.h"
0dbd6262 19
5273bf2f 20#if defined(__POWERPC__) && defined(__DARWIN__)
fa9d617b
GD
21# include <Carbon/Carbon.h>
22# define TARGET_CARBON 1
5273bf2f 23#else
5921f83f
SC
24# include <Quickdraw.h>
25# include <Appearance.h>
26# include <Folders.h>
27# include <Controls.h>
28# include <ControlDefinitions.h>
29# include <LowMem.h>
30# include <Gestalt.h>
5273bf2f 31#endif
5921f83f 32
5273bf2f
SC
33#if UNIVERSAL_INTERFACES_VERSION < 0x0340
34 #error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
35#endif
36
fa9d617b
GD
37#include "wx/window.h"
38
5273bf2f
SC
39class wxMacPortStateHelper
40{
d84afea9
GD
41 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper)
42
43public:
44 wxMacPortStateHelper( GrafPtr newport) ;
45 wxMacPortStateHelper() ;
46 ~wxMacPortStateHelper() ;
5273bf2f 47
d84afea9
GD
48 void Setup( GrafPtr newport ) ;
49 void Clear() ;
50 bool IsCleared() { return m_clip == NULL ; }
51 GrafPtr GetCurrentPort() { return m_currentPort ; }
5273bf2f 52
d84afea9
GD
53private:
54 GrafPtr m_currentPort ;
55 GrafPtr m_oldPort ;
56 RgnHandle m_clip ;
57 ThemeDrawingState m_drawingState ;
58 short m_textFont ;
59 short m_textSize ;
60 short m_textStyle ;
61 short m_textMode ;
5273bf2f
SC
62} ;
63
64class WXDLLEXPORT wxMacPortSetter
65{
d84afea9
GD
66 DECLARE_NO_COPY_CLASS(wxMacPortSetter)
67
68public:
69 wxMacPortSetter( const wxDC* dc ) ;
70 ~wxMacPortSetter() ;
71private:
72 wxMacPortStateHelper m_ph ;
73 const wxDC* m_dc ;
5273bf2f
SC
74} ;
75
e671beca
SC
76class WXDLLEXPORT wxMacWindowClipper
77{
78 DECLARE_NO_COPY_CLASS(wxMacWindowClipper)
79
80public:
81 wxMacWindowClipper( const wxWindow* win ) ;
82 ~wxMacWindowClipper() ;
83private:
84 RgnHandle m_formerClip ;
85 RgnHandle m_newClip ;
86} ;
87
5273bf2f
SC
88class wxMacDrawingHelper
89{
d84afea9
GD
90 DECLARE_NO_COPY_CLASS(wxMacDrawingHelper)
91
92public:
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 ; }
100private:
101 Point m_origin ;
102 GrafPtr m_formerPort ;
103 GrafPtr m_currentPort ;
104 PenState m_savedPenState ;
105 bool m_ok ;
5273bf2f
SC
106} ;
107
33426639
SC
108// app.h
109bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ;
5273bf2f
SC
110
111// filefn.h
112WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
113WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
114# ifndef __DARWIN__
115// Mac file names are POSIX (Unix style) under Darwin, so these are not needed
116WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
117WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ;
118WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ;
119WXDLLEXPORT wxString wxUnix2MacFilename( const char *s);
120# endif
121
122// utils.h
123WXDLLEXPORT wxString wxMacFindFolder(short vRefNum,
124 OSType folderType,
125 Boolean createFolder);
126
127GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
128void wxMacDestroyGWorld( GWorldPtr gw ) ;
129PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
130CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
131void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
132CTabHandle wxMacCreateColorTable( int numColors ) ;
2b5f62a0 133void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
0dbd6262 134
5273bf2f
SC
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)
3d963f81
SC
145
146#if TARGET_CARBON
147// converts this string into a carbon foundation string with optional pc 2 mac encoding
148CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) ;
149
150// converts this string into a carbon foundation string with optional pc 2 mac encoding
151inline CFStringRef wxMacCreateCFString( const wxString &str )
152 { return wxMacCreateCFString( str , wxApp::s_macDefaultEncodingIsPC ) ; }
153
154#endif //TARGET_CARBON
155
0dbd6262
SC
156#endif
157 // _WX_PRIVATE_H_