osx regrouping

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-07-29 20:04:11 +00:00
parent 33e902756f
commit b2680ced12
46 changed files with 4588 additions and 4332 deletions

View File

@@ -61,7 +61,7 @@ void wxAboutBox(const wxAboutDialogInfo& info)
// Mac native about box currently can show only name, version, copyright // Mac native about box currently can show only name, version, copyright
// and description fields and we also shoehorn the credits text into the // and description fields and we also shoehorn the credits text into the
// description but if we have anything else we must use the generic version // description but if we have anything else we must use the generic version
#ifndef __LP64__ #if wxOSX_USE_CARBON
if ( info.IsSimple() ) if ( info.IsSimple() )
{ {
AboutBoxOptions opts; AboutBoxOptions opts;

View File

@@ -44,14 +44,14 @@
#include <string.h> #include <string.h>
// mac // mac
#if wxOSX_USE_CARBON
#include "wx/osx/uma.h" #include "wx/osx/uma.h"
#else
#include "wx/osx/private.h"
#endif
#ifdef __DARWIN__ #if defined(WXMAKINGDLL_CORE)
# include <CoreServices/CoreServices.h> # include <mach-o/dyld.h>
# if defined(WXMAKINGDLL_CORE)
# include <mach-o/dyld.h>
# endif
#endif #endif
// Keep linker from discarding wxStockGDIMac // Keep linker from discarding wxStockGDIMac
@@ -60,8 +60,9 @@ wxFORCE_LINK_MODULE(gdiobj)
// statics for implementation // statics for implementation
static bool s_inYield = false; static bool s_inYield = false;
static bool s_inReceiveEvent = false ; static bool s_inReceiveEvent = false ;
#if wxOSX_USE_COCOA_OR_CARBON
static EventTime sleepTime = kEventDurationNoWait ; static EventTime sleepTime = kEventDurationNoWait ;
#endif
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler) BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
@@ -84,15 +85,25 @@ wxString wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
bool wxApp::sm_isEmbedded = false; // Normally we're not a plugin bool wxApp::sm_isEmbedded = false; // Normally we're not a plugin
#if wxOSX_USE_COCOA_OR_CARBON
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Core Apple Event Support // Core Apple Event Support
//---------------------------------------------------------------------- //----------------------------------------------------------------------
AEEventHandlerUPP sODocHandler = NULL ;
AEEventHandlerUPP sGURLHandler = NULL ;
AEEventHandlerUPP sOAppHandler = NULL ;
AEEventHandlerUPP sPDocHandler = NULL ;
AEEventHandlerUPP sRAppHandler = NULL ;
AEEventHandlerUPP sQuitHandler = NULL ;
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ; pascal OSErr AEHandleRApp( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
pascal OSErr AEHandleGURL( const AppleEvent *event , AppleEvent *reply , SRefCon refcon ) ;
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) ) pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , SRefCon WXUNUSED(refcon) )
{ {
@@ -268,6 +279,8 @@ short wxApp::MacHandleAERApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU
return noErr ; return noErr ;
} }
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Support Routines linking the Mac...File Calls to the Document Manager // Support Routines linking the Mac...File Calls to the Document Manager
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -378,6 +391,8 @@ void wxApp::MacReopenApp()
// if no native match they just return the passed-in id // if no native match they just return the passed-in id
#if wxOSX_USE_CARBON
struct IdPair struct IdPair
{ {
UInt32 macId ; UInt32 macId ;
@@ -511,10 +526,14 @@ wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item )
return itemMenu ; return itemMenu ;
} }
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Carbon Event Handler // Carbon Event Handler
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#if wxOSX_USE_CARBON
static const EventTypeSpec eventList[] = static const EventTypeSpec eventList[] =
{ {
{ kEventClassCommand, kEventProcessCommand } , { kEventClassCommand, kEventProcessCommand } ,
@@ -595,7 +614,6 @@ wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler),
return eventNotHandledErr; return eventNotHandledErr;
} }
#ifndef __LP64__
static pascal OSStatus static pascal OSStatus
wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) , wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
EventRef event , EventRef event ,
@@ -632,7 +650,6 @@ wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
} }
return result ; return result ;
} }
#endif
static pascal OSStatus static pascal OSStatus
wxMacAppApplicationEventHandler( EventHandlerCallRef WXUNUSED(handler) , wxMacAppApplicationEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
@@ -726,8 +743,9 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve
} }
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler ) DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler )
#endif
#ifdef __WXDEBUG__ #if defined( __WXDEBUG__ ) && wxOSX_USE_COCOA_OR_CARBON
pascal static void pascal static void
wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature), wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature),
@@ -784,13 +802,10 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
{ {
// Mac-specific // Mac-specific
#ifdef __WXDEBUG__ #if defined( __WXDEBUG__ ) && wxOSX_USE_COCOA_OR_CARBON
InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) ); InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );
#endif #endif
UMAInitToolbox( 4, sm_isEmbedded ) ;
// TODO CHECK Can Be Removed SetEventMask( everyEvent ) ;
// Mac OS X passes a process serial number command line argument when // Mac OS X passes a process serial number command line argument when
// the application is launched from the Finder. This argument must be // the application is launched from the Finder. This argument must be
// removed from the command line arguments before being handled by the // removed from the command line arguments before being handled by the
@@ -838,18 +853,11 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
return true; return true;
} }
AEEventHandlerUPP sODocHandler = NULL ;
AEEventHandlerUPP sGURLHandler = NULL ;
AEEventHandlerUPP sOAppHandler = NULL ;
AEEventHandlerUPP sPDocHandler = NULL ;
AEEventHandlerUPP sRAppHandler = NULL ;
AEEventHandlerUPP sQuitHandler = NULL ;
bool wxApp::OnInitGui() bool wxApp::OnInitGui()
{ {
if ( !wxAppBase::OnInitGui() ) if ( !wxAppBase::OnInitGui() )
return false ; return false ;
#ifndef __LP64__ #if wxOSX_USE_CARBON
InstallStandardEventHandler( GetApplicationEventTarget() ) ; InstallStandardEventHandler( GetApplicationEventTarget() ) ;
if (!sm_isEmbedded) if (!sm_isEmbedded)
{ {
@@ -859,6 +867,7 @@ bool wxApp::OnInitGui()
} }
#endif #endif
#if wxOSX_USE_COCOA_OR_CARBON
if (!sm_isEmbedded) if (!sm_isEmbedded)
{ {
sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ; sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ;
@@ -881,9 +890,11 @@ bool wxApp::OnInitGui()
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication , AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
sQuitHandler , 0 , FALSE ) ; sQuitHandler , 0 , FALSE ) ;
} }
#endif
#if wxOSX_USE_CARBON
if ( !wxMacInitCocoa() ) if ( !wxMacInitCocoa() )
return false; return false;
#endif
return true ; return true ;
} }
@@ -903,6 +914,8 @@ void wxApp::CleanUp()
// One last chance for pending objects to be cleaned up // One last chance for pending objects to be cleaned up
wxTheApp->DeletePendingObjects(); wxTheApp->DeletePendingObjects();
#if wxOSX_USE_COCOA_OR_CARBON
if (!sm_isEmbedded) if (!sm_isEmbedded)
RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) ); RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
@@ -929,6 +942,8 @@ void wxApp::CleanUp()
DisposeAEEventHandlerUPP( sQuitHandler ) ; DisposeAEEventHandlerUPP( sQuitHandler ) ;
} }
#endif
wxAppBase::CleanUp(); wxAppBase::CleanUp();
} }
@@ -1108,6 +1123,8 @@ bool wxApp::Yield(bool onlyIfNeeded)
// by definition yield should handle all non-processed events // by definition yield should handle all non-processed events
#if wxOSX_USE_COCOA_OR_CARBON
EventRef theEvent; EventRef theEvent;
OSStatus status = noErr ; OSStatus status = noErr ;
@@ -1134,6 +1151,10 @@ bool wxApp::Yield(bool onlyIfNeeded)
ReleaseEvent(theEvent); ReleaseEvent(theEvent);
} }
} }
#else
#endif
s_inYield = false; s_inYield = false;
@@ -1142,6 +1163,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
void wxApp::MacDoOneEvent() void wxApp::MacDoOneEvent()
{ {
#if wxOSX_USE_COCOA_OR_CARBON
wxMacAutoreleasePool autoreleasepool; wxMacAutoreleasePool autoreleasepool;
EventRef theEvent; EventRef theEvent;
@@ -1170,7 +1192,8 @@ void wxApp::MacDoOneEvent()
break; break;
} }
// repeaters // repeaters
#else
#endif
DeletePendingObjects() ; DeletePendingObjects() ;
} }
@@ -1188,8 +1211,18 @@ CFMutableArrayRef GetAutoReleaseArray()
return array; return array;
} }
//
//
//
//
//
//
void wxApp::MacHandleOneEvent( WXEVENTREF evr ) void wxApp::MacHandleOneEvent( WXEVENTREF evr )
{ {
#if wxOSX_USE_COCOA_OR_CARBON
EventTargetRef theTarget; EventTargetRef theTarget;
theTarget = GetEventDispatcherTarget(); theTarget = GetEventDispatcherTarget();
m_macCurrentEvent = evr ; m_macCurrentEvent = evr ;
@@ -1202,6 +1235,11 @@ void wxApp::MacHandleOneEvent( WXEVENTREF evr )
wxMutexGuiLeaveOrEnter(); wxMutexGuiLeaveOrEnter();
#endif // wxUSE_THREADS #endif // wxUSE_THREADS
#else
// TODO Threads
#endif
CFArrayRemoveAllValues( GetAutoReleaseArray() ); CFArrayRemoveAllValues( GetAutoReleaseArray() );
} }
@@ -1210,6 +1248,8 @@ void wxApp::MacAddToAutorelease( void* cfrefobj )
CFArrayAppendValue( GetAutoReleaseArray(), cfrefobj ); CFArrayAppendValue( GetAutoReleaseArray(), cfrefobj );
} }
#if wxOSX_USE_COCOA_OR_CARBON
long wxMacTranslateKey(unsigned char key, unsigned char code) long wxMacTranslateKey(unsigned char key, unsigned char code)
{ {
long retval = key ; long retval = key ;
@@ -1375,10 +1415,12 @@ int wxMacKeyCodeToModifier(wxKeyCode key)
return 0; return 0;
} }
} }
#endif
wxMouseState wxGetMouseState() wxMouseState wxGetMouseState()
{ {
wxMouseState ms; wxMouseState ms;
#if wxOSX_USE_COCOA_OR_CARBON
wxPoint pt = wxGetMousePosition(); wxPoint pt = wxGetMousePosition();
ms.SetX(pt.x); ms.SetX(pt.x);
@@ -1395,6 +1437,7 @@ wxMouseState wxGetMouseState()
ms.SetAltDown(modifiers & optionKey); ms.SetAltDown(modifiers & optionKey);
ms.SetMetaDown(modifiers & cmdKey); ms.SetMetaDown(modifiers & cmdKey);
#endif
return ms; return ms;
} }
@@ -1465,13 +1508,13 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
{ {
if ( !focus ) if ( !focus )
return false ; return false ;
wxKeyEvent event(wxEVT_CHAR) ; wxKeyEvent event(wxEVT_CHAR) ;
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ; MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
long keyval = event.m_keyCode ; long keyval = event.m_keyCode ;
bool handled = false ; bool handled = false ;
#if wxOSX_USE_CARBON
wxNonOwnedWindow *tlw = focus->MacGetTopLevelWindow() ; wxNonOwnedWindow *tlw = focus->MacGetTopLevelWindow() ;
if (tlw) if (tlw)
@@ -1512,12 +1555,12 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
} }
// backdoor handler for default return and command escape // backdoor handler for default return and command escape
if ( !handled && (!focus->IsKindOf(CLASSINFO(wxControl) ) || !focus->MacCanFocus() ) ) if ( !handled && (!focus->IsKindOf(CLASSINFO(wxControl) ) || !focus->AcceptsFocus() ) )
{ {
// if window is not having a focus still testing for default enter or cancel // if window is not having a focus still testing for default enter or cancel
// TODO: add the UMA version for ActiveNonFloatingWindow // TODO: add the UMA version for ActiveNonFloatingWindow
#ifndef __LP64__ #ifndef __LP64__
wxWindow* focus = wxFindWinFromMacWindow( FrontWindow() ) ; wxWindow* focus = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontWindow() ) ;
if ( focus ) if ( focus )
{ {
if ( keyval == WXK_RETURN || keyval == WXK_NUMPAD_ENTER ) if ( keyval == WXK_RETURN || keyval == WXK_NUMPAD_ENTER )
@@ -1546,12 +1589,14 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
} }
#endif #endif
} }
#endif
return handled ; return handled ;
} }
// This method handles common code for SendKeyDown, SendKeyUp, and SendChar events. // This method handles common code for SendKeyDown, SendKeyUp, and SendChar events.
void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar ) void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymessage , long modifiers , long when , short wherex , short wherey , wxChar uniChar )
{ {
#if wxOSX_USE_COCOA_OR_CARBON
short keycode, keychar ; short keycode, keychar ;
keychar = short(keymessage & charCodeMask); keychar = short(keymessage & charCodeMask);
@@ -1634,15 +1679,18 @@ void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymess
event.m_y = wherey; event.m_y = wherey;
event.SetTimestamp(when); event.SetTimestamp(when);
event.SetEventObject(focus); event.SetEventObject(focus);
#endif
} }
void wxApp::MacHideApp() void wxApp::MacHideApp()
{ {
#if wxOSX_USE_CARBON
wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess ); wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess );
HICommand command; HICommand command;
memset( &command, 0 , sizeof(command) ); memset( &command, 0 , sizeof(command) );
command.commandID = kHICommandHide ; command.commandID = kHICommandHide ;
event.SetParameter<HICommand>(kEventParamDirectObject, command ); event.SetParameter<HICommand>(kEventParamDirectObject, command );
SendEventToApplication( event ); SendEventToApplication( event );
#endif
} }

View File

@@ -23,6 +23,8 @@
#include "wx/image.h" #include "wx/image.h"
#endif #endif
#if !defined(__WXUNIVERSAL__)
#include "wx/artprov.h" #include "wx/artprov.h"
#include "wx/image.h" #include "wx/image.h"
@@ -106,3 +108,7 @@ wxBitmap wxMacArtProvider::CreateBitmap(const wxArtID& id,
return wxNullBitmap; return wxNullBitmap;
} }
#endif // !defined(__WXUNIVERSAL__)

