wxTheApp->ProcessPendingEvents();
}
+ProcessSerialNumber gAppProcess ;
+
bool wxApp::Initialize(int& argc, wxChar **argv)
{
// Mac-specific
if ( !wxAppBase::Initialize(argc, argv) )
return false;
+ GetCurrentProcess(&gAppProcess);
+
#if wxUSE_INTL
wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding());
#endif
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
-#ifdef __DARWIN__
- #include <ApplicationServices/ApplicationServices.h>
- #include <QuickTime/QuickTime.h>
-#else
- #include <PictUtils.h>
-#endif
+#include <ApplicationServices/ApplicationServices.h>
+#include <QuickTime/QuickTime.h>
#include "wx/mac/uma.h"
m_bytesPerRow = 0;
m_ok = false ;
m_bitmapMask = NULL ;
-
-#ifdef __WXMAC_OSX__
m_cgImageRef = NULL ;
-#endif
m_iconRef = NULL ;
m_pictHandle = NULL ;
++m_rawAccessCount ;
-#ifdef __WXMAC_OSX__
// we must destroy an existing cached image, as
// the bitmap data may change now
if ( m_cgImageRef )
CGImageRelease( m_cgImageRef ) ;
m_cgImageRef = NULL ;
}
-#endif
return m_memBuf.GetData() ;
}
return m_pictHandle ;
}
-#ifdef __WXMAC_OSX__
void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t WXUNUSED(size))
{
wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ;
CGImageRef image ;
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 ( m_bitmapMask )
return image ;
}
-#endif
#if wxMAC_USE_CORE_GRAPHICS
CGContextRef wxBitmapRefData::GetBitmapContext() const
{
wxASSERT_MSG( m_rawAccessCount == 0 , wxT("Bitmap still selected when destroyed") ) ;
-#ifdef __WXMAC_OSX__
if ( m_cgImageRef )
{
CGImageRelease( m_cgImageRef ) ;
m_cgImageRef = NULL ;
}
-#endif
if ( m_iconRef )
{
M_BITMAPDATA->EndRawAccess() ;
}
-#ifdef __WXMAC_OSX__
WXCGIMAGEREF wxBitmap::CGImageCreate() const
{
wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ;
return M_BITMAPDATA->CGImageCreate() ;
}
-#endif
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
{
m_bmpNormal = bitmap;
-#ifdef __WXMAC_OSX__
if ( HasFlag( wxBORDER_NONE ) )
{
// contrary to the docs this control only works with iconrefs
&bounds, &info, false, m_peer->GetControlRefAddr() );
}
else
-#endif
{
wxMacCreateBitmapButton( &info, m_bmpNormal );
err = CreateBevelButtonControl(
ControlButtonContentInfo info;
-#ifdef __WXMAC_OSX__
if ( HasFlag( wxBORDER_NONE ) )
{
wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef );
m_peer->SetData( kControlIconPart, kControlIconContentTag, info );
}
else
-#endif
{
wxMacCreateBitmapButton( &info, m_bmpNormal );
if ( info.contentType != kControlNoContent )
}
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
if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL || GetWindowVariant() == wxWINDOW_VARIANT_LARGE )
{
bounds.bottom = bounds.top + 15 ;
m_maxHeight = 15 ;
}
-#endif
-
err = CreatePushButtonControl(
MAC_WXHWND(parent->MacGetTopLevelWindowRef()),
&bounds, CFSTR(""), m_peer->GetControlRefAddr() );
#include "wx/mac/uma.h"
-#ifndef __DARWIN__
-#include <Appearance.h>
-#endif
-
IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
int lbHeight = 20;
int wLine;
-#if TARGET_CARBON
SInt32 metric ;
GetThemeMetric( kThemeMetricPopupButtonHeight , &metric );
lbHeight = metric ;
-#endif
{
#if wxMAC_USE_CORE_GRAPHICS
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()
{
m_open = false;
- m_data = new wxMacBinaryCompatHelper() ;
+ m_data = NULL ;
PasteboardRef clipboard = 0;
OSStatus err = PasteboardCreate( kPasteboardClipboard, &clipboard );
if (err != noErr)
{
wxLogSysError( wxT("Failed to create the clipboard.") );
}
- M_CLIPBOARD->m_pasteboard.reset(clipboard);
+ m_pasteboard.reset(clipboard);
}
wxClipboard::~wxClipboard()
{
- M_CLIPBOARD->m_pasteboard.reset((PasteboardRef)0);
- delete m_data;
+ m_pasteboard.reset((PasteboardRef)0);
+ delete m_data;
}
void wxClipboard::Clear()
{
- if (M_CLIPBOARD->m_trueData != NULL)
+ if (m_data != NULL)
{
- delete M_CLIPBOARD->m_trueData;
- M_CLIPBOARD->m_trueData = NULL;
+ delete m_data;
+ m_data = NULL;
}
- OSStatus err = PasteboardClear( M_CLIPBOARD->m_pasteboard );
+ OSStatus err = PasteboardClear( m_pasteboard );
if (err != noErr)
{
wxLogSysError( wxT("Failed to empty the clipboard.") );
// we can only store one wxDataObject
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&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;
}
// Get rid of cached object.
// If this is not done, copying data from
// another application will only work once
- if (M_CLIPBOARD->m_trueData)
+ if (m_data)
{
- delete M_CLIPBOARD->m_trueData;
- M_CLIPBOARD->m_trueData = (wxDataObject*) NULL;
+ delete m_data;
+ m_data = (wxDataObject*) NULL;
}
}
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
{
- if ( M_CLIPBOARD->m_trueData )
- return M_CLIPBOARD->m_trueData->IsSupported( dataFormat );
- return wxDataObject::IsFormatInPasteboard( M_CLIPBOARD->m_pasteboard, dataFormat );
+ if ( m_data )
+ return m_data->IsSupported( dataFormat );
+ return wxDataObject::IsFormatInPasteboard( m_pasteboard, dataFormat );
}
bool wxClipboard::GetData( wxDataObject& data )
bool transferred = false;
- if ( M_CLIPBOARD->m_trueData )
+ if ( m_data )
{
for (size_t i = 0; !transferred && i < formatcount; 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;
if (dataSize == 0)
else
{
char *d = new char[ dataSize ];
- M_CLIPBOARD->m_trueData->GetDataHere( format, (void*)d );
+ m_data->GetDataHere( format, (void*)d );
data.SetData( format, dataSize, d );
delete [] d;
}
// get formats from wxDataObjects
if ( !transferred )
{
- transferred = data.GetFromPasteboard( M_CLIPBOARD->m_pasteboard ) ;
+ transferred = data.GetFromPasteboard( m_pasteboard ) ;
}
delete [] array;
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
#include "wx/mac/private.h"
-#ifndef __DARWIN__
-#include <ColorPicker.h>
-#endif
/*
* wxColourDialog
{
RGBColor currentColor = *((RGBColor*)m_colourData.m_dataColour.GetPixel()) ;
-#if TARGET_API_MAC_OSX
NColorPickerInfo info;
OSStatus err ;
memset(&info, 0, sizeof(info)) ;
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;
}
// ----------------------------------------------------------------------------
// 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
// around text control.
static const wxCoord MARGIN = 4;
// this is the border a focus rect on OSX is needing
static const int TEXTFOCUSBORDER = 3 ;
-#else
-static const wxCoord MARGIN = 2;
-static const int TEXTFOCUSBORDER = 0 ;
-#endif
// ----------------------------------------------------------------------------
flags |= kDataBrowserSelectOnlyOne;
(void) this->SetSelectionFlags(flags);
} /* if */
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
OptionBits attributes; // variable definition
if (this->GetAttributes(&attributes) == noErr) // get default settings
attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers;
(void) this->SetAttributes(attributes);
} /* if */
-#endif
if ((style & wxDV_NO_HEADER) != 0)
this->SetHeaderButtonHeight(0);
} /* wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow*, wxPoint const&, wxSize const&, long) */
return ::SetDataBrowserTableViewGeometry(this->GetControlRef(),enableWidth,enableHeight);
} /* wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool, bool) */
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes)
{
return ::DataBrowserGetAttributes(this->GetControlRef(),attributes);
} /* wxMacDataBrowserTableViewControl::GetAttributes(OptionBits*) */
-#endif
OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth(DataBrowserPropertyID propertyID, UInt16* width) const
{
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)
{
return ::DataBrowserChangeAttributes(this->GetControlRef(),attributes,~attributes);
} /* wxMacDataBrowserTableViewControl::SetAttributes(OptionBits) */
-#endif
OSStatus wxMacDataBrowserTableViewControl::SetColumnWidth(DataBrowserPropertyID propertyID, UInt16 width)
{
wxModelessWindows.DeleteObject( this );
-#if TARGET_CARBON
SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
-#endif
}
else
{
return true;
}
-#if !TARGET_CARBON
-extern bool s_macIsInModalLoop ;
-#endif
-
void wxDialog::DoShowModal()
{
wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
#include "wx/gdicmn.h"
#endif
-#ifdef __DARWIN__
- #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 <Carbon/Carbon.h>
#include "wx/display_impl.h"
// display classes implementation
// ----------------------------------------------------------------------------
-#ifdef __WXMAC_OSX__
-
class wxDisplayImplMacOSX : public wxDisplayImpl
{
public:
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
{
wxWindow *win = NULL;
ControlPartCode controlPart;
- ControlRef control = wxMacFindControlUnderMouse(
- toplevel, localMouse, theWindow, &controlPart );
+ ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart );
if ( control )
win = wxFindControlFromMacControl( control );
else
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)
DataBrowserTableViewColumnID colId = 0;
err = GetDataBrowserTableViewColumnProperty(m_peer->GetControlRef(), 0, &colId);
}
else // normal item
{
-#if TARGET_CARBON
// what we do here is to hide the special items which are
// shown in the application menu anyhow -- it doesn't make
// sense to show them in their normal place as well
0 );
}
}
-#endif // TARGET_CARBON
}
previousItem = item ;
helpMenuHandle = NULL ;
}
-#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
{
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
else
EnableMenuCommand( NULL , kHICommandQuit ) ;
}
-#endif
wxString strippedHelpMenuTitle = wxStripMenuCodes( wxApp::s_macHelpMenuTitleName ) ;
wxString strippedTranslatedHelpMenuTitle = wxStripMenuCodes( wxString( _("&Help") ) ) ;
if ( IsSeparator() )
return ;
-#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
{
if ( !IsEnabled() )
else
EnableMenuCommand( NULL , kHICommandQuit ) ;
}
-#endif
{
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
void wxMenuItem::Enable(bool bDoEnable)
{
if (( m_isEnabled != bDoEnable
-#if TARGET_CARBON
// avoid changing menuitem state when menu is disabled
// eg. BeginAppModalStateForWindow() will disable menus and ignore this change
// which in turn causes m_isEnabled to become out of sync with real menuitem state
|| ( GetId() == wxApp::s_macPreferencesMenuItemId
|| GetId() == wxApp::s_macExitMenuItemId
|| GetId() == wxApp::s_macAboutMenuItemId
-#endif
))
{
wxMenuItemBase::Enable( bDoEnable ) ;
switch (GetWindowVariant())
{
case wxWINDOW_VARIANT_MINI:
- if ( UMAGetSystemVersion() >= 0x1030 )
- tabsize = 3 ;
- else
- tabsize = kControlSizeSmall;
+ tabsize = 3 ;
break;
case wxWINDOW_VARIANT_SMALL:
}
else
{
-#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 )
-#endif
{
#if !wxMAC_USE_CORE_GRAPHICS
GrafPtr thePort ;
#endif
#endif
-#if defined __WXMAC__ && defined __DARWIN__/*TARGET_CARBON*/
-#ifdef __APPLE_CC__
#include <Carbon/Carbon.h>
-#else
-#include <Carbon.h>
-#endif
-#else
-#include <Sound.h>
-#endif
//quicktime media layer only required for mac emulation on pc
#ifndef __WXMAC__
const wxPoint& pos,
const wxSize& size, long style )
{
-#ifdef __WXMAC_OSX__
- if ( UMAGetSystemVersion() >= 0x1030 )
- {
- m_peer = new wxMacSearchFieldControl( this , str , pos , size , style );
- }
-#endif
- if ( !m_peer )
- {
- wxTextCtrl::CreatePeer( str, pos, size, style );
- }
+ m_peer = new wxMacSearchFieldControl( this , str , pos , size , style );
}
#endif // wxUSE_NATIVE_SEARCH_CONTROL
// Later on, the staticbox's font height is added to this.
extraTop = 0;
- if ( UMAGetSystemVersion() >= 0x1030 ) // Panther
- {
- // As indicated by the HIG, Panther needs an extra border of 11
- // pixels (otherwise overlapping occurs at the top). The "other"
- // border has to be 11.
- extraTop = 11;
- other = 11;
- }
+ // As indicated by the HIG, Panther needs an extra border of 11
+ // pixels (otherwise overlapping occurs at the top). The "other"
+ // border has to be 11.
+ extraTop = 11;
+ other = 11;
}
*borderTop = extraTop;
tabsize = kControlTabSizeSmall ;
else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
{
- if (UMAGetSystemVersion() >= 0x1030 )
- tabsize = 3 ;
- else
- tabsize = kControlSizeSmall;
+ tabsize = 3 ;
}
m_peer = new wxMacControl( this );
#include "wx/filefn.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/carbon/private/mactext.h"
-#ifndef __WXMAC_OSX__
-enum
-{
- kTXNVisibilityTag = 'visb' // set the visibility state of the object
-};
-#endif
-
-
class wxMacFunctor
{
public :
Rect m_txnControlBounds ;
Rect m_txnVisBounds ;
-#ifdef __WXMAC_OSX__
static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ;
static pascal void TXNScrollInfoProc(
SInt32 iValue, SInt32 iMaximumValue,
SInt32 m_lastHorizontalValue ;
ControlRef m_sbVertical ;
SInt32 m_lastVerticalValue ;
-#endif
};
if ( UMAGetSystemVersion() >= 0x1050 )
forceMLTE = false;
- if ( UMAGetSystemVersion() >= 0x1030 && !forceMLTE )
+ if ( !forceMLTE )
{
if ( m_windowStyle & wxTE_MULTILINE )
m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
// setting the default font:
// under 10.2 this causes a visible caret, therefore we avoid it
- if ( UMAGetSystemVersion() >= 0x1030 )
- {
- Str255 fontName ;
- SInt16 fontSize ;
- Style fontStyle ;
+ Str255 fontName ;
+ SInt16 fontSize ;
+ Style fontStyle ;
- GetThemeFont( kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+ GetThemeFont( kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
- TXNTypeAttributes typeAttr[] =
- {
- { kTXNQDFontNameAttribute , kTXNQDFontNameAttributeSize , { (void*) fontName } } ,
- { kTXNQDFontSizeAttribute , kTXNFontSizeAttributeSize , { (void*) (fontSize << 16) } } ,
- { kTXNQDFontStyleAttribute , kTXNQDFontStyleAttributeSize , { (void*) normal } } ,
- } ;
-
- err = TXNSetTypeAttributes(
- m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes),
- typeAttr, kTXNStartOffset, kTXNEndOffset );
- verify_noerr( err );
- }
+ TXNTypeAttributes typeAttr[] =
+ {
+ { kTXNQDFontNameAttribute , kTXNQDFontNameAttributeSize , { (void*) fontName } } ,
+ { kTXNQDFontSizeAttribute , kTXNFontSizeAttributeSize , { (void*) (fontSize << 16) } } ,
+ { kTXNQDFontStyleAttribute , kTXNQDFontStyleAttributeSize , { (void*) normal } } ,
+ } ;
+
+ err = TXNSetTypeAttributes(
+ m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes),
+ typeAttr, kTXNStartOffset, kTXNEndOffset );
+ verify_noerr( err );
if ( m_windowStyle & wxTE_PASSWORD )
{
// 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 ....
-#ifdef __WXMAC_OSX__
-
TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
ControlActionUPP gTXNScrollActionProc = NULL ;
mlte->m_lastVerticalValue = newValue ;
}
}
-#endif
// make correct activations
void wxMacMLTEClassicControl::MacActivatePaneText(bool setActive)
m_txnVisBounds = visBounds ;
wxMacWindowClipper cl( textctrl ) ;
-#ifdef __WXMAC_OSX__
if ( m_sbHorizontal || m_sbVertical )
{
int w = bounds.right - bounds.left ;
m_txnControlBounds.right - (m_sbVertical ? 14 : 0),
m_txnFrameID );
#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
// movement, therefore we have to force it
wxMacControl::SuperChangedPosition() ;
}
-#ifdef __WXMAC_OSX__
-
ControlUserPaneDrawUPP gTPDrawProc = NULL;
ControlUserPaneHitTestUPP gTPHitProc = NULL;
ControlUserPaneTrackingUPP gTPTrackProc = NULL;
}
#endif
-#endif // __WXMAC_OSX__
-
// TXNRegisterScrollInfoProc
OSStatus wxMacMLTEClassicControl::DoCreate()
OSStatus err = noErr ;
// set up our globals
-#ifdef __WXMAC_OSX__
if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc);
if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc);
if (gTPTrackProc == NULL) gTPTrackProc = NewControlUserPaneTrackingUPP(wxMacControlUserPaneTrackingProc);
if (gTXNScrollInfoProc == NULL ) gTXNScrollInfoProc = NewTXNScrollInfoUPP(TXNScrollInfoProc) ;
if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ;
-#endif
// set the initial settings for our private data
m_txnWindow = GetControlOwner(m_controlRef);
m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow);
-#ifdef __WXMAC_OSX__
// set up the user pane procedures
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc);
SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc);
-#endif
// calculate the rectangles used by the control
UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds );
// create the new edit field
TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle );
-#ifdef __WXMAC_OSX__
// 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
frameOptions &= ~(kTXNWantHScrollBarMask | kTXNDrawGrowIconMask);
}
-#endif
-
err = TXNNewObject(
NULL, m_txnWindow, &bounds, frameOptions,
kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding,
verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) );
#endif
-#ifdef __WXMAC_OSX__
TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32)this );
-#endif
SetGWorld( origPort , origDev ) ;
#include "wx/sysopt.h"
-#ifdef __WXMAC_OSX__
const short kwxMacToolBarToolDefaultWidth = 16;
const short kwxMacToolBarToolDefaultHeight = 16;
const short kwxMacToolBarTopMargin = 4;
const short kwxMacToolBarLeftMargin = 4;
const short kwxMacToolBorder = 0;
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)
static const EventTypeSpec eventList[] =
{
{ kEventClassControl, kEventControlHit },
-#ifdef __WXMAC_OSX__
{ kEventClassControl, kEventControlHitTest },
-#endif
};
static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef WXUNUSED(handler), EventRef event, void *data )
{
bool shouldToggle;
-#ifdef __WXMAC_OSX__
shouldToggle = !tbartool->IsToggled();
-#else
- shouldToggle = (GetControl32BitValue( (ControlRef)(tbartool->GetControlHandle()) ) != 0);
-#endif
tbar->ToggleTool( tbartool->GetId(), shouldToggle );
}
}
break;
-#ifdef __WXMAC_OSX__
case kEventControlHitTest:
{
HIPoint pt = cEvent.GetParameter<HIPoint>(kEventParamMouseLocation);
result = noErr;
}
break;
-#endif
default:
break;
else
{
// separator
-#ifdef __WXMAC_OSX__
Rect contrlRect;
GetControlBounds( m_controlHandle, &contrlRect );
int former_mac_x = contrlRect.left;
if ( mac_x != former_mac_x || mac_y != former_mac_y )
UMAMoveControl( m_controlHandle, mac_x, mac_y );
-#endif
}
}
void wxToolBarTool::UpdateToggleImage( bool toggle )
{
-#ifdef __WXMAC_OSX__
if ( toggle )
{
int w = m_bmpNormal.GetWidth();
sizeof(transform), (Ptr)&transform );
HIViewSetNeedsDisplay( m_controlHandle, true );
-#else
- ::SetControl32BitValue( m_controlHandle, toggle );
-#endif
}
wxToolBarTool::wxToolBarTool(
GetSize( &w, &h );
bool drawMetalTheme = MacGetTopLevelWindow()->MacGetMetalAppearance();
- bool minimumUmaAvailable = (UMAGetSystemVersion() >= 0x1030);
#if wxMAC_USE_CORE_GRAPHICS
- if ( !drawMetalTheme && minimumUmaAvailable )
+ if ( !drawMetalTheme )
{
HIThemePlacardDrawInfo info;
memset( &info, 0, sizeof(info) );
{
wxMacPortSetter helper( &dc );
- if ( !drawMetalTheme || !minimumUmaAvailable )
+ if ( !drawMetalTheme )
{
Rect toolbarrect = { dc.YLOG2DEVMAC(0), dc.XLOG2DEVMAC(0),
dc.YLOG2DEVMAC(h), dc.XLOG2DEVMAC(w) };
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
// 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
- if ( ( cEvent.GetKind() == kEventMouseDown )
-#ifdef __WXMAC_OSX__
- &&
- (FindControlUnderMouse(windowMouseLocation , window , &dummyPart) !=
- wxMacFindControlUnderMouse( toplevelWindow , windowMouseLocation , window , &dummyPart ) )
-#endif
- )
+ if ( cEvent.GetKind() == kEventMouseDown )
{
if ( currentMouseWindow->MacIsReallyEnabled() )
{
#include "wx/toplevel.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"
// since we have decided that we only support 8.6 upwards we are
wxString str = wxStripMenuCodes( title ) ;
MenuRef menu ;
-#if TARGET_CARBON
CreateNewMenu( id , 0 , &menu ) ;
SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding ) ) ;
-#else
- Str255 ptitle ;
- wxMacStringToPascal( str , ptitle ) ;
- menu = ::NewMenu( id , ptitle ) ;
-#endif
return menu ;
}
{
wxString str = wxStripMenuCodes( title ) ;
-#if TARGET_CARBON
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 )
// we don't strip the accels here anymore, must be done before
wxString str = title ;
-#if TARGET_CARBON
SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str , encoding) ) ;
-
-#else
- Str255 ptitle ;
- wxMacStringToPascal( str , ptitle ) ;
- SetMenuItemText( menu , item , ptitle ) ;
-#endif
}
UInt32 UMAMenuEvent( EventRecord *inEvent )
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()
{
SetThemeCursor(kThemeWatchCursor);
{
wxASSERT( inWindowRef != NULL ) ;
-#if TARGET_CARBON
return (GrafPtr) GetWindowPort( inWindowRef ) ;
-#else
- return (GrafPtr) inWindowRef ;
-#endif
}
void UMADisposeWindow( WindowRef inWindowRef )
void UMASetWTitle( WindowRef inWindowRef , const wxString& title , wxFontEncoding encoding )
{
-#if TARGET_CARBON
SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title , encoding) ) ;
-
-#else
- Str255 ptitle ;
- wxMacStringToPascal( title , ptitle ) ;
- SetWTitle( inWindowRef , ptitle ) ;
-#endif
}
// appearance additions
void UMASetControlTitle( ControlRef inControl , const wxString& title , wxFontEncoding encoding )
{
-#if TARGET_CARBON
SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title , encoding) ) ;
-
-#else
- Str255 ptitle ;
- wxMacStringToPascal( title , ptitle ) ;
- SetControlTitle( inControl , ptitle ) ;
-#endif
}
void UMAActivateControl( ControlRef inControl )
{
-#if TARGET_API_MAC_OSX
::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 )
{
-#if TARGET_API_MAC_OSX
- ::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 )
{
-#if TARGET_API_MAC_OSX
::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 )
{
-#if TARGET_API_MAC_OSX
- ::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
#endif
}
-#if !TARGET_CARBON
-static OSStatus helpMenuStatus = noErr ;
-static MenuItemIndex firstCustomItemIndex = 0 ;
-#endif
-
static OSStatus UMAGetHelpMenu(
MenuRef * outHelpMenu,
MenuItemIndex * outFirstCustomItemIndex,
MenuItemIndex * outFirstCustomItemIndex,
bool allowHelpMenuCreation)
{
-#if TARGET_CARBON
static bool s_createdHelpMenu = false ;
if ( !s_createdHelpMenu && !allowHelpMenuCreation )
OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ;
s_createdHelpMenu = ( status == noErr ) ;
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(
SameProcess( &gAppProcess , &psn , &isSame );
if ( isSame )
{
-#if TARGET_CARBON
OSStatus err = noErr;
#if 0
kEventAttributeNone );
err = PostEventToQueue(GetMainEventQueue(), wakeupEvent,
kEventPriorityHigh );
-#endif
-#else
- PostEvent( nullEvent , 0 );
#endif
}
else
// Quartz Support
//
-#ifdef __WXMAC_OSX__
// snippets from Sketch Sample from Apple :
#define kGenericRGBProfilePathStr "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc"
return genericRGBColorSpace;
}
-#endif
#ifndef __LP64__
Boolean focusEverything = false ;
ControlPartCode controlPart = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode );
-#ifdef __WXMAC_OSX__
if ( cEvent.GetParameter<Boolean>(kEventParamControlFocusEverything , &focusEverything ) == noErr )
{
}
-#endif
if ( thisWindow->MacIsUserPane() )
result = noErr ;
break ;
case wxWINDOW_VARIANT_MINI :
- if (UMAGetSystemVersion() >= 0x1030 )
- {
- // not always defined in the headers
- size = 3 ;
- themeFont = 109 ;
- }
- else
- {
- size = kControlSizeSmall;
- themeFont = kThemeSmallSystemFont ;
- }
+ // not always defined in the headers
+ size = 3 ;
+ themeFont = 109 ;
break ;
case wxWINDOW_VARIANT_LARGE :
GetMouse( &pt ) ;
#endif
- control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ;
+ control = FindControlUnderMouse( pt , window , &part ) ;
if ( control )
mouseWin = wxFindControlFromMacControl( control ) ;
RectRgn( updateOuter, &rect ) ;
DiffRgn( updateOuter, updateInner , updateOuter ) ;
-#ifdef __WXMAC_OSX__
GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ;
-#else
- WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ;
- if ( tlw )
- InvalWindowRgn( tlw , updateOuter ) ;
-#endif
DisposeRgn( updateOuter ) ;
DisposeRgn( updateInner ) ;