]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/mac/private.h
We surely don't need two debugging sections,
[wxWidgets.git] / include / wx / mac / private.h
... / ...
CommitLineData
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#include "wx/app.h"
19
20#if defined(__POWERPC__) && defined(__DARWIN__)
21# include <Carbon/Carbon.h>
22# define TARGET_CARBON 1
23#else
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>
31#endif
32
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
37#include "wx/window.h"
38
39class wxMacPortStateHelper
40{
41 DECLARE_NO_COPY_CLASS(wxMacPortStateHelper)
42
43public:
44 wxMacPortStateHelper( GrafPtr newport) ;
45 wxMacPortStateHelper() ;
46 ~wxMacPortStateHelper() ;
47
48 void Setup( GrafPtr newport ) ;
49 void Clear() ;
50 bool IsCleared() { return m_clip == NULL ; }
51 GrafPtr GetCurrentPort() { return m_currentPort ; }
52
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 ;
62} ;
63
64class WXDLLEXPORT wxMacPortSetter
65{
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 ;
74} ;
75
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
88class wxMacDrawingHelper
89{
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 ;
106} ;
107
108// app.h
109bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ;
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 ) ;
133void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
134
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)
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
156#endif
157 // _WX_PRIVATE_H_