View File

@@ -28,7 +28,12 @@
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#if wxOSX_USE_CARBON
#include "wx/osx/uma.h" #include "wx/osx/uma.h"
#else
#include "wx/osx/private.h"
#endif
#ifndef __WXOSX_IPHONE__ #ifndef __WXOSX_IPHONE__
#include <QuickTime/QuickTime.h> #include <QuickTime/QuickTime.h>
#endif #endif
@@ -1688,7 +1693,9 @@ void wxBitmap::InitStandardHandlers()
#if !defined( __LP64__ ) && !defined(__WXOSX_IPHONE__) #if !defined( __LP64__ ) && !defined(__WXOSX_IPHONE__)
AddHandler( new wxPICTResourceHandler ) ; AddHandler( new wxPICTResourceHandler ) ;
#endif #endif
#if wxOSX_USE_COCOA_OR_CARBON
AddHandler( new wxICONResourceHandler ) ; AddHandler( new wxICONResourceHandler ) ;
#endif
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -137,7 +137,7 @@ bool wxBitmapButton::Create( wxWindow *parent,
verify_noerr( err ); verify_noerr( err );
wxMacReleaseBitmapButton( &info ); wxMacReleaseBitmapButton( &info );
wxASSERT_MSG( m_peer != NULL && m_peer->Ok(), wxT("No valid native Mac control") ); wxASSERT_MSG( m_peer != NULL && m_peer->IsOk(), wxT("No valid native Mac control") );
MacPostControlCreate( pos, size ); MacPostControlCreate( pos, size );

View File

@@ -92,7 +92,7 @@ bool wxButton::Create(wxWindow *parent,
} }
verify_noerr( err ); verify_noerr( err );
wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid Mac control") ) ; wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid Mac control") ) ;
MacPostControlCreate( pos, size ); MacPostControlCreate( pos, size );
@@ -236,7 +236,7 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin
m_peer->GetControlRefAddr() ); m_peer->GetControlRefAddr() );
verify_noerr( err ); verify_noerr( err );
wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid Mac control") ) ; wxASSERT_MSG( m_peer != NULL && m_peer->IsOk() , wxT("No valid Mac control") ) ;
MacPostControlCreate( pos, size ); MacPostControlCreate( pos, size );
// passing the text in the param doesn't seem to work, so lets do if again // passing the text in the param doesn't seem to work, so lets do if again

View File

