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