Fix enter and leave events.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13573
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
¤tMouseWindow ) ;
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
¤tMouseWindow ) ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
wxMouseEvent event ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
wxMouseEvent event ;
event.m_y = ev->where.v;
event.m_timeStamp = ev->when;
event.SetEventObject(this);
event.m_y = ev->where.v;
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxWindow::s_lastMouseWindow )
{
if ( wxWindow::s_lastMouseWindow )
{
- wxMouseEvent eventleave(event ) ;
- eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
+ wxMouseEvent eventleave(event);
+ eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
+ wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
+
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
}
if ( currentMouseWindow )
{
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
}
if ( currentMouseWindow )
{
- wxMouseEvent evententer(event ) ;
- evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
+ wxMouseEvent evententer(event);
+ evententer.SetEventType( wxEVT_ENTER_WINDOW );
+ currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
+
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
}
wxWindow::s_lastMouseWindow = currentMouseWindow ;
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
}
wxWindow::s_lastMouseWindow = currentMouseWindow ;
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
¤tMouseWindow ) ;
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
¤tMouseWindow ) ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
wxMouseEvent event ;
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
{
wxMouseEvent event ;
event.m_y = ev->where.v;
event.m_timeStamp = ev->when;
event.SetEventObject(this);
event.m_y = ev->where.v;
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxWindow::s_lastMouseWindow )
{
if ( wxWindow::s_lastMouseWindow )
{
- wxMouseEvent eventleave(event ) ;
- eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
+ wxMouseEvent eventleave(event);
+ eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
+ wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
+
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
}
if ( currentMouseWindow )
{
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
}
if ( currentMouseWindow )
{
- wxMouseEvent evententer(event ) ;
- evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
+ wxMouseEvent evententer(event);
+ evententer.SetEventType( wxEVT_ENTER_WINDOW );
+ currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
+
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
}
wxWindow::s_lastMouseWindow = currentMouseWindow ;
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
}
wxWindow::s_lastMouseWindow = currentMouseWindow ;
// Created: ??/??/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Created: ??/??/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
{
#if !TARGET_CARBON
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
{
#if !TARGET_CARBON
#endif
void * data = NULL ;
#endif
void * data = NULL ;
switch (dataFormat.GetType())
{
case wxDF_OEMTEXT:
switch (dataFormat.GetType())
{
case wxDF_OEMTEXT:
- ScrapRef scrapRef;
-
- err = GetCurrentScrap( &scrapRef );
- if ( err != noTypeErr && err != memFullErr )
- {
- ScrapFlavorFlags flavorFlags;
- Size byteCount;
-
- if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
- {
- if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
- {
- if ( dataFormat.GetType() == wxDF_TEXT )
- byteCount++ ;
-
+ ScrapRef scrapRef;
+
+ err = GetCurrentScrap( &scrapRef );
+ if ( err != noTypeErr && err != memFullErr )
+ {
+ ScrapFlavorFlags flavorFlags;
+ Size byteCount;
+
+ if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+ {
+ if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+ {
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ byteCount++ ;
+
data = new char[ byteCount ] ;
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
{
*len = byteCount ;
data = new char[ byteCount ] ;
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
{
*len = byteCount ;
- if ( dataFormat.GetType() == wxDF_TEXT )
- ((char*)data)[byteCount] = 0 ;
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ ((char*)data)[byteCount] = 0 ;
}
else
{
delete[] ((char *)data) ;
data = NULL ;
}
}
else
{
delete[] ((char *)data) ;
data = NULL ;
}
- long offset ;
- Handle datahandle = NewHandle(0) ;
- HLock( datahandle ) ;
- GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
- HUnlock( datahandle ) ;
- if ( GetHandleSize( datahandle ) > 0 )
- {
- long byteCount = GetHandleSize( datahandle ) ;
- if ( dataFormat.GetType() == wxDF_TEXT )
- data = new char[ byteCount + 1] ;
+ long offset ;
+ Handle datahandle = NewHandle(0) ;
+ HLock( datahandle ) ;
+ GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+ HUnlock( datahandle ) ;
+ if ( GetHandleSize( datahandle ) > 0 )
+ {
+ long byteCount = GetHandleSize( datahandle ) ;
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ data = new char[ byteCount + 1] ;
else
data = new char[ byteCount ] ;
else
data = new char[ byteCount ] ;
- memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
- if ( dataFormat.GetType() == wxDF_TEXT )
- ((char*)data)[byteCount] = 0 ;
- * len = byteCount ;
- }
- DisposeHandle( datahandle ) ;
+ memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ ((char*)data)[byteCount] = 0 ;
+ * len = byteCount ;
+ }
+ DisposeHandle( datahandle ) ;
m_data = (wxDataObject*) NULL;
}
#if TARGET_CARBON
m_data = (wxDataObject*) NULL;
}
#if TARGET_CARBON
- OSStatus err ;
- err = ClearCurrentScrap( );
+ OSStatus err ;
+ err = ClearCurrentScrap( );
- OSErr err ;
- err = ZeroScrap( );
+ OSErr err ;
+ err = ZeroScrap( );
wxLogSysError(_("Failed to empty the clipboard."));
wxLogSysError(_("Failed to empty the clipboard."));
}
bool wxClipboard::Flush()
}
bool wxClipboard::Flush()
array[i].GetId().c_str() );
#if !TARGET_CARBON
array[i].GetId().c_str() );
#if !TARGET_CARBON
#endif
switch ( array[i].GetType() )
#endif
switch ( array[i].GetType() )
{
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
wxString str(textDataObject->GetText());
{
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
wxString str(textDataObject->GetText());
- wxString mac ;
- if ( wxApp::s_macDefaultEncodingIsPC )
- {
- mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
- }
- else
- {
- mac = textDataObject->GetText() ;
- }
+ wxString mac ;
+ if ( wxApp::s_macDefaultEncodingIsPC )
+ {
+ mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
+ }
+ else
+ {
+ mac = textDataObject->GetText() ;
+ }
- err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
+ err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
- ScrapRef scrap;
- err = GetCurrentScrap (&scrap);
- if ( !err )
- {
- err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
- }
+ ScrapRef scrap;
+ err = GetCurrentScrap (&scrap);
+ if ( !err )
+ {
+ err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
+ }
#if wxUSE_DRAG_AND_DROP
case wxDF_METAFILE:
#if wxUSE_DRAG_AND_DROP
case wxDF_METAFILE:
wxMetafileDataObject* metaFileDataObject =
(wxMetafileDataObject*) data;
wxMetafile metaFile = metaFileDataObject->GetMetafile();
wxMetafileDataObject* metaFileDataObject =
(wxMetafileDataObject*) data;
wxMetafile metaFile = metaFileDataObject->GetMetafile();
- PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
- HLock( (Handle) pict ) ;
+ PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
+ HLock( (Handle) pict ) ;
- err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
+ err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
- ScrapRef scrap;
- err = GetCurrentScrap (&scrap);
- if ( !err )
- {
- err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
- }
+ ScrapRef scrap;
+ err = GetCurrentScrap (&scrap);
+ if ( !err )
+ {
+ err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
+ }
- HUnlock( (Handle) pict ) ;
+ HUnlock( (Handle) pict ) ;
#endif
case wxDF_BITMAP:
case wxDF_DIB:
default:
#endif
case wxDF_BITMAP:
case wxDF_DIB:
default:
return m_data->IsSupported( dataFormat ) ;
}
#if TARGET_CARBON
return m_data->IsSupported( dataFormat ) ;
}
#if TARGET_CARBON
- OSStatus err = noErr;
- ScrapRef scrapRef;
-
- err = GetCurrentScrap( &scrapRef );
- if ( err != noTypeErr && err != memFullErr )
- {
- ScrapFlavorFlags flavorFlags;
- Size byteCount;
-
- if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
- {
- if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
- {
- return TRUE ;
- }
- }
- }
- return FALSE;
-
+ OSStatus err = noErr;
+ ScrapRef scrapRef;
+
+ err = GetCurrentScrap( &scrapRef );
+ if ( err != noTypeErr && err != memFullErr )
+ {
+ ScrapFlavorFlags flavorFlags;
+ Size byteCount;
+
+ if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+ {
+ if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+ {
+ return TRUE ;
+ }
+ }
+ }
+ return FALSE;
+
- long offset ;
- Handle datahandle = NewHandle(0) ;
- HLock( datahandle ) ;
- GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
- HUnlock( datahandle ) ;
- bool hasData = GetHandleSize( datahandle ) > 0 ;
- DisposeHandle( datahandle ) ;
- return hasData ;
+ long offset ;
+ Handle datahandle = NewHandle(0) ;
+ HLock( datahandle ) ;
+ GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+ HUnlock( datahandle ) ;
+ bool hasData = GetHandleSize( datahandle ) > 0 ;
+ DisposeHandle( datahandle ) ;
+ return hasData ;
bool wxTopLevelWindowMac::IsIconized() const
{
bool wxTopLevelWindowMac::IsIconized() const
{
- // mac dialogs cannot be iconized
+ // mac dialogs cannot be iconized
event.m_x += m_x;
event.m_y += m_y;
event.m_x += m_x;
event.m_y += m_y;
-/*
- wxPoint origin = GetClientAreaOrigin() ;
-
- event.m_x += origin.x ;
- event.m_y += origin.y ;
-*/
-
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxTheApp->s_captureWindow )
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxTheApp->s_captureWindow )
event.m_x = x ;
event.m_y = y ;
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
event.m_x = x ;
event.m_y = y ;
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
if ( ev->what == mouseUp )
{
wxTheApp->s_captureWindow = NULL ;
if ( ev->what == mouseUp )
{
wxTheApp->s_captureWindow = NULL ;
MacRootWindowToWindow( x , y ) ;
if ( x )
MacRootWindowToWindow( x , y ) ;
if ( x )
- x -= MacGetLeftBorderSize() ;
+ x -= MacGetLeftBorderSize() ;
- y -= MacGetTopBorderSize() ;
+ y -= MacGetTopBorderSize() ;
}
void wxWindowMac::DoClientToScreen(int *x, int *y) const
}
void wxWindowMac::DoClientToScreen(int *x, int *y) const
WindowRef window = (WindowRef) MacGetRootWindow() ;
if ( x )
WindowRef window = (WindowRef) MacGetRootWindow() ;
if ( x )
- x += MacGetLeftBorderSize() ;
+ x += MacGetLeftBorderSize() ;
- y += MacGetTopBorderSize() ;
-
+ y += MacGetTopBorderSize() ;
+
MacWindowToRootWindow( x , y ) ;
Point localwhere = { 0,0 };
MacWindowToRootWindow( x , y ) ;
Point localwhere = { 0,0 };
void wxWindow::SetTitle(const wxString& title)
{
void wxWindow::SetTitle(const wxString& title)
{
}
wxString wxWindow::GetTitle() const
{
}
wxString wxWindow::GetTitle() const
{
}
bool wxWindowMac::Show(bool show)
}
bool wxWindowMac::Show(bool show)
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{
#if wxMAC_USE_THEME_BORDER
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{
#if wxMAC_USE_THEME_BORDER
- Rect rect = { top , left , m_height + top , m_width + left } ;
- SInt32 border = 0 ;
- /*
- GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
- InsetRect( &rect , border , border );
+ Rect rect = { top , left , m_height + top , m_width + left } ;
+ SInt32 border = 0 ;
+ /*
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+ InsetRect( &rect , border , border );
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
*/
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
#else
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
*/
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
#else
- bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+ bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBForeColor( &face );
MoveTo( left + 0 , top + m_height - 2 );
LineTo( left + 0 , top + 0 );
RGBForeColor( &face );
MoveTo( left + 0 , top + m_height - 2 );
LineTo( left + 0 , top + 0 );
}
else if (HasFlag(wxSIMPLE_BORDER))
{
}
else if (HasFlag(wxSIMPLE_BORDER))
{
- Rect rect = { top , left , m_height + top , m_width + left } ;
+ Rect rect = { top , left , m_height + top , m_width + left } ;
RGBForeColor( &black ) ;
FrameRect( &rect ) ;
}
RGBForeColor( &black ) ;
FrameRect( &rect ) ;
}
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
{
WindowRef window ;
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
{
WindowRef window ;
Point pt = { screenpoint.y , screenpoint.x } ;
if ( ::FindWindow( pt , &window ) == 3 )
{
Point pt = { screenpoint.y , screenpoint.x } ;
if ( ::FindWindow( pt , &window ) == 3 )
{
- wxPoint point( screenpoint ) ;
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
if ( win )
{
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
if ( win )
{
- point = win->ScreenToClient( point ) ;
- point += win->GetClientAreaOrigin() ;
+ // No, this yields the CLIENT are, we need the whole frame. RR.
+ // point = win->ScreenToClient( point ) ;
+
+ GrafPtr port;
+ ::GetPort( &port ) ;
+ ::SetPort( UMAGetWindowPort( window ) ) ;
+ ::GlobalToLocal( &pt ) ;
+ ::SetPort( port ) ;
+
+ wxPoint point( pt.h, pt.v ) ;
+
return win->MacGetWindowFromPointSub( point , outWin ) ;
}
}
return win->MacGetWindowFromPointSub( point , outWin ) ;
}
}
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
wxToolTip::RelayEvent( this , event);
#endif // wxUSE_TOOLTIPS
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
wxToolTip::RelayEvent( this , event);
#endif // wxUSE_TOOLTIPS
GetEventHandler()->ProcessEvent( event ) ;
GetEventHandler()->ProcessEvent( event ) ;
if ( win )
{
win->MacUpdate( 0 ) ;
if ( win )
{
win->MacUpdate( 0 ) ;
- if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
- {
- QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
- }
- }
+ if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
+ {
+ QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
+ }
+ }
}
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
}
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{
#if wxMAC_USE_THEME_BORDER
#if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON
- GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
}
else if ( m_windowStyle &wxDOUBLE_BORDER)
{
}
else if ( m_windowStyle &wxDOUBLE_BORDER)
{
#if wxMAC_USE_THEME_BORDER
#if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON
- GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
}
else if (m_windowStyle &wxSIMPLE_BORDER)
{
}
else if (m_windowStyle &wxSIMPLE_BORDER)
{
// Created: ??/??/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
// Created: ??/??/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
{
#if !TARGET_CARBON
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
{
#if !TARGET_CARBON
#endif
void * data = NULL ;
#endif
void * data = NULL ;
switch (dataFormat.GetType())
{
case wxDF_OEMTEXT:
switch (dataFormat.GetType())
{
case wxDF_OEMTEXT:
- ScrapRef scrapRef;
-
- err = GetCurrentScrap( &scrapRef );
- if ( err != noTypeErr && err != memFullErr )
- {
- ScrapFlavorFlags flavorFlags;
- Size byteCount;
-
- if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
- {
- if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
- {
- if ( dataFormat.GetType() == wxDF_TEXT )
- byteCount++ ;
-
+ ScrapRef scrapRef;
+
+ err = GetCurrentScrap( &scrapRef );
+ if ( err != noTypeErr && err != memFullErr )
+ {
+ ScrapFlavorFlags flavorFlags;
+ Size byteCount;
+
+ if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+ {
+ if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+ {
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ byteCount++ ;
+
data = new char[ byteCount ] ;
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
{
*len = byteCount ;
data = new char[ byteCount ] ;
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
{
*len = byteCount ;
- if ( dataFormat.GetType() == wxDF_TEXT )
- ((char*)data)[byteCount] = 0 ;
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ ((char*)data)[byteCount] = 0 ;
}
else
{
delete[] ((char *)data) ;
data = NULL ;
}
}
else
{
delete[] ((char *)data) ;
data = NULL ;
}
- long offset ;
- Handle datahandle = NewHandle(0) ;
- HLock( datahandle ) ;
- GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
- HUnlock( datahandle ) ;
- if ( GetHandleSize( datahandle ) > 0 )
- {
- long byteCount = GetHandleSize( datahandle ) ;
- if ( dataFormat.GetType() == wxDF_TEXT )
- data = new char[ byteCount + 1] ;
+ long offset ;
+ Handle datahandle = NewHandle(0) ;
+ HLock( datahandle ) ;
+ GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+ HUnlock( datahandle ) ;
+ if ( GetHandleSize( datahandle ) > 0 )
+ {
+ long byteCount = GetHandleSize( datahandle ) ;
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ data = new char[ byteCount + 1] ;
else
data = new char[ byteCount ] ;
else
data = new char[ byteCount ] ;
- memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
- if ( dataFormat.GetType() == wxDF_TEXT )
- ((char*)data)[byteCount] = 0 ;
- * len = byteCount ;
- }
- DisposeHandle( datahandle ) ;
+ memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
+ if ( dataFormat.GetType() == wxDF_TEXT )
+ ((char*)data)[byteCount] = 0 ;
+ * len = byteCount ;
+ }
+ DisposeHandle( datahandle ) ;
m_data = (wxDataObject*) NULL;
}
#if TARGET_CARBON
m_data = (wxDataObject*) NULL;
}
#if TARGET_CARBON
- OSStatus err ;
- err = ClearCurrentScrap( );
+ OSStatus err ;
+ err = ClearCurrentScrap( );
- OSErr err ;
- err = ZeroScrap( );
+ OSErr err ;
+ err = ZeroScrap( );
wxLogSysError(_("Failed to empty the clipboard."));
wxLogSysError(_("Failed to empty the clipboard."));
}
bool wxClipboard::Flush()
}
bool wxClipboard::Flush()
array[i].GetId().c_str() );
#if !TARGET_CARBON
array[i].GetId().c_str() );
#if !TARGET_CARBON
#endif
switch ( array[i].GetType() )
#endif
switch ( array[i].GetType() )
{
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
wxString str(textDataObject->GetText());
{
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
wxString str(textDataObject->GetText());
- wxString mac ;
- if ( wxApp::s_macDefaultEncodingIsPC )
- {
- mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
- }
- else
- {
- mac = textDataObject->GetText() ;
- }
+ wxString mac ;
+ if ( wxApp::s_macDefaultEncodingIsPC )
+ {
+ mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
+ }
+ else
+ {
+ mac = textDataObject->GetText() ;
+ }
- err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
+ err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
- ScrapRef scrap;
- err = GetCurrentScrap (&scrap);
- if ( !err )
- {
- err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
- }
+ ScrapRef scrap;
+ err = GetCurrentScrap (&scrap);
+ if ( !err )
+ {
+ err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
+ }
#if wxUSE_DRAG_AND_DROP
case wxDF_METAFILE:
#if wxUSE_DRAG_AND_DROP
case wxDF_METAFILE:
wxMetafileDataObject* metaFileDataObject =
(wxMetafileDataObject*) data;
wxMetafile metaFile = metaFileDataObject->GetMetafile();
wxMetafileDataObject* metaFileDataObject =
(wxMetafileDataObject*) data;
wxMetafile metaFile = metaFileDataObject->GetMetafile();
- PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
- HLock( (Handle) pict ) ;
+ PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
+ HLock( (Handle) pict ) ;
- err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
+ err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
- ScrapRef scrap;
- err = GetCurrentScrap (&scrap);
- if ( !err )
- {
- err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
- }
+ ScrapRef scrap;
+ err = GetCurrentScrap (&scrap);
+ if ( !err )
+ {
+ err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
+ }
- HUnlock( (Handle) pict ) ;
+ HUnlock( (Handle) pict ) ;
#endif
case wxDF_BITMAP:
case wxDF_DIB:
default:
#endif
case wxDF_BITMAP:
case wxDF_DIB:
default:
return m_data->IsSupported( dataFormat ) ;
}
#if TARGET_CARBON
return m_data->IsSupported( dataFormat ) ;
}
#if TARGET_CARBON
- OSStatus err = noErr;
- ScrapRef scrapRef;
-
- err = GetCurrentScrap( &scrapRef );
- if ( err != noTypeErr && err != memFullErr )
- {
- ScrapFlavorFlags flavorFlags;
- Size byteCount;
-
- if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
- {
- if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
- {
- return TRUE ;
- }
- }
- }
- return FALSE;
-
+ OSStatus err = noErr;
+ ScrapRef scrapRef;
+
+ err = GetCurrentScrap( &scrapRef );
+ if ( err != noTypeErr && err != memFullErr )
+ {
+ ScrapFlavorFlags flavorFlags;
+ Size byteCount;
+
+ if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
+ {
+ if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
+ {
+ return TRUE ;
+ }
+ }
+ }
+ return FALSE;
+
- long offset ;
- Handle datahandle = NewHandle(0) ;
- HLock( datahandle ) ;
- GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
- HUnlock( datahandle ) ;
- bool hasData = GetHandleSize( datahandle ) > 0 ;
- DisposeHandle( datahandle ) ;
- return hasData ;
+ long offset ;
+ Handle datahandle = NewHandle(0) ;
+ HLock( datahandle ) ;
+ GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
+ HUnlock( datahandle ) ;
+ bool hasData = GetHandleSize( datahandle ) > 0 ;
+ DisposeHandle( datahandle ) ;
+ return hasData ;
bool wxTopLevelWindowMac::IsIconized() const
{
bool wxTopLevelWindowMac::IsIconized() const
{
- // mac dialogs cannot be iconized
+ // mac dialogs cannot be iconized
event.m_x += m_x;
event.m_y += m_y;
event.m_x += m_x;
event.m_y += m_y;
-/*
- wxPoint origin = GetClientAreaOrigin() ;
-
- event.m_x += origin.x ;
- event.m_y += origin.y ;
-*/
-
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxTheApp->s_captureWindow )
event.m_timeStamp = ev->when;
event.SetEventObject(this);
if ( wxTheApp->s_captureWindow )
event.m_x = x ;
event.m_y = y ;
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
event.m_x = x ;
event.m_y = y ;
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
if ( ev->what == mouseUp )
{
wxTheApp->s_captureWindow = NULL ;
if ( ev->what == mouseUp )
{
wxTheApp->s_captureWindow = NULL ;
MacRootWindowToWindow( x , y ) ;
if ( x )
MacRootWindowToWindow( x , y ) ;
if ( x )
- x -= MacGetLeftBorderSize() ;
+ x -= MacGetLeftBorderSize() ;
- y -= MacGetTopBorderSize() ;
+ y -= MacGetTopBorderSize() ;
}
void wxWindowMac::DoClientToScreen(int *x, int *y) const
}
void wxWindowMac::DoClientToScreen(int *x, int *y) const
WindowRef window = (WindowRef) MacGetRootWindow() ;
if ( x )
WindowRef window = (WindowRef) MacGetRootWindow() ;
if ( x )
- x += MacGetLeftBorderSize() ;
+ x += MacGetLeftBorderSize() ;
- y += MacGetTopBorderSize() ;
-
+ y += MacGetTopBorderSize() ;
+
MacWindowToRootWindow( x , y ) ;
Point localwhere = { 0,0 };
MacWindowToRootWindow( x , y ) ;
Point localwhere = { 0,0 };
void wxWindow::SetTitle(const wxString& title)
{
void wxWindow::SetTitle(const wxString& title)
{
}
wxString wxWindow::GetTitle() const
{
}
wxString wxWindow::GetTitle() const
{
}
bool wxWindowMac::Show(bool show)
}
bool wxWindowMac::Show(bool show)
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{
#if wxMAC_USE_THEME_BORDER
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{
#if wxMAC_USE_THEME_BORDER
- Rect rect = { top , left , m_height + top , m_width + left } ;
- SInt32 border = 0 ;
- /*
- GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
- InsetRect( &rect , border , border );
+ Rect rect = { top , left , m_height + top , m_width + left } ;
+ SInt32 border = 0 ;
+ /*
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+ InsetRect( &rect , border , border );
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
*/
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
#else
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
*/
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
#else
- bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
+ bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBForeColor( &face );
MoveTo( left + 0 , top + m_height - 2 );
LineTo( left + 0 , top + 0 );
RGBForeColor( &face );
MoveTo( left + 0 , top + m_height - 2 );
LineTo( left + 0 , top + 0 );
}
else if (HasFlag(wxSIMPLE_BORDER))
{
}
else if (HasFlag(wxSIMPLE_BORDER))
{
- Rect rect = { top , left , m_height + top , m_width + left } ;
+ Rect rect = { top , left , m_height + top , m_width + left } ;
RGBForeColor( &black ) ;
FrameRect( &rect ) ;
}
RGBForeColor( &black ) ;
FrameRect( &rect ) ;
}
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
{
WindowRef window ;
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
{
WindowRef window ;
Point pt = { screenpoint.y , screenpoint.x } ;
if ( ::FindWindow( pt , &window ) == 3 )
{
Point pt = { screenpoint.y , screenpoint.x } ;
if ( ::FindWindow( pt , &window ) == 3 )
{
- wxPoint point( screenpoint ) ;
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
if ( win )
{
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
if ( win )
{
- point = win->ScreenToClient( point ) ;
- point += win->GetClientAreaOrigin() ;
+ // No, this yields the CLIENT are, we need the whole frame. RR.
+ // point = win->ScreenToClient( point ) ;
+
+ GrafPtr port;
+ ::GetPort( &port ) ;
+ ::SetPort( UMAGetWindowPort( window ) ) ;
+ ::GlobalToLocal( &pt ) ;
+ ::SetPort( port ) ;
+
+ wxPoint point( pt.h, pt.v ) ;
+
return win->MacGetWindowFromPointSub( point , outWin ) ;
}
}
return win->MacGetWindowFromPointSub( point , outWin ) ;
}
}
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
wxToolTip::RelayEvent( this , event);
#endif // wxUSE_TOOLTIPS
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
wxToolTip::RelayEvent( this , event);
#endif // wxUSE_TOOLTIPS
GetEventHandler()->ProcessEvent( event ) ;
GetEventHandler()->ProcessEvent( event ) ;
if ( win )
{
win->MacUpdate( 0 ) ;
if ( win )
{
win->MacUpdate( 0 ) ;
- if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
- {
- QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
- }
- }
+ if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
+ {
+ QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
+ }
+ }
}
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
}
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
{
#if wxMAC_USE_THEME_BORDER
#if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON
- GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
}
else if ( m_windowStyle &wxDOUBLE_BORDER)
{
}
else if ( m_windowStyle &wxDOUBLE_BORDER)
{
#if wxMAC_USE_THEME_BORDER
#if wxMAC_USE_THEME_BORDER
-#if TARGET_CARBON
- GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
+#if TARGET_CARBON
+ GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
}
else if (m_windowStyle &wxSIMPLE_BORDER)
{
}
else if (m_windowStyle &wxSIMPLE_BORDER)
{