@@ -186,7 +186,7 @@ public :
{ {
OSStatus err = errDataBrowserPropertyNotSupported; OSStatus err = errDataBrowserPropertyNotSupported;
wxCheckListBox *checklist = wxDynamicCast( owner->GetPeer() , wxCheckListBox ); wxCheckListBox *checklist = wxDynamicCast( owner->GetWXPeer() , wxCheckListBox );
wxCHECK_MSG( checklist != NULL , errDataBrowserPropertyNotSupported , wxT("wxCheckListBox expected")); wxCHECK_MSG( checklist != NULL , errDataBrowserPropertyNotSupported , wxT("wxCheckListBox expected"));
if ( !changeValue ) if ( !changeValue )

View File

@@ -27,7 +27,7 @@
#include "wx/metafile.h" #include "wx/metafile.h"
#include "wx/osx/uma.h" #include "wx/osx/private.h"
#define wxUSE_DATAOBJ 1 #define wxUSE_DATAOBJ 1

View File

@@ -21,7 +21,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
#if wxMAC_USE_QUICKDRAW #if wxOSX_USE_QUICKDRAW
wxColour::wxColour(const RGBColor& col) wxColour::wxColour(const RGBColor& col)
{ {
InitRGBColor(col); InitRGBColor(col);
@@ -33,7 +33,7 @@ wxColour::wxColour(CGColorRef col)
InitCGColorRef(col); InitCGColorRef(col);
} }
#if wxMAC_USE_QUICKDRAW #if wxOSX_USE_QUICKDRAW
void wxColour::GetRGBColor( RGBColor *col ) const void wxColour::GetRGBColor( RGBColor *col ) const
{ {
col->red = (m_red << 8) + m_red; col->red = (m_red << 8) + m_red;
@@ -84,7 +84,7 @@ void wxColour::InitRGBA (ChannelType r, ChannelType g, ChannelType b, ChannelTyp
m_cgColour.reset( col ); m_cgColour.reset( col );
} }
#if wxMAC_USE_QUICKDRAW #if wxOSX_USE_QUICKDRAW
void wxColour::InitRGBColor( const RGBColor& col ) void wxColour::InitRGBColor( const RGBColor& col )
{ {
m_red = col.red >> 8; m_red = col.red >> 8;

View File

@@ -83,7 +83,7 @@ bool wxControl::ProcessCommand( wxCommandEvent &event )
void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) ) void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
{ {
if ( m_peer == NULL || !m_peer->Ok() ) if ( m_peer == NULL || !m_peer->IsOk() )
return; return;
UInt32 keyCode, modifiers; UInt32 keyCode, modifiers;

View File

@@ -36,25 +36,32 @@ public:
virtual bool IsOk() const virtual bool IsOk() const
{ {
#if wxOSX_USE_COCOA_OR_CARBON
if ( m_hCursor != NULL ) if ( m_hCursor != NULL )
return true; return true;
#if !wxMAC_USE_COCOA #if wxOSX_USE_CARBON
if ( m_themeCursor != -1 ) if ( m_themeCursor != -1 )
return true; return true;
#endif #endif
return false; return false;
#else
// in order to avoid asserts, always claim to have a valid cursor
return true;
#endif
} }
protected: protected:
#if wxMAC_USE_COCOA #if wxOSX_USE_COCOA
WX_NSCursor m_hCursor; WX_NSCursor m_hCursor;
#else #elif wxOSX_USE_CARBON
WXHCURSOR m_hCursor; WXHCURSOR m_hCursor;
bool m_disposeHandle; bool m_disposeHandle;
bool m_releaseHandle; bool m_releaseHandle;
bool m_isColorCursor; bool m_isColorCursor;
long m_themeCursor; long m_themeCursor;
#elif wxOSX_USE_IPHONE
void* m_hCursor;
#endif #endif
friend class wxCursor; friend class wxCursor;
@@ -64,6 +71,8 @@ protected:
#define M_CURSORDATA wx_static_cast(wxCursorRefData*, m_refData) #define M_CURSORDATA wx_static_cast(wxCursorRefData*, m_refData)
#if wxOSX_USE_COCOA_OR_CARBON
ClassicCursor gMacCursors[kwxCursorLast+1] = ClassicCursor gMacCursors[kwxCursorLast+1] =
{ {
@@ -189,9 +198,11 @@ ClassicCursor gMacCursors[kwxCursorLast+1] =
}; };
#endif
wxCursor gMacCurrentCursor ; wxCursor gMacCurrentCursor ;
#if !wxMAC_USE_COCOA #if wxOSX_USE_CARBON
CursHandle wxGetStockCursor( int number ) CursHandle wxGetStockCursor( int number )
{ {
wxASSERT_MSG( number >= 0 && number <=kwxCursorLast , wxT("invalid stock cursor id") ) ; wxASSERT_MSG( number >= 0 && number <=kwxCursorLast , wxT("invalid stock cursor id") ) ;
@@ -212,8 +223,7 @@ CursHandle wxGetStockCursor( int number )
wxCursorRefData::wxCursorRefData() wxCursorRefData::wxCursorRefData()
{ {
m_hCursor = NULL; m_hCursor = NULL;
#if wxMAC_USE_COCOA #if wxOSX_USE_CARBON
#else
m_disposeHandle = false; m_disposeHandle = false;
m_releaseHandle = false; m_releaseHandle = false;
m_isColorCursor = false; m_isColorCursor = false;
@@ -226,9 +236,9 @@ wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor)
// FIXME: need to copy the cursor // FIXME: need to copy the cursor
m_hCursor = NULL; m_hCursor = NULL;
#if wxMAC_USE_COCOA #if wxOSX_USE_COCOA
wxUnusedVar(cursor); wxUnusedVar(cursor);
#else #elif wxOSX_USE_CARBON
m_disposeHandle = false; m_disposeHandle = false;
m_releaseHandle = false; m_releaseHandle = false;
m_isColorCursor = cursor.m_isColorCursor; m_isColorCursor = cursor.m_isColorCursor;
@@ -238,10 +248,10 @@ wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor)
wxCursorRefData::~wxCursorRefData() wxCursorRefData::~wxCursorRefData()
{ {
#if wxMAC_USE_COCOA #if wxOSX_USE_COCOA
if ( m_hCursor ) if ( m_hCursor )
wxMacCocoaRelease(m_hCursor); wxMacCocoaRelease(m_hCursor);
#else #elif wxOSX_USE_CARBON
if ( m_isColorCursor ) if ( m_isColorCursor )
{ {
#ifndef __LP64__ #ifndef __LP64__
@@ -310,7 +320,7 @@ WXHCURSOR wxCursor::GetHCURSOR() const
return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
} }
#if !wxMAC_USE_COCOA #if wxOSX_USE_CARBON
short GetCTabIndex( CTabHandle colors , RGBColor *col ) short GetCTabIndex( CTabHandle colors , RGBColor *col )
{ {
short retval = 0 ; short retval = 0 ;
@@ -340,7 +350,7 @@ void wxCursor::CreateFromImage(const wxImage & image)
m_refData = new wxCursorRefData; m_refData = new wxCursorRefData;
int hotSpotX = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X); int hotSpotX = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
int hotSpotY = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y); int hotSpotY = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
#if wxMAC_USE_COCOA #if wxOSX_USE_COCOA
wxBitmap bmp( image ); wxBitmap bmp( image );
CGImageRef cgimage = wxMacCreateCGImageFromBitmap(bmp); CGImageRef cgimage = wxMacCreateCGImageFromBitmap(bmp);
if ( cgimage ) if ( cgimage )
@@ -348,7 +358,7 @@ void wxCursor::CreateFromImage(const wxImage & image)
M_CURSORDATA->m_hCursor = wxMacCocoaCreateCursorFromCGImage( cgimage, hotSpotX, hotSpotY ); M_CURSORDATA->m_hCursor = wxMacCocoaCreateCursorFromCGImage( cgimage, hotSpotX, hotSpotY );
CFRelease( cgimage ); CFRelease( cgimage );
} }
#else #elif wxOSX_USE_CARBON
#ifndef __LP64__ #ifndef __LP64__
int w = 16; int w = 16;
int h = 16; int h = 16;
@@ -489,9 +499,9 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX
m_refData = new wxCursorRefData; m_refData = new wxCursorRefData;
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE ) if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
{ {
#if wxMAC_USE_COCOA #if wxOSX_USE_COCOA
wxFAIL_MSG( wxT("Not implemented") ); wxFAIL_MSG( wxT("Not implemented") );
#else #elif wxOSX_USE_CARBON
#ifndef __LP64__ #ifndef __LP64__
Str255 theName ; Str255 theName ;
wxMacStringToPascal( cursor_file , theName ) ; wxMacStringToPascal( cursor_file , theName ) ;
@@ -549,9 +559,9 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX
wxCursor::wxCursor(int cursor_type) wxCursor::wxCursor(int cursor_type)
{ {
m_refData = new wxCursorRefData; m_refData = new wxCursorRefData;
#if wxMAC_USE_COCOA #if wxOSX_USE_COCOA
M_CURSORDATA->m_hCursor = wxMacCocoaCreateStockCursor( cursor_type ); M_CURSORDATA->m_hCursor = wxMacCocoaCreateStockCursor( cursor_type );
#else #elif wxOSX_USE_CARBON
switch (cursor_type) switch (cursor_type)
{ {
case wxCURSOR_COPY_ARROW: case wxCURSOR_COPY_ARROW:
@@ -660,10 +670,10 @@ wxCursor::wxCursor(int cursor_type)
void wxCursor::MacInstall() const void wxCursor::MacInstall() const
{ {
gMacCurrentCursor = *this ; gMacCurrentCursor = *this ;
#if wxMAC_USE_COCOA #if wxOSX_USE_COCOA
if ( IsOk() ) if ( IsOk() )
wxMacCocoaSetCursor( M_CURSORDATA->m_hCursor ); wxMacCocoaSetCursor( M_CURSORDATA->m_hCursor );
#else #elif wxOSX_USE_CARBON
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 ) if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
{ {
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ; SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;

View File

@@ -615,7 +615,7 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrow
DataBrowserTableViewColumnIndex modelColumnIndex; DataBrowserTableViewColumnIndex modelColumnIndex;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr != NULL, false,_("Pointer to data view control not set correctly."));
@@ -640,7 +640,7 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(M
{ {
wxArrayDataBrowserItemID itemIDs; wxArrayDataBrowserItemID itemIDs;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxCHECK_RET(dataViewCtrlPtr != NULL,_("wxWidget control pointer is not a data view pointer")); wxCHECK_RET(dataViewCtrlPtr != NULL,_("wxWidget control pointer is not a data view pointer"));
@@ -668,7 +668,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
// variable definitions: // variable definitions:
wxDataViewCtrl* dataViewCtrlPtr; wxDataViewCtrl* dataViewCtrlPtr;
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer()); dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
if (dataViewCtrlPtr->IsDeleting()) if (dataViewCtrlPtr->IsDeleting())
return noErr; // if a delete process is running the data of editable fields cannot be saved because the associated model variable may already have been deleted return noErr; // if a delete process is running the data of editable fields cannot be saved because the associated model variable may already have been deleted
@@ -762,7 +762,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
wxDataViewColumn* dataViewColumnPtr; wxDataViewColumn* dataViewColumnPtr;
wxDataViewCtrl* dataViewCtrlPtr; wxDataViewCtrl* dataViewCtrlPtr;
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer()); dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID); dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
@@ -784,7 +784,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
case kDataBrowserContainerIsClosableProperty: case kDataBrowserContainerIsClosableProperty:
{ {
// variable definitions: // variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
// initialize wxWidget event: // initialize wxWidget event:
@@ -801,7 +801,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
case kDataBrowserContainerIsOpenableProperty: case kDataBrowserContainerIsOpenableProperty:
{ {
// variable definitions: // variable definitions:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
// initialize wxWidget event: // initialize wxWidget event:
@@ -818,7 +818,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
case kDataBrowserItemIsContainerProperty: case kDataBrowserItemIsContainerProperty:
{ {
// variable definition: // variable definition:
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr != NULL,errDataBrowserNotConfigured,_("Pointer to data view control not set correctly."));
wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
@@ -834,7 +834,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData) void wxMacDataViewDataBrowserListViewControl::DataBrowserItemNotificationProc(DataBrowserItemID itemID, DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
{ {
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer()));
// check if the data view control pointer still exists because this call back function can still be called when the control has already been deleted: // check if the data view control pointer still exists because this call back function can still be called when the control has already been deleted:
@@ -1006,7 +1006,7 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowse
wxVariant dataToRender; wxVariant dataToRender;
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer()); dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_RET(dataViewCtrlPtr != NULL, _("Pointer to data view control not set correctly.")); wxCHECK_RET(dataViewCtrlPtr != NULL, _("Pointer to data view control not set correctly."));
wxCHECK_RET(dataViewCtrlPtr->GetModel() != NULL,_("Pointer to model not set correctly.")); wxCHECK_RET(dataViewCtrlPtr->GetModel() != NULL,_("Pointer to model not set correctly."));
wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex) == noErr,_("Could not determine column index.")); wxCHECK_RET(this->GetColumnIndex(propertyID,&columnIndex) == noErr,_("Could not determine column index."));
@@ -1029,7 +1029,7 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowse
if (this->GetRegion(kControlContentMetaPart,rgn) == noErr) if (this->GetRegion(kControlContentMetaPart,rgn) == noErr)
GetRegionBounds(rgn,&content); GetRegionBounds(rgn,&content);
else else
this->GetRect(&content); GetControlBounds(m_controlRef, &content);
::DisposeRgn(rgn); ::DisposeRgn(rgn);
// space for the header // space for the header
this->GetHeaderButtonHeight(&headerHeight); this->GetHeaderButtonHeight(&headerHeight);
@@ -1111,7 +1111,7 @@ DataBrowserTrackingResult wxMacDataViewDataBrowserListViewControl::DataBrowserTr
dataViewCustomRendererItem = reinterpret_cast<void*>(itemID); dataViewCustomRendererItem = reinterpret_cast<void*>(itemID);
wxCHECK_MSG(dataViewCustomRendererItem.IsOk(),kDataBrowserNothingHit,_("Invalid data view item")); wxCHECK_MSG(dataViewCustomRendererItem.IsOk(),kDataBrowserNothingHit,_("Invalid data view item"));
dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetPeer()); dataViewCtrlPtr = dynamic_cast<wxDataViewCtrl*>(this->GetWXPeer());
wxCHECK_MSG(dataViewCtrlPtr != NULL,kDataBrowserNothingHit,_("Pointer to data view control not set correctly.")); wxCHECK_MSG(dataViewCtrlPtr != NULL,kDataBrowserNothingHit,_("Pointer to data view control not set correctly."));
dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID); dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing.")); wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing."));

View File

@@ -220,7 +220,7 @@ public:
bool noFailureFlag = (!(parent.IsOk()) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&itemID) == noErr) || bool noFailureFlag = (!(parent.IsOk()) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&itemID) == noErr) ||
parent.IsOk() && (this->m_dataViewControlPtr->AddItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr)); parent.IsOk() && (this->m_dataViewControlPtr->AddItem(reinterpret_cast<DataBrowserItemID>(parent.GetID()),&itemID) == noErr));
wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetPeer(); wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetWXPeer();
if (dvc->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) if (dvc->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
{ {
wxDataViewModel *model = GetOwner(); wxDataViewModel *model = GetOwner();
@@ -270,7 +270,7 @@ public:
// give allocated array space free again: // give allocated array space free again:
delete[] itemIDs; delete[] itemIDs;
wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetPeer(); wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetWXPeer();
if (dvc->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT) if (dvc->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
{ {
wxDataViewModel *model = GetOwner(); wxDataViewModel *model = GetOwner();
@@ -321,7 +321,7 @@ public:
wxCHECK_MSG(item.IsOk(),false,_("Changed item is invalid.")); wxCHECK_MSG(item.IsOk(),false,_("Changed item is invalid."));
if (this->m_dataViewControlPtr->UpdateItems(&itemID) == noErr) if (this->m_dataViewControlPtr->UpdateItems(&itemID) == noErr)
{ {
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
// sent the equivalent wxWidget event: // sent the equivalent wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
@@ -356,7 +356,7 @@ public:
noFailureFlag = (this->m_dataViewControlPtr->UpdateItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr); noFailureFlag = (this->m_dataViewControlPtr->UpdateItems(kDataBrowserNoItem,noOfEntries,itemIDs,kDataBrowserItemNoProperty,kDataBrowserItemNoProperty) == noErr);
if (noFailureFlag) if (noFailureFlag)
{ {
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
// send for all changed items a wxWidget event: // send for all changed items a wxWidget event:
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
@@ -385,7 +385,7 @@ public:
// variable definition and initialization: // variable definition and initialization:
DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID())); DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
OSStatus errorStatus; OSStatus errorStatus;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
// when this method is called and currently an item is being edited this item may have already been deleted in the model (the passed item and the being edited item have // when this method is called and currently an item is being edited this item may have already been deleted in the model (the passed item and the being edited item have
// not to be identical because the being edited item might be below the passed item in the hierarchy); // not to be identical because the being edited item might be below the passed item in the hierarchy);
@@ -407,7 +407,7 @@ public:
DataBrowserItemID* itemIDs; DataBrowserItemID* itemIDs;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
size_t noOfEntries; size_t noOfEntries;
@@ -439,7 +439,7 @@ public:
DataBrowserPropertyID propertyID; DataBrowserPropertyID propertyID;
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer())); wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
wxCHECK_MSG(item.IsOk(), false,_("Passed item is invalid.")); wxCHECK_MSG(item.IsOk(), false,_("Passed item is invalid."));

View File

@@ -26,6 +26,7 @@
#include "wx/graphics.h" #include "wx/graphics.h"
#include "wx/rawbmp.h" #include "wx/rawbmp.h"
#include "wx/osx/private.h" #include "wx/osx/private.h"
#include "wx/osx/dcclient.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxWindowDCImpl // wxWindowDCImpl
@@ -39,21 +40,20 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
m_release = false; m_release = false;
} }
wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window ) wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )
: wxGCDCImpl( owner ) : wxGCDCImpl( owner )
{ {
m_window = window; m_window = window;
WindowRef rootwindow = (WindowRef) window->MacGetTopLevelWindowRef() ;
if (!rootwindow)
return;
m_ok = true ; m_ok = true ;
m_window->GetSize( &m_width , &m_height); m_window->GetSize( &m_width , &m_height);
if ( !m_window->IsShownOnScreen() ) if ( !m_window->IsShownOnScreen() )
m_width = m_height = 0; m_width = m_height = 0;
CGContextRef cg = (CGContextRef) window->MacGetCGContextRef(); CGContextRef cg = (CGContextRef) window->MacGetCGContextRef();
m_release = false; m_release = false;
if ( cg == NULL ) if ( cg == NULL )
{ {
@@ -96,6 +96,7 @@ void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
*height = m_height; *height = m_height;
} }
#if wxOSX_USE_CARBON
wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
{ {
// wxScreenDC is derived from wxWindowDC, so a screen dc will // wxScreenDC is derived from wxWindowDC, so a screen dc will
@@ -103,9 +104,6 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
if (!m_window) if (!m_window)
return wxNullBitmap; return wxNullBitmap;
#ifdef __LP64__
return wxNullBitmap;
#else
ControlRef handle = (ControlRef) m_window->GetHandle(); ControlRef handle = (ControlRef) m_window->GetHandle();
if ( !handle ) if ( !handle )
return wxNullBitmap; return wxNullBitmap;
@@ -139,8 +137,8 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
CGContextRestoreGState(context); CGContextRestoreGState(context);
return bmp; return bmp;
#endif
} }
#endif
/* /*
* wxClientDCImpl * wxClientDCImpl

View File

@@ -12,9 +12,9 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#include "wx/dcscreen.h" #include "wx/dcscreen.h"
#include "wx/osx/carbon/dcscreen.h" #include "wx/osx/dcscreen.h"
#include "wx/osx/uma.h" #include "wx/osx/private.h"
#include "wx/graphics.h" #include "wx/graphics.h"
IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl) IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
@@ -27,7 +27,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
wxScreenDCImpl::wxScreenDCImpl( wxDC *owner ) : wxScreenDCImpl::wxScreenDCImpl( wxDC *owner ) :
wxWindowDCImpl( owner ) wxWindowDCImpl( owner )
{ {
#ifdef __LP64__ #if wxOSX_USE_COCOA_OR_IPHONE
m_graphicContext = NULL; m_graphicContext = NULL;
m_ok = false ; m_ok = false ;
#else #else
@@ -52,7 +52,7 @@ wxScreenDCImpl::~wxScreenDCImpl()
{ {
delete m_graphicContext; delete m_graphicContext;
m_graphicContext = NULL; m_graphicContext = NULL;
#ifdef __LP64__ #if wxOSX_USE_COCOA_OR_IPHONE
#else #else
DisposeWindow((WindowRef) m_overlayWindow ); DisposeWindow((WindowRef) m_overlayWindow );
#endif #endif

View File

@@ -62,7 +62,7 @@ void wxDialog::SetModal( bool flag )
{ {
m_isModalStyle = true; m_isModalStyle = true;
SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ; SetWindowModality( (WindowRef)GetWXWindow(), kWindowModalityAppModal, NULL ) ;
} }
else else
{ {
@@ -135,7 +135,7 @@ void wxDialog::DoShowModal()
SetFocus() ; SetFocus() ;
WindowRef windowRef = (WindowRef) MacGetWindowRef(); WindowRef windowRef = (WindowRef) GetWXWindow();
WindowGroupRef windowGroup; WindowGroupRef windowGroup;
WindowGroupRef formerParentGroup; WindowGroupRef formerParentGroup;
bool resetGroupParent = false; bool resetGroupParent = false;

View File

@@ -11,7 +11,7 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#if wxUSE_DIRDLG #if wxUSE_DIRDLG && !defined(__WXUNIVERSAL__)
#include "wx/dirdlg.h" #include "wx/dirdlg.h"

View File

@@ -34,9 +34,10 @@
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#endif #endif
#include <Carbon/Carbon.h>
#include "wx/display_impl.h" #include "wx/display_impl.h"
#include "wx/osx/private.h"
#if wxOSX_USE_COCOA_OR_CARBON
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// display classes implementation // display classes implementation
@@ -252,4 +253,13 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
return new wxDisplayFactoryMacOSX; return new wxDisplayFactoryMacOSX;
} }
#else
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
{
return new wxDisplayFactorySingle;
}
#endif
#endif // wxUSE_DISPLAY #endif // wxUSE_DISPLAY

View File

@@ -359,7 +359,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(
GetDragAttributes( theDrag, &attributes ); GetDragAttributes( theDrag, &attributes );
wxNonOwnedWindow* toplevel = wxFindWinFromMacWindow( theWindow ); wxNonOwnedWindow* toplevel = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) theWindow );
bool optionDown = GetCurrentKeyModifiers() & optionKey; bool optionDown = GetCurrentKeyModifiers() & optionKey;
wxDragResult result = optionDown ? wxDragCopy : wxDragMove; wxDragResult result = optionDown ? wxDragCopy : wxDragMove;
@@ -385,15 +385,18 @@ pascal OSErr wxMacWindowDragTrackingHandler(
break; break;
GetDragMouse( theDrag, &mouse, 0L ); GetDragMouse( theDrag, &mouse, 0L );
localMouse = mouse; int x = mouse.h ;
wxMacGlobalToLocal( theWindow, &localMouse ); int y = mouse.v ;
toplevel->GetNonOwnedPeer()->ScreenToWindow( &x, &y );
localMouse.h = x;
localMouse.v = y;
{ {
wxWindow *win = NULL; wxWindow *win = NULL;
ControlPartCode controlPart; ControlPartCode controlPart;
ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart ); ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart );
if ( control ) if ( control )
win = wxFindControlFromMacControl( control ); win = wxFindWindowFromWXWidget( (WXWidget) control );
else else
win = toplevel; win = toplevel;
@@ -534,9 +537,11 @@ pascal OSErr wxMacWindowDragReceiveHandler(
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ); trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );
GetDragMouse( theDrag, &mouse, 0L ); GetDragMouse( theDrag, &mouse, 0L );
localMouse = mouse; localMouse = mouse;
wxMacGlobalToLocal( theWindow, &localMouse );
localx = localMouse.h; localx = localMouse.h;
localy = localMouse.v; localy = localMouse.v;
wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) theWindow);
if ( tlw )
tlw->GetNonOwnedPeer()->ScreenToWindow( &localx, &localy );
// TODO : should we use client coordinates? // TODO : should we use client coordinates?
if ( trackingGlobals->m_currentTargetWindow ) if ( trackingGlobals->m_currentTargetWindow )

View File

@@ -69,30 +69,30 @@ bool wxDrawerWindow::Create(wxWindow *parent,
const wxSize dummySize(0,0); const wxSize dummySize(0,0);
const long style = wxFRAME_DRAWER; const long style = wxFRAME_DRAWER;
bool success = wxWindow::Create(parent, id, pos, dummySize, style, name); bool success = wxNonOwnedWindow::Create(parent, id, pos, size, style, name);
if (success) if (success)
{ {
this->MacCreateRealWindow(pos, size, style, name); // this->MacCreateRealWindow(pos, size, style, name);
success = (m_macWindow != NULL); success = (GetWXWindow() != NULL);
} }
if (success) if (success)
{ {
// Use drawer brush. // Use drawer brush.
SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) ); SetBackgroundColour( wxColour( wxMacCreateCGColorFromHITheme( kThemeBrushDrawerBackground ) ) );
::SetThemeWindowBackground((WindowRef)m_macWindow, kThemeBrushDrawerBackground, false); ::SetThemeWindowBackground((WindowRef)GetWXWindow(), kThemeBrushDrawerBackground, false);
// Leading and trailing offset are gaps from parent window edges // Leading and trailing offset are gaps from parent window edges
// to where the drawer starts. // to where the drawer starts.
::SetDrawerOffsets((WindowRef)m_macWindow, kLeadingOffset, kTrailingOffset); ::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
// Set the drawers parent. // Set the drawers parent.
// Is there a better way to get the parent's WindowRef? // Is there a better way to get the parent's WindowRef?
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow); wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
if (NULL != tlwParent) if (NULL != tlwParent)
{ {
OSStatus status = ::SetDrawerParent((WindowRef)m_macWindow, OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
(WindowRef)tlwParent->MacGetWindowRef()); (WindowRef)tlwParent->GetWXWindow());
success = (noErr == status); success = (noErr == status);
} }
else else
@@ -104,19 +104,19 @@ bool wxDrawerWindow::Create(wxWindow *parent,
wxDirection wxDrawerWindow::GetCurrentEdge() const wxDirection wxDrawerWindow::GetCurrentEdge() const
{ {
const OptionBits edge = ::GetDrawerCurrentEdge((WindowRef)m_macWindow); const OptionBits edge = ::GetDrawerCurrentEdge((WindowRef)GetWXWindow());
return WindowEdgeToDirection(edge); return WindowEdgeToDirection(edge);
} }
wxDirection wxDrawerWindow::GetPreferredEdge() const wxDirection wxDrawerWindow::GetPreferredEdge() const
{ {
const OptionBits edge = ::GetDrawerPreferredEdge((WindowRef)m_macWindow); const OptionBits edge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow());
return WindowEdgeToDirection(edge); return WindowEdgeToDirection(edge);
} }
bool wxDrawerWindow::IsOpen() const bool wxDrawerWindow::IsOpen() const
{ {
WindowDrawerState state = ::GetDrawerState((WindowRef)m_macWindow); WindowDrawerState state = ::GetDrawerState((WindowRef)GetWXWindow());
return (state == kWindowDrawerOpen || state == kWindowDrawerOpening); return (state == kWindowDrawerOpen || state == kWindowDrawerOpening);
} }
@@ -127,18 +127,18 @@ bool wxDrawerWindow::Open(bool show)
if (show) if (show)
{ {
const OptionBits preferredEdge = ::GetDrawerPreferredEdge((WindowRef)m_macWindow); const OptionBits preferredEdge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow());
status = ::OpenDrawer((WindowRef)m_macWindow, preferredEdge, kAsynchronous); status = ::OpenDrawer((WindowRef)GetWXWindow(), preferredEdge, kAsynchronous);
} }
else else
status = ::CloseDrawer((WindowRef)m_macWindow, kAsynchronous); status = ::CloseDrawer((WindowRef)GetWXWindow(), kAsynchronous);
return (noErr == status); return (noErr == status);
} }
bool wxDrawerWindow::SetPreferredEdge(wxDirection edge) bool wxDrawerWindow::SetPreferredEdge(wxDirection edge)
{ {
const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)m_macWindow, const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)GetWXWindow(),
DirectionToWindowEdge(edge)); DirectionToWindowEdge(edge));
return (noErr == status); return (noErr == status);
} }

View File

@@ -30,10 +30,10 @@
#include "wx/app.h" #include "wx/app.h"
#endif // WX_PRECOMP #endif // WX_PRECOMP
#ifdef __DARWIN__ #if wxOSX_USE_CARBON
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#else #else
#include <Carbon.h> #include <CoreFoundation/CoreFoundation.h>
#endif #endif
// ============================================================================ // ============================================================================
// wxEventLoop implementation // wxEventLoop implementation
@@ -43,6 +43,8 @@
// high level functions for RunApplicationEventLoop() case // high level functions for RunApplicationEventLoop() case
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxMAC_USE_RUN_APP_EVENT_LOOP #if wxMAC_USE_RUN_APP_EVENT_LOOP
int wxGUIEventLoop::Run() int wxGUIEventLoop::Run()
@@ -84,6 +86,7 @@ void wxGUIEventLoop::WakeUp()
bool wxGUIEventLoop::Pending() const bool wxGUIEventLoop::Pending() const
{ {
#if wxOSX_USE_CARBON
EventRef theEvent; EventRef theEvent;
return ReceiveNextEvent return ReceiveNextEvent
@@ -94,16 +97,23 @@ bool wxGUIEventLoop::Pending() const
false, // don't remove the event from queue false, // don't remove the event from queue
&theEvent &theEvent
) == noErr; ) == noErr;
#else
return true; // TODO
#endif
} }
bool wxGUIEventLoop::Dispatch() bool wxGUIEventLoop::Dispatch()
{ {
// TODO: we probably should do the dispatching directly from here but for
// now it's easier to forward to wxApp which has all the code to do
// it
if ( !wxTheApp ) if ( !wxTheApp )
return false; return false;
#if wxOSX_USE_CARBON
// TODO: we probably should do the dispatching directly from here but for
// now it's easier to forward to wxApp which has all the code to do
// it
wxTheApp->MacDoOneEvent(); wxTheApp->MacDoOneEvent();
#else
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, 0);
#endif
return true; return true;
} }

View File

@@ -25,7 +25,11 @@
#include "wx/graphics.h" #include "wx/graphics.h"
#include "wx/settings.h" #include "wx/settings.h"
#if wxOSX_USE_CARBON
#include "wx/osx/uma.h" #include "wx/osx/uma.h"
#else
#include "wx/osx/private.h"
#endif
#ifndef __DARWIN__ #ifndef __DARWIN__
#include <ATSUnicode.h> #include <ATSUnicode.h>
@@ -414,7 +418,7 @@ void wxFontRefData::MacFindFont()
traits |= kCTFontItalicTrait; traits |= kCTFontItalicTrait;
// use font descriptor caching // use font descriptor caching
#if 1 #if 0
wxString lookupname = wxString::Format( "%s_%ld", m_faceName.c_str(), traits ); wxString lookupname = wxString::Format( "%s_%ld", m_faceName.c_str(), traits );
static std::map< std::wstring , wxCFRef< CTFontDescriptorRef > > fontdescriptorcache ; static std::map< std::wstring , wxCFRef< CTFontDescriptorRef > > fontdescriptorcache ;
@@ -432,7 +436,7 @@ void wxFontRefData::MacFindFont()
#endif #endif
// use font caching // use font caching
#if 1 #if 0
wxString lookupnameWithSize = wxString::Format( "%s_%ld_%ld", m_faceName.c_str(), traits, m_pointSize ); wxString lookupnameWithSize = wxString::Format( "%s_%ld_%ld", m_faceName.c_str(), traits, m_pointSize );
static std::map< std::wstring , wxCFRef< CTFontRef > > fontcache ; static std::map< std::wstring , wxCFRef< CTFontRef > > fontcache ;
@@ -445,6 +449,17 @@ void wxFontRefData::MacFindFont()
#else #else
m_ctFont.reset( CTFontCreateWithFontDescriptor( m_ctFontDescriptor, m_pointSize, NULL ) ); m_ctFont.reset( CTFontCreateWithFontDescriptor( m_ctFontDescriptor, m_pointSize, NULL ) );
#endif #endif
if ( /* (CTFontGetSymbolicTraits( m_ctFont ) & 0x03) !=*/ traits )
{
CTFontRef font = CTFontCreateWithName( cf, m_pointSize, NULL );
CTFontRef font2 = CTFontCreateCopyWithSymbolicTraits( font, m_pointSize, NULL, traits, 0x03 );
CFRelease(font);
m_ctFont.reset( font2 );
if ( (CTFontGetSymbolicTraits( m_ctFont ) & 0x03) != traits )
{
wxMessageBox( wxString::Format( "expected %d but got %d traits" , traits, (CTFontGetSymbolicTraits( m_ctFont ) & 0x03) ) );
}
}
} }
#if wxMAC_USE_ATSU_TEXT #if wxMAC_USE_ATSU_TEXT
OSStatus status = noErr; OSStatus status = noErr;

View File

@@ -225,7 +225,7 @@ void wxFrame::DetachMenuBar()
void wxFrame::AttachMenuBar( wxMenuBar *menuBar ) void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
{ {
wxFrame* tlf = wxDynamicCast( wxFindWinFromMacWindow( FrontNonFloatingWindow() ) , wxFrame ); wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontNonFloatingWindow() ) , wxFrame );
bool makeCurrent = false; bool makeCurrent = false;
// if this is already the current menubar or we are the frontmost window // if this is already the current menubar or we are the frontmost window

View File

@@ -60,7 +60,7 @@ void wxGauge::SetRange(int r)
// we are going via the base class in case there is // we are going via the base class in case there is
// some change behind the values by it // some change behind the values by it
wxGaugeBase::SetRange( r ) ; wxGaugeBase::SetRange( r ) ;
if ( m_peer && m_peer->Ok() ){ if ( m_peer && m_peer->IsOk() ){
// switch back to determinate mode if not there already // switch back to determinate mode if not there already
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false ) if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
{ {
@@ -77,7 +77,7 @@ void wxGauge::SetValue(int pos)
// some change behind the values by it // some change behind the values by it
wxGaugeBase::SetValue( pos ) ; wxGaugeBase::SetValue( pos ) ;
if ( m_peer && m_peer->Ok() ) if ( m_peer && m_peer->IsOk() )
{ {
// switch back to determinate mode if not there already // switch back to determinate mode if not there already
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false ) if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
@@ -110,7 +110,7 @@ int wxGauge::GetValue() const
void wxGauge::Pulse() void wxGauge::Pulse()
{ {
if ( m_peer && m_peer->Ok() ) if ( m_peer && m_peer->IsOk() )
{ {
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != true ) if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != true )
{ {

View File

@@ -20,6 +20,7 @@
#include "wx/link.h" #include "wx/link.h"
#include "wx/osx/private.h" #include "wx/osx/private.h"
#include "wx/font.h"
// Linker will discard entire object file without this // Linker will discard entire object file without this
wxFORCE_LINK_THIS_MODULE(gdiobj) wxFORCE_LINK_THIS_MODULE(gdiobj)
@@ -50,6 +51,9 @@ void wxStockGDIMac::OnExit()
{ {
} }
extern wxFont* CreateNormalFont();
extern wxFont* CreateSmallFont();
const wxFont* wxStockGDIMac::GetFont(Item item) const wxFont* wxStockGDIMac::GetFont(Item item)
{ {
wxFont* font = static_cast<wxFont*>(ms_stockObject[item]); wxFont* font = static_cast<wxFont*>(ms_stockObject[item]);
@@ -57,6 +61,7 @@ const wxFont* wxStockGDIMac::GetFont(Item item)
{ {
switch (item) switch (item)
{ {
#if wxOSX_USE_COCOA_OR_CARBON
case FONT_NORMAL: case FONT_NORMAL:
font = new wxFont; font = new wxFont;
font->MacCreateFromThemeFont(kThemeSystemFont); font->MacCreateFromThemeFont(kThemeSystemFont);
@@ -65,6 +70,14 @@ const wxFont* wxStockGDIMac::GetFont(Item item)
font = new wxFont; font = new wxFont;
font->MacCreateFromThemeFont(kThemeSmallSystemFont); font->MacCreateFromThemeFont(kThemeSmallSystemFont);
break; break;
#else
case FONT_NORMAL:
font = CreateNormalFont() ;
break;
case FONT_SMALL:
font = CreateSmallFont();
break;
#endif
default: default:
font = const_cast<wxFont*>(super::GetFont(item)); font = const_cast<wxFont*>(super::GetFont(item));
break; break;

View File

@@ -35,8 +35,16 @@
#endif #endif
#ifdef __WXMAC__ #ifdef __WXMAC__
#include "wx/osx/uma.h" #include "wx/osx/private.h"
#include "wx/osx/dcprint.h" #include "wx/osx/dcprint.h"
#include "wx/osx/dcclient.h"
#include "wx/osx/dcmemory.h"
#if wxOSX_USE_CARBON
#include "wx/osx/uma.h"
#else
#include "wx/osx/private.h"
#endif
#else #else
#include "CoreServices/CoreServices.h" #include "CoreServices/CoreServices.h"
#include "ApplicationServices/ApplicationServices.h" #include "ApplicationServices/ApplicationServices.h"
@@ -92,12 +100,12 @@ OSStatus wxMacDrawCGImage(
const CGRect * inBounds, const CGRect * inBounds,
CGImageRef inImage) CGImageRef inImage)
{ {
#if defined( __LP64__ ) || defined(__WXCOCOA__) #if wxOSX_USE_CARBON
return HIViewDrawCGImage( inContext, inBounds, inImage );
#else
// todo flip // todo flip
CGContextDrawImage(inContext, *inBounds, inImage ); CGContextDrawImage(inContext, *inBounds, inImage );
return noErr; return noErr;
#else
return HIViewDrawCGImage( inContext, inBounds, inImage );
#endif #endif
} }
@@ -122,7 +130,7 @@ CGColorRef wxMacCreateCGColor( const wxColour& col )
return retval; return retval;
} }
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && defined(wxMAC_USE_CORE_TEXT) #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 && wxMAC_USE_CORE_TEXT
CTFontRef wxMacCreateCTFont( const wxFont& font ) CTFontRef wxMacCreateCTFont( const wxFont& font )
{ {
@@ -758,6 +766,14 @@ CGFunctionRef wxMacCoreGraphicsBrushData::CreateGradientFunction( const wxColour
// Font // Font
// //
#if wxOSX_USE_IPHONE
extern UIFont* CreateUIFont( const wxFont& font );
extern void DrawTextInContext( CGContextRef context, CGPoint where, UIFont *font, NSString* text );
extern CGSize MeasureTextInContext( UIFont *font, NSString* text );
#endif
class wxMacCoreGraphicsFontData : public wxGraphicsObjectRefData class wxMacCoreGraphicsFontData : public wxGraphicsObjectRefData
{ {
public: public:
@@ -773,6 +789,9 @@ public:
wxColour GetColour() const { return m_colour ; } wxColour GetColour() const { return m_colour ; }
bool GetUnderlined() const { return m_underlined ; } bool GetUnderlined() const { return m_underlined ; }
#if wxOSX_USE_IPHONE
UIFont* GetUIFont() const { return m_uiFont; }
#endif
private : private :
wxColour m_colour; wxColour m_colour;
bool m_underlined; bool m_underlined;
@@ -782,6 +801,9 @@ private :
#if wxMAC_USE_CORE_TEXT #if wxMAC_USE_CORE_TEXT
wxCFRef< CTFontRef > m_ctFont; wxCFRef< CTFontRef > m_ctFont;
#endif #endif
#if wxOSX_USE_IPHONE
UIFont* m_uiFont;
#endif
}; };
wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col) : wxGraphicsObjectRefData( renderer ) wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* renderer, const wxFont &font, const wxColour& col) : wxGraphicsObjectRefData( renderer )
@@ -792,6 +814,10 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
#if wxMAC_USE_CORE_TEXT #if wxMAC_USE_CORE_TEXT
m_ctFont.reset( wxMacCreateCTFont( font ) ); m_ctFont.reset( wxMacCreateCTFont( font ) );
#endif #endif
#if wxOSX_USE_IPHONE
m_uiFont = CreateUIFont(font);
wxMacCocoaRetain( m_uiFont );
#endif
#if wxMAC_USE_ATSU_TEXT #if wxMAC_USE_ATSU_TEXT
OSStatus status = noErr; OSStatus status = noErr;
m_macATSUIStyle = NULL; m_macATSUIStyle = NULL;
@@ -827,8 +853,6 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") ); wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
#endif #endif
#if wxMAC_USE_CG_TEXT
#endif
} }
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData() wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
@@ -842,7 +866,8 @@ wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
m_macATSUIStyle = NULL; m_macATSUIStyle = NULL;
} }
#endif #endif
#if wxMAC_USE_CG_TEXT #if wxOSX_USE_IPHONE
wxMacCocoaRelease( m_uiFont );
#endif #endif
} }
@@ -1244,7 +1269,9 @@ class WXDLLEXPORT wxMacCoreGraphicsContext : public wxGraphicsContext
public: public:
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, CGContextRef cgcontext, wxDouble width = 0, wxDouble height = 0 ); wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, CGContextRef cgcontext, wxDouble width = 0, wxDouble height = 0 );
#if wxOSX_USE_CARBON
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ); wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window );
#endif
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ); wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window );
@@ -1353,20 +1380,23 @@ public:
void SetNativeContext( CGContextRef cg ); void SetNativeContext( CGContextRef cg );
DECLARE_NO_COPY_CLASS(wxMacCoreGraphicsContext) DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacCoreGraphicsContext)
DECLARE_DYNAMIC_CLASS(wxMacCoreGraphicsContext)
private: private:
void EnsureIsValid(); void EnsureIsValid();
CGContextRef m_cgContext; CGContextRef m_cgContext;
#if wxOSX_USE_CARBON
WindowRef m_windowRef; WindowRef m_windowRef;
#endif
bool m_releaseContext; bool m_releaseContext;
CGAffineTransform m_windowTransform; CGAffineTransform m_windowTransform;
wxDouble m_width; wxDouble m_width;
wxDouble m_height; wxDouble m_height;
#if wxOSX_USE_CARBON
wxCFRef<HIShapeRef> m_clipRgn; wxCFRef<HIShapeRef> m_clipRgn;
#endif
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -1411,7 +1441,9 @@ void wxMacCoreGraphicsContext::Init()
{ {
m_cgContext = NULL; m_cgContext = NULL;
m_releaseContext = false; m_releaseContext = false;
#if wxOSX_USE_CARBON
m_windowRef = NULL; m_windowRef = NULL;
#endif
m_width = 0; m_width = 0;
m_height = 0; m_height = 0;
} }
@@ -1424,11 +1456,13 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
m_height = height; m_height = height;
} }
#if wxOSX_USE_CARBON
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ): wxGraphicsContext(renderer) wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ): wxGraphicsContext(renderer)
{ {
Init(); Init();
m_windowRef = window; m_windowRef = window;
} }
#endif
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ): wxGraphicsContext(renderer) wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ): wxGraphicsContext(renderer)
{ {
@@ -1438,7 +1472,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
originX = originY = 0; originX = originY = 0;
Rect bounds = { 0,0,0,0 }; Rect bounds = { 0,0,0,0 };
#if defined( __LP64__ ) || defined(__WXCOCOA__) #if defined(__WXCOCOA__) || !wxOSX_USE_CARBON
#else #else
m_windowRef = (WindowRef) window->MacGetTopLevelWindowRef(); m_windowRef = (WindowRef) window->MacGetTopLevelWindowRef();
window->MacWindowToRootWindow( &originX , &originY ); window->MacWindowToRootWindow( &originX , &originY );
@@ -1499,12 +1533,10 @@ void wxMacCoreGraphicsContext::EnsureIsValid()
{ {
if ( !m_cgContext ) if ( !m_cgContext )
{ {
OSStatus status = #if defined(__WXCOCOA__) || ! wxOSX_USE_CARBON
#if ! ( defined( __LP64__ ) || defined(__WXCOCOA__) ) wxFAIL_MSG("Cannot create wxDCs lazily");
QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
#else #else
paramErr; OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
#endif
if ( status != noErr ) if ( status != noErr )
{ {
wxFAIL_MSG("Cannot nest wxDCs on the same window"); wxFAIL_MSG("Cannot nest wxDCs on the same window");
@@ -1532,6 +1564,7 @@ void wxMacCoreGraphicsContext::EnsureIsValid()
} }
} }
CGContextSaveGState( m_cgContext ); CGContextSaveGState( m_cgContext );
#endif
} }
} }
@@ -1548,8 +1581,12 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function )
bool shouldAntiAlias = true; bool shouldAntiAlias = true;
CGBlendMode mode = kCGBlendModeNormal; CGBlendMode mode = kCGBlendModeNormal;
#if defined(__WXMAC__) && ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 ) #if defined(__WXMAC__) && ( wxOSX_USE_IPHONE || ( MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 ) )
#if wxOSX_USE_IPHONE
if ( 1 )
#else
if ( UMAGetSystemVersion() >= 0x1050 ) if ( UMAGetSystemVersion() >= 0x1050 )
#endif
{ {
retval = true; retval = true;
switch ( function ) switch ( function )
@@ -1597,7 +1634,7 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function )
void wxMacCoreGraphicsContext::Clip( const wxRegion &region ) void wxMacCoreGraphicsContext::Clip( const wxRegion &region )
{ {
#ifdef __WXMAC__ #if wxOSX_USE_CARBON
if( m_cgContext ) if( m_cgContext )
{ {
wxCFRef<HIShapeRef> shape = wxCFRefFromGet(region.GetWXHRGN()); wxCFRef<HIShapeRef> shape = wxCFRefFromGet(region.GetWXHRGN());
@@ -1623,6 +1660,9 @@ void wxMacCoreGraphicsContext::Clip( const wxRegion &region )
HIShapeOffset( mutableShape, transformedOrigin.x, transformedOrigin.y ); HIShapeOffset( mutableShape, transformedOrigin.x, transformedOrigin.y );
m_clipRgn.reset(mutableShape); m_clipRgn.reset(mutableShape);
} }
#else
// allow usage as measuring context
// wxASSERT_MSG( m_cgContext != NULL, "Needs a valid context for clipping" );
#endif #endif
} }
@@ -1636,10 +1676,15 @@ void wxMacCoreGraphicsContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDoubl
} }
else else
{ {
#if wxOSX_USE_CARBON
// the clipping itself must be stored as device coordinates, otherwise // the clipping itself must be stored as device coordinates, otherwise
// we cannot apply it back correctly // we cannot apply it back correctly
r.origin= CGPointApplyAffineTransform( r.origin, m_windowTransform ); r.origin= CGPointApplyAffineTransform( r.origin, m_windowTransform );
m_clipRgn.reset(HIShapeCreateWithRect(&r)); m_clipRgn.reset(HIShapeCreateWithRect(&r));
#else
// allow usage as measuring context
// wxFAIL_MSG( "Needs a valid context for clipping" );
#endif
} }
} }
@@ -1660,7 +1705,12 @@ void wxMacCoreGraphicsContext::ResetClip()
} }
else else
{ {
#if wxOSX_USE_CARBON
m_clipRgn.reset(); m_clipRgn.reset();
#else
// allow usage as measuring context
// wxFAIL_MSG( "Needs a valid context for clipping" );
#endif
} }
} }
@@ -1765,7 +1815,7 @@ void wxMacCoreGraphicsContext::SetNativeContext( CGContextRef cg )
CGContextRestoreGState( m_cgContext ); CGContextRestoreGState( m_cgContext );
if ( m_releaseContext ) if ( m_releaseContext )
{ {
#if ! ( defined( __LP64__ ) || defined(__WXCOCOA__) ) #if wxOSX_USE_CARBON
QDEndCGContext( GetWindowPort( m_windowRef ) , &m_cgContext); QDEndCGContext( GetWindowPort( m_windowRef ) , &m_cgContext);
#endif #endif
} }
@@ -1868,7 +1918,7 @@ void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDoubl
CGContextSaveGState( m_cgContext ); CGContextSaveGState( m_cgContext );
CGContextTranslateCTM( m_cgContext,(CGFloat) x ,(CGFloat) (y + h) ); CGContextTranslateCTM( m_cgContext,(CGFloat) x ,(CGFloat) (y + h) );
CGContextScaleCTM( m_cgContext, 1, -1 ); CGContextScaleCTM( m_cgContext, 1, -1 );
#ifdef __WXMAC__ #if wxOSX_USE_CARBON
PlotIconRefInContext( m_cgContext , &r , kAlignNone , kTransformNone , PlotIconRefInContext( m_cgContext , &r , kAlignNone , kTransformNone ,
NULL , kPlotIconRefNormalFlags , MAC_WXHICON( icon.GetHICON() ) ); NULL , kPlotIconRefNormalFlags , MAC_WXHICON( icon.GetHICON() ) );
#endif #endif
@@ -1930,7 +1980,19 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
} }
#endif #endif
#if wxMAC_USE_CG_TEXT #if wxMAC_USE_CG_TEXT
// TODO core graphics text implementation here wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
CGContextSaveGState(m_cgContext);
CGColorRef col = wxMacCreateCGColor( fref->GetColour() );
CGContextSetTextDrawingMode (m_cgContext, kCGTextFill);
CGContextSetFillColorWithColor( m_cgContext, col );
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
DrawTextInContext( m_cgContext, CGPointMake( x, y ), fref->GetUIFont() , text.AsNSString() );
CGContextRestoreGState(m_cgContext);
CFRelease( col );
#endif #endif
} }
@@ -2122,7 +2184,21 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
} }
#endif #endif
#if wxMAC_USE_CG_TEXT #if wxMAC_USE_CG_TEXT
// TODO core graphics text implementation here wxMacCoreGraphicsFontData* fref = (wxMacCoreGraphicsFontData*)m_font.GetRefData();
wxCFStringRef text(str, wxLocale::GetSystemEncoding() );
CGSize sz = MeasureTextInContext( fref->GetUIFont() , text.AsNSString() );
if ( height )
*height = sz.height;
/*
if ( descent )
*descent = FixedToInt(textDescent);
if ( externalLeading )
*externalLeading = 0;
*/
if ( width )
*width = sz.width;
#endif #endif
} }
@@ -2338,7 +2414,7 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
return &gs_MacCoreGraphicsRenderer; return &gs_MacCoreGraphicsRenderer;
} }
#ifdef __WXCOCOA__ #if defined( __WXCOCOA__ ) || wxOSX_USE_COCOA
extern CGContextRef wxMacGetContextFromCurrentNSContext() ; extern CGContextRef wxMacGetContextFromCurrentNSContext() ;
#endif #endif
@@ -2379,6 +2455,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxMemoryDC&
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxPrinterDC& dc ) wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxPrinterDC& dc )
{ {
#if wxUSE_PRINTING_ARCHITECTURE
#ifdef __WXMAC__ #ifdef __WXMAC__
const wxDCImpl* impl = dc.GetImpl(); const wxDCImpl* impl = dc.GetImpl();
wxPrinterDCImpl *print_impl = wxDynamicCast( impl, wxPrinterDCImpl ); wxPrinterDCImpl *print_impl = wxDynamicCast( impl, wxPrinterDCImpl );
@@ -2389,6 +2466,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxPrinterDC&
return new wxMacCoreGraphicsContext( this, return new wxMacCoreGraphicsContext( this,
(CGContextRef)(print_impl->GetGraphicsContext()->GetNativeContext()), (wxDouble) w, (wxDouble) h ); (CGContextRef)(print_impl->GetGraphicsContext()->GetNativeContext()), (wxDouble) w, (wxDouble) h );
} }
#endif
#endif #endif
return NULL; return NULL;
} }
@@ -2398,10 +2476,13 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( v
return new wxMacCoreGraphicsContext(this,(CGContextRef)context); return new wxMacCoreGraphicsContext(this,(CGContextRef)context);
} }
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window ) wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window )
{ {
#if wxOSX_USE_CARBON
return new wxMacCoreGraphicsContext(this,(WindowRef)window); return new wxMacCoreGraphicsContext(this,(WindowRef)window);
#else
return NULL;
#endif
} }
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window ) wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window )

