#define _WX_PRIVATE_H_
#include "wx/defs.h"
+#include "wx/app.h"
-#if defined(__POWERPC__) && defined(__DARWIN__)
+#ifdef __DARWIN__
# include <Carbon/Carbon.h>
-# define TARGET_CARBON 1
#else
-# include "MacHeaders.c"
+# include <Quickdraw.h>
+# include <Appearance.h>
+# include <Folders.h>
+# include <Controls.h>
+# include <ControlDefinitions.h>
+# include <LowMem.h>
+# include <Gestalt.h>
#endif
+
#if UNIVERSAL_INTERFACES_VERSION < 0x0340
#error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
#endif
class wxMacPortStateHelper
{
-public :
- wxMacPortStateHelper( GrafPtr newport) ;
- wxMacPortStateHelper() ;
- ~wxMacPortStateHelper() ;
-
- void Setup( GrafPtr newport ) ;
- void Clear() ;
- bool IsCleared() { return m_clip == NULL ; }
- GrafPtr GetCurrentPort() { return m_currentPort ; }
-
-private :
- GrafPtr m_currentPort ;
- GrafPtr m_oldPort ;
- RgnHandle m_clip ;
- ThemeDrawingState m_drawingState ;
- short m_textFont ;
- short m_textSize ;
- short m_textStyle ;
- short m_textMode ;
+ DECLARE_NO_COPY_CLASS(wxMacPortStateHelper)
+
+public:
+ wxMacPortStateHelper( GrafPtr newport) ;
+ wxMacPortStateHelper() ;
+ ~wxMacPortStateHelper() ;
+
+ void Setup( GrafPtr newport ) ;
+ void Clear() ;
+ bool IsCleared() { return m_clip == NULL ; }
+ GrafPtr GetCurrentPort() { return m_currentPort ; }
+
+private:
+ GrafPtr m_currentPort ;
+ GrafPtr m_oldPort ;
+ RgnHandle m_clip ;
+ ThemeDrawingState m_drawingState ;
+ short m_textFont ;
+ short m_textSize ;
+ short m_textStyle ;
+ short m_textMode ;
} ;
class WXDLLEXPORT wxMacPortSetter
{
-public :
- wxMacPortSetter( const wxDC* dc ) ;
- ~wxMacPortSetter() ;
-private :
- wxMacPortStateHelper m_ph ;
+ DECLARE_NO_COPY_CLASS(wxMacPortSetter)
+
+public:
+ wxMacPortSetter( const wxDC* dc ) ;
+ ~wxMacPortSetter() ;
+private:
+ wxMacPortStateHelper m_ph ;
+ const wxDC* m_dc ;
+} ;
+
+class WXDLLEXPORT wxMacWindowClipper
+{
+ DECLARE_NO_COPY_CLASS(wxMacWindowClipper)
+
+public:
+ wxMacWindowClipper( const wxWindow* win ) ;
+ ~wxMacWindowClipper() ;
+private:
+ RgnHandle m_formerClip ;
+ RgnHandle m_newClip ;
} ;
class wxMacDrawingHelper
{
-public :
- wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
- ~wxMacDrawingHelper() ;
- bool Ok() { return m_ok ; }
- void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
- void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
- void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
- const Point& GetOrigin() { return m_origin ; }
-private :
- Point m_origin ;
- GrafPtr m_formerPort ;
- GrafPtr m_currentPort ;
- PenState m_savedPenState ;
- bool m_ok ;
+ DECLARE_NO_COPY_CLASS(wxMacDrawingHelper)
+
+public:
+ wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea = false ) ;
+ ~wxMacDrawingHelper() ;
+ bool Ok() { return m_ok ; }
+ void LocalToWindow( Rect *rect) { OffsetRect( rect , m_origin.h , m_origin.v ) ; }
+ void LocalToWindow( Point *pt ) { AddPt( m_origin , pt ) ; }
+ void LocalToWindow( RgnHandle rgn ) { OffsetRgn( rgn , m_origin.h , m_origin.v ) ; }
+ const Point& GetOrigin() { return m_origin ; }
+private:
+ Point m_origin ;
+ GrafPtr m_formerPort ;
+ GrafPtr m_currentPort ;
+ PenState m_savedPenState ;
+ bool m_ok ;
} ;
+// app.h
+bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ;
// filefn.h
WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
CTabHandle wxMacCreateColorTable( int numColors ) ;
+void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
#define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
#define MAC_WXHBITMAP(a) (GWorldPtr(a))
#define MAC_WXRECPTR(a) ((Rect*)a)
#define MAC_WXPOINTPTR(a) ((Point*)a)
#define MAC_WXHMENU(a) ((MenuHandle)a)
+
+//---------------------------------------------------------------------------
+// wxMac string conversions
+//---------------------------------------------------------------------------
+
+void wxMacConvertToPC( const char *from , char *to , int len ) ;
+void wxMacConvertFromPC( const char *from , char *to , int len ) ;
+void wxMacConvertToPC( const char *from , char *to , int len ) ;
+
+wxString wxMacMakeMacStringFromPC( const char * p ) ;
+
+wxString wxMacMakePCStringFromMac( const char * p ) ;
+
+
+// converts this c string into a wxString with optional mac 2 pc encoding
+wxString wxMacMakeStringFromMacString( const char* from , bool mac2pcEncoding ) ;
+
+// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
+inline wxString wxMacMakeStringFromMacString( const char* from )
+ { return wxMacMakeStringFromMacString( from , wxApp::s_macDefaultEncodingIsPC ) ; }
+
+// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
+inline wxString wxMacMakeStringFromMacString( const wxString& from )
+ { return wxApp::s_macDefaultEncodingIsPC ?
+ wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
+
+//
+// Pascal Strings
+//
+
+// converts this string into a pascal with optional pc 2 mac encoding
+void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding ) ;
+
+// converts this string into a pascal with pc 2 mac encoding if s_macDefaultEncodingIsPC
+inline void wxMacStringToPascal( const char * from , StringPtr to )
+ { wxMacStringToPascal( from , to , wxApp::s_macDefaultEncodingIsPC ) ; }
+
+// converts this string into a pascal with optional mac 2 pc encoding
+wxString wxMacMakeStringFromPascal( ConstStringPtr from , bool mac2pcEncoding ) ;
+
+// converts this pascal string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
+inline wxString wxMacMakeStringFromPascal( ConstStringPtr from )
+ { return wxMacMakeStringFromPascal( from , wxApp::s_macDefaultEncodingIsPC ) ; }
+
+//
+// CFStringRefs (Carbon only)
+//
+
+#if TARGET_CARBON
+// converts this string into a carbon foundation string with optional pc 2 mac encoding
+CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) ;
+
+// converts this string into a carbon foundation string with optional pc 2 mac encoding
+inline CFStringRef wxMacCreateCFString( const wxString &str )
+ { return wxMacCreateCFString( str , wxApp::s_macDefaultEncodingIsPC ) ; }
+
+#endif //TARGET_CARBON
+
+
#endif
// _WX_PRIVATE_H_