cleanup mac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -766,6 +766,8 @@ extern "C" void macPostedEventCallback(void *WXUNUSED(unused))
|
|||||||
wxTheApp->ProcessPendingEvents();
|
wxTheApp->ProcessPendingEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProcessSerialNumber gAppProcess ;
|
||||||
|
|
||||||
bool wxApp::Initialize(int& argc, wxChar **argv)
|
bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||||
{
|
{
|
||||||
// Mac-specific
|
// Mac-specific
|
||||||
@@ -796,6 +798,8 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
|
|||||||
if ( !wxAppBase::Initialize(argc, argv) )
|
if ( !wxAppBase::Initialize(argc, argv) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
GetCurrentProcess(&gAppProcess);
|
||||||
|
|
||||||
#if wxUSE_INTL
|
#if wxUSE_INTL
|
||||||
wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
|
wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
|
||||||
#endif
|
#endif
|
||||||
|
@@ -28,12 +28,8 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#include <ApplicationServices/ApplicationServices.h>
|
||||||
#include <ApplicationServices/ApplicationServices.h>
|
#include <QuickTime/QuickTime.h>
|
||||||
#include <QuickTime/QuickTime.h>
|
|
||||||
#else
|
|
||||||
#include <PictUtils.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
@@ -171,10 +167,7 @@ void wxBitmapRefData::Init()
|
|||||||
m_bytesPerRow = 0;
|
m_bytesPerRow = 0;
|
||||||
m_ok = false ;
|
m_ok = false ;
|
||||||
m_bitmapMask = NULL ;
|
m_bitmapMask = NULL ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
m_cgImageRef = NULL ;
|
m_cgImageRef = NULL ;
|
||||||
#endif
|
|
||||||
|
|
||||||
m_iconRef = NULL ;
|
m_iconRef = NULL ;
|
||||||
m_pictHandle = NULL ;
|
m_pictHandle = NULL ;
|
||||||
@@ -304,7 +297,6 @@ void *wxBitmapRefData::BeginRawAccess()
|
|||||||
|
|
||||||
++m_rawAccessCount ;
|
++m_rawAccessCount ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
// we must destroy an existing cached image, as
|
// we must destroy an existing cached image, as
|
||||||
// the bitmap data may change now
|
// the bitmap data may change now
|
||||||
if ( m_cgImageRef )
|
if ( m_cgImageRef )
|
||||||
@@ -312,7 +304,6 @@ void *wxBitmapRefData::BeginRawAccess()
|
|||||||
CGImageRelease( m_cgImageRef ) ;
|
CGImageRelease( m_cgImageRef ) ;
|
||||||
m_cgImageRef = NULL ;
|
m_cgImageRef = NULL ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return m_memBuf.GetData() ;
|
return m_memBuf.GetData() ;
|
||||||
}
|
}
|
||||||
@@ -687,7 +678,6 @@ PicHandle wxBitmapRefData::GetPictHandle()
|
|||||||
return m_pictHandle ;
|
return m_pictHandle ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t WXUNUSED(size))
|
void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t WXUNUSED(size))
|
||||||
{
|
{
|
||||||
wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;
|
wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;
|
||||||
@@ -704,7 +694,7 @@ CGImageRef wxBitmapRefData::CGImageCreate() const
|
|||||||
CGImageRef image ;
|
CGImageRef image ;
|
||||||
if ( m_rawAccessCount > 0 || m_cgImageRef == NULL )
|
if ( m_rawAccessCount > 0 || m_cgImageRef == NULL )
|
||||||
{
|
{
|
||||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) && wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
if ( UMAGetSystemVersion() >= 0x1040 && m_depth != 1 && m_bitmapMask == NULL )
|
if ( UMAGetSystemVersion() >= 0x1040 && m_depth != 1 && m_bitmapMask == NULL )
|
||||||
{
|
{
|
||||||
if ( m_bitmapMask )
|
if ( m_bitmapMask )
|
||||||
@@ -809,7 +799,6 @@ CGImageRef wxBitmapRefData::CGImageCreate() const
|
|||||||
|
|
||||||
return image ;
|
return image ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
CGContextRef wxBitmapRefData::GetBitmapContext() const
|
CGContextRef wxBitmapRefData::GetBitmapContext() const
|
||||||
@@ -871,13 +860,11 @@ void wxBitmapRefData::Free()
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( m_rawAccessCount == 0 , wxT("Bitmap still selected when destroyed") ) ;
|
wxASSERT_MSG( m_rawAccessCount == 0 , wxT("Bitmap still selected when destroyed") ) ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if ( m_cgImageRef )
|
if ( m_cgImageRef )
|
||||||
{
|
{
|
||||||
CGImageRelease( m_cgImageRef ) ;
|
CGImageRelease( m_cgImageRef ) ;
|
||||||
m_cgImageRef = NULL ;
|
m_cgImageRef = NULL ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( m_iconRef )
|
if ( m_iconRef )
|
||||||
{
|
{
|
||||||
@@ -1130,14 +1117,12 @@ void wxBitmap::EndRawAccess()
|
|||||||
M_BITMAPDATA->EndRawAccess() ;
|
M_BITMAPDATA->EndRawAccess() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
WXCGIMAGEREF wxBitmap::CGImageCreate() const
|
WXCGIMAGEREF wxBitmap::CGImageCreate() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
|
wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
|
||||||
|
|
||||||
return M_BITMAPDATA->CGImageCreate() ;
|
return M_BITMAPDATA->CGImageCreate() ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
|
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
|
||||||
{
|
{
|
||||||
|
@@ -118,7 +118,6 @@ bool wxBitmapButton::Create( wxWindow *parent,
|
|||||||
m_bmpNormal = bitmap;
|
m_bmpNormal = bitmap;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if ( HasFlag( wxBORDER_NONE ) )
|
if ( HasFlag( wxBORDER_NONE ) )
|
||||||
{
|
{
|
||||||
// contrary to the docs this control only works with iconrefs
|
// contrary to the docs this control only works with iconrefs
|
||||||
@@ -128,7 +127,6 @@ bool wxBitmapButton::Create( wxWindow *parent,
|
|||||||
&bounds, &info, false, m_peer->GetControlRefAddr() );
|
&bounds, &info, false, m_peer->GetControlRefAddr() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
||||||
err = CreateBevelButtonControl(
|
err = CreateBevelButtonControl(
|
||||||
@@ -158,7 +156,6 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
|
|||||||
|
|
||||||
ControlButtonContentInfo info;
|
ControlButtonContentInfo info;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if ( HasFlag( wxBORDER_NONE ) )
|
if ( HasFlag( wxBORDER_NONE ) )
|
||||||
{
|
{
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef );
|
wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef );
|
||||||
@@ -166,7 +163,6 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap )
|
|||||||
m_peer->SetData( kControlIconPart, kControlIconContentTag, info );
|
m_peer->SetData( kControlIconPart, kControlIconContentTag, info );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
wxMacCreateBitmapButton( &info, m_bmpNormal );
|
||||||
if ( info.contentType != kControlNoContent )
|
if ( info.contentType != kControlNoContent )
|
||||||
|
@@ -61,7 +61,6 @@ bool wxButton::Create(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
|
else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
// Button height is static in Mac, can't be changed, so we need to force it here
|
// Button height is static in Mac, can't be changed, so we need to force it here
|
||||||
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL || GetWindowVariant() == wxWINDOW_VARIANT_LARGE )
|
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL || GetWindowVariant() == wxWINDOW_VARIANT_LARGE )
|
||||||
{
|
{
|
||||||
@@ -78,8 +77,6 @@ bool wxButton::Create(wxWindow *parent,
|
|||||||
bounds.bottom = bounds.top + 15 ;
|
bounds.bottom = bounds.top + 15 ;
|
||||||
m_maxHeight = 15 ;
|
m_maxHeight = 15 ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
err = CreatePushButtonControl(
|
err = CreatePushButtonControl(
|
||||||
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
|
||||||
&bounds, CFSTR(""), m_peer->GetControlRefAddr() );
|
&bounds, CFSTR(""), m_peer->GetControlRefAddr() );
|
||||||
|
@@ -24,10 +24,6 @@
|
|||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
#include <Appearance.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
|
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
|
BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
|
||||||
|
@@ -268,12 +268,10 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
int lbHeight = 20;
|
int lbHeight = 20;
|
||||||
int wLine;
|
int wLine;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
SInt32 metric ;
|
SInt32 metric ;
|
||||||
|
|
||||||
GetThemeMetric( kThemeMetricPopupButtonHeight , &metric );
|
GetThemeMetric( kThemeMetricPopupButtonHeight , &metric );
|
||||||
lbHeight = metric ;
|
lbHeight = metric ;
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
|
@@ -41,88 +41,34 @@ static const wxChar *TRACE_CLIPBOARD = wxT("clipboard");
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
|
||||||
|
|
||||||
// in order to keep the binary interface the same this class
|
|
||||||
// serves just to have a few additional member variables inside
|
|
||||||
// the clipboard class
|
|
||||||
|
|
||||||
class wxMacBinaryCompatHelper : public wxDataObject
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
wxMacBinaryCompatHelper()
|
|
||||||
{
|
|
||||||
m_trueData = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
~wxMacBinaryCompatHelper()
|
|
||||||
{
|
|
||||||
if (m_trueData != NULL)
|
|
||||||
{
|
|
||||||
delete m_trueData;
|
|
||||||
m_trueData = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const
|
|
||||||
{
|
|
||||||
return wxDataFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual size_t GetFormatCount(Direction dir = Get) const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void GetAllFormats(wxDataFormat *formats,
|
|
||||||
Direction dir = Get) const
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual size_t GetDataSize(const wxDataFormat& format) const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool GetDataHere(const wxDataFormat& format, void *buf) const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// only relevant from here on
|
|
||||||
|
|
||||||
wxDataObject* m_trueData;
|
|
||||||
wxCFRef<PasteboardRef> m_pasteboard;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define M_CLIPBOARD ((wxMacBinaryCompatHelper*)m_data)
|
|
||||||
|
|
||||||
wxClipboard::wxClipboard()
|
wxClipboard::wxClipboard()
|
||||||
{
|
{
|
||||||
m_open = false;
|
m_open = false;
|
||||||
m_data = new wxMacBinaryCompatHelper() ;
|
m_data = NULL ;
|
||||||
PasteboardRef clipboard = 0;
|
PasteboardRef clipboard = 0;
|
||||||
OSStatus err = PasteboardCreate( kPasteboardClipboard, &clipboard );
|
OSStatus err = PasteboardCreate( kPasteboardClipboard, &clipboard );
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
{
|
{
|
||||||
wxLogSysError( wxT("Failed to create the clipboard.") );
|
wxLogSysError( wxT("Failed to create the clipboard.") );
|
||||||
}
|
}
|
||||||
M_CLIPBOARD->m_pasteboard.reset(clipboard);
|
m_pasteboard.reset(clipboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClipboard::~wxClipboard()
|
wxClipboard::~wxClipboard()
|
||||||
{
|
{
|
||||||
M_CLIPBOARD->m_pasteboard.reset((PasteboardRef)0);
|
m_pasteboard.reset((PasteboardRef)0);
|
||||||
delete m_data;
|
delete m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxClipboard::Clear()
|
void wxClipboard::Clear()
|
||||||
{
|
{
|
||||||
if (M_CLIPBOARD->m_trueData != NULL)
|
if (m_data != NULL)
|
||||||
{
|
{
|
||||||
delete M_CLIPBOARD->m_trueData;
|
delete m_data;
|
||||||
M_CLIPBOARD->m_trueData = NULL;
|
m_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus err = PasteboardClear( M_CLIPBOARD->m_pasteboard );
|
OSStatus err = PasteboardClear( m_pasteboard );
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
{
|
{
|
||||||
wxLogSysError( wxT("Failed to empty the clipboard.") );
|
wxLogSysError( wxT("Failed to empty the clipboard.") );
|
||||||
@@ -174,13 +120,13 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
// we can only store one wxDataObject
|
// we can only store one wxDataObject
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
PasteboardSyncFlags syncFlags = PasteboardSynchronize( M_CLIPBOARD->m_pasteboard );
|
PasteboardSyncFlags syncFlags = PasteboardSynchronize( m_pasteboard );
|
||||||
wxCHECK_MSG( !(syncFlags&kPasteboardModified), false, wxT("clipboard modified after clear") );
|
wxCHECK_MSG( !(syncFlags&kPasteboardModified), false, wxT("clipboard modified after clear") );
|
||||||
wxCHECK_MSG( (syncFlags&kPasteboardClientIsOwner), false, wxT("client couldn't own clipboard") );
|
wxCHECK_MSG( (syncFlags&kPasteboardClientIsOwner), false, wxT("client couldn't own clipboard") );
|
||||||
|
|
||||||
M_CLIPBOARD->m_trueData = data;
|
m_data = data;
|
||||||
|
|
||||||
data->AddToPasteboard( M_CLIPBOARD->m_pasteboard, 1 );
|
data->AddToPasteboard( m_pasteboard, 1 );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -194,18 +140,18 @@ void wxClipboard::Close()
|
|||||||
// Get rid of cached object.
|
// Get rid of cached object.
|
||||||
// If this is not done, copying data from
|
// If this is not done, copying data from
|
||||||
// another application will only work once
|
// another application will only work once
|
||||||
if (M_CLIPBOARD->m_trueData)
|
if (m_data)
|
||||||
{
|
{
|
||||||
delete M_CLIPBOARD->m_trueData;
|
delete m_data;
|
||||||
M_CLIPBOARD->m_trueData = (wxDataObject*) NULL;
|
m_data = (wxDataObject*) NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
|
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
|
||||||
{
|
{
|
||||||
if ( M_CLIPBOARD->m_trueData )
|
if ( m_data )
|
||||||
return M_CLIPBOARD->m_trueData->IsSupported( dataFormat );
|
return m_data->IsSupported( dataFormat );
|
||||||
return wxDataObject::IsFormatInPasteboard( M_CLIPBOARD->m_pasteboard, dataFormat );
|
return wxDataObject::IsFormatInPasteboard( m_pasteboard, dataFormat );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxClipboard::GetData( wxDataObject& data )
|
bool wxClipboard::GetData( wxDataObject& data )
|
||||||
@@ -222,14 +168,14 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
|
|
||||||
bool transferred = false;
|
bool transferred = false;
|
||||||
|
|
||||||
if ( M_CLIPBOARD->m_trueData )
|
if ( m_data )
|
||||||
{
|
{
|
||||||
for (size_t i = 0; !transferred && i < formatcount; i++)
|
for (size_t i = 0; !transferred && i < formatcount; i++)
|
||||||
{
|
{
|
||||||
wxDataFormat format = array[ i ];
|
wxDataFormat format = array[ i ];
|
||||||
if ( M_CLIPBOARD->m_trueData->IsSupported( format ) )
|
if ( m_data->IsSupported( format ) )
|
||||||
{
|
{
|
||||||
int dataSize = M_CLIPBOARD->m_trueData->GetDataSize( format );
|
int dataSize = m_data->GetDataSize( format );
|
||||||
transferred = true;
|
transferred = true;
|
||||||
|
|
||||||
if (dataSize == 0)
|
if (dataSize == 0)
|
||||||
@@ -239,7 +185,7 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *d = new char[ dataSize ];
|
char *d = new char[ dataSize ];
|
||||||
M_CLIPBOARD->m_trueData->GetDataHere( format, (void*)d );
|
m_data->GetDataHere( format, (void*)d );
|
||||||
data.SetData( format, dataSize, d );
|
data.SetData( format, dataSize, d );
|
||||||
delete [] d;
|
delete [] d;
|
||||||
}
|
}
|
||||||
@@ -250,7 +196,7 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
// get formats from wxDataObjects
|
// get formats from wxDataObjects
|
||||||
if ( !transferred )
|
if ( !transferred )
|
||||||
{
|
{
|
||||||
transferred = data.GetFromPasteboard( M_CLIPBOARD->m_pasteboard ) ;
|
transferred = data.GetFromPasteboard( m_pasteboard ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] array;
|
delete [] array;
|
||||||
|
@@ -21,9 +21,6 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
|
||||||
|
|
||||||
#include "wx/mac/private.h"
|
#include "wx/mac/private.h"
|
||||||
#ifndef __DARWIN__
|
|
||||||
#include <ColorPicker.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxColourDialog
|
* wxColourDialog
|
||||||
@@ -52,7 +49,6 @@ int wxColourDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
RGBColor currentColor = *((RGBColor*)m_colourData.m_dataColour.GetPixel()) ;
|
RGBColor currentColor = *((RGBColor*)m_colourData.m_dataColour.GetPixel()) ;
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
NColorPickerInfo info;
|
NColorPickerInfo info;
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
memset(&info, 0, sizeof(info)) ;
|
memset(&info, 0, sizeof(info)) ;
|
||||||
@@ -72,18 +68,6 @@ int wxColourDialog::ShowModal()
|
|||||||
|
|
||||||
return wxID_OK;
|
return wxID_OK;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
RGBColor newColor ;
|
|
||||||
Point where ;
|
|
||||||
|
|
||||||
where.h = where.v = -1;
|
|
||||||
|
|
||||||
if (GetColor( where, "\pSelect a new palette color.", ¤tColor, &newColor ))
|
|
||||||
{
|
|
||||||
m_colourData.m_dataColour.Set( (WXCOLORREF*) &newColor ) ;
|
|
||||||
return wxID_OK;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,16 +50,11 @@ MenuHandle NewUniqueMenu()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// the margin between the text control and the choice
|
// the margin between the text control and the choice
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
// margin should be bigger on OS X due to blue highlight
|
// margin should be bigger on OS X due to blue highlight
|
||||||
// around text control.
|
// around text control.
|
||||||
static const wxCoord MARGIN = 4;
|
static const wxCoord MARGIN = 4;
|
||||||
// this is the border a focus rect on OSX is needing
|
// this is the border a focus rect on OSX is needing
|
||||||
static const int TEXTFOCUSBORDER = 3 ;
|
static const int TEXTFOCUSBORDER = 3 ;
|
||||||
#else
|
|
||||||
static const wxCoord MARGIN = 2;
|
|
||||||
static const int TEXTFOCUSBORDER = 0 ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -134,7 +134,6 @@ wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* pee
|
|||||||
flags |= kDataBrowserSelectOnlyOne;
|
flags |= kDataBrowserSelectOnlyOne;
|
||||||
(void) this->SetSelectionFlags(flags);
|
(void) this->SetSelectionFlags(flags);
|
||||||
} /* if */
|
} /* if */
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
OptionBits attributes; // variable definition
|
OptionBits attributes; // variable definition
|
||||||
|
|
||||||
if (this->GetAttributes(&attributes) == noErr) // get default settings
|
if (this->GetAttributes(&attributes) == noErr) // get default settings
|
||||||
@@ -145,7 +144,6 @@ wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* pee
|
|||||||
attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers;
|
attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers;
|
||||||
(void) this->SetAttributes(attributes);
|
(void) this->SetAttributes(attributes);
|
||||||
} /* if */
|
} /* if */
|
||||||
#endif
|
|
||||||
if ((style & wxDV_NO_HEADER) != 0)
|
if ((style & wxDV_NO_HEADER) != 0)
|
||||||
this->SetHeaderButtonHeight(0);
|
this->SetHeaderButtonHeight(0);
|
||||||
} /* wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow*, wxPoint const&, wxSize const&, long) */
|
} /* wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow*, wxPoint const&, wxSize const&, long) */
|
||||||
@@ -190,12 +188,10 @@ OSStatus wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool enabl
|
|||||||
return ::SetDataBrowserTableViewGeometry(this->GetControlRef(),enableWidth,enableHeight);
|
return ::SetDataBrowserTableViewGeometry(this->GetControlRef(),enableWidth,enableHeight);
|
||||||
} /* wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool, bool) */
|
} /* wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool, bool) */
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes)
|
OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes)
|
||||||
{
|
{
|
||||||
return ::DataBrowserGetAttributes(this->GetControlRef(),attributes);
|
return ::DataBrowserGetAttributes(this->GetControlRef(),attributes);
|
||||||
} /* wxMacDataBrowserTableViewControl::GetAttributes(OptionBits*) */
|
} /* wxMacDataBrowserTableViewControl::GetAttributes(OptionBits*) */
|
||||||
#endif
|
|
||||||
|
|
||||||
OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth(DataBrowserPropertyID propertyID, UInt16* width) const
|
OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth(DataBrowserPropertyID propertyID, UInt16* width) const
|
||||||
{
|
{
|
||||||
@@ -232,12 +228,10 @@ OSStatus wxMacDataBrowserTableViewControl::GetScrollPosition( UInt32 *top , UInt
|
|||||||
return GetDataBrowserScrollPosition(this->m_controlRef, top , left );
|
return GetDataBrowserScrollPosition(this->m_controlRef, top , left );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes)
|
OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes)
|
||||||
{
|
{
|
||||||
return ::DataBrowserChangeAttributes(this->GetControlRef(),attributes,~attributes);
|
return ::DataBrowserChangeAttributes(this->GetControlRef(),attributes,~attributes);
|
||||||
} /* wxMacDataBrowserTableViewControl::SetAttributes(OptionBits) */
|
} /* wxMacDataBrowserTableViewControl::SetAttributes(OptionBits) */
|
||||||
#endif
|
|
||||||
|
|
||||||
OSStatus wxMacDataBrowserTableViewControl::SetColumnWidth(DataBrowserPropertyID propertyID, UInt16 width)
|
OSStatus wxMacDataBrowserTableViewControl::SetColumnWidth(DataBrowserPropertyID propertyID, UInt16 width)
|
||||||
{
|
{
|
||||||
|
@@ -64,9 +64,7 @@ void wxDialog::SetModal( bool flag )
|
|||||||
|
|
||||||
wxModelessWindows.DeleteObject( this );
|
wxModelessWindows.DeleteObject( this );
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
|
SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -128,10 +126,6 @@ bool wxDialog::Show(bool show)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
|
||||||
extern bool s_macIsInModalLoop ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void wxDialog::DoShowModal()
|
void wxDialog::DoShowModal()
|
||||||
{
|
{
|
||||||
wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
|
wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
|
||||||
|
@@ -34,16 +34,7 @@
|
|||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __DARWIN__
|
#include <Carbon/Carbon.h>
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
#else
|
|
||||||
#include <Gestalt.h>
|
|
||||||
#include <Displays.h>
|
|
||||||
#include <Quickdraw.h>
|
|
||||||
#include <Video.h> // for VDSwitchInfoRec
|
|
||||||
#include <FixMath.h>
|
|
||||||
#include <Debugging.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/display_impl.h"
|
#include "wx/display_impl.h"
|
||||||
|
|
||||||
@@ -51,8 +42,6 @@
|
|||||||
// display classes implementation
|
// display classes implementation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
|
|
||||||
class wxDisplayImplMacOSX : public wxDisplayImpl
|
class wxDisplayImplMacOSX : public wxDisplayImpl
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -263,470 +252,4 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
|
|||||||
return new wxDisplayFactoryMacOSX;
|
return new wxDisplayFactoryMacOSX;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // !__WXMAC_OSX__
|
|
||||||
|
|
||||||
class wxDisplayImplMac : public wxDisplayImpl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxDisplayImplMac(unsigned n, GDHandle hndl)
|
|
||||||
: wxDisplayImpl(n),
|
|
||||||
m_hndl(hndl)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual wxRect GetGeometry() const;
|
|
||||||
virtual wxString GetName() const { return wxString(); }
|
|
||||||
|
|
||||||
virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const;
|
|
||||||
virtual wxVideoMode GetCurrentMode() const;
|
|
||||||
virtual bool ChangeMode(const wxVideoMode& mode);
|
|
||||||
|
|
||||||
private:
|
|
||||||
GDHandle m_hndl;
|
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxDisplayImplMac)
|
|
||||||
};
|
|
||||||
|
|
||||||
class wxDisplayFactoryMac : public wxDisplayFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxDisplayFactoryMac();
|
|
||||||
|
|
||||||
virtual wxDisplayImpl *CreateDisplay(unsigned n);
|
|
||||||
virtual unsigned GetCount();
|
|
||||||
virtual int GetFromPoint(const wxPoint& pt);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
DECLARE_NO_COPY_CLASS(wxDisplayFactoryMac)
|
|
||||||
};
|
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// wxDisplayFactoryMac implementation
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
unsigned wxDisplayFactoryMac::GetCount()
|
|
||||||
{
|
|
||||||
unsigned num = 0;
|
|
||||||
GDHandle hndl = DMGetFirstScreenDevice(true);
|
|
||||||
while(hndl)
|
|
||||||
{
|
|
||||||
num++;
|
|
||||||
hndl = DMGetNextScreenDevice(hndl, true);
|
|
||||||
}
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxDisplayFactoryMac::GetFromPoint(const wxPoint &p)
|
|
||||||
{
|
|
||||||
unsigned num = 0;
|
|
||||||
GDHandle hndl = DMGetFirstScreenDevice(true);
|
|
||||||
while(hndl)
|
|
||||||
{
|
|
||||||
Rect screenrect = (*hndl)->gdRect;
|
|
||||||
if (p.x >= screenrect.left &&
|
|
||||||
p.x <= screenrect.right &&
|
|
||||||
p.y >= screenrect.top &&
|
|
||||||
p.y <= screenrect.bottom)
|
|
||||||
{
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
num++;
|
|
||||||
hndl = DMGetNextScreenDevice(hndl, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxNOT_FOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxDisplayImpl *wxDisplayFactoryMac::CreateDisplay(unsigned n)
|
|
||||||
{
|
|
||||||
unsigned nOrig = n;
|
|
||||||
|
|
||||||
GDHandle hndl = DMGetFirstScreenDevice(true);
|
|
||||||
while(hndl)
|
|
||||||
{
|
|
||||||
if (n == 0)
|
|
||||||
{
|
|
||||||
return new wxDisplayImplMac(nOrig, hndl);
|
|
||||||
}
|
|
||||||
n--;
|
|
||||||
hndl = DMGetNextScreenDevice(hndl, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// wxDisplayImplMac implementation
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
wxRect wxDisplayImplMac::GetGeometry() const
|
|
||||||
{
|
|
||||||
Rect screenrect = (*m_hndl)->gdRect;
|
|
||||||
return wxRect(screenrect.left, screenrect.top,
|
|
||||||
screenrect.right - screenrect.left,
|
|
||||||
screenrect.bottom - screenrect.top);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DMModeIteratorRec
|
|
||||||
{
|
|
||||||
wxArrayVideoModes* pModes;
|
|
||||||
const wxVideoMode* pMatchMode;
|
|
||||||
};
|
|
||||||
|
|
||||||
pascal void DMModeListIteratorProc(
|
|
||||||
void* pData,
|
|
||||||
DMListIndexType nIndex,
|
|
||||||
DMDisplayModeListEntryPtr pInfo)
|
|
||||||
{
|
|
||||||
DMModeIteratorRec* pInfoData = (DMModeIteratorRec*) pData;
|
|
||||||
|
|
||||||
// Note that in testing the refresh rate is always 0 on my ibook - RN
|
|
||||||
int refresh = (int) Fix2Long(pInfo->displayModeResolutionInfo->csRefreshRate);
|
|
||||||
|
|
||||||
#define pDBI pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthVPBlock
|
|
||||||
|
|
||||||
for (unsigned long i = 0; i < pInfo->displayModeDepthBlockInfo->depthBlockCount; ++i)
|
|
||||||
{
|
|
||||||
if (wxVideoMode( (int) pInfo->displayModeResolutionInfo->csHorizontalPixels,
|
|
||||||
(int) pInfo->displayModeResolutionInfo->csVerticalLines,
|
|
||||||
(int) pDBI->vpPixelSize,
|
|
||||||
refresh).Matches(*pInfoData->pMatchMode) )
|
|
||||||
{
|
|
||||||
pInfoData->pModes->Add(
|
|
||||||
wxVideoMode(
|
|
||||||
(int) pInfo->displayModeResolutionInfo->csHorizontalPixels,
|
|
||||||
(int) pInfo->displayModeResolutionInfo->csVerticalLines,
|
|
||||||
(int) pDBI->vpPixelSize,
|
|
||||||
refresh ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef pDBI
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DMModeInfoRec
|
|
||||||
{
|
|
||||||
const wxVideoMode* pMode;
|
|
||||||
VDSwitchInfoRec sMode;
|
|
||||||
bool bMatched;
|
|
||||||
};
|
|
||||||
|
|
||||||
pascal void DMModeInfoProc(
|
|
||||||
void* pData,
|
|
||||||
DMListIndexType nIndex,
|
|
||||||
DMDisplayModeListEntryPtr pInfo )
|
|
||||||
{
|
|
||||||
DMModeInfoRec* pInfoData = (DMModeInfoRec*) pData;
|
|
||||||
Fixed refresh = Long2Fix(pInfoData->pMode->refresh);
|
|
||||||
|
|
||||||
#define pDBI pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthVPBlock
|
|
||||||
|
|
||||||
for (unsigned long i = 0; i < pInfo->displayModeDepthBlockInfo->depthBlockCount; ++i)
|
|
||||||
{
|
|
||||||
if (pInfoData->pMode->w == (int&) pInfo->displayModeResolutionInfo->csHorizontalPixels &&
|
|
||||||
pInfoData->pMode->h == (int&) pInfo->displayModeResolutionInfo->csVerticalLines &&
|
|
||||||
pInfoData->pMode->bpp == (int) pDBI->vpPixelSize &&
|
|
||||||
refresh == pInfo->displayModeResolutionInfo->csRefreshRate)
|
|
||||||
{
|
|
||||||
memcpy(
|
|
||||||
&pInfoData->sMode,
|
|
||||||
pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthSwitchInfo,
|
|
||||||
sizeof(VDSwitchInfoRec));
|
|
||||||
pInfoData->sMode.csMode = pDBI->vpPixelSize;
|
|
||||||
pInfoData->bMatched = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef pDBI
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DMModeTransRec
|
|
||||||
{
|
|
||||||
wxVideoMode Mode;
|
|
||||||
const VDSwitchInfoRec* psMode;
|
|
||||||
bool bMatched;
|
|
||||||
};
|
|
||||||
|
|
||||||
pascal void DMModeTransProc(
|
|
||||||
void* pData,
|
|
||||||
DMListIndexType nIndex,
|
|
||||||
DMDisplayModeListEntryPtr pInfo)
|
|
||||||
{
|
|
||||||
DMModeTransRec* pInfoData = (DMModeTransRec*) pData;
|
|
||||||
|
|
||||||
#define pDBI pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthVPBlock
|
|
||||||
|
|
||||||
for (unsigned long i = 0; i < pInfo->displayModeDepthBlockInfo->depthBlockCount; ++i)
|
|
||||||
{
|
|
||||||
if (pInfoData->psMode->csData == pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthSwitchInfo->csData)
|
|
||||||
{
|
|
||||||
pInfoData->Mode = wxVideoMode(
|
|
||||||
(int) pInfo->displayModeResolutionInfo->csHorizontalPixels,
|
|
||||||
(int) pInfo->displayModeResolutionInfo->csVerticalLines,
|
|
||||||
(int) pDBI->vpPixelSize,
|
|
||||||
(int) Fix2Long(pInfo->displayModeResolutionInfo->csRefreshRate) );
|
|
||||||
pInfoData->bMatched = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef pDBI
|
|
||||||
}
|
|
||||||
|
|
||||||
wxArrayVideoModes wxDisplayImplMac::GetModes(const wxVideoMode& mode) const
|
|
||||||
{
|
|
||||||
wxArrayVideoModes Modes;
|
|
||||||
unsigned long dwDMVer;
|
|
||||||
|
|
||||||
// Check DM version == 2
|
|
||||||
// (for backward compatibility only - 7.5.3+ use 2.0)
|
|
||||||
Gestalt( gestaltDisplayMgrVers, (long*) &dwDMVer );
|
|
||||||
if (dwDMVer >= 0x020000)
|
|
||||||
{
|
|
||||||
DMListIndexType nNumModes;
|
|
||||||
DMListType pModes;
|
|
||||||
DMDisplayModeListIteratorUPP uppMLI;
|
|
||||||
DisplayIDType nDisplayID;
|
|
||||||
OSErr err;
|
|
||||||
|
|
||||||
err = DMGetDisplayIDByGDevice(m_hndl, &nDisplayID, false);
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
// Create a new list...
|
|
||||||
err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes);
|
|
||||||
wxASSERT_MSG( err == noErr, wxT("Could not create a new display mode list") );
|
|
||||||
|
|
||||||
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeListIteratorProc);
|
|
||||||
wxASSERT( uppMLI );
|
|
||||||
|
|
||||||
DMModeIteratorRec sModeInfo;
|
|
||||||
sModeInfo.pModes = &Modes;
|
|
||||||
sModeInfo.pMatchMode = &mode;
|
|
||||||
|
|
||||||
for (DMListIndexType i = 0; i < nNumModes; ++i)
|
|
||||||
{
|
|
||||||
err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
|
|
||||||
verify_noerr( err );
|
|
||||||
}
|
|
||||||
|
|
||||||
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
|
||||||
err = DMDisposeList(pModes);
|
|
||||||
verify_noerr( err );
|
|
||||||
}
|
|
||||||
else // DM 1.0, 1.2, 1.x
|
|
||||||
{
|
|
||||||
wxLogSysError(
|
|
||||||
wxString::Format(
|
|
||||||
wxT("Display Manager Version %u Not Supported! Present? %s"),
|
|
||||||
(unsigned int) dwDMVer / 0x10000,
|
|
||||||
(dwDMVer & (1 << gestaltDisplayMgrPresent) ? wxT("Yes") : wxT("No")) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return Modes;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxVideoMode wxDisplayImplMac::GetCurrentMode() const
|
|
||||||
{
|
|
||||||
unsigned long dwDMVer;
|
|
||||||
wxVideoMode RetMode;
|
|
||||||
|
|
||||||
// Check DM version == 2
|
|
||||||
// (for backward compatibility only - 7.5.3+ use 2.0)
|
|
||||||
Gestalt( gestaltDisplayMgrVers, (long*) &dwDMVer );
|
|
||||||
if (dwDMVer >= 0x020000)
|
|
||||||
{
|
|
||||||
VDSwitchInfoRec sMode; // Note: csMode member also contains the bit depth
|
|
||||||
OSErr err;
|
|
||||||
|
|
||||||
err = DMGetDisplayMode( m_hndl, &sMode );
|
|
||||||
if (err == noErr)
|
|
||||||
{
|
|
||||||
DMListIndexType nNumModes;
|
|
||||||
DMListType pModes;
|
|
||||||
DMDisplayModeListIteratorUPP uppMLI;
|
|
||||||
DisplayIDType nDisplayID;
|
|
||||||
|
|
||||||
err = DMGetDisplayIDByGDevice(m_hndl, &nDisplayID, false);
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
// Create a new list...
|
|
||||||
err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes);
|
|
||||||
wxASSERT_MSG( err == noErr, wxT("Could not create a new display mode list") );
|
|
||||||
|
|
||||||
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeTransProc);
|
|
||||||
wxASSERT( uppMLI );
|
|
||||||
|
|
||||||
DMModeTransRec sModeInfo;
|
|
||||||
sModeInfo.bMatched = false;
|
|
||||||
sModeInfo.psMode = &sMode;
|
|
||||||
for (DMListIndexType i = 0; i < nNumModes; ++i)
|
|
||||||
{
|
|
||||||
err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
if ( sModeInfo.bMatched )
|
|
||||||
{
|
|
||||||
RetMode = sModeInfo.Mode;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
|
||||||
err = DMDisposeList(pModes);
|
|
||||||
verify_noerr( err );
|
|
||||||
}
|
|
||||||
else // Can't get current mode?
|
|
||||||
{
|
|
||||||
wxLogSysError(
|
|
||||||
wxString::Format(
|
|
||||||
wxT("Couldn't obtain current display mode!!!\ndwDMVer:%u"),
|
|
||||||
(unsigned int) dwDMVer));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // DM ver 1
|
|
||||||
{
|
|
||||||
wxLogSysError(
|
|
||||||
wxString::Format(
|
|
||||||
wxT("Display Manager Version %u Not Supported! Present? %s"),
|
|
||||||
(unsigned int) dwDMVer / 0x10000,
|
|
||||||
(dwDMVer & (1 << gestaltDisplayMgrPresent) ? wxT("Yes") : wxT("No")) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return RetMode;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDisplayImplMac::ChangeMode(const wxVideoMode& mode)
|
|
||||||
{
|
|
||||||
unsigned long dwDMVer;
|
|
||||||
|
|
||||||
Gestalt( gestaltDisplayMgrVers, (long*)&dwDMVer );
|
|
||||||
if (GetCount() == 1 || dwDMVer >= 0x020000)
|
|
||||||
{
|
|
||||||
if (mode == wxDefaultVideoMode)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
//#ifndef __DARWIN__
|
|
||||||
// Handle hDisplayState;
|
|
||||||
// if (DMBeginConfigureDisplays(&hDisplayState) != noErr)
|
|
||||||
// {
|
|
||||||
// wxLogSysError(wxT("Could not lock display for display mode changing!"));
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// wxASSERT( DMUseScreenPrefs(true, hDisplayState) == noErr);
|
|
||||||
// DMEndConfigureDisplays(hDisplayState);
|
|
||||||
// return true;
|
|
||||||
//#else
|
|
||||||
// hmmmmm....
|
|
||||||
// return true;
|
|
||||||
//#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
//0 & NULL for params 2 & 3 of DMSetVideoMode signal it to use defaults (current mode)
|
|
||||||
//DM 2.0+ doesn't use params 2 & 3 of DMSetDisplayMode
|
|
||||||
//so we have to use this icky structure
|
|
||||||
VDSwitchInfoRec sMode;
|
|
||||||
memset( &sMode, 0, sizeof(VDSwitchInfoRec) );
|
|
||||||
|
|
||||||
DMListIndexType nNumModes;
|
|
||||||
DMListType pModes;
|
|
||||||
DMDisplayModeListIteratorUPP uppMLI;
|
|
||||||
DisplayIDType nDisplayID;
|
|
||||||
OSErr err;
|
|
||||||
|
|
||||||
err = DMGetDisplayIDByGDevice(m_hndl, &nDisplayID, false);
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
// Create a new list...
|
|
||||||
err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes);
|
|
||||||
wxASSERT_MSG(err == noErr, wxT("Could not create a new display mode list") );
|
|
||||||
|
|
||||||
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeInfoProc);
|
|
||||||
wxASSERT(uppMLI);
|
|
||||||
|
|
||||||
DMModeInfoRec sModeInfo;
|
|
||||||
sModeInfo.bMatched = false;
|
|
||||||
sModeInfo.pMode = &mode;
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < nNumModes; ++i)
|
|
||||||
{
|
|
||||||
err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
if (sModeInfo.bMatched)
|
|
||||||
{
|
|
||||||
sMode = sModeInfo.sMode;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == nNumModes)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
|
||||||
|
|
||||||
err = DMDisposeList(pModes);
|
|
||||||
verify_noerr( err );
|
|
||||||
|
|
||||||
// For the really paranoid -
|
|
||||||
// unsigned long flags;
|
|
||||||
// Boolean bok;
|
|
||||||
// wxASSERT(noErr == DMCheckDisplayMode(m_hndl, sMode.csData,
|
|
||||||
// sMode.csMode, &flags, NULL, &bok));
|
|
||||||
// wxASSERT(bok);
|
|
||||||
|
|
||||||
Handle hDisplayState;
|
|
||||||
if (DMBeginConfigureDisplays(&hDisplayState) != noErr)
|
|
||||||
{
|
|
||||||
wxLogSysError(wxT("Could not lock display for display mode changing!"));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned long dwBPP = (unsigned long) mode.bpp;
|
|
||||||
err = DMSetDisplayMode(
|
|
||||||
m_hndl, sMode.csData,
|
|
||||||
(unsigned long*) &(dwBPP),
|
|
||||||
NULL, //(unsigned long) &sMode
|
|
||||||
hDisplayState );
|
|
||||||
|
|
||||||
if (err != noErr)
|
|
||||||
{
|
|
||||||
DMEndConfigureDisplays(hDisplayState);
|
|
||||||
wxLogError(wxT("Could not set the display mode"));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
DMEndConfigureDisplays(hDisplayState);
|
|
||||||
}
|
|
||||||
else // DM 1.0, 1.2, 1.x
|
|
||||||
{
|
|
||||||
wxLogSysError(
|
|
||||||
wxString::Format(
|
|
||||||
wxT("Monitor gravitation not supported yet. dwDMVer:%u"),
|
|
||||||
(unsigned int) dwDMVer));
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// wxDisplay::CreateFactory()
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
/* static */ wxDisplayFactory *wxDisplay::CreateFactory()
|
|
||||||
{
|
|
||||||
return new wxDisplayFactoryMac;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // !OSX
|
|
||||||
|
|
||||||
#endif // wxUSE_DISPLAY
|
#endif // wxUSE_DISPLAY
|
||||||
|
@@ -389,8 +389,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(
|
|||||||
{
|
{
|
||||||
wxWindow *win = NULL;
|
wxWindow *win = NULL;
|
||||||
ControlPartCode controlPart;
|
ControlPartCode controlPart;
|
||||||
ControlRef control = wxMacFindControlUnderMouse(
|
ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart );
|
||||||
toplevel, localMouse, theWindow, &controlPart );
|
|
||||||
if ( control )
|
if ( control )
|
||||||
win = wxFindControlFromMacControl( control );
|
win = wxFindControlFromMacControl( control );
|
||||||
else
|
else
|
||||||
|
@@ -326,12 +326,6 @@ int wxListBox::DoListHitTest(const wxPoint& inpoint) const
|
|||||||
|
|
||||||
wxPoint point = inpoint;
|
wxPoint point = inpoint;
|
||||||
|
|
||||||
// interestingly enough 10.2 (and below?) have GetDataBrowserItemPartBounds
|
|
||||||
// giving root window coordinates but 10.3 and above give client coordinates
|
|
||||||
// so we only compare using root window coordinates on 10.3 and up
|
|
||||||
if ( UMAGetSystemVersion() < 0x1030 )
|
|
||||||
MacClientToRootWindow(&point.x, &point.y);
|
|
||||||
|
|
||||||
// get column property ID (req. for call to itempartbounds)
|
// get column property ID (req. for call to itempartbounds)
|
||||||
DataBrowserTableViewColumnID colId = 0;
|
DataBrowserTableViewColumnID colId = 0;
|
||||||
err = GetDataBrowserTableViewColumnProperty(m_peer->GetControlRef(), 0, &colId);
|
err = GetDataBrowserTableViewColumnProperty(m_peer->GetControlRef(), 0, &colId);
|
||||||
|
@@ -465,7 +465,6 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu )
|
|||||||
}
|
}
|
||||||
else // normal item
|
else // normal item
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
// what we do here is to hide the special items which are
|
// what we do here is to hide the special items which are
|
||||||
// shown in the application menu anyhow -- it doesn't make
|
// shown in the application menu anyhow -- it doesn't make
|
||||||
// sense to show them in their normal place as well
|
// sense to show them in their normal place as well
|
||||||
@@ -520,7 +519,6 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu )
|
|||||||
0 );
|
0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // TARGET_CARBON
|
|
||||||
}
|
}
|
||||||
|
|
||||||
previousItem = item ;
|
previousItem = item ;
|
||||||
@@ -751,7 +749,6 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
helpMenuHandle = NULL ;
|
helpMenuHandle = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
|
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
|
||||||
{
|
{
|
||||||
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
|
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
|
||||||
@@ -773,7 +770,6 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
else
|
else
|
||||||
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
wxString strippedHelpMenuTitle = wxStripMenuCodes( wxApp::s_macHelpMenuTitleName ) ;
|
wxString strippedHelpMenuTitle = wxStripMenuCodes( wxApp::s_macHelpMenuTitleName ) ;
|
||||||
wxString strippedTranslatedHelpMenuTitle = wxStripMenuCodes( wxString( _("&Help") ) ) ;
|
wxString strippedTranslatedHelpMenuTitle = wxStripMenuCodes( wxString( _("&Help") ) ) ;
|
||||||
|
@@ -100,7 +100,6 @@ void wxMenuItem::UpdateItemStatus()
|
|||||||
if ( IsSeparator() )
|
if ( IsSeparator() )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
|
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
|
||||||
{
|
{
|
||||||
if ( !IsEnabled() )
|
if ( !IsEnabled() )
|
||||||
@@ -116,7 +115,6 @@ void wxMenuItem::UpdateItemStatus()
|
|||||||
else
|
else
|
||||||
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
EnableMenuCommand( NULL , kHICommandQuit ) ;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
{
|
{
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
||||||
@@ -163,7 +161,6 @@ void wxMenuItem::UpdateItemText()
|
|||||||
void wxMenuItem::Enable(bool bDoEnable)
|
void wxMenuItem::Enable(bool bDoEnable)
|
||||||
{
|
{
|
||||||
if (( m_isEnabled != bDoEnable
|
if (( m_isEnabled != bDoEnable
|
||||||
#if TARGET_CARBON
|
|
||||||
// avoid changing menuitem state when menu is disabled
|
// avoid changing menuitem state when menu is disabled
|
||||||
// eg. BeginAppModalStateForWindow() will disable menus and ignore this change
|
// eg. BeginAppModalStateForWindow() will disable menus and ignore this change
|
||||||
// which in turn causes m_isEnabled to become out of sync with real menuitem state
|
// which in turn causes m_isEnabled to become out of sync with real menuitem state
|
||||||
@@ -172,7 +169,6 @@ void wxMenuItem::Enable(bool bDoEnable)
|
|||||||
|| ( GetId() == wxApp::s_macPreferencesMenuItemId
|
|| ( GetId() == wxApp::s_macPreferencesMenuItemId
|
||||||
|| GetId() == wxApp::s_macExitMenuItemId
|
|| GetId() == wxApp::s_macExitMenuItemId
|
||||||
|| GetId() == wxApp::s_macAboutMenuItemId
|
|| GetId() == wxApp::s_macAboutMenuItemId
|
||||||
#endif
|
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
wxMenuItemBase::Enable( bDoEnable ) ;
|
wxMenuItemBase::Enable( bDoEnable ) ;
|
||||||
|
@@ -105,10 +105,7 @@ bool wxNotebook::Create( wxWindow *parent,
|
|||||||
switch (GetWindowVariant())
|
switch (GetWindowVariant())
|
||||||
{
|
{
|
||||||
case wxWINDOW_VARIANT_MINI:
|
case wxWINDOW_VARIANT_MINI:
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
tabsize = 3 ;
|
tabsize = 3 ;
|
||||||
else
|
|
||||||
tabsize = kControlSizeSmall;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxWINDOW_VARIANT_SMALL:
|
case wxWINDOW_VARIANT_SMALL:
|
||||||
|
@@ -509,9 +509,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 )
|
if ( UMAGetSystemVersion() >= 0x1000 )
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#if !wxMAC_USE_CORE_GRAPHICS
|
#if !wxMAC_USE_CORE_GRAPHICS
|
||||||
GrafPtr thePort ;
|
GrafPtr thePort ;
|
||||||
|
@@ -52,15 +52,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined __WXMAC__ && defined __DARWIN__/*TARGET_CARBON*/
|
|
||||||
#ifdef __APPLE_CC__
|
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#else
|
|
||||||
#include <Carbon.h>
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#include <Sound.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//quicktime media layer only required for mac emulation on pc
|
//quicktime media layer only required for mac emulation on pc
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
|
@@ -408,16 +408,7 @@ void wxSearchCtrl::CreatePeer(
|
|||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size, long style )
|
const wxSize& size, long style )
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
{
|
|
||||||
m_peer = new wxMacSearchFieldControl( this , str , pos , size , style );
|
m_peer = new wxMacSearchFieldControl( this , str , pos , size , style );
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if ( !m_peer )
|
|
||||||
{
|
|
||||||
wxTextCtrl::CreatePeer( str, pos, size, style );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_NATIVE_SEARCH_CONTROL
|
#endif // wxUSE_NATIVE_SEARCH_CONTROL
|
||||||
|
@@ -58,15 +58,12 @@ void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const
|
|||||||
// Later on, the staticbox's font height is added to this.
|
// Later on, the staticbox's font height is added to this.
|
||||||
extraTop = 0;
|
extraTop = 0;
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 ) // Panther
|
|
||||||
{
|
|
||||||
// As indicated by the HIG, Panther needs an extra border of 11
|
// As indicated by the HIG, Panther needs an extra border of 11
|
||||||
// pixels (otherwise overlapping occurs at the top). The "other"
|
// pixels (otherwise overlapping occurs at the top). The "other"
|
||||||
// border has to be 11.
|
// border has to be 11.
|
||||||
extraTop = 11;
|
extraTop = 11;
|
||||||
other = 11;
|
other = 11;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
*borderTop = extraTop;
|
*borderTop = extraTop;
|
||||||
if ( !m_label.empty() )
|
if ( !m_label.empty() )
|
||||||
|
@@ -56,10 +56,7 @@ bool wxTabCtrl::Create( wxWindow *parent,
|
|||||||
tabsize = kControlTabSizeSmall ;
|
tabsize = kControlTabSizeSmall ;
|
||||||
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
|
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
|
||||||
{
|
{
|
||||||
if (UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
tabsize = 3 ;
|
tabsize = 3 ;
|
||||||
else
|
|
||||||
tabsize = kControlSizeSmall;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_peer = new wxMacControl( this );
|
m_peer = new wxMacControl( this );
|
||||||
|
@@ -45,30 +45,9 @@
|
|||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/sysopt.h"
|
#include "wx/sysopt.h"
|
||||||
|
|
||||||
#if defined(__BORLANDC__) && !defined(__WIN32__)
|
|
||||||
#include <alloc.h>
|
|
||||||
#elif !defined(__MWERKS__) && !defined(__GNUWIN32) && !defined(__DARWIN__)
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
#include <MacTextEditor.h>
|
|
||||||
#include <ATSUnicode.h>
|
|
||||||
#include <TextCommon.h>
|
|
||||||
#include <TextEncodingConverter.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
#include "wx/mac/carbon/private/mactext.h"
|
#include "wx/mac/carbon/private/mactext.h"
|
||||||
|
|
||||||
#ifndef __WXMAC_OSX__
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
kTXNVisibilityTag = 'visb' // set the visibility state of the object
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class wxMacFunctor
|
class wxMacFunctor
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
@@ -302,7 +281,6 @@ private :
|
|||||||
Rect m_txnControlBounds ;
|
Rect m_txnControlBounds ;
|
||||||
Rect m_txnVisBounds ;
|
Rect m_txnVisBounds ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ;
|
static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ;
|
||||||
static pascal void TXNScrollInfoProc(
|
static pascal void TXNScrollInfoProc(
|
||||||
SInt32 iValue, SInt32 iMaximumValue,
|
SInt32 iValue, SInt32 iMaximumValue,
|
||||||
@@ -312,7 +290,6 @@ private :
|
|||||||
SInt32 m_lastHorizontalValue ;
|
SInt32 m_lastHorizontalValue ;
|
||||||
ControlRef m_sbVertical ;
|
ControlRef m_sbVertical ;
|
||||||
SInt32 m_lastVerticalValue ;
|
SInt32 m_lastVerticalValue ;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -415,7 +392,7 @@ void wxTextCtrl::CreatePeer(
|
|||||||
if ( UMAGetSystemVersion() >= 0x1050 )
|
if ( UMAGetSystemVersion() >= 0x1050 )
|
||||||
forceMLTE = false;
|
forceMLTE = false;
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 && !forceMLTE )
|
if ( !forceMLTE )
|
||||||
{
|
{
|
||||||
if ( m_windowStyle & wxTE_MULTILINE )
|
if ( m_windowStyle & wxTE_MULTILINE )
|
||||||
m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
|
m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
|
||||||
@@ -1741,8 +1718,6 @@ void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background,
|
|||||||
// setting the default font:
|
// setting the default font:
|
||||||
// under 10.2 this causes a visible caret, therefore we avoid it
|
// under 10.2 this causes a visible caret, therefore we avoid it
|
||||||
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
{
|
|
||||||
Str255 fontName ;
|
Str255 fontName ;
|
||||||
SInt16 fontSize ;
|
SInt16 fontSize ;
|
||||||
Style fontStyle ;
|
Style fontStyle ;
|
||||||
@@ -1760,7 +1735,6 @@ void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background,
|
|||||||
m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes),
|
m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes),
|
||||||
typeAttr, kTXNStartOffset, kTXNEndOffset );
|
typeAttr, kTXNStartOffset, kTXNEndOffset );
|
||||||
verify_noerr( err );
|
verify_noerr( err );
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_windowStyle & wxTE_PASSWORD )
|
if ( m_windowStyle & wxTE_PASSWORD )
|
||||||
{
|
{
|
||||||
@@ -2327,8 +2301,6 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const
|
|||||||
// while this can be solved on 10.3 by reassigning them the correct place, on 10.2 there is
|
// while this can be solved on 10.3 by reassigning them the correct place, on 10.2 there is
|
||||||
// no way out, therefore we are using our own implementation and our own scrollbars ....
|
// no way out, therefore we are using our own implementation and our own scrollbars ....
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
|
|
||||||
TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
|
TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
|
||||||
ControlActionUPP gTXNScrollActionProc = NULL ;
|
ControlActionUPP gTXNScrollActionProc = NULL ;
|
||||||
|
|
||||||
@@ -2432,7 +2404,6 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef
|
|||||||
mlte->m_lastVerticalValue = newValue ;
|
mlte->m_lastVerticalValue = newValue ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// make correct activations
|
// make correct activations
|
||||||
void wxMacMLTEClassicControl::MacActivatePaneText(bool setActive)
|
void wxMacMLTEClassicControl::MacActivatePaneText(bool setActive)
|
||||||
@@ -2502,7 +2473,6 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
|
|||||||
m_txnVisBounds = visBounds ;
|
m_txnVisBounds = visBounds ;
|
||||||
wxMacWindowClipper cl( textctrl ) ;
|
wxMacWindowClipper cl( textctrl ) ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if ( m_sbHorizontal || m_sbVertical )
|
if ( m_sbHorizontal || m_sbVertical )
|
||||||
{
|
{
|
||||||
int w = bounds.right - bounds.left ;
|
int w = bounds.right - bounds.left ;
|
||||||
@@ -2564,13 +2534,6 @@ void wxMacMLTEClassicControl::MacUpdatePosition()
|
|||||||
m_txnControlBounds.right - (m_sbVertical ? 14 : 0),
|
m_txnControlBounds.right - (m_sbVertical ? 14 : 0),
|
||||||
m_txnFrameID );
|
m_txnFrameID );
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
|
|
||||||
TXNSetFrameBounds(
|
|
||||||
m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
|
|
||||||
wxMax( m_txnControlBounds.bottom, m_txnControlBounds.top ),
|
|
||||||
wxMax( m_txnControlBounds.right, m_txnControlBounds.left ), m_txnFrameID );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// the SetFrameBounds method under Classic sometimes does not correctly scroll a selection into sight after a
|
// the SetFrameBounds method under Classic sometimes does not correctly scroll a selection into sight after a
|
||||||
// movement, therefore we have to force it
|
// movement, therefore we have to force it
|
||||||
@@ -2807,8 +2770,6 @@ void wxMacMLTEClassicControl::SuperChangedPosition()
|
|||||||
wxMacControl::SuperChangedPosition() ;
|
wxMacControl::SuperChangedPosition() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
|
|
||||||
ControlUserPaneDrawUPP gTPDrawProc = NULL;
|
ControlUserPaneDrawUPP gTPDrawProc = NULL;
|
||||||
ControlUserPaneHitTestUPP gTPHitProc = NULL;
|
ControlUserPaneHitTestUPP gTPHitProc = NULL;
|
||||||
ControlUserPaneTrackingUPP gTPTrackProc = NULL;
|
ControlUserPaneTrackingUPP gTPTrackProc = NULL;
|
||||||
@@ -2891,8 +2852,6 @@ static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, Contro
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __WXMAC_OSX__
|
|
||||||
|
|
||||||
// TXNRegisterScrollInfoProc
|
// TXNRegisterScrollInfoProc
|
||||||
|
|
||||||
OSStatus wxMacMLTEClassicControl::DoCreate()
|
OSStatus wxMacMLTEClassicControl::DoCreate()
|
||||||
@@ -2901,7 +2860,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
|
|
||||||
// set up our globals
|
// set up our globals
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc);
|
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc);
|
||||||
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc);
|
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc);
|
||||||
if (gTPTrackProc == NULL) gTPTrackProc = NewControlUserPaneTrackingUPP(wxMacControlUserPaneTrackingProc);
|
if (gTPTrackProc == NULL) gTPTrackProc = NewControlUserPaneTrackingUPP(wxMacControlUserPaneTrackingProc);
|
||||||
@@ -2912,14 +2870,12 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
|
|
||||||
if (gTXNScrollInfoProc == NULL ) gTXNScrollInfoProc = NewTXNScrollInfoUPP(TXNScrollInfoProc) ;
|
if (gTXNScrollInfoProc == NULL ) gTXNScrollInfoProc = NewTXNScrollInfoUPP(TXNScrollInfoProc) ;
|
||||||
if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ;
|
if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ;
|
||||||
#endif
|
|
||||||
|
|
||||||
// set the initial settings for our private data
|
// set the initial settings for our private data
|
||||||
|
|
||||||
m_txnWindow = GetControlOwner(m_controlRef);
|
m_txnWindow = GetControlOwner(m_controlRef);
|
||||||
m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow);
|
m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow);
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
// set up the user pane procedures
|
// set up the user pane procedures
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
|
||||||
@@ -2928,7 +2884,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc);
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
|
||||||
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
|
||||||
#endif
|
|
||||||
|
|
||||||
// calculate the rectangles used by the control
|
// calculate the rectangles used by the control
|
||||||
UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds );
|
UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds );
|
||||||
@@ -2945,7 +2900,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
// create the new edit field
|
// create the new edit field
|
||||||
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle );
|
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle );
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
// the scrollbars are not correctly embedded but are inserted at the root:
|
// the scrollbars are not correctly embedded but are inserted at the root:
|
||||||
// this gives us problems as we have erratic redraws even over the structure area
|
// this gives us problems as we have erratic redraws even over the structure area
|
||||||
|
|
||||||
@@ -2975,8 +2929,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
frameOptions &= ~(kTXNWantHScrollBarMask | kTXNDrawGrowIconMask);
|
frameOptions &= ~(kTXNWantHScrollBarMask | kTXNDrawGrowIconMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
err = TXNNewObject(
|
err = TXNNewObject(
|
||||||
NULL, m_txnWindow, &bounds, frameOptions,
|
NULL, m_txnWindow, &bounds, frameOptions,
|
||||||
kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding,
|
kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding,
|
||||||
@@ -2996,9 +2948,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
|
|||||||
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) );
|
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32)this );
|
TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32)this );
|
||||||
#endif
|
|
||||||
|
|
||||||
SetGWorld( origPort , origDev ) ;
|
SetGWorld( origPort , origDev ) ;
|
||||||
|
|
||||||
|
@@ -25,21 +25,12 @@
|
|||||||
#include "wx/sysopt.h"
|
#include "wx/sysopt.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
const short kwxMacToolBarToolDefaultWidth = 16;
|
const short kwxMacToolBarToolDefaultWidth = 16;
|
||||||
const short kwxMacToolBarToolDefaultHeight = 16;
|
const short kwxMacToolBarToolDefaultHeight = 16;
|
||||||
const short kwxMacToolBarTopMargin = 4;
|
const short kwxMacToolBarTopMargin = 4;
|
||||||
const short kwxMacToolBarLeftMargin = 4;
|
const short kwxMacToolBarLeftMargin = 4;
|
||||||
const short kwxMacToolBorder = 0;
|
const short kwxMacToolBorder = 0;
|
||||||
const short kwxMacToolSpacing = 6;
|
const short kwxMacToolSpacing = 6;
|
||||||
#else
|
|
||||||
const short kwxMacToolBarToolDefaultWidth = 24;
|
|
||||||
const short kwxMacToolBarToolDefaultHeight = 22;
|
|
||||||
const short kwxMacToolBarTopMargin = 2;
|
|
||||||
const short kwxMacToolBarLeftMargin = 2;
|
|
||||||
const short kwxMacToolBorder = 4;
|
|
||||||
const short kwxMacToolSpacing = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
|
||||||
@@ -243,9 +234,7 @@ private:
|
|||||||
static const EventTypeSpec eventList[] =
|
static const EventTypeSpec eventList[] =
|
||||||
{
|
{
|
||||||
{ kEventClassControl, kEventControlHit },
|
{ kEventClassControl, kEventControlHit },
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
{ kEventClassControl, kEventControlHitTest },
|
{ kEventClassControl, kEventControlHitTest },
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef WXUNUSED(handler), EventRef event, void *data )
|
static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef WXUNUSED(handler), EventRef event, void *data )
|
||||||
@@ -266,11 +255,7 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef
|
|||||||
{
|
{
|
||||||
bool shouldToggle;
|
bool shouldToggle;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
shouldToggle = !tbartool->IsToggled();
|
shouldToggle = !tbartool->IsToggled();
|
||||||
#else
|
|
||||||
shouldToggle = (GetControl32BitValue( (ControlRef)(tbartool->GetControlHandle()) ) != 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tbar->ToggleTool( tbartool->GetId(), shouldToggle );
|
tbar->ToggleTool( tbartool->GetId(), shouldToggle );
|
||||||
}
|
}
|
||||||
@@ -281,7 +266,6 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
case kEventControlHitTest:
|
case kEventControlHitTest:
|
||||||
{
|
{
|
||||||
HIPoint pt = cEvent.GetParameter<HIPoint>(kEventParamMouseLocation);
|
HIPoint pt = cEvent.GetParameter<HIPoint>(kEventParamMouseLocation);
|
||||||
@@ -295,7 +279,6 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef
|
|||||||
result = noErr;
|
result = noErr;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -451,7 +434,6 @@ void wxToolBarTool::SetPosition( const wxPoint& position )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// separator
|
// separator
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
Rect contrlRect;
|
Rect contrlRect;
|
||||||
GetControlBounds( m_controlHandle, &contrlRect );
|
GetControlBounds( m_controlHandle, &contrlRect );
|
||||||
int former_mac_x = contrlRect.left;
|
int former_mac_x = contrlRect.left;
|
||||||
@@ -459,13 +441,11 @@ void wxToolBarTool::SetPosition( const wxPoint& position )
|
|||||||
|
|
||||||
if ( mac_x != former_mac_x || mac_y != former_mac_y )
|
if ( mac_x != former_mac_x || mac_y != former_mac_y )
|
||||||
UMAMoveControl( m_controlHandle, mac_x, mac_y );
|
UMAMoveControl( m_controlHandle, mac_x, mac_y );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBarTool::UpdateToggleImage( bool toggle )
|
void wxToolBarTool::UpdateToggleImage( bool toggle )
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if ( toggle )
|
if ( toggle )
|
||||||
{
|
{
|
||||||
int w = m_bmpNormal.GetWidth();
|
int w = m_bmpNormal.GetWidth();
|
||||||
@@ -516,9 +496,6 @@ void wxToolBarTool::UpdateToggleImage( bool toggle )
|
|||||||
sizeof(transform), (Ptr)&transform );
|
sizeof(transform), (Ptr)&transform );
|
||||||
HIViewSetNeedsDisplay( m_controlHandle, true );
|
HIViewSetNeedsDisplay( m_controlHandle, true );
|
||||||
|
|
||||||
#else
|
|
||||||
::SetControl32BitValue( m_controlHandle, toggle );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxToolBarTool::wxToolBarTool(
|
wxToolBarTool::wxToolBarTool(
|
||||||
@@ -1741,10 +1718,9 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
|||||||
GetSize( &w, &h );
|
GetSize( &w, &h );
|
||||||
|
|
||||||
bool drawMetalTheme = MacGetTopLevelWindow()->MacGetMetalAppearance();
|
bool drawMetalTheme = MacGetTopLevelWindow()->MacGetMetalAppearance();
|
||||||
bool minimumUmaAvailable = (UMAGetSystemVersion() >= 0x1030);
|
|
||||||
|
|
||||||
#if wxMAC_USE_CORE_GRAPHICS
|
#if wxMAC_USE_CORE_GRAPHICS
|
||||||
if ( !drawMetalTheme && minimumUmaAvailable )
|
if ( !drawMetalTheme )
|
||||||
{
|
{
|
||||||
HIThemePlacardDrawInfo info;
|
HIThemePlacardDrawInfo info;
|
||||||
memset( &info, 0, sizeof(info) );
|
memset( &info, 0, sizeof(info) );
|
||||||
@@ -1768,7 +1744,7 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
|||||||
{
|
{
|
||||||
wxMacPortSetter helper( &dc );
|
wxMacPortSetter helper( &dc );
|
||||||
|
|
||||||
if ( !drawMetalTheme || !minimumUmaAvailable )
|
if ( !drawMetalTheme )
|
||||||
{
|
{
|
||||||
Rect toolbarrect = { dc.YLOG2DEVMAC(0), dc.XLOG2DEVMAC(0),
|
Rect toolbarrect = { dc.YLOG2DEVMAC(0), dc.XLOG2DEVMAC(0),
|
||||||
dc.YLOG2DEVMAC(h), dc.XLOG2DEVMAC(w) };
|
dc.YLOG2DEVMAC(h), dc.XLOG2DEVMAC(w) };
|
||||||
|
@@ -442,18 +442,6 @@ ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, const Point
|
|||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow , const Point& location , WindowRef window , ControlPartCode *outPart )
|
|
||||||
{
|
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
return FindControlUnderMouse( location , window , outPart ) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ControlRef rootControl = NULL ;
|
|
||||||
verify_noerr( GetRootControl( window , &rootControl ) ) ;
|
|
||||||
|
|
||||||
return wxMacFindSubControl( toplevelWindow , location , rootControl , outPart ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NEW_CAPTURE_HANDLING 1
|
#define NEW_CAPTURE_HANDLING 1
|
||||||
|
|
||||||
@@ -620,13 +608,7 @@ wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler),
|
|||||||
// if built-in find control is finding the wrong control (ie static box instead of overlaid
|
// if built-in find control is finding the wrong control (ie static box instead of overlaid
|
||||||
// button, we cannot let the standard handler do its job, but must handle manually
|
// button, we cannot let the standard handler do its job, but must handle manually
|
||||||
|
|
||||||
if ( ( cEvent.GetKind() == kEventMouseDown )
|
if ( cEvent.GetKind() == kEventMouseDown )
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
&&
|
|
||||||
(FindControlUnderMouse(windowMouseLocation , window , &dummyPart) !=
|
|
||||||
wxMacFindControlUnderMouse( toplevelWindow , windowMouseLocation , window , &dummyPart ) )
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if ( currentMouseWindow->MacIsReallyEnabled() )
|
if ( currentMouseWindow->MacIsReallyEnabled() )
|
||||||
{
|
{
|
||||||
|
@@ -18,19 +18,6 @@
|
|||||||
#include "wx/toplevel.h"
|
#include "wx/toplevel.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
|
|
||||||
#ifndef __DARWIN__
|
|
||||||
# include <MacTextEditor.h>
|
|
||||||
# include <Navigation.h>
|
|
||||||
# if defined(TARGET_CARBON)
|
|
||||||
# if PM_USE_SESSION_APIS
|
|
||||||
# include <PMCore.h>
|
|
||||||
# endif
|
|
||||||
# include <PMApplication.h>
|
|
||||||
# else
|
|
||||||
# include <Printing.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
// since we have decided that we only support 8.6 upwards we are
|
// since we have decided that we only support 8.6 upwards we are
|
||||||
@@ -116,14 +103,8 @@ MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding
|
|||||||
wxString str = wxStripMenuCodes( title ) ;
|
wxString str = wxStripMenuCodes( title ) ;
|
||||||
MenuRef menu ;
|
MenuRef menu ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
CreateNewMenu( id , 0 , &menu ) ;
|
CreateNewMenu( id , 0 , &menu ) ;
|
||||||
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding ) ) ;
|
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding ) ) ;
|
||||||
#else
|
|
||||||
Str255 ptitle ;
|
|
||||||
wxMacStringToPascal( str , ptitle ) ;
|
|
||||||
menu = ::NewMenu( id , ptitle ) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return menu ;
|
return menu ;
|
||||||
}
|
}
|
||||||
@@ -132,14 +113,7 @@ void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding enco
|
|||||||
{
|
{
|
||||||
wxString str = wxStripMenuCodes( title ) ;
|
wxString str = wxStripMenuCodes( title ) ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding) ) ;
|
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding) ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
Str255 ptitle ;
|
|
||||||
wxMacStringToPascal( str , ptitle ) ;
|
|
||||||
SetMenuTitle( menu , ptitle ) ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title, wxFontEncoding encoding )
|
void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title, wxFontEncoding encoding )
|
||||||
@@ -147,14 +121,7 @@ void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& titl
|
|||||||
// we don't strip the accels here anymore, must be done before
|
// we don't strip the accels here anymore, must be done before
|
||||||
wxString str = title ;
|
wxString str = title ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str , encoding) ) ;
|
SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str , encoding) ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
Str255 ptitle ;
|
|
||||||
wxMacStringToPascal( str , ptitle ) ;
|
|
||||||
SetMenuItemText( menu , item , ptitle ) ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UInt32 UMAMenuEvent( EventRecord *inEvent )
|
UInt32 UMAMenuEvent( EventRecord *inEvent )
|
||||||
@@ -346,54 +313,6 @@ void UMAInsertMenuItem( MenuRef menu , const wxString& title, wxFontEncoding enc
|
|||||||
UMASetMenuItemShortcut( menu , item+1 , entry ) ;
|
UMASetMenuItemShortcut( menu , item+1 , entry ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// quickdraw
|
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
|
||||||
|
|
||||||
int gPrOpenCounter = 0 ;
|
|
||||||
|
|
||||||
OSStatus UMAPrOpen()
|
|
||||||
{
|
|
||||||
OSErr err = noErr ;
|
|
||||||
|
|
||||||
++gPrOpenCounter ;
|
|
||||||
|
|
||||||
if ( gPrOpenCounter == 1 )
|
|
||||||
{
|
|
||||||
PrOpen() ;
|
|
||||||
err = PrError() ;
|
|
||||||
wxASSERT( err == noErr ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
return err ;
|
|
||||||
}
|
|
||||||
|
|
||||||
OSStatus UMAPrClose()
|
|
||||||
{
|
|
||||||
OSErr err = noErr ;
|
|
||||||
|
|
||||||
wxASSERT( gPrOpenCounter >= 1 ) ;
|
|
||||||
|
|
||||||
if ( gPrOpenCounter == 1 )
|
|
||||||
{
|
|
||||||
PrClose() ;
|
|
||||||
err = PrError() ;
|
|
||||||
wxASSERT( err == noErr ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
--gPrOpenCounter ;
|
|
||||||
|
|
||||||
return err ;
|
|
||||||
}
|
|
||||||
|
|
||||||
pascal QDGlobalsPtr GetQDGlobalsPtr() ;
|
|
||||||
pascal QDGlobalsPtr GetQDGlobalsPtr()
|
|
||||||
{
|
|
||||||
return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void UMAShowWatchCursor()
|
void UMAShowWatchCursor()
|
||||||
{
|
{
|
||||||
SetThemeCursor(kThemeWatchCursor);
|
SetThemeCursor(kThemeWatchCursor);
|
||||||
@@ -410,11 +329,7 @@ GrafPtr UMAGetWindowPort( WindowRef inWindowRef )
|
|||||||
{
|
{
|
||||||
wxASSERT( inWindowRef != NULL ) ;
|
wxASSERT( inWindowRef != NULL ) ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
return (GrafPtr) GetWindowPort( inWindowRef ) ;
|
return (GrafPtr) GetWindowPort( inWindowRef ) ;
|
||||||
#else
|
|
||||||
return (GrafPtr) inWindowRef ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADisposeWindow( WindowRef inWindowRef )
|
void UMADisposeWindow( WindowRef inWindowRef )
|
||||||
@@ -426,128 +341,34 @@ void UMADisposeWindow( WindowRef inWindowRef )
|
|||||||
|
|
||||||
void UMASetWTitle( WindowRef inWindowRef , const wxString& title , wxFontEncoding encoding )
|
void UMASetWTitle( WindowRef inWindowRef , const wxString& title , wxFontEncoding encoding )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title , encoding) ) ;
|
SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title , encoding) ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
Str255 ptitle ;
|
|
||||||
wxMacStringToPascal( title , ptitle ) ;
|
|
||||||
SetWTitle( inWindowRef , ptitle ) ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// appearance additions
|
// appearance additions
|
||||||
|
|
||||||
void UMASetControlTitle( ControlRef inControl , const wxString& title , wxFontEncoding encoding )
|
void UMASetControlTitle( ControlRef inControl , const wxString& title , wxFontEncoding encoding )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title , encoding) ) ;
|
SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title , encoding) ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
Str255 ptitle ;
|
|
||||||
wxMacStringToPascal( title , ptitle ) ;
|
|
||||||
SetControlTitle( inControl , ptitle ) ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAActivateControl( ControlRef inControl )
|
void UMAActivateControl( ControlRef inControl )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
::ActivateControl( inControl ) ;
|
::ActivateControl( inControl ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
// we have to add the control after again to the update rgn
|
|
||||||
// otherwise updates get lost
|
|
||||||
if ( !IsControlActive( inControl ) )
|
|
||||||
{
|
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
|
||||||
if ( visible )
|
|
||||||
SetControlVisibility( inControl , false , false ) ;
|
|
||||||
|
|
||||||
::ActivateControl( inControl ) ;
|
|
||||||
|
|
||||||
if ( visible )
|
|
||||||
{
|
|
||||||
SetControlVisibility( inControl , true , false ) ;
|
|
||||||
|
|
||||||
Rect ctrlBounds ;
|
|
||||||
InvalWindowRect( GetControlOwner(inControl), UMAGetControlBoundsInWindowCoords(inControl, &ctrlBounds) ) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMAMoveControl( ControlRef inControl , short x , short y )
|
void UMAMoveControl( ControlRef inControl , short x , short y )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
::MoveControl( inControl , x , y ) ;
|
::MoveControl( inControl , x , y ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
|
||||||
if ( visible )
|
|
||||||
{
|
|
||||||
SetControlVisibility( inControl , false , false ) ;
|
|
||||||
Rect ctrlBounds ;
|
|
||||||
InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
::MoveControl( inControl , x , y ) ;
|
|
||||||
|
|
||||||
if ( visible )
|
|
||||||
{
|
|
||||||
SetControlVisibility( inControl , true , false ) ;
|
|
||||||
Rect ctrlBounds ;
|
|
||||||
InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMASizeControl( ControlRef inControl , short x , short y )
|
void UMASizeControl( ControlRef inControl , short x , short y )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
::SizeControl( inControl , x , y ) ;
|
::SizeControl( inControl , x , y ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
|
||||||
if ( visible )
|
|
||||||
{
|
|
||||||
SetControlVisibility( inControl , false , false ) ;
|
|
||||||
Rect ctrlBounds ;
|
|
||||||
InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
::SizeControl( inControl , x , y ) ;
|
|
||||||
|
|
||||||
if ( visible )
|
|
||||||
{
|
|
||||||
SetControlVisibility( inControl , true , false ) ;
|
|
||||||
Rect ctrlBounds ;
|
|
||||||
InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UMADeactivateControl( ControlRef inControl )
|
void UMADeactivateControl( ControlRef inControl )
|
||||||
{
|
{
|
||||||
#if TARGET_API_MAC_OSX
|
|
||||||
::DeactivateControl( inControl ) ;
|
::DeactivateControl( inControl ) ;
|
||||||
|
|
||||||
#else
|
|
||||||
// we have to add the control after again to the update rgn
|
|
||||||
// otherwise updates get lost
|
|
||||||
bool visible = IsControlVisible( inControl ) ;
|
|
||||||
if ( visible )
|
|
||||||
SetControlVisibility( inControl , false , false ) ;
|
|
||||||
|
|
||||||
::DeactivateControl( inControl ) ;
|
|
||||||
|
|
||||||
if ( visible )
|
|
||||||
{
|
|
||||||
SetControlVisibility( inControl , true , false ) ;
|
|
||||||
Rect ctrlBounds ;
|
|
||||||
InvalWindowRect( GetControlOwner(inControl), UMAGetControlBoundsInWindowCoords(inControl, &ctrlBounds) ) ;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// shows the control and adds the region to the update region
|
// shows the control and adds the region to the update region
|
||||||
@@ -639,11 +460,6 @@ OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
|
||||||
static OSStatus helpMenuStatus = noErr ;
|
|
||||||
static MenuItemIndex firstCustomItemIndex = 0 ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static OSStatus UMAGetHelpMenu(
|
static OSStatus UMAGetHelpMenu(
|
||||||
MenuRef * outHelpMenu,
|
MenuRef * outHelpMenu,
|
||||||
MenuItemIndex * outFirstCustomItemIndex,
|
MenuItemIndex * outFirstCustomItemIndex,
|
||||||
@@ -654,7 +470,6 @@ static OSStatus UMAGetHelpMenu(
|
|||||||
MenuItemIndex * outFirstCustomItemIndex,
|
MenuItemIndex * outFirstCustomItemIndex,
|
||||||
bool allowHelpMenuCreation)
|
bool allowHelpMenuCreation)
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
static bool s_createdHelpMenu = false ;
|
static bool s_createdHelpMenu = false ;
|
||||||
|
|
||||||
if ( !s_createdHelpMenu && !allowHelpMenuCreation )
|
if ( !s_createdHelpMenu && !allowHelpMenuCreation )
|
||||||
@@ -665,21 +480,6 @@ static OSStatus UMAGetHelpMenu(
|
|||||||
OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
|
OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
|
||||||
s_createdHelpMenu = ( status == noErr ) ;
|
s_createdHelpMenu = ( status == noErr ) ;
|
||||||
return status ;
|
return status ;
|
||||||
#else
|
|
||||||
wxUnusedVar( allowHelpMenuCreation ) ;
|
|
||||||
MenuRef helpMenuHandle ;
|
|
||||||
|
|
||||||
helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ;
|
|
||||||
if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr )
|
|
||||||
firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ;
|
|
||||||
|
|
||||||
if ( outFirstCustomItemIndex )
|
|
||||||
*outFirstCustomItemIndex = firstCustomItemIndex ;
|
|
||||||
|
|
||||||
*outHelpMenu = helpMenuHandle ;
|
|
||||||
|
|
||||||
return helpMenuStatus ;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus UMAGetHelpMenu(
|
OSStatus UMAGetHelpMenu(
|
||||||
|
@@ -671,7 +671,6 @@ void wxMacWakeUp()
|
|||||||
SameProcess( &gAppProcess , &psn , &isSame );
|
SameProcess( &gAppProcess , &psn , &isSame );
|
||||||
if ( isSame )
|
if ( isSame )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -697,9 +696,6 @@ void wxMacWakeUp()
|
|||||||
kEventAttributeNone );
|
kEventAttributeNone );
|
||||||
err = PostEventToQueue(GetMainEventQueue(), wakeupEvent,
|
err = PostEventToQueue(GetMainEventQueue(), wakeupEvent,
|
||||||
kEventPriorityHigh );
|
kEventPriorityHigh );
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
PostEvent( nullEvent , 0 );
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2207,7 +2203,6 @@ OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable )
|
|||||||
// Quartz Support
|
// Quartz Support
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
// snippets from Sketch Sample from Apple :
|
// snippets from Sketch Sample from Apple :
|
||||||
|
|
||||||
#define kGenericRGBProfilePathStr "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
|
#define kGenericRGBProfilePathStr "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
|
||||||
@@ -2277,7 +2272,6 @@ CGColorSpaceRef wxMacGetGenericRGBColorSpace()
|
|||||||
|
|
||||||
return genericRGBColorSpace;
|
return genericRGBColorSpace;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __LP64__
|
#ifndef __LP64__
|
||||||
|
|
||||||
|
@@ -329,11 +329,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
|
|||||||
Boolean focusEverything = false ;
|
Boolean focusEverything = false ;
|
||||||
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
if ( cEvent.GetParameter<Boolean>(kEventParamControlFocusEverything , &focusEverything ) == noErr )
|
if ( cEvent.GetParameter<Boolean>(kEventParamControlFocusEverything , &focusEverything ) == noErr )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( thisWindow->MacIsUserPane() )
|
if ( thisWindow->MacIsUserPane() )
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
@@ -1156,17 +1154,9 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxWINDOW_VARIANT_MINI :
|
case wxWINDOW_VARIANT_MINI :
|
||||||
if (UMAGetSystemVersion() >= 0x1030 )
|
|
||||||
{
|
|
||||||
// not always defined in the headers
|
// not always defined in the headers
|
||||||
size = 3 ;
|
size = 3 ;
|
||||||
themeFont = 109 ;
|
themeFont = 109 ;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
size = kControlSizeSmall;
|
|
||||||
themeFont = kThemeSmallSystemFont ;
|
|
||||||
}
|
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxWINDOW_VARIANT_LARGE :
|
case wxWINDOW_VARIANT_LARGE :
|
||||||
@@ -1730,7 +1720,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
|
|||||||
|
|
||||||
GetMouse( &pt ) ;
|
GetMouse( &pt ) ;
|
||||||
#endif
|
#endif
|
||||||
control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ;
|
control = FindControlUnderMouse( pt , window , &part ) ;
|
||||||
if ( control )
|
if ( control )
|
||||||
mouseWin = wxFindControlFromMacControl( control ) ;
|
mouseWin = wxFindControlFromMacControl( control ) ;
|
||||||
|
|
||||||
@@ -1842,13 +1832,7 @@ void wxWindowMac::MacInvalidateBorders()
|
|||||||
RectRgn( updateOuter, &rect ) ;
|
RectRgn( updateOuter, &rect ) ;
|
||||||
DiffRgn( updateOuter, updateInner , updateOuter ) ;
|
DiffRgn( updateOuter, updateInner , updateOuter ) ;
|
||||||
|
|
||||||
#ifdef __WXMAC_OSX__
|
|
||||||
GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ;
|
GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ;
|
||||||
#else
|
|
||||||
WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ;
|
|
||||||
if ( tlw )
|
|
||||||
InvalWindowRgn( tlw , updateOuter ) ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DisposeRgn( updateOuter ) ;
|
DisposeRgn( updateOuter ) ;
|
||||||
DisposeRgn( updateInner ) ;
|
DisposeRgn( updateInner ) ;
|
||||||
|
Reference in New Issue
Block a user