View File

@@ -426,7 +426,7 @@ void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner ,
return; return;
} }
wxListBox *list = wxDynamicCast( owner->GetPeer() , wxListBox ); wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
wxCHECK_RET( list != NULL , wxT("Listbox expected")); wxCHECK_RET( list != NULL , wxT("Listbox expected"));
if (message == kDataBrowserItemDoubleClicked) if (message == kDataBrowserItemDoubleClicked)
@@ -535,7 +535,7 @@ void wxMacDataBrowserListControl::ItemNotification(
DataBrowserItemNotification message, DataBrowserItemNotification message,
DataBrowserItemDataRef itemData) DataBrowserItemDataRef itemData)
{ {
wxListBox *list = wxDynamicCast( GetPeer() , wxListBox ); wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox );
wxCHECK_RET( list != NULL , wxT("Listbox expected")); wxCHECK_RET( list != NULL , wxT("Listbox expected"));
if (list->HasMultipleSelection() && (message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents())) if (list->HasMultipleSelection() && (message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents()))
@@ -549,7 +549,7 @@ void wxMacDataBrowserListControl::ItemNotification(
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() ); wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
int sel = list->GetSelection(); int sel = list->GetSelection();
if ((sel < 0) || (sel > list->GetCount())) // OS X can select an item below the last item (why?) if ((sel < 0) || (sel > (int) list->GetCount())) // OS X can select an item below the last item (why?)
return; return;
event.SetEventObject( list ); event.SetEventObject( list );
if ( list->HasClientObjectData() ) if ( list->HasClientObjectData() )
@@ -566,12 +566,12 @@ void wxMacDataBrowserListControl::ItemNotification(
// call super for item level(wxMacDataItem->Notification) callback processing // call super for item level(wxMacDataItem->Notification) callback processing
wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData); wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData);
} }
/*
wxWindow * wxMacDataBrowserListControl::GetPeer() const wxWindow * wxMacDataBrowserListControl::GetPeer() const
{ {
return wxDynamicCast( wxMacControl::GetPeer() , wxWindow ); return wxDynamicCast( wxMacControl::GetWX() , wxWindow );
} }
*/
wxMacDataItem* wxMacDataBrowserListControl::CreateItem() wxMacDataItem* wxMacDataBrowserListControl::CreateItem()
{ {
return new wxMacListBoxItem(); return new wxMacListBoxItem();

View File

@@ -2448,7 +2448,7 @@ void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner ,
return ; return ;
} }
wxListCtrl *list = wxDynamicCast( owner->GetPeer() , wxListCtrl ); wxListCtrl *list = wxDynamicCast( owner->GetWXPeer() , wxListCtrl );
if ( list && lb ) if ( list && lb )
{ {
bool trigger = false; bool trigger = false;
@@ -2669,7 +2669,7 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
int imgIndex = -1; int imgIndex = -1;
short listColumn = property - kMinColumnId; short listColumn = property - kMinColumnId;
wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl ); wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
wxMacListCtrlItem* lcItem; wxMacListCtrlItem* lcItem;
wxColour color = *wxBLACK; wxColour color = *wxBLACK;
wxColour bgColor = wxNullColour; wxColour bgColor = wxNullColour;
@@ -2905,7 +2905,7 @@ OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemI
short listColumn = property - kMinColumnId; short listColumn = property - kMinColumnId;
OSStatus err = errDataBrowserPropertyNotSupported; OSStatus err = errDataBrowserPropertyNotSupported;
wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl ); wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
wxMacListCtrlItem* lcItem = NULL; wxMacListCtrlItem* lcItem = NULL;
if (listColumn >= 0) if (listColumn >= 0)
@@ -3024,7 +3024,7 @@ void wxMacDataBrowserListCtrlControl::ItemNotification(DataBrowserItemID itemID,
return ; return ;
} }
wxListCtrl *list = wxDynamicCast( GetPeer() , wxListCtrl ); wxListCtrl *list = wxDynamicCast( GetWXPeer() , wxListCtrl );
if ( list ) if ( list )
{ {
bool trigger = false; bool trigger = false;
@@ -3102,7 +3102,7 @@ Boolean wxMacDataBrowserListCtrlControl::CompareItems(DataBrowserItemID itemOneI
int colId = sortProperty - kMinColumnId; int colId = sortProperty - kMinColumnId;
wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl ); wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
DataBrowserSortOrder sort; DataBrowserSortOrder sort;
verify_noerr(GetSortOrder(&sort)); verify_noerr(GetSortOrder(&sort));
@@ -3175,7 +3175,7 @@ void wxMacDataBrowserListCtrlControl::MacSetColumnInfo( unsigned int row, unsign
listItem->SetOrder(row); listItem->SetOrder(row);
UpdateState(dataItem, item); UpdateState(dataItem, item);
wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl ); wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
// NB: When this call was made before a control was completely shown, it would // NB: When this call was made before a control was completely shown, it would
// update the item prematurely (i.e. no text would be listed) and, on show, // update the item prematurely (i.e. no text would be listed) and, on show,

View File

@@ -218,7 +218,7 @@ void wxMDIParentFrame::MacActivate(long timestamp, bool activating)
{ {
wxLogTrace(TRACE_MDI, wxT("child had been scheduled for deactivation, rehighlighting")); wxLogTrace(TRACE_MDI, wxT("child had been scheduled for deactivation, rehighlighting"));
UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->MacGetWindowRef(), true); UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->GetWXWindow(), true);
wxLogTrace(TRACE_MDI, wxT("finished highliting child")); wxLogTrace(TRACE_MDI, wxT("finished highliting child"));
@@ -382,14 +382,10 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
SetName(name); SetName(name);
if ( id == wxID_ANY ) if ( id == wxID_ANY )
m_windowId = (int)NewControlId(); id = (int)NewControlId();
else
m_windowId = id;
if (parent) wxNonOwnedWindow::Create( parent, id, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
parent->AddChild(this);
MacCreateRealWindow( pos , size , MacRemoveBordersFromStyle(style) , name ) ;
SetTitle( title ); SetTitle( title );
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
@@ -420,7 +416,7 @@ void wxMDIChildFrame::MacActivate(long timestamp, bool activating)
{ {
wxLogTrace(TRACE_MDI, wxT("parent had been scheduled for deactivation, rehighlighting")); wxLogTrace(TRACE_MDI, wxT("parent had been scheduled for deactivation, rehighlighting"));
UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->MacGetWindowRef(), true); UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->GetWXWindow(), true);
wxLogTrace(TRACE_MDI, wxT("finished highliting parent")); wxLogTrace(TRACE_MDI, wxT("finished highliting parent"));

View File

@@ -57,7 +57,7 @@
#include <QuickTime/QuickTimeComponents.h> #include <QuickTime/QuickTimeComponents.h>
#endif #endif
#if !defined(__LP64__) #if wxOSX_USE_CARBON
#define USE_QUICKTIME 1 #define USE_QUICKTIME 1
#else #else
#define USE_QUICKTIME 0 #define USE_QUICKTIME 0

File diff suppressed because it is too large Load Diff

View File

@@ -60,15 +60,13 @@ void wxOverlayImpl::MacGetBounds( Rect *bounds )
int x, y; int x, y;
x=y=0; x=y=0;
m_window->MacWindowToRootWindow( &x , &y ) ; m_window->MacWindowToRootWindow( &x , &y ) ;
WindowRef window = (WindowRef) m_window->MacGetTopLevelWindowRef() ; wxNonOwnedWindow* tlw = m_window->MacGetTopLevelWindow();
tlw->GetNonOwnedPeer()->WindowToScreen( &x, &y );
Point localwhere = { y, x }; bounds->top = y+m_y;
wxMacLocalToGlobal( window, &localwhere ) ; bounds->left = x+m_x;
bounds->bottom = y+m_y+m_height;
bounds->top = localwhere.v+m_y; bounds->right = x+m_x+m_width;
bounds->left = localwhere.h+m_x;
bounds->bottom = localwhere.v+m_y+m_height;
bounds->right = localwhere.h+m_x+m_width;
} }
OSStatus wxOverlayImpl::CreateOverlayWindow() OSStatus wxOverlayImpl::CreateOverlayWindow()

View File

@@ -142,7 +142,7 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data )
if ( !m_printerName.empty() ) if ( !m_printerName.empty() )
PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxCFStringRef( m_printerName , wxFont::GetDefaultEncoding() ) ) ; PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxCFStringRef( m_printerName , wxFont::GetDefaultEncoding() ) ) ;
#endif #endif
#ifndef __LP64__ #if wxOSX_USE_CARBON
PMColorMode color ; PMColorMode color ;
PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ;
if ( data.GetColour() ) if ( data.GetColour() )
@@ -176,15 +176,16 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data )
PMResolution res; PMResolution res;
PMPrinter printer; PMPrinter printer;
PMSessionGetCurrentPrinter(m_macPrintSession, &printer); PMSessionGetCurrentPrinter(m_macPrintSession, &printer);
#if 0 // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
#if wxOSX_USE_CARBON
PMTag tag = kPMMaxSquareResolution;
PMPrinterGetPrinterResolution(printer, tag, &res);
PMSetResolution((PMPageFormat) m_macPageFormat, &res);
#else
PMPrinterGetOutputResolution( printer, PMPrinterGetOutputResolution( printer,
(PMPrintSettings) m_macPrintSettings, &res) ; (PMPrintSettings) m_macPrintSettings, &res) ;
// TODO transfer ? into page format ? // TODO transfer ? into page format ?
// may fail ! // may fail !
#else
PMTag tag = kPMMaxSquareResolution;
PMPrinterGetPrinterResolution(printer, tag, &res);
PMSetResolution((PMPageFormat) m_macPageFormat, &res);
#endif #endif
// after setting the new resolution the format has to be updated, otherwise the page rect remains // after setting the new resolution the format has to be updated, otherwise the page rect remains
// at the 'old' scaling // at the 'old' scaling
@@ -420,12 +421,12 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
PMResolution res; PMResolution res;
wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*) wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*)
(m_printDialogData.GetPrintData().GetNativeData()); (m_printDialogData.GetPrintData().GetNativeData());
#if 0 // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 #if wxOSX_USE_CARBON
PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res);
#else
PMPrinter printer; PMPrinter printer;
PMSessionGetCurrentPrinter(nativeData->m_macPrintSession, &printer); PMSessionGetCurrentPrinter(nativeData->m_macPrintSession, &printer);
PMPrinterGetOutputResolution( printer, nativeData->m_macPrintSettings, &res) ; PMPrinterGetOutputResolution( printer, nativeData->m_macPrintSettings, &res) ;
#else
PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res);
#endif #endif
printout->SetPPIPrinter(int(res.hRes), int(res.vRes)); printout->SetPPIPrinter(int(res.hRes), int(res.vRes));

