Fix preprocessor definitions for wxBase build under OS X.

Define __WXOSX__ for non-GUI build under Darwin. Ensure that the rest of the
code compiles correctly when just __WXOSX__ is defined but neither of
__WXOSX_{CARBON,COCOA,IPHONE}__ is. This ensures that wxBase can actually be
built under Mac.

Move OS X symbols definitions in wx/platform.h after wx/setup.h inclusion as
they rely on __DARWIN__ and wxUSE_GUI values which are both define in that
file now. Still keep them before wx/chkconf.h inclusion which relies on
__WXOSX_XXX__ being defined. Yes, it's a mess and should be cleaned up more
permanently some day.

Also remove some redundancy from wx/osx/{carbon,cocoa}/private.h by factoring
out common parts into wx/osx/core/private.h. Also include this header itself
from wx/osx/private.h directly instead of including it thrice from different
sub-ports headers.

Closes #12660.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-11-09 23:53:42 +00:00
parent 947d5ad04c
commit 382c4adea6
8 changed files with 106 additions and 146 deletions

View File

@@ -14,10 +14,6 @@
#ifndef _WX_PRIVATE_H_
#define _WX_PRIVATE_H_
#include "wx/osx/core/private.h"
#include <Carbon/Carbon.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
typedef UInt32 URefCon;
typedef SInt32 SRefCon;
@@ -942,16 +938,6 @@ UPP Get##x() \
return sHandler; \
}
//---------------------------------------------------------------------------
// wxMac string conversions
//---------------------------------------------------------------------------
// filefn.cpp
WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
//---------------------------------------------------------------------------
// cocoa bridging utilities
//---------------------------------------------------------------------------

View File

@@ -41,7 +41,8 @@
* to configure the build otherwise and give error messages
*/
#if !wxUSE_GRAPHICS_CONTEXT || ( defined( wxMAC_USE_CORE_GRAPHICS ) && !wxMAC_USE_CORE_GRAPHICS )
#if wxUSE_GUI && (!wxUSE_GRAPHICS_CONTEXT || \
( defined( wxMAC_USE_CORE_GRAPHICS ) && !wxMAC_USE_CORE_GRAPHICS ))
# error "OS X builds use CoreGraphics in this wx version, you cannot turn back to QuickDraw completely"
#endif

View File

@@ -14,20 +14,8 @@
#ifndef _WX_PRIVATE_COCOA_H_
#define _WX_PRIVATE_COCOA_H_
#include "wx/osx/core/private.h"
#include "wx/defs.h"
#include <ApplicationServices/ApplicationServices.h>
#if wxOSX_USE_ATSU_TEXT
// we need theming and atsu
#include <Carbon/Carbon.h>
#else
// we only need theming, if we find a better include replace the following
#include <Carbon/Carbon.h>
#endif
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#endif
@@ -53,22 +41,9 @@ OSStatus WXDLLIMPEXP_CORE wxMacDrawCGImage(
CGImageRef inImage) ;
WX_NSImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromCGImage( CGImageRef image );
CGImageRef WXDLLIMPEXP_CORE wxOSXCreateCGImageFromNSImage( WX_NSImage nsimage );
#endif
long UMAGetSystemVersion() ;
WXDLLIMPEXP_BASE void wxMacStringToPascal( const wxString&from , StringPtr to );
WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
class WXDLLIMPEXP_FWD_CORE wxDialog;
//
//
//
#if wxUSE_GUI
class WXDLLIMPEXP_CORE wxWidgetCocoaImpl : public wxWidgetImpl
{
public :

View File

@@ -32,13 +32,21 @@
#define wxOSX_10_6_AND_LATER(x)
#endif
#if wxOSX_USE_COCOA_OR_CARBON
#if !wxUSE_GUI || wxOSX_USE_COCOA_OR_CARBON
// Carbon functions are currently still used in wxOSX/Cocoa too (including
// wxBase part of it).
#include <Carbon/Carbon.h>
WXDLLIMPEXP_BASE long UMAGetSystemVersion() ;
void WXDLLIMPEXP_CORE wxMacStringToPascal( const wxString&from , unsigned char * to );
wxString WXDLLIMPEXP_CORE wxMacMakeStringFromPascal( const unsigned char * from );
WXDLLIMPEXP_BASE wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathComponent = NULL );
WXDLLIMPEXP_BASE OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef );
WXDLLIMPEXP_BASE wxString wxMacHFSUniStrToString( ConstHFSUniStr255Param uniname );
#endif
#if wxUSE_GUI

View File

@@ -14,8 +14,6 @@
#ifndef _WX_PRIVATE_IPHONE_H_
#define _WX_PRIVATE_IPHONE_H_
#include "wx/osx/core/private.h"
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif

View File

@@ -1,18 +1,16 @@
/* common warning snippet for all osx direct includes */
#ifndef wxOSX_USE_CARBON
#error "this files should only be included after platform.h was included"
#endif
#ifndef _WX_PRIVATE_OSX_H_
#define _WX_PRIVATE_OSX_H_
#include "wx/osx/core/private.h"
#if wxOSX_USE_IPHONE
#include "wx/osx/iphone/private.h"
#elif wxOSX_USE_CARBON
#include "wx/osx/carbon/private.h"
#elif wxOSX_USE_COCOA
#include "wx/osx/cocoa/private.h"
#elif wxUSE_GUI
#error "Must include wx/defs.h first"
#endif
#endif