osx regrouping
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
33e902756f
commit
b2680ced12
@ -61,7 +61,7 @@ void wxAboutBox(const wxAboutDialogInfo& info)
|
||||
// Mac native about box currently can show only name, version, copyright
|
||||
// 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
|
||||
#ifndef __LP64__
|
||||
#if wxOSX_USE_CARBON
|
||||
if ( info.IsSimple() )
|
||||
{
|
||||
AboutBoxOptions opts;
|
||||
|
@ -44,14 +44,14 @@
|
||||
#include <string.h>
|
||||
|
||||
// mac
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
#include "wx/osx/uma.h"
|
||||
#else
|
||||
#include "wx/osx/private.h"
|
||||
#endif
|
||||
|
||||
#ifdef __DARWIN__
|
||||
# include <CoreServices/CoreServices.h>
|
||||
# if defined(WXMAKINGDLL_CORE)
|
||||
# include <mach-o/dyld.h>
|
||||
# endif
|
||||
#if defined(WXMAKINGDLL_CORE)
|
||||
# include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
// Keep linker from discarding wxStockGDIMac
|
||||
@ -60,8 +60,9 @@ wxFORCE_LINK_MODULE(gdiobj)
|
||||
// statics for implementation
|
||||
static bool s_inYield = false;
|
||||
static bool s_inReceiveEvent = false ;
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
static EventTime sleepTime = kEventDurationNoWait ;
|
||||
|
||||
#endif
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(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
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 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 AEHandleOApp( 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 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) )
|
||||
{
|
||||
@ -268,6 +279,8 @@ short wxApp::MacHandleAERApp(const WXEVENTREF WXUNUSED(event) , WXEVENTREF WXUNU
|
||||
return noErr ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 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 wxOSX_USE_CARBON
|
||||
|
||||
struct IdPair
|
||||
{
|
||||
UInt32 macId ;
|
||||
@ -511,10 +526,14 @@ wxMenu* wxFindMenuFromMacCommand( const HICommand &command , wxMenuItem* &item )
|
||||
return itemMenu ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Carbon Event Handler
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
static const EventTypeSpec eventList[] =
|
||||
{
|
||||
{ kEventClassCommand, kEventProcessCommand } ,
|
||||
@ -595,7 +614,6 @@ wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler),
|
||||
return eventNotHandledErr;
|
||||
}
|
||||
|
||||
#ifndef __LP64__
|
||||
static pascal OSStatus
|
||||
wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
|
||||
EventRef event ,
|
||||
@ -632,7 +650,6 @@ wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
|
||||
}
|
||||
return result ;
|
||||
}
|
||||
#endif
|
||||
|
||||
static pascal OSStatus
|
||||
wxMacAppApplicationEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
|
||||
@ -726,8 +743,9 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve
|
||||
}
|
||||
|
||||
DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacAppEventHandler )
|
||||
#endif
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
#if defined( __WXDEBUG__ ) && wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
pascal static void
|
||||
wxMacAssertOutputHandler(OSType WXUNUSED(componentSignature),
|
||||
@ -784,13 +802,10 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||
{
|
||||
// Mac-specific
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
#if defined( __WXDEBUG__ ) && wxOSX_USE_COCOA_OR_CARBON
|
||||
InstallDebugAssertOutputHandler( NewDebugAssertOutputHandlerUPP( wxMacAssertOutputHandler ) );
|
||||
#endif
|
||||
|
||||
UMAInitToolbox( 4, sm_isEmbedded ) ;
|
||||
// TODO CHECK Can Be Removed SetEventMask( everyEvent ) ;
|
||||
|
||||
// Mac OS X passes a process serial number command line argument when
|
||||
// the application is launched from the Finder. This argument must be
|
||||
// removed from the command line arguments before being handled by the
|
||||
@ -838,18 +853,11 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||
return true;
|
||||
}
|
||||
|
||||
AEEventHandlerUPP sODocHandler = NULL ;
|
||||
AEEventHandlerUPP sGURLHandler = NULL ;
|
||||
AEEventHandlerUPP sOAppHandler = NULL ;
|
||||
AEEventHandlerUPP sPDocHandler = NULL ;
|
||||
AEEventHandlerUPP sRAppHandler = NULL ;
|
||||
AEEventHandlerUPP sQuitHandler = NULL ;
|
||||
|
||||
bool wxApp::OnInitGui()
|
||||
{
|
||||
if ( !wxAppBase::OnInitGui() )
|
||||
return false ;
|
||||
#ifndef __LP64__
|
||||
#if wxOSX_USE_CARBON
|
||||
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
||||
if (!sm_isEmbedded)
|
||||
{
|
||||
@ -859,6 +867,7 @@ bool wxApp::OnInitGui()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
if (!sm_isEmbedded)
|
||||
{
|
||||
sODocHandler = NewAEEventHandlerUPP(AEHandleODoc) ;
|
||||
@ -881,9 +890,11 @@ bool wxApp::OnInitGui()
|
||||
AEInstallEventHandler( kCoreEventClass , kAEQuitApplication ,
|
||||
sQuitHandler , 0 , FALSE ) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if wxOSX_USE_CARBON
|
||||
if ( !wxMacInitCocoa() )
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true ;
|
||||
}
|
||||
@ -903,6 +914,8 @@ void wxApp::CleanUp()
|
||||
// One last chance for pending objects to be cleaned up
|
||||
wxTheApp->DeletePendingObjects();
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
if (!sm_isEmbedded)
|
||||
RemoveEventHandler( (EventHandlerRef)(wxTheApp->m_macEventHandler) );
|
||||
|
||||
@ -929,6 +942,8 @@ void wxApp::CleanUp()
|
||||
DisposeAEEventHandlerUPP( sQuitHandler ) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
wxAppBase::CleanUp();
|
||||
}
|
||||
|
||||
@ -1108,6 +1123,8 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
||||
|
||||
// by definition yield should handle all non-processed events
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
EventRef theEvent;
|
||||
|
||||
OSStatus status = noErr ;
|
||||
@ -1134,6 +1151,10 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
||||
ReleaseEvent(theEvent);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
s_inYield = false;
|
||||
|
||||
@ -1142,6 +1163,7 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
||||
|
||||
void wxApp::MacDoOneEvent()
|
||||
{
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
wxMacAutoreleasePool autoreleasepool;
|
||||
EventRef theEvent;
|
||||
|
||||
@ -1170,7 +1192,8 @@ void wxApp::MacDoOneEvent()
|
||||
break;
|
||||
}
|
||||
// repeaters
|
||||
|
||||
#else
|
||||
#endif
|
||||
DeletePendingObjects() ;
|
||||
}
|
||||
|
||||
@ -1188,8 +1211,18 @@ CFMutableArrayRef GetAutoReleaseArray()
|
||||
return array;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||
{
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
EventTargetRef theTarget;
|
||||
theTarget = GetEventDispatcherTarget();
|
||||
m_macCurrentEvent = evr ;
|
||||
@ -1202,6 +1235,11 @@ void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||
wxMutexGuiLeaveOrEnter();
|
||||
#endif // wxUSE_THREADS
|
||||
|
||||
#else
|
||||
// TODO Threads
|
||||
#endif
|
||||
|
||||
|
||||
CFArrayRemoveAllValues( GetAutoReleaseArray() );
|
||||
}
|
||||
|
||||
@ -1210,6 +1248,8 @@ void wxApp::MacAddToAutorelease( void* cfrefobj )
|
||||
CFArrayAppendValue( GetAutoReleaseArray(), cfrefobj );
|
||||
}
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
long wxMacTranslateKey(unsigned char key, unsigned char code)
|
||||
{
|
||||
long retval = key ;
|
||||
@ -1375,10 +1415,12 @@ int wxMacKeyCodeToModifier(wxKeyCode key)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
wxMouseState wxGetMouseState()
|
||||
{
|
||||
wxMouseState ms;
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
wxPoint pt = wxGetMousePosition();
|
||||
ms.SetX(pt.x);
|
||||
@ -1395,6 +1437,7 @@ wxMouseState wxGetMouseState()
|
||||
ms.SetAltDown(modifiers & optionKey);
|
||||
ms.SetMetaDown(modifiers & cmdKey);
|
||||
|
||||
#endif
|
||||
return ms;
|
||||
}
|
||||
|
||||
@ -1465,13 +1508,13 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
|
||||
{
|
||||
if ( !focus )
|
||||
return false ;
|
||||
|
||||
wxKeyEvent event(wxEVT_CHAR) ;
|
||||
MacCreateKeyEvent( event, focus , keymessage , modifiers , when , wherex , wherey , uniChar ) ;
|
||||
long keyval = event.m_keyCode ;
|
||||
|
||||
bool handled = false ;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxNonOwnedWindow *tlw = focus->MacGetTopLevelWindow() ;
|
||||
|
||||
if (tlw)
|
||||
@ -1512,12 +1555,12 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
|
||||
}
|
||||
|
||||
// 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
|
||||
// TODO: add the UMA version for ActiveNonFloatingWindow
|
||||
#ifndef __LP64__
|
||||
wxWindow* focus = wxFindWinFromMacWindow( FrontWindow() ) ;
|
||||
wxWindow* focus = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontWindow() ) ;
|
||||
if ( focus )
|
||||
{
|
||||
if ( keyval == WXK_RETURN || keyval == WXK_NUMPAD_ENTER )
|
||||
@ -1546,12 +1589,14 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return handled ;
|
||||
}
|
||||
|
||||
// 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 )
|
||||
{
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
short keycode, keychar ;
|
||||
|
||||
keychar = short(keymessage & charCodeMask);
|
||||
@ -1634,15 +1679,18 @@ void wxApp::MacCreateKeyEvent( wxKeyEvent& event, wxWindow* focus , long keymess
|
||||
event.m_y = wherey;
|
||||
event.SetTimestamp(when);
|
||||
event.SetEventObject(focus);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void wxApp::MacHideApp()
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacCarbonEvent event( kEventClassCommand , kEventCommandProcess );
|
||||
HICommand command;
|
||||
memset( &command, 0 , sizeof(command) );
|
||||
command.commandID = kHICommandHide ;
|
||||
event.SetParameter<HICommand>(kEventParamDirectObject, command );
|
||||
SendEventToApplication( event );
|
||||
#endif
|
||||
}
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "wx/image.h"
|
||||
#endif
|
||||
|
||||
#if !defined(__WXUNIVERSAL__)
|
||||
|
||||
#include "wx/artprov.h"
|
||||
#include "wx/image.h"
|
||||
|
||||
@ -106,3 +108,7 @@ wxBitmap wxMacArtProvider::CreateBitmap(const wxArtID& id,
|
||||
|
||||
return wxNullBitmap;
|
||||
}
|
||||
|
||||
#endif // !defined(__WXUNIVERSAL__)
|
||||
|
||||
|
||||
|
@ -28,7 +28,12 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
#include "wx/osx/uma.h"
|
||||
#else
|
||||
#include "wx/osx/private.h"
|
||||
#endif
|
||||
|
||||
#ifndef __WXOSX_IPHONE__
|
||||
#include <QuickTime/QuickTime.h>
|
||||
#endif
|
||||
@ -1688,7 +1693,9 @@ void wxBitmap::InitStandardHandlers()
|
||||
#if !defined( __LP64__ ) && !defined(__WXOSX_IPHONE__)
|
||||
AddHandler( new wxPICTResourceHandler ) ;
|
||||
#endif
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
AddHandler( new wxICONResourceHandler ) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -137,7 +137,7 @@ bool wxBitmapButton::Create( wxWindow *parent,
|
||||
verify_noerr( err );
|
||||
|
||||
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 );
|
||||
|
||||
|
@ -92,7 +92,7 @@ bool wxButton::Create(wxWindow *parent,
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
@ -236,7 +236,7 @@ bool wxDisclosureTriangle::Create(wxWindow *parent, wxWindowID id, const wxStrin
|
||||
m_peer->GetControlRefAddr() );
|
||||
|
||||
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 );
|
||||
// passing the text in the param doesn't seem to work, so lets do if again
|
||||
|
@ -186,7 +186,7 @@ public :
|
||||
{
|
||||
OSStatus err = errDataBrowserPropertyNotSupported;
|
||||
|
||||
wxCheckListBox *checklist = wxDynamicCast( owner->GetPeer() , wxCheckListBox );
|
||||
wxCheckListBox *checklist = wxDynamicCast( owner->GetWXPeer() , wxCheckListBox );
|
||||
wxCHECK_MSG( checklist != NULL , errDataBrowserPropertyNotSupported , wxT("wxCheckListBox expected"));
|
||||
|
||||
if ( !changeValue )
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "wx/metafile.h"
|
||||
|
||||
#include "wx/osx/uma.h"
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
#define wxUSE_DATAOBJ 1
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
|
||||
|
||||
#if wxMAC_USE_QUICKDRAW
|
||||
#if wxOSX_USE_QUICKDRAW
|
||||
wxColour::wxColour(const RGBColor& col)
|
||||
{
|
||||
InitRGBColor(col);
|
||||
@ -33,7 +33,7 @@ wxColour::wxColour(CGColorRef col)
|
||||
InitCGColorRef(col);
|
||||
}
|
||||
|
||||
#if wxMAC_USE_QUICKDRAW
|
||||
#if wxOSX_USE_QUICKDRAW
|
||||
void wxColour::GetRGBColor( RGBColor *col ) const
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
#if wxMAC_USE_QUICKDRAW
|
||||
#if wxOSX_USE_QUICKDRAW
|
||||
void wxColour::InitRGBColor( const RGBColor& col )
|
||||
{
|
||||
m_red = col.red >> 8;
|
||||
|
@ -83,7 +83,7 @@ bool wxControl::ProcessCommand( wxCommandEvent &event )
|
||||
|
||||
void wxControl::OnKeyDown( wxKeyEvent &WXUNUSED(event) )
|
||||
{
|
||||
if ( m_peer == NULL || !m_peer->Ok() )
|
||||
if ( m_peer == NULL || !m_peer->IsOk() )
|
||||
return;
|
||||
|
||||
UInt32 keyCode, modifiers;
|
||||
|
@ -36,25 +36,32 @@ public:
|
||||
|
||||
virtual bool IsOk() const
|
||||
{
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
if ( m_hCursor != NULL )
|
||||
return true;
|
||||
#if !wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_CARBON
|
||||
if ( m_themeCursor != -1 )
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
#else
|
||||
// in order to avoid asserts, always claim to have a valid cursor
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
#if wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
WX_NSCursor m_hCursor;
|
||||
#else
|
||||
#elif wxOSX_USE_CARBON
|
||||
WXHCURSOR m_hCursor;
|
||||
bool m_disposeHandle;
|
||||
bool m_releaseHandle;
|
||||
bool m_isColorCursor;
|
||||
long m_themeCursor;
|
||||
#elif wxOSX_USE_IPHONE
|
||||
void* m_hCursor;
|
||||
#endif
|
||||
|
||||
friend class wxCursor;
|
||||
@ -64,6 +71,8 @@ protected:
|
||||
|
||||
#define M_CURSORDATA wx_static_cast(wxCursorRefData*, m_refData)
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
ClassicCursor gMacCursors[kwxCursorLast+1] =
|
||||
{
|
||||
|
||||
@ -189,9 +198,11 @@ ClassicCursor gMacCursors[kwxCursorLast+1] =
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
wxCursor gMacCurrentCursor ;
|
||||
|
||||
#if !wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_CARBON
|
||||
CursHandle wxGetStockCursor( int number )
|
||||
{
|
||||
wxASSERT_MSG( number >= 0 && number <=kwxCursorLast , wxT("invalid stock cursor id") ) ;
|
||||
@ -212,8 +223,7 @@ CursHandle wxGetStockCursor( int number )
|
||||
wxCursorRefData::wxCursorRefData()
|
||||
{
|
||||
m_hCursor = NULL;
|
||||
#if wxMAC_USE_COCOA
|
||||
#else
|
||||
#if wxOSX_USE_CARBON
|
||||
m_disposeHandle = false;
|
||||
m_releaseHandle = false;
|
||||
m_isColorCursor = false;
|
||||
@ -226,9 +236,9 @@ wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor)
|
||||
// FIXME: need to copy the cursor
|
||||
m_hCursor = NULL;
|
||||
|
||||
#if wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
wxUnusedVar(cursor);
|
||||
#else
|
||||
#elif wxOSX_USE_CARBON
|
||||
m_disposeHandle = false;
|
||||
m_releaseHandle = false;
|
||||
m_isColorCursor = cursor.m_isColorCursor;
|
||||
@ -238,10 +248,10 @@ wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor)
|
||||
|
||||
wxCursorRefData::~wxCursorRefData()
|
||||
{
|
||||
#if wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
if ( m_hCursor )
|
||||
wxMacCocoaRelease(m_hCursor);
|
||||
#else
|
||||
#elif wxOSX_USE_CARBON
|
||||
if ( m_isColorCursor )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
@ -310,7 +320,7 @@ WXHCURSOR wxCursor::GetHCURSOR() const
|
||||
return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0);
|
||||
}
|
||||
|
||||
#if !wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_CARBON
|
||||
short GetCTabIndex( CTabHandle colors , RGBColor *col )
|
||||
{
|
||||
short retval = 0 ;
|
||||
@ -340,7 +350,7 @@ void wxCursor::CreateFromImage(const wxImage & image)
|
||||
m_refData = new wxCursorRefData;
|
||||
int hotSpotX = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
|
||||
int hotSpotY = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
|
||||
#if wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
wxBitmap bmp( image );
|
||||
CGImageRef cgimage = wxMacCreateCGImageFromBitmap(bmp);
|
||||
if ( cgimage )
|
||||
@ -348,7 +358,7 @@ void wxCursor::CreateFromImage(const wxImage & image)
|
||||
M_CURSORDATA->m_hCursor = wxMacCocoaCreateCursorFromCGImage( cgimage, hotSpotX, hotSpotY );
|
||||
CFRelease( cgimage );
|
||||
}
|
||||
#else
|
||||
#elif wxOSX_USE_CARBON
|
||||
#ifndef __LP64__
|
||||
int w = 16;
|
||||
int h = 16;
|
||||
@ -489,9 +499,9 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX
|
||||
m_refData = new wxCursorRefData;
|
||||
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
|
||||
{
|
||||
#if wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
wxFAIL_MSG( wxT("Not implemented") );
|
||||
#else
|
||||
#elif wxOSX_USE_CARBON
|
||||
#ifndef __LP64__
|
||||
Str255 theName ;
|
||||
wxMacStringToPascal( cursor_file , theName ) ;
|
||||
@ -549,9 +559,9 @@ wxCursor::wxCursor(const wxString& cursor_file, wxBitmapType flags, int hotSpotX
|
||||
wxCursor::wxCursor(int cursor_type)
|
||||
{
|
||||
m_refData = new wxCursorRefData;
|
||||
#if wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
M_CURSORDATA->m_hCursor = wxMacCocoaCreateStockCursor( cursor_type );
|
||||
#else
|
||||
#elif wxOSX_USE_CARBON
|
||||
switch (cursor_type)
|
||||
{
|
||||
case wxCURSOR_COPY_ARROW:
|
||||
@ -660,10 +670,10 @@ wxCursor::wxCursor(int cursor_type)
|
||||
void wxCursor::MacInstall() const
|
||||
{
|
||||
gMacCurrentCursor = *this ;
|
||||
#if wxMAC_USE_COCOA
|
||||
#if wxOSX_USE_COCOA
|
||||
if ( IsOk() )
|
||||
wxMacCocoaSetCursor( M_CURSORDATA->m_hCursor );
|
||||
#else
|
||||
#elif wxOSX_USE_CARBON
|
||||
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
|
||||
{
|
||||
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
|
||||
|
@ -615,7 +615,7 @@ Boolean wxMacDataViewDataBrowserListViewControl::DataBrowserCompareProc(DataBrow
|
||||
|
||||
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."));
|
||||
@ -640,7 +640,7 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserGetContextualMenuProc(M
|
||||
{
|
||||
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"));
|
||||
@ -668,7 +668,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
|
||||
// variable definitions:
|
||||
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."));
|
||||
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
|
||||
@ -762,7 +762,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
|
||||
wxDataViewColumn* dataViewColumnPtr;
|
||||
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->GetModel() != NULL,errDataBrowserNotConfigured,_("Pointer to model not set correctly."));
|
||||
dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
|
||||
@ -784,7 +784,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
|
||||
case kDataBrowserContainerIsClosableProperty:
|
||||
{
|
||||
// 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."));
|
||||
// initialize wxWidget event:
|
||||
@ -801,7 +801,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
|
||||
case kDataBrowserContainerIsOpenableProperty:
|
||||
{
|
||||
// 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."));
|
||||
// initialize wxWidget event:
|
||||
@ -818,7 +818,7 @@ OSStatus wxMacDataViewDataBrowserListViewControl::DataBrowserGetSetItemDataProc(
|
||||
case kDataBrowserItemIsContainerProperty:
|
||||
{
|
||||
// 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->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)
|
||||
{
|
||||
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:
|
||||
@ -1006,7 +1006,7 @@ void wxMacDataViewDataBrowserListViewControl::DataBrowserDrawItemProc(DataBrowse
|
||||
|
||||
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->GetModel() != NULL,_("Pointer to model not set correctly."));
|
||||
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)
|
||||
GetRegionBounds(rgn,&content);
|
||||
else
|
||||
this->GetRect(&content);
|
||||
GetControlBounds(m_controlRef, &content);
|
||||
::DisposeRgn(rgn);
|
||||
// space for the header
|
||||
this->GetHeaderButtonHeight(&headerHeight);
|
||||
@ -1111,7 +1111,7 @@ DataBrowserTrackingResult wxMacDataViewDataBrowserListViewControl::DataBrowserTr
|
||||
|
||||
dataViewCustomRendererItem = reinterpret_cast<void*>(itemID);
|
||||
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."));
|
||||
dataViewColumnPtr = dataViewCtrlPtr->GetColumnPtr(propertyID);
|
||||
wxCHECK_MSG(dataViewColumnPtr != NULL,kDataBrowserNothingHit,_("No column existing."));
|
||||
|
@ -220,7 +220,7 @@ public:
|
||||
bool noFailureFlag = (!(parent.IsOk()) && (this->m_dataViewControlPtr->AddItem(kDataBrowserNoItem,&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)
|
||||
{
|
||||
wxDataViewModel *model = GetOwner();
|
||||
@ -270,7 +270,7 @@ public:
|
||||
// give allocated array space free again:
|
||||
delete[] itemIDs;
|
||||
|
||||
wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetPeer();
|
||||
wxDataViewCtrl *dvc = (wxDataViewCtrl*) this->m_dataViewControlPtr->GetWXPeer();
|
||||
if (dvc->GetWindowStyle() & wxDV_VARIABLE_LINE_HEIGHT)
|
||||
{
|
||||
wxDataViewModel *model = GetOwner();
|
||||
@ -321,7 +321,7 @@ public:
|
||||
wxCHECK_MSG(item.IsOk(),false,_("Changed item is invalid."));
|
||||
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:
|
||||
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);
|
||||
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:
|
||||
wxDataViewEvent dataViewEvent(wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED,dataViewCtrlPtr->GetId()); // variable defintion
|
||||
@ -385,7 +385,7 @@ public:
|
||||
// variable definition and initialization:
|
||||
DataBrowserItemID itemID(reinterpret_cast<DataBrowserItemID>(item.GetID()));
|
||||
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
|
||||
// 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;
|
||||
|
||||
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetPeer()));
|
||||
wxDataViewCtrl* dataViewCtrlPtr(dynamic_cast<wxDataViewCtrl*>(this->m_dataViewControlPtr->GetWXPeer()));
|
||||
|
||||
size_t noOfEntries;
|
||||
|
||||
@ -439,7 +439,7 @@ public:
|
||||
|
||||
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."));
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "wx/graphics.h"
|
||||
#include "wx/rawbmp.h"
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/osx/dcclient.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowDCImpl
|
||||
@ -39,21 +40,20 @@ wxWindowDCImpl::wxWindowDCImpl( wxDC *owner )
|
||||
m_release = false;
|
||||
}
|
||||
|
||||
|
||||
wxWindowDCImpl::wxWindowDCImpl( wxDC *owner, wxWindow *window )
|
||||
: wxGCDCImpl( owner )
|
||||
{
|
||||
m_window = window;
|
||||
|
||||
WindowRef rootwindow = (WindowRef) window->MacGetTopLevelWindowRef() ;
|
||||
if (!rootwindow)
|
||||
return;
|
||||
|
||||
m_ok = true ;
|
||||
|
||||
m_window->GetSize( &m_width , &m_height);
|
||||
if ( !m_window->IsShownOnScreen() )
|
||||
m_width = m_height = 0;
|
||||
|
||||
CGContextRef cg = (CGContextRef) window->MacGetCGContextRef();
|
||||
|
||||
m_release = false;
|
||||
if ( cg == NULL )
|
||||
{
|
||||
@ -96,6 +96,7 @@ void wxWindowDCImpl::DoGetSize( int* width, int* height ) const
|
||||
*height = m_height;
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
||||
{
|
||||
// wxScreenDC is derived from wxWindowDC, so a screen dc will
|
||||
@ -103,9 +104,6 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
||||
if (!m_window)
|
||||
return wxNullBitmap;
|
||||
|
||||
#ifdef __LP64__
|
||||
return wxNullBitmap;
|
||||
#else
|
||||
ControlRef handle = (ControlRef) m_window->GetHandle();
|
||||
if ( !handle )
|
||||
return wxNullBitmap;
|
||||
@ -139,8 +137,8 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const
|
||||
CGContextRestoreGState(context);
|
||||
|
||||
return bmp;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* wxClientDCImpl
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "wx/wxprec.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"
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
|
||||
@ -27,7 +27,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxScreenDCImpl, wxWindowDCImpl)
|
||||
wxScreenDCImpl::wxScreenDCImpl( wxDC *owner ) :
|
||||
wxWindowDCImpl( owner )
|
||||
{
|
||||
#ifdef __LP64__
|
||||
#if wxOSX_USE_COCOA_OR_IPHONE
|
||||
m_graphicContext = NULL;
|
||||
m_ok = false ;
|
||||
#else
|
||||
@ -52,7 +52,7 @@ wxScreenDCImpl::~wxScreenDCImpl()
|
||||
{
|
||||
delete m_graphicContext;
|
||||
m_graphicContext = NULL;
|
||||
#ifdef __LP64__
|
||||
#if wxOSX_USE_COCOA_OR_IPHONE
|
||||
#else
|
||||
DisposeWindow((WindowRef) m_overlayWindow );
|
||||
#endif
|
||||
|
@ -62,7 +62,7 @@ void wxDialog::SetModal( bool flag )
|
||||
{
|
||||
m_isModalStyle = true;
|
||||
|
||||
SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
|
||||
SetWindowModality( (WindowRef)GetWXWindow(), kWindowModalityAppModal, NULL ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -135,7 +135,7 @@ void wxDialog::DoShowModal()
|
||||
|
||||
SetFocus() ;
|
||||
|
||||
WindowRef windowRef = (WindowRef) MacGetWindowRef();
|
||||
WindowRef windowRef = (WindowRef) GetWXWindow();
|
||||
WindowGroupRef windowGroup;
|
||||
WindowGroupRef formerParentGroup;
|
||||
bool resetGroupParent = false;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxUSE_DIRDLG
|
||||
#if wxUSE_DIRDLG && !defined(__WXUNIVERSAL__)
|
||||
|
||||
#include "wx/dirdlg.h"
|
||||
|
||||
|
@ -34,9 +34,10 @@
|
||||
#include "wx/gdicmn.h"
|
||||
#endif
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#include "wx/display_impl.h"
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// display classes implementation
|
||||
@ -252,4 +253,13 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
|
||||
return new wxDisplayFactoryMacOSX;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
|
||||
{
|
||||
return new wxDisplayFactorySingle;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_DISPLAY
|
||||
|
@ -359,7 +359,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(
|
||||
|
||||
GetDragAttributes( theDrag, &attributes );
|
||||
|
||||
wxNonOwnedWindow* toplevel = wxFindWinFromMacWindow( theWindow );
|
||||
wxNonOwnedWindow* toplevel = wxNonOwnedWindow::GetFromWXWindow( (WXWindow) theWindow );
|
||||
|
||||
bool optionDown = GetCurrentKeyModifiers() & optionKey;
|
||||
wxDragResult result = optionDown ? wxDragCopy : wxDragMove;
|
||||
@ -385,15 +385,18 @@ pascal OSErr wxMacWindowDragTrackingHandler(
|
||||
break;
|
||||
|
||||
GetDragMouse( theDrag, &mouse, 0L );
|
||||
localMouse = mouse;
|
||||
wxMacGlobalToLocal( theWindow, &localMouse );
|
||||
int x = mouse.h ;
|
||||
int y = mouse.v ;
|
||||
toplevel->GetNonOwnedPeer()->ScreenToWindow( &x, &y );
|
||||
localMouse.h = x;
|
||||
localMouse.v = y;
|
||||
|
||||
{
|
||||
wxWindow *win = NULL;
|
||||
ControlPartCode controlPart;
|
||||
ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart );
|
||||
if ( control )
|
||||
win = wxFindControlFromMacControl( control );
|
||||
win = wxFindWindowFromWXWidget( (WXWidget) control );
|
||||
else
|
||||
win = toplevel;
|
||||
|
||||
@ -534,9 +537,11 @@ pascal OSErr wxMacWindowDragReceiveHandler(
|
||||
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag );
|
||||
GetDragMouse( theDrag, &mouse, 0L );
|
||||
localMouse = mouse;
|
||||
wxMacGlobalToLocal( theWindow, &localMouse );
|
||||
localx = localMouse.h;
|
||||
localy = localMouse.v;
|
||||
wxNonOwnedWindow* tlw = wxNonOwnedWindow::GetFromWXWindow((WXWindow) theWindow);
|
||||
if ( tlw )
|
||||
tlw->GetNonOwnedPeer()->ScreenToWindow( &localx, &localy );
|
||||
|
||||
// TODO : should we use client coordinates?
|
||||
if ( trackingGlobals->m_currentTargetWindow )
|
||||
|
@ -69,30 +69,30 @@ bool wxDrawerWindow::Create(wxWindow *parent,
|
||||
const wxSize dummySize(0,0);
|
||||
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)
|
||||
{
|
||||
this->MacCreateRealWindow(pos, size, style, name);
|
||||
success = (m_macWindow != NULL);
|
||||
// this->MacCreateRealWindow(pos, size, style, name);
|
||||
success = (GetWXWindow() != NULL);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
// Use drawer brush.
|
||||
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
|
||||
// to where the drawer starts.
|
||||
::SetDrawerOffsets((WindowRef)m_macWindow, kLeadingOffset, kTrailingOffset);
|
||||
::SetDrawerOffsets((WindowRef)GetWXWindow() , kLeadingOffset, kTrailingOffset);
|
||||
|
||||
// Set the drawers parent.
|
||||
// Is there a better way to get the parent's WindowRef?
|
||||
wxTopLevelWindow* tlwParent = wxDynamicCast(parent, wxTopLevelWindow);
|
||||
if (NULL != tlwParent)
|
||||
{
|
||||
OSStatus status = ::SetDrawerParent((WindowRef)m_macWindow,
|
||||
(WindowRef)tlwParent->MacGetWindowRef());
|
||||
OSStatus status = ::SetDrawerParent((WindowRef) GetWXWindow(),
|
||||
(WindowRef)tlwParent->GetWXWindow());
|
||||
success = (noErr == status);
|
||||
}
|
||||
else
|
||||
@ -104,19 +104,19 @@ bool wxDrawerWindow::Create(wxWindow *parent,
|
||||
|
||||
wxDirection wxDrawerWindow::GetCurrentEdge() const
|
||||
{
|
||||
const OptionBits edge = ::GetDrawerCurrentEdge((WindowRef)m_macWindow);
|
||||
const OptionBits edge = ::GetDrawerCurrentEdge((WindowRef)GetWXWindow());
|
||||
return WindowEdgeToDirection(edge);
|
||||
}
|
||||
|
||||
wxDirection wxDrawerWindow::GetPreferredEdge() const
|
||||
{
|
||||
const OptionBits edge = ::GetDrawerPreferredEdge((WindowRef)m_macWindow);
|
||||
const OptionBits edge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow());
|
||||
return WindowEdgeToDirection(edge);
|
||||
}
|
||||
|
||||
bool wxDrawerWindow::IsOpen() const
|
||||
{
|
||||
WindowDrawerState state = ::GetDrawerState((WindowRef)m_macWindow);
|
||||
WindowDrawerState state = ::GetDrawerState((WindowRef)GetWXWindow());
|
||||
return (state == kWindowDrawerOpen || state == kWindowDrawerOpening);
|
||||
}
|
||||
|
||||
@ -127,18 +127,18 @@ bool wxDrawerWindow::Open(bool show)
|
||||
|
||||
if (show)
|
||||
{
|
||||
const OptionBits preferredEdge = ::GetDrawerPreferredEdge((WindowRef)m_macWindow);
|
||||
status = ::OpenDrawer((WindowRef)m_macWindow, preferredEdge, kAsynchronous);
|
||||
const OptionBits preferredEdge = ::GetDrawerPreferredEdge((WindowRef)GetWXWindow());
|
||||
status = ::OpenDrawer((WindowRef)GetWXWindow(), preferredEdge, kAsynchronous);
|
||||
}
|
||||
else
|
||||
status = ::CloseDrawer((WindowRef)m_macWindow, kAsynchronous);
|
||||
status = ::CloseDrawer((WindowRef)GetWXWindow(), kAsynchronous);
|
||||
|
||||
return (noErr == status);
|
||||
}
|
||||
|
||||
bool wxDrawerWindow::SetPreferredEdge(wxDirection edge)
|
||||
{
|
||||
const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)m_macWindow,
|
||||
const OSStatus status = ::SetDrawerPreferredEdge((WindowRef)GetWXWindow(),
|
||||
DirectionToWindowEdge(edge));
|
||||
return (noErr == status);
|
||||
}
|
||||
|
@ -30,10 +30,10 @@
|
||||
#include "wx/app.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#ifdef __DARWIN__
|
||||
#if wxOSX_USE_CARBON
|
||||
#include <Carbon/Carbon.h>
|
||||
#else
|
||||
#include <Carbon.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
// ============================================================================
|
||||
// wxEventLoop implementation
|
||||
@ -43,6 +43,8 @@
|
||||
// high level functions for RunApplicationEventLoop() case
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
#if wxMAC_USE_RUN_APP_EVENT_LOOP
|
||||
|
||||
int wxGUIEventLoop::Run()
|
||||
@ -84,6 +86,7 @@ void wxGUIEventLoop::WakeUp()
|
||||
|
||||
bool wxGUIEventLoop::Pending() const
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
EventRef theEvent;
|
||||
|
||||
return ReceiveNextEvent
|
||||
@ -94,16 +97,23 @@ bool wxGUIEventLoop::Pending() const
|
||||
false, // don't remove the event from queue
|
||||
&theEvent
|
||||
) == noErr;
|
||||
#else
|
||||
return true; // TODO
|
||||
#endif
|
||||
}
|
||||
|
||||
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 )
|
||||
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();
|
||||
#else
|
||||
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, 0);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -25,7 +25,11 @@
|
||||
#include "wx/graphics.h"
|
||||
#include "wx/settings.h"
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
#include "wx/osx/uma.h"
|
||||
#else
|
||||
#include "wx/osx/private.h"
|
||||
#endif
|
||||
|
||||
#ifndef __DARWIN__
|
||||
#include <ATSUnicode.h>
|
||||
@ -414,7 +418,7 @@ void wxFontRefData::MacFindFont()
|
||||
traits |= kCTFontItalicTrait;
|
||||
|
||||
// use font descriptor caching
|
||||
#if 1
|
||||
#if 0
|
||||
wxString lookupname = wxString::Format( "%s_%ld", m_faceName.c_str(), traits );
|
||||
|
||||
static std::map< std::wstring , wxCFRef< CTFontDescriptorRef > > fontdescriptorcache ;
|
||||
@ -432,7 +436,7 @@ void wxFontRefData::MacFindFont()
|
||||
#endif
|
||||
|
||||
// use font caching
|
||||
#if 1
|
||||
#if 0
|
||||
wxString lookupnameWithSize = wxString::Format( "%s_%ld_%ld", m_faceName.c_str(), traits, m_pointSize );
|
||||
|
||||
static std::map< std::wstring , wxCFRef< CTFontRef > > fontcache ;
|
||||
@ -445,6 +449,17 @@ void wxFontRefData::MacFindFont()
|
||||
#else
|
||||
m_ctFont.reset( CTFontCreateWithFontDescriptor( m_ctFontDescriptor, m_pointSize, NULL ) );
|
||||
#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
|
||||
OSStatus status = noErr;
|
||||
|
@ -225,7 +225,7 @@ void wxFrame::DetachMenuBar()
|
||||
|
||||
void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
||||
{
|
||||
wxFrame* tlf = wxDynamicCast( wxFindWinFromMacWindow( FrontNonFloatingWindow() ) , wxFrame );
|
||||
wxFrame* tlf = wxDynamicCast( wxNonOwnedWindow::GetFromWXWindow( (WXWindow) FrontNonFloatingWindow() ) , wxFrame );
|
||||
bool makeCurrent = false;
|
||||
|
||||
// if this is already the current menubar or we are the frontmost window
|
||||
|
@ -60,7 +60,7 @@ void wxGauge::SetRange(int r)
|
||||
// we are going via the base class in case there is
|
||||
// some change behind the values by it
|
||||
wxGaugeBase::SetRange( r ) ;
|
||||
if ( m_peer && m_peer->Ok() ){
|
||||
if ( m_peer && m_peer->IsOk() ){
|
||||
// switch back to determinate mode if not there already
|
||||
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
||||
{
|
||||
@ -77,7 +77,7 @@ void wxGauge::SetValue(int pos)
|
||||
// some change behind the values by it
|
||||
wxGaugeBase::SetValue( pos ) ;
|
||||
|
||||
if ( m_peer && m_peer->Ok() )
|
||||
if ( m_peer && m_peer->IsOk() )
|
||||
{
|
||||
// switch back to determinate mode if not there already
|
||||
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != false )
|
||||
@ -110,7 +110,7 @@ int wxGauge::GetValue() const
|
||||
|
||||
void wxGauge::Pulse()
|
||||
{
|
||||
if ( m_peer && m_peer->Ok() )
|
||||
if ( m_peer && m_peer->IsOk() )
|
||||
{
|
||||
if ( m_peer->GetData<Boolean>( kControlNoPart, kControlProgressBarIndeterminateTag ) != true )
|
||||
{
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "wx/link.h"
|
||||
#include "wx/osx/private.h"
|
||||
#include "wx/font.h"
|
||||
|
||||
// Linker will discard entire object file without this
|
||||
wxFORCE_LINK_THIS_MODULE(gdiobj)
|
||||
@ -50,6 +51,9 @@ void wxStockGDIMac::OnExit()
|
||||
{
|
||||
}
|
||||
|
||||
extern wxFont* CreateNormalFont();
|
||||
extern wxFont* CreateSmallFont();
|
||||
|
||||
const wxFont* wxStockGDIMac::GetFont(Item item)
|
||||
{
|
||||
wxFont* font = static_cast<wxFont*>(ms_stockObject[item]);
|
||||
@ -57,6 +61,7 @@ const wxFont* wxStockGDIMac::GetFont(Item item)
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
case FONT_NORMAL:
|
||||
font = new wxFont;
|
||||
font->MacCreateFromThemeFont(kThemeSystemFont);
|
||||
@ -65,6 +70,14 @@ const wxFont* wxStockGDIMac::GetFont(Item item)
|
||||
font = new wxFont;
|
||||
font->MacCreateFromThemeFont(kThemeSmallSystemFont);
|
||||
break;
|
||||
#else
|
||||
case FONT_NORMAL:
|
||||
font = CreateNormalFont() ;
|
||||
break;
|
||||
case FONT_SMALL:
|
||||
font = CreateSmallFont();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
font = const_cast<wxFont*>(super::GetFont(item));
|
||||
break;
|
||||
|
@ -35,8 +35,16 @@
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#include "wx/osx/uma.h"
|
||||
#include "wx/osx/private.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
|
||||
#include "CoreServices/CoreServices.h"
|
||||
#include "ApplicationServices/ApplicationServices.h"
|
||||
@ -92,12 +100,12 @@ OSStatus wxMacDrawCGImage(
|
||||
const CGRect * inBounds,
|
||||
CGImageRef inImage)
|
||||
{
|
||||
#if defined( __LP64__ ) || defined(__WXCOCOA__)
|
||||
#if wxOSX_USE_CARBON
|
||||
return HIViewDrawCGImage( inContext, inBounds, inImage );
|
||||
#else
|
||||
// todo flip
|
||||
CGContextDrawImage(inContext, *inBounds, inImage );
|
||||
return noErr;
|
||||
#else
|
||||
return HIViewDrawCGImage( inContext, inBounds, inImage );
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -122,7 +130,7 @@ CGColorRef wxMacCreateCGColor( const wxColour& col )
|
||||
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 )
|
||||
{
|
||||
@ -758,6 +766,14 @@ CGFunctionRef wxMacCoreGraphicsBrushData::CreateGradientFunction( const wxColour
|
||||
// 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
|
||||
{
|
||||
public:
|
||||
@ -773,6 +789,9 @@ public:
|
||||
wxColour GetColour() const { return m_colour ; }
|
||||
|
||||
bool GetUnderlined() const { return m_underlined ; }
|
||||
#if wxOSX_USE_IPHONE
|
||||
UIFont* GetUIFont() const { return m_uiFont; }
|
||||
#endif
|
||||
private :
|
||||
wxColour m_colour;
|
||||
bool m_underlined;
|
||||
@ -782,6 +801,9 @@ private :
|
||||
#if wxMAC_USE_CORE_TEXT
|
||||
wxCFRef< CTFontRef > m_ctFont;
|
||||
#endif
|
||||
#if wxOSX_USE_IPHONE
|
||||
UIFont* m_uiFont;
|
||||
#endif
|
||||
};
|
||||
|
||||
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
|
||||
m_ctFont.reset( wxMacCreateCTFont( font ) );
|
||||
#endif
|
||||
#if wxOSX_USE_IPHONE
|
||||
m_uiFont = CreateUIFont(font);
|
||||
wxMacCocoaRetain( m_uiFont );
|
||||
#endif
|
||||
#if wxMAC_USE_ATSU_TEXT
|
||||
OSStatus status = noErr;
|
||||
m_macATSUIStyle = NULL;
|
||||
@ -827,8 +853,6 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
|
||||
|
||||
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
|
||||
#endif
|
||||
#if wxMAC_USE_CG_TEXT
|
||||
#endif
|
||||
}
|
||||
|
||||
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
|
||||
@ -842,7 +866,8 @@ wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
|
||||
m_macATSUIStyle = NULL;
|
||||
}
|
||||
#endif
|
||||
#if wxMAC_USE_CG_TEXT
|
||||
#if wxOSX_USE_IPHONE
|
||||
wxMacCocoaRelease( m_uiFont );
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1244,7 +1269,9 @@ class WXDLLEXPORT wxMacCoreGraphicsContext : public wxGraphicsContext
|
||||
public:
|
||||
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, CGContextRef cgcontext, wxDouble width = 0, wxDouble height = 0 );
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window );
|
||||
#endif
|
||||
|
||||
wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window );
|
||||
|
||||
@ -1353,20 +1380,23 @@ public:
|
||||
|
||||
void SetNativeContext( CGContextRef cg );
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxMacCoreGraphicsContext)
|
||||
DECLARE_DYNAMIC_CLASS(wxMacCoreGraphicsContext)
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacCoreGraphicsContext)
|
||||
|
||||
private:
|
||||
void EnsureIsValid();
|
||||
|
||||
CGContextRef m_cgContext;
|
||||
#if wxOSX_USE_CARBON
|
||||
WindowRef m_windowRef;
|
||||
#endif
|
||||
bool m_releaseContext;
|
||||
CGAffineTransform m_windowTransform;
|
||||
wxDouble m_width;
|
||||
wxDouble m_height;
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxCFRef<HIShapeRef> m_clipRgn;
|
||||
#endif
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1411,7 +1441,9 @@ void wxMacCoreGraphicsContext::Init()
|
||||
{
|
||||
m_cgContext = NULL;
|
||||
m_releaseContext = false;
|
||||
#if wxOSX_USE_CARBON
|
||||
m_windowRef = NULL;
|
||||
#endif
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
}
|
||||
@ -1424,11 +1456,13 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, WindowRef window ): wxGraphicsContext(renderer)
|
||||
{
|
||||
Init();
|
||||
m_windowRef = window;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer, wxWindow* window ): wxGraphicsContext(renderer)
|
||||
{
|
||||
@ -1438,7 +1472,7 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
|
||||
originX = originY = 0;
|
||||
|
||||
Rect bounds = { 0,0,0,0 };
|
||||
#if defined( __LP64__ ) || defined(__WXCOCOA__)
|
||||
#if defined(__WXCOCOA__) || !wxOSX_USE_CARBON
|
||||
#else
|
||||
m_windowRef = (WindowRef) window->MacGetTopLevelWindowRef();
|
||||
window->MacWindowToRootWindow( &originX , &originY );
|
||||
@ -1499,12 +1533,10 @@ void wxMacCoreGraphicsContext::EnsureIsValid()
|
||||
{
|
||||
if ( !m_cgContext )
|
||||
{
|
||||
OSStatus status =
|
||||
#if ! ( defined( __LP64__ ) || defined(__WXCOCOA__) )
|
||||
QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
|
||||
#if defined(__WXCOCOA__) || ! wxOSX_USE_CARBON
|
||||
wxFAIL_MSG("Cannot create wxDCs lazily");
|
||||
#else
|
||||
paramErr;
|
||||
#endif
|
||||
OSStatus status = QDBeginCGContext( GetWindowPort( m_windowRef ) , &m_cgContext );
|
||||
if ( status != noErr )
|
||||
{
|
||||
wxFAIL_MSG("Cannot nest wxDCs on the same window");
|
||||
@ -1532,6 +1564,7 @@ void wxMacCoreGraphicsContext::EnsureIsValid()
|
||||
}
|
||||
}
|
||||
CGContextSaveGState( m_cgContext );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1548,8 +1581,12 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function )
|
||||
bool shouldAntiAlias = true;
|
||||
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 )
|
||||
#endif
|
||||
{
|
||||
retval = true;
|
||||
switch ( function )
|
||||
@ -1597,7 +1634,7 @@ bool wxMacCoreGraphicsContext::SetLogicalFunction( int function )
|
||||
|
||||
void wxMacCoreGraphicsContext::Clip( const wxRegion ®ion )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
#if wxOSX_USE_CARBON
|
||||
if( m_cgContext )
|
||||
{
|
||||
wxCFRef<HIShapeRef> shape = wxCFRefFromGet(region.GetWXHRGN());
|
||||
@ -1623,6 +1660,9 @@ void wxMacCoreGraphicsContext::Clip( const wxRegion ®ion )
|
||||
HIShapeOffset( mutableShape, transformedOrigin.x, transformedOrigin.y );
|
||||
m_clipRgn.reset(mutableShape);
|
||||
}
|
||||
#else
|
||||
// allow usage as measuring context
|
||||
// wxASSERT_MSG( m_cgContext != NULL, "Needs a valid context for clipping" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1636,10 +1676,15 @@ void wxMacCoreGraphicsContext::Clip( wxDouble x, wxDouble y, wxDouble w, wxDoubl
|
||||
}
|
||||
else
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
// the clipping itself must be stored as device coordinates, otherwise
|
||||
// we cannot apply it back correctly
|
||||
r.origin= CGPointApplyAffineTransform( r.origin, m_windowTransform );
|
||||
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
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
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 );
|
||||
if ( m_releaseContext )
|
||||
{
|
||||
#if ! ( defined( __LP64__ ) || defined(__WXCOCOA__) )
|
||||
#if wxOSX_USE_CARBON
|
||||
QDEndCGContext( GetWindowPort( m_windowRef ) , &m_cgContext);
|
||||
#endif
|
||||
}
|
||||
@ -1868,7 +1918,7 @@ void wxMacCoreGraphicsContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDoubl
|
||||
CGContextSaveGState( m_cgContext );
|
||||
CGContextTranslateCTM( m_cgContext,(CGFloat) x ,(CGFloat) (y + h) );
|
||||
CGContextScaleCTM( m_cgContext, 1, -1 );
|
||||
#ifdef __WXMAC__
|
||||
#if wxOSX_USE_CARBON
|
||||
PlotIconRefInContext( m_cgContext , &r , kAlignNone , kTransformNone ,
|
||||
NULL , kPlotIconRefNormalFlags , MAC_WXHICON( icon.GetHICON() ) );
|
||||
#endif
|
||||
@ -1930,7 +1980,19 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
|
||||
}
|
||||
#endif
|
||||
#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
|
||||
}
|
||||
|
||||
@ -2122,7 +2184,21 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
|
||||
}
|
||||
#endif
|
||||
#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
|
||||
}
|
||||
|
||||
@ -2338,7 +2414,7 @@ wxGraphicsRenderer* wxGraphicsRenderer::GetDefaultRenderer()
|
||||
return &gs_MacCoreGraphicsRenderer;
|
||||
}
|
||||
|
||||
#ifdef __WXCOCOA__
|
||||
#if defined( __WXCOCOA__ ) || wxOSX_USE_COCOA
|
||||
extern CGContextRef wxMacGetContextFromCurrentNSContext() ;
|
||||
#endif
|
||||
|
||||
@ -2379,6 +2455,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxMemoryDC&
|
||||
|
||||
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxPrinterDC& dc )
|
||||
{
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
#ifdef __WXMAC__
|
||||
const wxDCImpl* impl = dc.GetImpl();
|
||||
wxPrinterDCImpl *print_impl = wxDynamicCast( impl, wxPrinterDCImpl );
|
||||
@ -2389,6 +2466,7 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( const wxPrinterDC&
|
||||
return new wxMacCoreGraphicsContext( this,
|
||||
(CGContextRef)(print_impl->GetGraphicsContext()->GetNativeContext()), (wxDouble) w, (wxDouble) h );
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
@ -2398,10 +2476,13 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeContext( v
|
||||
return new wxMacCoreGraphicsContext(this,(CGContextRef)context);
|
||||
}
|
||||
|
||||
|
||||
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContextFromNativeWindow( void * window )
|
||||
{
|
||||
#if wxOSX_USE_CARBON
|
||||
return new wxMacCoreGraphicsContext(this,(WindowRef)window);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window )
|
||||
|
@ -426,7 +426,7 @@ void wxMacListBoxItem::Notification(wxMacDataItemBrowserControl *owner ,
|
||||
return;
|
||||
}
|
||||
|
||||
wxListBox *list = wxDynamicCast( owner->GetPeer() , wxListBox );
|
||||
wxListBox *list = wxDynamicCast( owner->GetWXPeer() , wxListBox );
|
||||
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
|
||||
|
||||
if (message == kDataBrowserItemDoubleClicked)
|
||||
@ -535,7 +535,7 @@ void wxMacDataBrowserListControl::ItemNotification(
|
||||
DataBrowserItemNotification message,
|
||||
DataBrowserItemDataRef itemData)
|
||||
{
|
||||
wxListBox *list = wxDynamicCast( GetPeer() , wxListBox );
|
||||
wxListBox *list = wxDynamicCast( GetWXPeer() , wxListBox );
|
||||
wxCHECK_RET( list != NULL , wxT("Listbox expected"));
|
||||
|
||||
if (list->HasMultipleSelection() && (message == kDataBrowserSelectionSetChanged) && (!list->MacGetBlockEvents()))
|
||||
@ -549,7 +549,7 @@ void wxMacDataBrowserListControl::ItemNotification(
|
||||
wxCommandEvent event( wxEVT_COMMAND_LISTBOX_SELECTED, list->GetId() );
|
||||
|
||||
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;
|
||||
event.SetEventObject( list );
|
||||
if ( list->HasClientObjectData() )
|
||||
@ -566,12 +566,12 @@ void wxMacDataBrowserListControl::ItemNotification(
|
||||
// call super for item level(wxMacDataItem->Notification) callback processing
|
||||
wxMacDataItemBrowserControl::ItemNotification( itemID, message, itemData);
|
||||
}
|
||||
|
||||
/*
|
||||
wxWindow * wxMacDataBrowserListControl::GetPeer() const
|
||||
{
|
||||
return wxDynamicCast( wxMacControl::GetPeer() , wxWindow );
|
||||
return wxDynamicCast( wxMacControl::GetWX() , wxWindow );
|
||||
}
|
||||
|
||||
*/
|
||||
wxMacDataItem* wxMacDataBrowserListControl::CreateItem()
|
||||
{
|
||||
return new wxMacListBoxItem();
|
||||
|
@ -2448,7 +2448,7 @@ void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner ,
|
||||
return ;
|
||||
}
|
||||
|
||||
wxListCtrl *list = wxDynamicCast( owner->GetPeer() , wxListCtrl );
|
||||
wxListCtrl *list = wxDynamicCast( owner->GetWXPeer() , wxListCtrl );
|
||||
if ( list && lb )
|
||||
{
|
||||
bool trigger = false;
|
||||
@ -2669,7 +2669,7 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
||||
int imgIndex = -1;
|
||||
short listColumn = property - kMinColumnId;
|
||||
|
||||
wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
|
||||
wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
|
||||
wxMacListCtrlItem* lcItem;
|
||||
wxColour color = *wxBLACK;
|
||||
wxColour bgColor = wxNullColour;
|
||||
@ -2905,7 +2905,7 @@ OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemI
|
||||
short listColumn = property - kMinColumnId;
|
||||
|
||||
OSStatus err = errDataBrowserPropertyNotSupported;
|
||||
wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
|
||||
wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
|
||||
wxMacListCtrlItem* lcItem = NULL;
|
||||
|
||||
if (listColumn >= 0)
|
||||
@ -3024,7 +3024,7 @@ void wxMacDataBrowserListCtrlControl::ItemNotification(DataBrowserItemID itemID,
|
||||
return ;
|
||||
}
|
||||
|
||||
wxListCtrl *list = wxDynamicCast( GetPeer() , wxListCtrl );
|
||||
wxListCtrl *list = wxDynamicCast( GetWXPeer() , wxListCtrl );
|
||||
if ( list )
|
||||
{
|
||||
bool trigger = false;
|
||||
@ -3102,7 +3102,7 @@ Boolean wxMacDataBrowserListCtrlControl::CompareItems(DataBrowserItemID itemOneI
|
||||
|
||||
int colId = sortProperty - kMinColumnId;
|
||||
|
||||
wxListCtrl* list = wxDynamicCast( GetPeer() , wxListCtrl );
|
||||
wxListCtrl* list = wxDynamicCast( GetWXPeer() , wxListCtrl );
|
||||
|
||||
DataBrowserSortOrder sort;
|
||||
verify_noerr(GetSortOrder(&sort));
|
||||
@ -3175,7 +3175,7 @@ void wxMacDataBrowserListCtrlControl::MacSetColumnInfo( unsigned int row, unsign
|
||||
listItem->SetOrder(row);
|
||||
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
|
||||
// update the item prematurely (i.e. no text would be listed) and, on show,
|
||||
|
@ -218,7 +218,7 @@ void wxMDIParentFrame::MacActivate(long timestamp, bool activating)
|
||||
{
|
||||
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"));
|
||||
|
||||
@ -382,14 +382,10 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
SetName(name);
|
||||
|
||||
if ( id == wxID_ANY )
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
id = (int)NewControlId();
|
||||
|
||||
if (parent)
|
||||
parent->AddChild(this);
|
||||
|
||||
MacCreateRealWindow( pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
||||
wxNonOwnedWindow::Create( parent, id, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
||||
|
||||
SetTitle( title );
|
||||
|
||||
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"));
|
||||
|
||||
UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->MacGetWindowRef(), true);
|
||||
UMAHighlightAndActivateWindow((WindowRef)s_macDeactivateWindow->GetWXWindow(), true);
|
||||
|
||||
wxLogTrace(TRACE_MDI, wxT("finished highliting parent"));
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include <QuickTime/QuickTimeComponents.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__LP64__)
|
||||
#if wxOSX_USE_CARBON
|
||||
#define USE_QUICKTIME 1
|
||||
#else
|
||||
#define USE_QUICKTIME 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -60,15 +60,13 @@ void wxOverlayImpl::MacGetBounds( Rect *bounds )
|
||||
int x, y;
|
||||
x=y=0;
|
||||
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 };
|
||||
wxMacLocalToGlobal( window, &localwhere ) ;
|
||||
|
||||
bounds->top = localwhere.v+m_y;
|
||||
bounds->left = localwhere.h+m_x;
|
||||
bounds->bottom = localwhere.v+m_y+m_height;
|
||||
bounds->right = localwhere.h+m_x+m_width;
|
||||
bounds->top = y+m_y;
|
||||
bounds->left = x+m_x;
|
||||
bounds->bottom = y+m_y+m_height;
|
||||
bounds->right = x+m_x+m_width;
|
||||
}
|
||||
|
||||
OSStatus wxOverlayImpl::CreateOverlayWindow()
|
||||
|
@ -142,7 +142,7 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data )
|
||||
if ( !m_printerName.empty() )
|
||||
PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxCFStringRef( m_printerName , wxFont::GetDefaultEncoding() ) ) ;
|
||||
#endif
|
||||
#ifndef __LP64__
|
||||
#if wxOSX_USE_CARBON
|
||||
PMColorMode color ;
|
||||
PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ;
|
||||
if ( data.GetColour() )
|
||||
@ -176,15 +176,16 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data )
|
||||
PMResolution res;
|
||||
PMPrinter 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,
|
||||
(PMPrintSettings) m_macPrintSettings, &res) ;
|
||||
// TODO transfer ? into page format ?
|
||||
// may fail !
|
||||
#else
|
||||
PMTag tag = kPMMaxSquareResolution;
|
||||
PMPrinterGetPrinterResolution(printer, tag, &res);
|
||||
PMSetResolution((PMPageFormat) m_macPageFormat, &res);
|
||||
#endif
|
||||
// after setting the new resolution the format has to be updated, otherwise the page rect remains
|
||||
// at the 'old' scaling
|
||||
@ -420,12 +421,12 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
||||
PMResolution res;
|
||||
wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*)
|
||||
(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;
|
||||
PMSessionGetCurrentPrinter(nativeData->m_macPrintSession, &printer);
|
||||
PMPrinterGetOutputResolution( printer, nativeData->m_macPrintSettings, &res) ;
|
||||
#else
|
||||
PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res);
|
||||
#endif
|
||||
printout->SetPPIPrinter(int(res.hRes), int(res.vRes));
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "wx/renderer.h"
|
||||
#include "wx/graphics.h"
|
||||
#include "wx/osx/uma.h"
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
|
||||
class WXDLLEXPORT wxRendererMac : public wxDelegateRendererNative
|
||||
@ -236,7 +236,7 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win,
|
||||
wxOrientation orient,
|
||||
int WXUNUSED(flags) )
|
||||
{
|
||||
bool hasMetal = win->MacGetTopLevelWindow()->MacGetMetalAppearance();
|
||||
bool hasMetal = win->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL;
|
||||
SInt32 height;
|
||||
GetThemeMetric( kThemeMetricSmallPaneSplitterHeight, &height );
|
||||
HIRect splitterRect;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "wx/gdicmn.h"
|
||||
#endif
|
||||
|
||||
#include "wx/osx/uma.h"
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxSystemSettingsNative
|
||||
@ -31,12 +31,18 @@
|
||||
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
{
|
||||
wxColour resultColor;
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
ThemeBrush colorBrushID;
|
||||
#endif
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case wxSYS_COLOUR_WINDOW:
|
||||
resultColor = *wxWHITE ;
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
resultColor = wxColour(wxMacCreateCGColorFromHITheme( kThemeBrushDocumentWindowBackground )) ;
|
||||
#else
|
||||
resultColor = *wxWHITE;
|
||||
#endif
|
||||
break ;
|
||||
case wxSYS_COLOUR_SCROLLBAR :
|
||||
case wxSYS_COLOUR_BACKGROUND:
|
||||
@ -48,7 +54,11 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
case wxSYS_COLOUR_INACTIVEBORDER:
|
||||
case wxSYS_COLOUR_BTNFACE:
|
||||
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 ;
|
||||
|
||||
case wxSYS_COLOUR_LISTBOX :
|
||||
@ -56,7 +66,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
break ;
|
||||
|
||||
case wxSYS_COLOUR_BTNSHADOW:
|
||||
resultColor = wxColor( 0xBE, 0xBE, 0xBE );
|
||||
resultColor = wxColour( 0xBE, 0xBE, 0xBE );
|
||||
break ;
|
||||
|
||||
case wxSYS_COLOUR_BTNTEXT:
|
||||
@ -70,13 +80,17 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
|
||||
case wxSYS_COLOUR_HIGHLIGHT:
|
||||
{
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
#if 0
|
||||
// NB: enable this case as desired
|
||||
colorBrushID = kThemeBrushAlternatePrimaryHighlightColor;
|
||||
#else
|
||||
colorBrushID = kThemeBrushPrimaryHighlightColor;
|
||||
#endif
|
||||
resultColor = wxColor( wxMacCreateCGColorFromHITheme(colorBrushID) );
|
||||
resultColor = wxColour( wxMacCreateCGColorFromHITheme(colorBrushID) );
|
||||
#else
|
||||
resultColor = wxColor( 0xCC, 0xCC, 0xFF );
|
||||
#endif
|
||||
}
|
||||
break ;
|
||||
|
||||
@ -94,10 +108,7 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
break ;
|
||||
|
||||
case wxSYS_COLOUR_HIGHLIGHTTEXT :
|
||||
#if 0
|
||||
// NB: enable this case as desired
|
||||
resultColor = *wxWHITE ;
|
||||
#else
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
{
|
||||
wxColour highlightcolor( wxMacCreateCGColorFromHITheme(kThemeBrushPrimaryHighlightColor) );
|
||||
if ((highlightcolor.Red() + highlightcolor.Green() + highlightcolor.Blue() ) == 0)
|
||||
@ -105,6 +116,8 @@ wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||
else
|
||||
resultColor = *wxBLACK ;
|
||||
}
|
||||
#else
|
||||
resultColor = *wxWHITE ;
|
||||
#endif
|
||||
break ;
|
||||
|
||||
@ -227,12 +240,12 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w
|
||||
// TODO: case wxSYS_SHOW_SOUNDS:
|
||||
|
||||
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
|
||||
// but rather rely on the 'click-count' by the system delivered in a mouse event
|
||||
return 500;
|
||||
#else
|
||||
return (int)(GetDblTime() * 1000. / 60.);
|
||||
#endif
|
||||
default:
|
||||
// unsupported metric
|
||||
|
@ -66,6 +66,8 @@ public :
|
||||
|
||||
virtual void SetDescriptiveText(const wxString& text);
|
||||
virtual wxString GetDescriptiveText() const;
|
||||
|
||||
virtual bool SetFocus();
|
||||
|
||||
protected :
|
||||
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
|
||||
// ============================================================================
|
||||
@ -274,27 +291,6 @@ wxSize wxSearchCtrl::DoGetBestSize() const
|
||||
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
|
||||
// wxSearchCtrl owns menu after this call
|
||||
|
@ -58,7 +58,7 @@ bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
|
||||
if ( !wxStatusBarGeneric::Create( parent, id, style, name ) )
|
||||
return false;
|
||||
|
||||
if ( parent->MacGetTopLevelWindow()->MacGetMetalAppearance() )
|
||||
if ( parent->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
|
||||
SetBackgroundStyle( wxBG_STYLE_TRANSPARENT );
|
||||
|
||||
// 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 ypos = 1;
|
||||
|
||||
if ( MacGetTopLevelWindow()->MacGetMetalAppearance() )
|
||||
if ( MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL )
|
||||
ypos++;
|
||||
|
||||
dc.SetClippingRegion(rect.x, 0, rect.width, h);
|
||||
@ -136,7 +136,7 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||
if (major >= 10)
|
||||
{
|
||||
// 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));
|
||||
else
|
||||
dc.SetPen(wxPen(wxColour(0xB1, 0xB1, 0xB1), 1, wxSOLID));
|
||||
|
@ -328,7 +328,7 @@ public :
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void SetRect( Rect *r ) ;
|
||||
virtual void Move(int x, int y, int width, int height);
|
||||
|
||||
protected :
|
||||
OSStatus DoCreate();
|
||||
@ -1368,7 +1368,7 @@ bool wxMacUnicodeTextControl::Create( wxTextCtrl *wxPeer,
|
||||
if ( !(m_windowStyle & wxTE_MULTILINE) )
|
||||
SetData<Boolean>( kControlEditTextPart , kControlEditTextSingleLineTag , true ) ;
|
||||
|
||||
InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(),
|
||||
::InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(),
|
||||
GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this,
|
||||
NULL);
|
||||
|
||||
@ -1664,7 +1664,7 @@ void wxMacMLTEControl::SetStringValue( const wxString &str )
|
||||
|
||||
{
|
||||
#ifndef __LP64__
|
||||
wxMacWindowClipper c( m_peer ) ;
|
||||
wxMacWindowClipper c( GetWXPeer() ) ;
|
||||
#endif
|
||||
|
||||
{
|
||||
@ -2010,7 +2010,7 @@ void wxMacMLTEControl::Replace( long from , long to , const wxString &str )
|
||||
|
||||
wxMacEditHelper help( m_txn ) ;
|
||||
#ifndef __LP64__
|
||||
wxMacWindowClipper c( m_peer ) ;
|
||||
wxMacWindowClipper c( GetWXPeer() ) ;
|
||||
#endif
|
||||
|
||||
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 )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
wxMacWindowClipper c( m_peer ) ;
|
||||
wxMacWindowClipper c( GetWXPeer() ) ;
|
||||
#endif
|
||||
wxMacEditHelper help( m_txn ) ;
|
||||
TXNSetSelection( m_txn , from , to ) ;
|
||||
@ -2039,7 +2039,7 @@ void wxMacMLTEControl::GetSelection( long* from, long* to) const
|
||||
void wxMacMLTEControl::SetSelection( long from , long to )
|
||||
{
|
||||
#ifndef __LP64__
|
||||
wxMacWindowClipper c( m_peer ) ;
|
||||
wxMacWindowClipper c( GetWXPeer() ) ;
|
||||
#endif
|
||||
|
||||
// change the selection
|
||||
@ -2060,7 +2060,7 @@ void wxMacMLTEControl::WriteText( const wxString& str )
|
||||
|
||||
GetSelection( &start , &dummy ) ;
|
||||
#ifndef __LP64__
|
||||
wxMacWindowClipper c( m_peer ) ;
|
||||
wxMacWindowClipper c( GetWXPeer() ) ;
|
||||
#endif
|
||||
|
||||
{
|
||||
@ -2076,7 +2076,7 @@ void wxMacMLTEControl::WriteText( const wxString& str )
|
||||
void wxMacMLTEControl::Clear()
|
||||
{
|
||||
#ifndef __LP64__
|
||||
wxMacWindowClipper c( m_peer ) ;
|
||||
wxMacWindowClipper c( GetWXPeer() ) ;
|
||||
#endif
|
||||
wxMacEditHelper st( m_txn ) ;
|
||||
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() ;
|
||||
}
|
||||
|
||||
@ -2770,7 +2770,7 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
|
||||
{
|
||||
wxString st = str ;
|
||||
wxMacConvertNewlines10To13( &st ) ;
|
||||
wxMacWindowClipper clipper( m_peer ) ;
|
||||
wxMacWindowClipper clipper( GetWXPeer() ) ;
|
||||
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
|
||||
TXNSetSelection( m_txn, 0, 0 ) ;
|
||||
}
|
||||
@ -2804,7 +2804,7 @@ ControlUserPaneFocusUPP gTPFocusProc = NULL;
|
||||
|
||||
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 ;
|
||||
if ( win )
|
||||
win->MacControlUserPaneDrawProc( part ) ;
|
||||
@ -2812,7 +2812,7 @@ static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
|
||||
|
||||
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 ;
|
||||
if ( win )
|
||||
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)
|
||||
{
|
||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ;
|
||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget( (WXWidget) control) , wxTextCtrl ) ;
|
||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
||||
if ( win )
|
||||
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)
|
||||
{
|
||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindControlFromMacControl(control) , wxTextCtrl ) ;
|
||||
wxTextCtrl *textCtrl = wxDynamicCast( wxFindWindowFromWXWidget((WXWidget) control) , wxTextCtrl ) ;
|
||||
wxMacMLTEClassicControl * win = textCtrl ? (wxMacMLTEClassicControl*)(textCtrl->GetPeer()) : NULL ;
|
||||
if ( win )
|
||||
win->MacControlUserPaneIdleProc() ;
|
||||
@ -2840,7 +2840,7 @@ static pascal void wxMacControlUserPaneIdleProc(ControlRef control)
|
||||
|
||||
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 ;
|
||||
if ( win )
|
||||
return win->MacControlUserPaneKeyDownProc( keyCode, charCode, modifiers ) ;
|
||||
@ -2850,7 +2850,7 @@ static pascal ControlPartCode wxMacControlUserPaneKeyDownProc(ControlRef control
|
||||
|
||||
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 ;
|
||||
if ( win )
|
||||
win->MacControlUserPaneActivateProc( activating ) ;
|
||||
@ -2858,7 +2858,7 @@ static pascal void wxMacControlUserPaneActivateProc(ControlRef control, Boolean
|
||||
|
||||
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 ;
|
||||
if ( win )
|
||||
return win->MacControlUserPaneFocusProc( action ) ;
|
||||
@ -2869,7 +2869,7 @@ static pascal ControlPartCode wxMacControlUserPaneFocusProc(ControlRef control,
|
||||
#if 0
|
||||
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 ;
|
||||
if ( win )
|
||||
win->MacControlUserPaneBackgroundProc(info) ;
|
||||
@ -3080,7 +3080,7 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
|
||||
{
|
||||
HIViewAddSubview( m_scrollView , m_textView ) ;
|
||||
m_controlRef = m_scrollView ;
|
||||
wxPeer->MacInstallEventHandler( (WXWidget) m_textView ) ;
|
||||
wxMacControl::MacInstallEventHandler( m_textView, wxPeer ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3090,14 +3090,14 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
|
||||
|
||||
AdjustCreationAttributes( *wxWHITE , true ) ;
|
||||
#ifndef __LP64__
|
||||
wxMacWindowClipper c( m_peer ) ;
|
||||
wxMacWindowClipper c( GetWXPeer() ) ;
|
||||
#endif
|
||||
SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ;
|
||||
|
||||
TXNSetSelection( m_txn, 0, 0 );
|
||||
TXNShowSelection( m_txn, kTXNShowStart );
|
||||
|
||||
InstallControlEventHandler( m_textView , GetwxMacTextControlEventHandlerUPP(),
|
||||
::InstallControlEventHandler( m_textView , GetwxMacTextControlEventHandlerUPP(),
|
||||
GetEventTypeCount(eventList), eventList, this,
|
||||
NULL);
|
||||
}
|
||||
|
@ -25,7 +25,12 @@
|
||||
|
||||
#include "wx/thread.h"
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#else
|
||||
#include <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
#include "wx/osx/uma.h"
|
||||
|
||||
// the possible states of the thread:
|
||||
|
@ -664,7 +664,7 @@ static pascal OSStatus ControlToolbarItemHandler( EventHandlerCallRef inCallRef,
|
||||
{
|
||||
case kEventControlGetSizeConstraints:
|
||||
{
|
||||
wxWindow* wxwindow = wxFindControlFromMacControl(object->viewRef ) ;
|
||||
wxWindow* wxwindow = wxFindWindowFromWXWidget( (WXWidget) object->viewRef ) ;
|
||||
if ( wxwindow )
|
||||
{
|
||||
// during toolbar layout the native window sometimes gets negative sizes,
|
||||
@ -1051,10 +1051,9 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
|
||||
ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 );
|
||||
SetAutomaticControlDragTrackingEnabledForWindow( tlw, true );
|
||||
|
||||
Rect r = { 0, 0, 0, 0 };
|
||||
m_peer->SetRect( &r );
|
||||
m_peer->Move(0,0,0,0 );
|
||||
SetSize( wxSIZE_AUTO_WIDTH, 0 );
|
||||
m_peer->SetVisibility( false, true );
|
||||
m_peer->SetVisibility( false );
|
||||
wxToolBarBase::Show( false );
|
||||
}
|
||||
}
|
||||
@ -1069,7 +1068,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
|
||||
ChangeWindowAttributes( tlw, 0, kWindowToolbarButtonAttribute );
|
||||
SetWindowToolbar( tlw, NULL );
|
||||
|
||||
m_peer->SetVisibility( true, true );
|
||||
m_peer->SetVisibility( true );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1125,6 +1124,13 @@ bool wxToolBar::Realize()
|
||||
bool insertAll = false;
|
||||
|
||||
HIToolbarRef refTB = (HIToolbarRef)m_macHIToolbarRef;
|
||||
wxFont f;
|
||||
wxFontEncoding enc;
|
||||
f = GetFont();
|
||||
if ( f.IsOk() )
|
||||
enc = f.GetEncoding();
|
||||
else
|
||||
enc = wxFont::GetDefaultEncoding();
|
||||
#endif
|
||||
|
||||
node = m_tools.GetFirst();
|
||||
@ -1169,6 +1175,12 @@ bool wxToolBar::Realize()
|
||||
HIToolbarItemRef hiItemRef = tool->GetToolbarItemRef();
|
||||
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) )
|
||||
{
|
||||
OSStatus err = noErr;
|
||||
@ -1711,7 +1723,7 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
||||
int w, h;
|
||||
GetSize( &w, &h );
|
||||
|
||||
bool drawMetalTheme = MacGetTopLevelWindow()->MacGetMetalAppearance();
|
||||
bool drawMetalTheme = MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL;
|
||||
|
||||
if ( !drawMetalTheme )
|
||||
{
|
||||
|
@ -224,9 +224,12 @@ void wxMacToolTip::Draw()
|
||||
HMHelpContentRec tag ;
|
||||
tag.version = kMacHelpVersion;
|
||||
|
||||
Point p = { m_position.y , m_position.x };
|
||||
wxMacLocalToGlobal( m_window , &p ) ;
|
||||
SetRect( &tag.absHotRect , p.h - 2 , p.v - 2 , p.h + 2 , p.v + 2 );
|
||||
int x = m_position.x;
|
||||
int y = m_position.y;
|
||||
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 ) ;
|
||||
tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "wx/control.h"
|
||||
#endif //WX_PRECOMP
|
||||
|
||||
#include "wx/osx/uma.h"
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/dnd.h"
|
||||
|
||||
@ -45,10 +44,6 @@
|
||||
#include "wx/sysopt.h"
|
||||
#endif
|
||||
|
||||
#ifndef __DARWIN__
|
||||
#include <ToolUtils.h>
|
||||
#endif
|
||||
|
||||
// for targeting OSX
|
||||
#include "wx/osx/private.h"
|
||||
|
||||
@ -63,18 +58,11 @@ END_EVENT_TABLE()
|
||||
// wxTopLevelWindowMac creation
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef struct
|
||||
{
|
||||
wxPoint m_position ;
|
||||
wxSize m_size ;
|
||||
bool m_wasResizable ;
|
||||
} FullScreenData ;
|
||||
|
||||
void wxTopLevelWindowMac::Init()
|
||||
{
|
||||
m_iconized =
|
||||
m_maximizeOnShow = false;
|
||||
m_macFullScreenData = NULL ;
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::Create(wxWindow *parent,
|
||||
@ -89,7 +77,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
|
||||
return false;
|
||||
|
||||
wxWindow::SetLabel( title ) ;
|
||||
SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , GetFont().GetEncoding() ) );
|
||||
m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
|
||||
wxTopLevelWindows.Append(this);
|
||||
|
||||
return true;
|
||||
@ -97,9 +85,6 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent,
|
||||
|
||||
wxTopLevelWindowMac::~wxTopLevelWindowMac()
|
||||
{
|
||||
FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
|
||||
delete data ;
|
||||
m_macFullScreenData = NULL ;
|
||||
}
|
||||
|
||||
|
||||
@ -109,39 +94,24 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac()
|
||||
|
||||
void wxTopLevelWindowMac::Maximize(bool maximize)
|
||||
{
|
||||
Point idealSize = { 0 , 0 } ;
|
||||
if ( 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 ) ;
|
||||
if ( IsMaximized() != maximize )
|
||||
m_nowpeer->Maximize(maximize);
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::IsMaximized() const
|
||||
{
|
||||
return IsWindowInStandardState( (WindowRef)m_macWindow , NULL , NULL ) ;
|
||||
return m_nowpeer->IsMaximized();
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::Iconize(bool iconize)
|
||||
{
|
||||
if ( IsWindowCollapsable( (WindowRef)m_macWindow) )
|
||||
CollapseWindow( (WindowRef)m_macWindow , iconize ) ;
|
||||
if ( IsIconized() != iconize )
|
||||
m_nowpeer->Iconize(iconize);
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::IsIconized() const
|
||||
{
|
||||
return IsWindowCollapsed((WindowRef)m_macWindow ) ;
|
||||
return m_nowpeer->IsIconized();
|
||||
}
|
||||
|
||||
void wxTopLevelWindowMac::Restore()
|
||||
@ -164,7 +134,7 @@ wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const
|
||||
void wxTopLevelWindowMac::SetTitle(const wxString& title)
|
||||
{
|
||||
wxWindow::SetLabel( title ) ;
|
||||
SetWindowTitleWithCFString( (WindowRef) m_macWindow , wxCFStringRef( title , GetFont().GetEncoding() ) ) ;
|
||||
m_nowpeer->SetTitle(title, GetFont().GetEncoding() );
|
||||
}
|
||||
|
||||
wxString wxTopLevelWindowMac::GetTitle() const
|
||||
@ -174,101 +144,15 @@ wxString wxTopLevelWindowMac::GetTitle() const
|
||||
|
||||
bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
|
||||
{
|
||||
if ( show )
|
||||
{
|
||||
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;
|
||||
return m_nowpeer->ShowFullScreen(show, style);
|
||||
}
|
||||
|
||||
bool wxTopLevelWindowMac::IsFullScreen() const
|
||||
{
|
||||
return m_macFullScreenData != NULL ;
|
||||
return m_nowpeer->IsFullScreen();
|
||||
}
|
||||
|
||||
// Attracts the users attention to this window if the application is
|
||||
// inactive (should be called when a background event occurs)
|
||||
|
||||
static pascal void wxMacNMResponse( NMRecPtr ptr )
|
||||
void wxTopLevelWindowMac::RequestUserAttention(int flags)
|
||||
{
|
||||
NMRemove( ptr ) ;
|
||||
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 ) ) ;
|
||||
return m_nowpeer->RequestUserAttention(flags);
|
||||
}
|
||||
|
@ -31,35 +31,9 @@ long UMAGetSystemVersion()
|
||||
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
|
||||
|
||||
#if 1 // not yet wxMAC_USE_COCOA == 0
|
||||
#if wxOSX_USE_CARBON
|
||||
|
||||
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 ) ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 1 // not yet wxMAC_USE_COCOA == 0
|
||||
|
||||
static OSStatus UMAGetHelpMenu(
|
||||
MenuRef * outHelpMenu,
|
||||
MenuItemIndex * outFirstCustomItemIndex,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,11 @@
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#if wxOSX_USE_COCOA_OR_CARBON
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#else
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
#include "wx/osx/private.h"
|
||||
@ -19,12 +23,14 @@
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
#if wxOSX_USE_CARBON
|
||||
bool wxMacInitCocoa()
|
||||
{
|
||||
bool cocoaLoaded = NSApplicationLoad();
|
||||
wxASSERT_MSG(cocoaLoaded,wxT("Couldn't load Cocoa in Carbon Environment")) ;
|
||||
return cocoaLoaded;
|
||||
}
|
||||
#endif
|
||||
|
||||
wxMacAutoreleasePool::wxMacAutoreleasePool()
|
||||
{
|
||||
@ -38,7 +44,7 @@ wxMacAutoreleasePool::~wxMacAutoreleasePool()
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __WXCOCOCA__
|
||||
#if defined( __WXCOCOCA__ ) || wxOSX_USE_COCOA
|
||||
|
||||
CGContextRef wxMacGetContextFromCurrentNSContext()
|
||||
{
|
||||
@ -68,6 +74,8 @@ void wxMacCocoaRetain( void* obj )
|
||||
[(NSObject*)obj retain];
|
||||
}
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// NSImage Utils
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -97,8 +105,6 @@ WX_NSImage CreateNSImageFromCGImage( CGImageRef image )
|
||||
// NSCursor Utils
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if wxMAC_USE_COCOA
|
||||
|
||||
// copied from cursor.mm
|
||||
|
||||
static NSCursor* wxGetStockCursor( short sIndex )
|
||||
@ -302,3 +308,4 @@ void wxMacCocoaShowCursor()
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user