View File

@@ -27,7 +27,7 @@
#include "wx/renderer.h" #include "wx/renderer.h"
#include "wx/graphics.h" #include "wx/graphics.h"
#include "wx/osx/uma.h" #include "wx/osx/private.h"
class WXDLLEXPORT wxRendererMac : public wxDelegateRendererNative class WXDLLEXPORT wxRendererMac : public wxDelegateRendererNative
@@ -236,7 +236,7 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win,
wxOrientation orient, wxOrientation orient,
int WXUNUSED(flags) ) int WXUNUSED(flags) )
{ {
bool hasMetal = win->MacGetTopLevelWindow()->MacGetMetalAppearance(); bool hasMetal = win->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL;
SInt32 height; SInt32 height;
GetThemeMetric( kThemeMetricSmallPaneSplitterHeight, &height ); GetThemeMetric( kThemeMetricSmallPaneSplitterHeight, &height );
HIRect splitterRect; HIRect splitterRect;

View File

@@ -18,7 +18,7 @@
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#endif #endif
#include "wx/osx/uma.h" #include "wx/osx/private.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxSystemSettingsNative // wxSystemSettingsNative
@@ -31,12 +31,18 @@
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index) wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
{ {
wxColour resultColor; wxColour resultColor;
#if wxOSX_USE_COCOA_OR_CARBON
ThemeBrush colorBrushID; ThemeBrush colorBrushID;
#endif
switch ( index ) switch ( index )
{ {
case wxSYS_COLOUR_WINDOW: case wxSYS_COLOUR_WINDOW:
resultColor = *wxWHITE ; #if wxOSX_USE_COCOA_OR_CARBON
resultColor = wxColour(wxMacCreateCGColorFromHITheme( kThemeBrushDocumentWindowBackground )) ;
#else
resultColor = *wxWHITE;
#endif
break ; break ;
case wxSYS_COLOUR_SCROLLBAR : case wxSYS_COLOUR_SCROLLBAR :
case wxSYS_COLOUR_BACKGROUND: case wxSYS_COLOUR_BACKGROUND:
@@ -48,7 +54,11 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
case wxSYS_COLOUR_INACTIVEBORDER: case wxSYS_COLOUR_INACTIVEBORDER:
case wxSYS_COLOUR_BTNFACE: case wxSYS_COLOUR_BTNFACE:
case wxSYS_COLOUR_MENUBAR: case wxSYS_COLOUR_MENUBAR:
resultColor = wxColor( 0xDD, 0xDD, 0xDD ); #if wxOSX_USE_COCOA_OR_CARBON
resultColor = wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive));
#else
resultColor = wxColour( 0xBE, 0xBE, 0xBE ) ;
#endif
break ; break ;
case wxSYS_COLOUR_LISTBOX : case wxSYS_COLOUR_LISTBOX :
@@ -56,7 +66,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
break ; break ;
case wxSYS_COLOUR_BTNSHADOW: case wxSYS_COLOUR_BTNSHADOW:
resultColor = wxColor( 0xBE, 0xBE, 0xBE ); resultColor = wxColour( 0xBE, 0xBE, 0xBE );
break ; break ;
case wxSYS_COLOUR_BTNTEXT: case wxSYS_COLOUR_BTNTEXT:
@@ -70,13 +80,17 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
case wxSYS_COLOUR_HIGHLIGHT: case wxSYS_COLOUR_HIGHLIGHT:
{ {
#if wxOSX_USE_COCOA_OR_CARBON
#if 0 #if 0
// NB: enable this case as desired // NB: enable this case as desired
colorBrushID = kThemeBrushAlternatePrimaryHighlightColor; colorBrushID = kThemeBrushAlternatePrimaryHighlightColor;
#else #else
colorBrushID = kThemeBrushPrimaryHighlightColor; colorBrushID = kThemeBrushPrimaryHighlightColor;
#endif #endif
resultColor = wxColor( wxMacCreateCGColorFromHITheme(colorBrushID) ); resultColor = wxColour( wxMacCreateCGColorFromHITheme(colorBrushID) );
#else
resultColor = wxColor( 0xCC, 0xCC, 0xFF );
#endif
} }
break ; break ;
@@ -94,10 +108,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
break ; break ;
case wxSYS_COLOUR_HIGHLIGHTTEXT : case wxSYS_COLOUR_HIGHLIGHTTEXT :
#if 0 #if wxOSX_USE_COCOA_OR_CARBON
// NB: enable this case as desired
resultColor = *wxWHITE ;
#else
{ {
wxColour highlightcolor( wxMacCreateCGColorFromHITheme(kThemeBrushPrimaryHighlightColor) ); wxColour highlightcolor( wxMacCreateCGColorFromHITheme(kThemeBrushPrimaryHighlightColor) );
if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0) if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0)
@@ -105,6 +116,8 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
else else
resultColor = *wxBLACK ; resultColor = *wxBLACK ;
} }
#else
resultColor = *wxWHITE ;
#endif #endif
break ; break ;
@@ -227,12 +240,12 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w
// TODO: case wxSYS_SHOW_SOUNDS: // TODO: case wxSYS_SHOW_SOUNDS:
case wxSYS_DCLICK_MSEC: case wxSYS_DCLICK_MSEC:
#ifdef __LP64__ #if wxOSX_USE_CARBON
return (int)(GetDblTime() * 1000. / 60.);
#else
// default on mac is 30 ticks, we shouldn't really use wxSYS_DCLICK_MSEC anyway // default on mac is 30 ticks, we shouldn't really use wxSYS_DCLICK_MSEC anyway
// but rather rely on the 'click-count' by the system delivered in a mouse event // but rather rely on the 'click-count' by the system delivered in a mouse event
return 500; return 500;
#else
return (int)(GetDblTime() * 1000. / 60.);
#endif #endif
default: default:
// unsupported metric // unsupported metric

View File

@@ -66,6 +66,8 @@ public :
virtual void SetDescriptiveText(const wxString& text); virtual void SetDescriptiveText(const wxString& text);
virtual wxString GetDescriptiveText() const; virtual wxString GetDescriptiveText() const;
virtual bool SetFocus();
protected : protected :
virtual void CreateControl( wxTextCtrl* peer, const Rect* bounds, CFStringRef crf ); virtual void CreateControl( wxTextCtrl* peer, const Rect* bounds, CFStringRef crf );
@@ -176,6 +178,21 @@ wxString wxMacSearchFieldControl::GetDescriptiveText() const
} }
} }
bool wxMacSearchFieldControl::SetFocus()
{
// NB: We have to implement SetFocus a little differently because kControlFocusNextPart
// leads to setting the focus on the search icon rather than the text area.
// We get around this by explicitly telling the control to set focus to the
// text area.
OSStatus err = SetKeyboardFocus( GetControlOwner( m_controlRef ), m_controlRef, kControlEditTextPart );
if ( err == errCouldntSetFocus )
return false ;
SetUserFocusWindow(GetControlOwner( m_controlRef ) );
return true;
}
// ============================================================================ // ============================================================================
// implementation // implementation
// ============================================================================ // ============================================================================
@@ -274,27 +291,6 @@ wxSize wxSearchCtrl::DoGetBestSize() const
return size; return size;
} }
void wxSearchCtrl::SetFocus()
{
// NB: We have to implement SetFocus a little differently because kControlFocusNextPart
// leads to setting the focus on the search icon rather than the text area.
// We get around this by explicitly telling the control to set focus to the
// text area.
if ( !AcceptsFocus() )
return ;
wxWindow* former = FindFocus() ;
if ( former == this )
return ;
// as we cannot rely on the control features to find out whether we are in full keyboard mode,
// we can only leave in case of an error
OSStatus err = m_peer->SetFocus( kControlEditTextPart ) ;
if ( err == errCouldntSetFocus )
return ;
SetUserFocusWindow( (WindowRef)MacGetTopLevelWindowRef() );
}
// search control specific interfaces // search control specific interfaces
// wxSearchCtrl owns menu after this call // wxSearchCtrl owns menu after this call

View File

@@ -58,7 +58,7 @@ bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
if ( !wxStatusBarGeneric::Create( parent, id, style, name ) ) if ( !wxStatusBarGeneric::Create( parent, id, style, name ) )
return false; return false;
if ( parent->MacGetTopLevelWindow()->MacGetMetalAppearance() ) if ( parent->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
SetBackgroundStyle( wxBG_STYLE_TRANSPARENT ); SetBackgroundStyle( wxBG_STYLE_TRANSPARENT );
// normal system font is too tall for fitting into the standard height // normal system font is too tall for fitting into the standard height
@@ -86,7 +86,7 @@ void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
int xpos = rect.x + leftMargin + 1; int xpos = rect.x + leftMargin + 1;
int ypos = 1; int ypos = 1;
if ( MacGetTopLevelWindow()->MacGetMetalAppearance() ) if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
ypos++; ypos++;
dc.SetClippingRegion(rect.x, 0, rect.width, h); dc.SetClippingRegion(rect.x, 0, rect.width, h);
@@ -136,7 +136,7 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
if (major >= 10) if (major >= 10)
{ {
// Finder statusbar border color: (Project Builder similar is 9B9B9B) // Finder statusbar border color: (Project Builder similar is 9B9B9B)
if ( MacGetTopLevelWindow()->MacGetMetalAppearance() ) if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
dc.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID)); dc.SetPen(wxPen(wxColour(0x40, 0x40, 0x40), 1, wxSOLID));
else else
dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID)); dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID));

View File

@@ -328,7 +328,7 @@ public :
return true; return true;
} }
virtual void SetRect( Rect *r ) ; virtual void Move(int x, int y, int width, int height);
protected : protected :
OSStatus DoCreate(); OSStatus DoCreate();
@@ -1368,7 +1368,7 @@ bool wxMacUnicodeTextControl::Create( wxTextCtrl *wxPeer,
if ( !(m_windowStyle & wxTE_MULTILINE) ) if ( !(m_windowStyle & wxTE_MULTILINE) )
SetData<Boolean>( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ; SetData<Boolean>( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ;
InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(), ::InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(),
GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this, GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this,
NULL); NULL);
@@ -1664,7 +1664,7 @@ void wxMacMLTEControl::SetStringValue( const wxString &str )
{ {
#ifndef __LP64__ #ifndef __LP64__
wxMacWindowClipper c( m_peer ) ; wxMacWindowClipper c( GetWXPeer() ) ;
#endif #endif
{ {
@@ -2010,7 +2010,7 @@ void wxMacMLTEControl::Replace( long from , long to , const wxString &str )
wxMacEditHelper help( m_txn ) ; wxMacEditHelper help( m_txn ) ;
#ifndef __LP64__ #ifndef __LP64__
wxMacWindowClipper c( m_peer ) ; wxMacWindowClipper c( GetWXPeer() ) ;
#endif #endif
TXNSetSelection( m_txn, from, to == -1 ? kTXNEndOffset : to ) ; TXNSetSelection( m_txn, from, to == -1 ? kTXNEndOffset : to ) ;
@@ -2021,7 +2021,7 @@ void wxMacMLTEControl::Replace( long from , long to , const wxString &str )
void wxMacMLTEControl::Remove( long from , long to ) void wxMacMLTEControl::Remove( long from , long to )
{ {
#ifndef __LP64__ #ifndef __LP64__
wxMacWindowClipper c( m_peer ) ; wxMacWindowClipper c( GetWXPeer() ) ;
#endif #endif
wxMacEditHelper help( m_txn ) ; wxMacEditHelper help( m_txn ) ;
TXNSetSelection( m_txn , from , to ) ; TXNSetSelection( m_txn , from , to ) ;
@@ -2039,7 +2039,7 @@ void wxMacMLTEControl::GetSelection( long* from, long* to) const
void wxMacMLTEControl::SetSelection( long from , long to ) void wxMacMLTEControl::SetSelection( long from , long to )
{ {
#ifndef __LP64__ #ifndef __LP64__
wxMacWindowClipper c( m_peer ) ; wxMacWindowClipper c( GetWXPeer() ) ;
#endif #endif
// change the selection // change the selection
@@ -2060,7 +2060,7 @@ void wxMacMLTEControl::WriteText( const wxString& str )
GetSelection( &start , &dummy ) ; GetSelection( &start , &dummy ) ;
#ifndef __LP64__ #ifndef __LP64__
wxMacWindowClipper c( m_peer ) ; wxMacWindowClipper c( GetWXPeer() ) ;
#endif #endif
{ {
@@ -2076,7 +2076,7 @@ void wxMacMLTEControl::WriteText( const wxString& str )
void wxMacMLTEControl::Clear() void wxMacMLTEControl::Clear()
{ {
#ifndef __LP64__ #ifndef __LP64__
wxMacWindowClipper c( m_peer ) ; wxMacWindowClipper c( GetWXPeer() ) ;
#endif #endif
wxMacEditHelper st( m_txn ) ; wxMacEditHelper st( m_txn ) ;
TXNSetSelection( m_txn , kTXNStartOffset , kTXNEndOffset ) ; TXNSetSelection( m_txn , kTXNStartOffset , kTXNEndOffset ) ;
@@ -2571,9 +2571,9 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
} }
} }
void wxMacMLTEClassicControl::SetRect( Rect *r ) void wxMacMLTEClassicControl::Move(int x, int y, int width, int height)
{ {
wxMacControl::SetRect( r ) ; wxMacControl::Move(x,y,width,height) ;
MacUpdatePosition() ; MacUpdatePosition() ;
} }
@@ -2770,7 +2770,7 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
{ {
wxString st = str ; wxString st = str ;
wxMacConvertNewlines10To13( &st ) ; wxMacConvertNewlines10To13( &st ) ;
wxMacWindowClipper clipper( m_peer ) ; wxMacWindowClipper clipper( GetWXPeer() ) ;
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ; SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
TXNSetSelection( m_txn, 0, 0 ) ; TXNSetSelection( m_txn, 0, 0 ) ;
} }
@@ -2804,7 +2804,7 @@ ControlUserPaneFocusUPP gTPFocusProc = NULL;
static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part) static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
win->MacControlUserPaneDrawProc( part ) ; win->MacControlUserPaneDrawProc( part ) ;
@@ -2812,7 +2812,7 @@ static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control, Point where) static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control, Point where)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
return win->MacControlUserPaneHitTestProc( where.h , where.v ) ; return win->MacControlUserPaneHitTestProc( where.h , where.v ) ;
@@ -2822,7 +2822,7 @@ static pascal ControlPartCode wxMacControlUserPaneHitTestProc(ControlRef control
static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef control, Point startPt, ControlActionUPP actionProc) static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef control, Point startPt, ControlActionUPP actionProc)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
return win->MacControlUserPaneTrackingProc( startPt.h , startPt.v , (void*) actionProc ) ; return win->MacControlUserPaneTrackingProc( startPt.h , startPt.v , (void*) actionProc ) ;
@@ -2832,7 +2832,7 @@ static pascal ControlPartCode wxMacControlUserPaneTrackingProc(ControlRef contro
static pascal void wxMacControlUserPaneIdleProc(ControlRef control) static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
win->MacControlUserPaneIdleProc() ; win->MacControlUserPaneIdleProc() ;
@@ -2840,7 +2840,7 @@ static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers) static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control, SInt16 keyCode, SInt16 charCode, SInt16 modifiers)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
return win->MacControlUserPaneKeyDownProc( keyCode, charCode, modifiers ) ; return win->MacControlUserPaneKeyDownProc( keyCode, charCode, modifiers ) ;
@@ -2850,7 +2850,7 @@ static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control
static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean activating) static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean activating)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget)control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
win->MacControlUserPaneActivateProc( activating ) ; win->MacControlUserPaneActivateProc( activating ) ;
@@ -2858,7 +2858,7 @@ static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean
static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control, ControlFocusPart action) static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control, ControlFocusPart action)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
return win->MacControlUserPaneFocusProc( action ) ; return win->MacControlUserPaneFocusProc( action ) ;
@@ -2869,7 +2869,7 @@ static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control,
#if 0 #if 0
static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info) static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, ControlBackgroundPtr info)
{ {
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ; wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget(control) , wxTextCtrl ) ;
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ; wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
if ( win ) if ( win )
win->MacControlUserPaneBackgroundProc(info) ; win->MacControlUserPaneBackgroundProc(info) ;
@@ -3080,7 +3080,7 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
{ {
HIViewAddSubview( m_scrollView , m_textView ) ; HIViewAddSubview( m_scrollView , m_textView ) ;
m_controlRef = m_scrollView ; m_controlRef = m_scrollView ;
wxPeer->MacInstallEventHandler( (WXWidget) m_textView ) ; wxMacControl::MacInstallEventHandler( m_textView, wxPeer ) ;
} }
else else
{ {
@@ -3090,14 +3090,14 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
AdjustCreationAttributes( *wxWHITE , true ) ; AdjustCreationAttributes( *wxWHITE , true ) ;
#ifndef __LP64__ #ifndef __LP64__
wxMacWindowClipper c( m_peer ) ; wxMacWindowClipper c( GetWXPeer() ) ;
#endif #endif
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ; SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
TXNSetSelection( m_txn, 0, 0 ); TXNSetSelection( m_txn, 0, 0 );
TXNShowSelection( m_txn, kTXNShowStart ); TXNShowSelection( m_txn, kTXNShowStart );
InstallControlEventHandler( m_textView , GetwxMacTextControlEventHandlerUPP(), ::InstallControlEventHandler( m_textView , GetwxMacTextControlEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this, GetEventTypeCount(eventList), eventList, this,
NULL); NULL);
} }

View File

@@ -25,7 +25,12 @@
#include "wx/thread.h" #include "wx/thread.h"
#if wxOSX_USE_COCOA_OR_CARBON
#include <CoreServices/CoreServices.h> #include <CoreServices/CoreServices.h>
#else
#include <Foundation/Foundation.h>
#endif
#include "wx/osx/uma.h" #include "wx/osx/uma.h"
// the possible states of the thread: // the possible states of the thread:

View File

@@ -664,7 +664,7 @@ static pascal OSStatus ControlToolbarItemHandler( EventHandlerCallRef inCallRef,
{ {
case kEventControlGetSizeConstraints: case kEventControlGetSizeConstraints:
{ {
wxWindow* wxwindow = wxFindControlFromMacControl(object->viewRef ) ; wxWindow* wxwindow = wxFindWindowFromWXWidget( (WXWidget) object->viewRef ) ;
if ( wxwindow ) if ( wxwindow )
{ {
// during toolbar layout the native window sometimes gets negative sizes, // during toolbar layout the native window sometimes gets negative sizes,
@@ -1051,10 +1051,9 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 ); ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 );
SetAutomaticControlDragTrackingEnabledForWindow( tlw, true ); SetAutomaticControlDragTrackingEnabledForWindow( tlw, true );
Rect r = { 0, 0, 0, 0 }; m_peer->Move(0,0,0,0 );
m_peer->SetRect( &r );
SetSize( wxSIZE_AUTO_WIDTH, 0 ); SetSize( wxSIZE_AUTO_WIDTH, 0 );
m_peer->SetVisibility( false, true ); m_peer->SetVisibility( false );
wxToolBarBase::Show( false ); wxToolBarBase::Show( false );
} }
} }
@@ -1069,7 +1068,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
ChangeWindowAttributes( tlw, 0, kWindowToolbarButtonAttribute ); ChangeWindowAttributes( tlw, 0, kWindowToolbarButtonAttribute );
SetWindowToolbar( tlw, NULL ); SetWindowToolbar( tlw, NULL );
m_peer->SetVisibility( true, true ); m_peer->SetVisibility( true );
} }
} }
@@ -1125,6 +1124,13 @@ bool wxToolBar::Realize()
bool insertAll = false; bool insertAll = false;
HIToolbarRef refTB = (HIToolbarRef)m_macHIToolbarRef; HIToolbarRef refTB = (HIToolbarRef)m_macHIToolbarRef;
wxFont f;
wxFontEncoding enc;
f = GetFont();
if ( f.IsOk() )
enc = f.GetEncoding();
else
enc = wxFont::GetDefaultEncoding();
#endif #endif
node = m_tools.GetFirst(); node = m_tools.GetFirst();
@@ -1169,6 +1175,12 @@ bool wxToolBar::Realize()
HIToolbarItemRef hiItemRef = tool->GetToolbarItemRef(); HIToolbarItemRef hiItemRef = tool->GetToolbarItemRef();
if ( hiItemRef != NULL ) if ( hiItemRef != NULL )
{ {
// since setting the help texts is non-virtual we have to update
// the strings now
HIToolbarItemSetHelpText( hiItemRef,
wxCFStringRef( tool->GetShortHelp(), enc ),
wxCFStringRef( tool->GetLongHelp(), enc ) );
if ( insertAll || (tool->GetIndex() != currentPosition) ) if ( insertAll || (tool->GetIndex() != currentPosition) )
{ {
OSStatus err = noErr; OSStatus err = noErr;
@@ -1711,7 +1723,7 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
int w, h; int w, h;
GetSize( &w, &h ); GetSize( &w, &h );
bool drawMetalTheme = MacGetTopLevelWindow()->MacGetMetalAppearance(); bool drawMetalTheme = MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL;
if ( !drawMetalTheme ) if ( !drawMetalTheme )
{ {

View File

@@ -224,9 +224,12 @@ void wxMacToolTip::Draw()
HMHelpContentRec tag ; HMHelpContentRec tag ;
tag.version = kMacHelpVersion; tag.version = kMacHelpVersion;
Point p = { m_position.y , m_position.x }; int x = m_position.x;
wxMacLocalToGlobal( m_window , &p ) ; int y = m_position.y;
SetRect( &tag.absHotRect , p.h - 2 , p.v - 2 , p.h + 2 , p.v + 2 ); wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) m_window);
if ( tlw )
tlw->GetNonOwnedPeer()->WindowToScreen( &x, &y );
SetRect( &tag.absHotRect , x - 2 , y - 2 , x + 2 , y + 2 );
m_helpTextRef = wxCFStringRef( m_label , wxFONTENCODING_DEFAULT ) ; m_helpTextRef = wxCFStringRef( m_label , wxFONTENCODING_DEFAULT ) ;
tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;

View File

@@ -37,7 +37,6 @@
#include "wx/control.h" #include "wx/control.h"
#endif //WX_PRECOMP #endif //WX_PRECOMP
#include "wx/osx/uma.h"
#include "wx/tooltip.h" #include "wx/tooltip.h"
#include "wx/dnd.h" #include "wx/dnd.h"
@@ -45,10 +44,6 @@
#include "wx/sysopt.h" #include "wx/sysopt.h"
#endif #endif
#ifndef __DARWIN__
#include <ToolUtils.h>
#endif
// for targeting OSX // for targeting OSX
#include "wx/osx/private.h" #include "wx/osx/private.h"
@@ -63,18 +58,11 @@ END_EVENT_TABLE()
// wxTopLevelWindowMac creation // wxTopLevelWindowMac creation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
typedef struct
{
wxPoint m_position ;
wxSize m_size ;
bool m_wasResizable ;
} FullScreenData ;
void wxTopLevelWindowMac::Init() void wxTopLevelWindowMac::Init()
{ {
m_iconized = m_iconized =
m_maximizeOnShow = false; m_maximizeOnShow = false;
m_macFullScreenData = NULL ;
} }
bool wxTopLevelWindowMac::Create(wxWindow *parent, bool wxTopLevelWindowMac::Create(wxWindow *parent,
@@ -89,7 +77,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
return false; return false;
wxWindow::SetLabel( title ) ; wxWindow::SetLabel( title ) ;
SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , GetFont().GetEncoding() ) ); m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
wxTopLevelWindows.Append(this); wxTopLevelWindows.Append(this);
return true; return true;
@@ -97,9 +85,6 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
wxTopLevelWindowMac::~wxTopLevelWindowMac() wxTopLevelWindowMac::~wxTopLevelWindowMac()
{ {
FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
delete data ;
m_macFullScreenData = NULL ;
} }
@@ -109,39 +94,24 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
void wxTopLevelWindowMac::Maximize(bool maximize) void wxTopLevelWindowMac::Maximize(bool maximize)
{ {
Point idealSize = { 0 , 0 } ; if ( IsMaximized() != maximize )
if ( maximize ) m_nowpeer->Maximize(maximize);
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
HIRect bounds ;
HIWindowGetAvailablePositioningBounds(kCGNullDirectDisplay,kHICoordSpace72DPIGlobal,
&bounds);
idealSize.h = bounds.size.width;
idealSize.v = bounds.size.height;
#else
Rect rect ;
GetAvailableWindowPositioningBounds(GetMainDevice(),&rect) ;
idealSize.h = rect.right - rect.left ;
idealSize.v = rect.bottom - rect.top ;
#endif
}
ZoomWindowIdeal( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
} }
bool wxTopLevelWindowMac::IsMaximized() const bool wxTopLevelWindowMac::IsMaximized() const
{ {
return IsWindowInStandardState( (WindowRef)m_macWindow , NULL , NULL ) ; return m_nowpeer->IsMaximized();
} }
void wxTopLevelWindowMac::Iconize(bool iconize) void wxTopLevelWindowMac::Iconize(bool iconize)
{ {
if ( IsWindowCollapsable( (WindowRef)m_macWindow) ) if ( IsIconized() != iconize )
CollapseWindow( (WindowRef)m_macWindow , iconize ) ; m_nowpeer->Iconize(iconize);
} }
bool wxTopLevelWindowMac::IsIconized() const bool wxTopLevelWindowMac::IsIconized() const
{ {
return IsWindowCollapsed((WindowRef)m_macWindow ) ; return m_nowpeer->IsIconized();
} }
void wxTopLevelWindowMac::Restore() void wxTopLevelWindowMac::Restore()
@@ -164,7 +134,7 @@ wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
void wxTopLevelWindowMac::SetTitle(const wxString& title) void wxTopLevelWindowMac::SetTitle(const wxString& title)
{ {
wxWindow::SetLabel( title ) ; wxWindow::SetLabel( title ) ;
SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , GetFont().GetEncoding() ) ) ; m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
} }
wxString wxTopLevelWindowMac::GetTitle() const wxString wxTopLevelWindowMac::GetTitle() const
@@ -174,101 +144,15 @@ wxString wxTopLevelWindowMac::GetTitle() const
bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style) bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
{ {
if ( show ) return m_nowpeer->ShowFullScreen(show, style);
{
FullScreenData *data = (FullScreenData *)m_macFullScreenData ;
delete data ;
data = new FullScreenData() ;
m_macFullScreenData = data ;
data->m_position = GetPosition() ;
data->m_size = GetSize() ;
data->m_wasResizable = MacGetWindowAttributes() & kWindowResizableAttribute ;
if ( style & wxFULLSCREEN_NOMENUBAR )
HideMenuBar() ;
wxRect client = wxGetClientDisplayRect() ;
int left , top , right , bottom ;
int x, y, w, h ;
x = client.x ;
y = client.y ;
w = client.width ;
h = client.height ;
MacGetContentAreaInset( left , top , right , bottom ) ;
if ( style & wxFULLSCREEN_NOCAPTION )
{
y -= top ;
h += top ;
}
if ( style & wxFULLSCREEN_NOBORDER )
{
x -= left ;
w += left + right ;
h += bottom ;
}
if ( style & wxFULLSCREEN_NOTOOLBAR )
{
// TODO
}
if ( style & wxFULLSCREEN_NOSTATUSBAR )
{
// TODO
}
SetSize( x , y , w, h ) ;
if ( data->m_wasResizable )
MacChangeWindowAttributes( kWindowNoAttributes , kWindowResizableAttribute ) ;
}
else if ( m_macFullScreenData != NULL )
{
ShowMenuBar() ;
FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
if ( data->m_wasResizable )
MacChangeWindowAttributes( kWindowResizableAttribute , kWindowNoAttributes ) ;
SetPosition( data->m_position ) ;
SetSize( data->m_size ) ;
delete data ;
m_macFullScreenData = NULL ;
}
return false;
} }
bool wxTopLevelWindowMac::IsFullScreen() const bool wxTopLevelWindowMac::IsFullScreen() const
{ {
return m_macFullScreenData != NULL ; return m_nowpeer->IsFullScreen();
} }
// Attracts the users attention to this window if the application is void wxTopLevelWindowMac::RequestUserAttention(int flags)
// inactive (should be called when a background event occurs)
static pascal void wxMacNMResponse( NMRecPtr ptr )
{ {
NMRemove( ptr ) ; return m_nowpeer->RequestUserAttention(flags);
DisposePtr( (Ptr)ptr ) ;
}
void wxTopLevelWindowMac::RequestUserAttention(int WXUNUSED(flags))
{
NMRecPtr notificationRequest = (NMRecPtr) NewPtr( sizeof( NMRec) ) ;
static wxMacNMUPP nmupp( wxMacNMResponse );
memset( notificationRequest , 0 , sizeof(*notificationRequest) ) ;
notificationRequest->qType = nmType ;
notificationRequest->nmMark = 1 ;
notificationRequest->nmIcon = 0 ;
notificationRequest->nmSound = 0 ;
notificationRequest->nmStr = NULL ;
notificationRequest->nmResp = nmupp ;
verify_noerr( NMInstall( notificationRequest ) ) ;
} }

View File

@@ -31,35 +31,9 @@ long UMAGetSystemVersion()
return sUMASystemVersion ; return sUMASystemVersion ;
} }
void UMAInitToolbox( UInt16 WXUNUSED(inMoreMastersCalls),
bool WXUNUSED(isEmbedded) )
{
#if 0 // ndef __LP64__
{
FontFamilyID fontId ;
Str255 fontName ;
SInt16 fontSize ;
Style fontStyle ;
GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
GetFNum( fontName, &fontId );
TXNMacOSPreferredFontDescription fontDescriptions[] =
{
{ fontId , (fontSize << 16) , kTXNDefaultFontStyle, kTXNSystemDefaultEncoding }
} ;
int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ;
OptionBits options = 0 ;
TXNInitTextension( fontDescriptions, noOfFontDescriptions, options );
}
#endif
}
// menu manager // menu manager
#if 1 // not yet wxMAC_USE_COCOA == 0 #if wxOSX_USE_CARBON
MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding ) MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding )
{ {
@@ -271,10 +245,6 @@ void UMAInsertMenuItem( MenuRef menu , const wxString& title, wxFontEncoding enc
UMASetMenuItemShortcut( menu , item+1 , entry ) ; UMASetMenuItemShortcut( menu , item+1 , entry ) ;
} }
#endif
#if 1 // not yet wxMAC_USE_COCOA == 0
static OSStatus UMAGetHelpMenu( static OSStatus UMAGetHelpMenu(
MenuRef * outHelpMenu, MenuRef * outHelpMenu,
MenuItemIndex * outFirstCustomItemIndex, MenuItemIndex * outFirstCustomItemIndex,

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,11 @@
#include "wx/wxprec.h" #include "wx/wxprec.h"
#if wxOSX_USE_COCOA_OR_CARBON
#include <Cocoa/Cocoa.h> #include <Cocoa/Cocoa.h>
#else
#import <UIKit/UIKit.h>
#endif
#ifdef __WXMAC__ #ifdef __WXMAC__
#include "wx/osx/private.h" #include "wx/osx/private.h"
@@ -19,12 +23,14 @@
#ifdef __WXMAC__ #ifdef __WXMAC__
#if wxOSX_USE_CARBON
bool wxMacInitCocoa() bool wxMacInitCocoa()
{ {
bool cocoaLoaded = NSApplicationLoad(); bool cocoaLoaded = NSApplicationLoad();
wxASSERT_MSG(cocoaLoaded,wxT("Couldn't load Cocoa in Carbon Environment")) ; wxASSERT_MSG(cocoaLoaded,wxT("Couldn't load Cocoa in Carbon Environment")) ;
return cocoaLoaded; return cocoaLoaded;
} }
#endif
wxMacAutoreleasePool::wxMacAutoreleasePool() wxMacAutoreleasePool::wxMacAutoreleasePool()
{ {
@@ -38,7 +44,7 @@ wxMacAutoreleasePool::~wxMacAutoreleasePool()
#endif #endif
#ifdef __WXCOCOCA__ #if defined( __WXCOCOCA__ ) || wxOSX_USE_COCOA
CGContextRef wxMacGetContextFromCurrentNSContext() CGContextRef wxMacGetContextFromCurrentNSContext()
{ {
@@ -68,6 +74,8 @@ void wxMacCocoaRetain( void* obj )
[(NSObject*)obj retain]; [(NSObject*)obj retain];
} }
#if wxOSX_USE_COCOA
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// NSImage Utils // NSImage Utils
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -97,8 +105,6 @@ WX_NSImage CreateNSImageFromCGImage( CGImageRef image )
// NSCursor Utils // NSCursor Utils
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxMAC_USE_COCOA
// copied from cursor.mm // copied from cursor.mm
static NSCursor* wxGetStockCursor( short sIndex ) static NSCursor* wxGetStockCursor( short sIndex )
@@ -302,3 +308,4 @@ void wxMacCocoaShowCursor()
} }
#endif #endif

File diff suppressed because it is too large Load Diff