Fix wxClipboard.
Fix enter and leave events. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13573 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
||||||
¤tMouseWindow ) ;
|
¤tMouseWindow ) ;
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent event ;
|
wxMouseEvent event ;
|
||||||
@@ -1695,17 +1694,21 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
event.m_y = ev->where.v;
|
event.m_y = ev->where.v;
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
if ( wxWindow::s_lastMouseWindow )
|
if ( wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent eventleave(event ) ;
|
wxMouseEvent eventleave(event);
|
||||||
eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
|
eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
|
||||||
|
wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
|
||||||
|
|
||||||
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
||||||
}
|
}
|
||||||
if ( currentMouseWindow )
|
if ( currentMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent evententer(event ) ;
|
wxMouseEvent evententer(event);
|
||||||
evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
|
evententer.SetEventType( wxEVT_ENTER_WINDOW );
|
||||||
|
currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
|
||||||
|
|
||||||
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
||||||
}
|
}
|
||||||
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
||||||
|
@@ -1676,7 +1676,6 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
||||||
¤tMouseWindow ) ;
|
¤tMouseWindow ) ;
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent event ;
|
wxMouseEvent event ;
|
||||||
@@ -1695,17 +1694,21 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
event.m_y = ev->where.v;
|
event.m_y = ev->where.v;
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
if ( wxWindow::s_lastMouseWindow )
|
if ( wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent eventleave(event ) ;
|
wxMouseEvent eventleave(event);
|
||||||
eventleave.SetEventType( wxEVT_LEAVE_WINDOW ) ;
|
eventleave.SetEventType( wxEVT_LEAVE_WINDOW );
|
||||||
|
wxWindow::s_lastMouseWindow->ScreenToClient( &eventleave.m_x, &eventleave.m_y );
|
||||||
|
|
||||||
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
wxWindow::s_lastMouseWindow->GetEventHandler()->ProcessEvent(eventleave);
|
||||||
}
|
}
|
||||||
if ( currentMouseWindow )
|
if ( currentMouseWindow )
|
||||||
{
|
{
|
||||||
wxMouseEvent evententer(event ) ;
|
wxMouseEvent evententer(event);
|
||||||
evententer.SetEventType( wxEVT_ENTER_WINDOW ) ;
|
evententer.SetEventType( wxEVT_ENTER_WINDOW );
|
||||||
|
currentMouseWindow->ScreenToClient( &evententer.m_x, &evententer.m_y );
|
||||||
|
|
||||||
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
currentMouseWindow->GetEventHandler()->ProcessEvent(evententer);
|
||||||
}
|
}
|
||||||
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
wxWindow::s_lastMouseWindow = currentMouseWindow ;
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: ??/??/98
|
// Created: ??/??/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) AUTHOR
|
// Copyright: (c) AUTHOR
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -39,12 +39,12 @@ static const wxChar *TRACE_CLIPBOARD = _T("clipboard");
|
|||||||
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||||
{
|
{
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
OSErr err = noErr ;
|
OSErr err = noErr ;
|
||||||
#else
|
#else
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
#endif
|
#endif
|
||||||
void * data = NULL ;
|
void * data = NULL ;
|
||||||
|
|
||||||
switch (dataFormat.GetType())
|
switch (dataFormat.GetType())
|
||||||
{
|
{
|
||||||
case wxDF_OEMTEXT:
|
case wxDF_OEMTEXT:
|
||||||
@@ -61,57 +61,57 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
ScrapRef scrapRef;
|
ScrapRef scrapRef;
|
||||||
|
|
||||||
err = GetCurrentScrap( &scrapRef );
|
err = GetCurrentScrap( &scrapRef );
|
||||||
if ( err != noTypeErr && err != memFullErr )
|
if ( err != noTypeErr && err != memFullErr )
|
||||||
{
|
{
|
||||||
ScrapFlavorFlags flavorFlags;
|
ScrapFlavorFlags flavorFlags;
|
||||||
Size byteCount;
|
Size byteCount;
|
||||||
|
|
||||||
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
||||||
{
|
{
|
||||||
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
||||||
{
|
{
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
byteCount++ ;
|
byteCount++ ;
|
||||||
|
|
||||||
data = new char[ byteCount ] ;
|
data = new char[ byteCount ] ;
|
||||||
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
|
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
|
||||||
{
|
{
|
||||||
*len = byteCount ;
|
*len = byteCount ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
((char*)data)[byteCount] = 0 ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete[] ((char *)data) ;
|
delete[] ((char *)data) ;
|
||||||
data = NULL ;
|
data = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
long offset ;
|
long offset ;
|
||||||
Handle datahandle = NewHandle(0) ;
|
Handle datahandle = NewHandle(0) ;
|
||||||
HLock( datahandle ) ;
|
HLock( datahandle ) ;
|
||||||
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
||||||
HUnlock( datahandle ) ;
|
HUnlock( datahandle ) ;
|
||||||
if ( GetHandleSize( datahandle ) > 0 )
|
if ( GetHandleSize( datahandle ) > 0 )
|
||||||
{
|
{
|
||||||
long byteCount = GetHandleSize( datahandle ) ;
|
long byteCount = GetHandleSize( datahandle ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
data = new char[ byteCount + 1] ;
|
data = new char[ byteCount + 1] ;
|
||||||
else
|
else
|
||||||
data = new char[ byteCount ] ;
|
data = new char[ byteCount ] ;
|
||||||
|
|
||||||
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
((char*)data)[byteCount] = 0 ;
|
||||||
* len = byteCount ;
|
* len = byteCount ;
|
||||||
}
|
}
|
||||||
DisposeHandle( datahandle ) ;
|
DisposeHandle( datahandle ) ;
|
||||||
#endif
|
#endif
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
@@ -156,16 +156,16 @@ void wxClipboard::Clear()
|
|||||||
m_data = (wxDataObject*) NULL;
|
m_data = (wxDataObject*) NULL;
|
||||||
}
|
}
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
err = ClearCurrentScrap( );
|
err = ClearCurrentScrap( );
|
||||||
#else
|
#else
|
||||||
OSErr err ;
|
OSErr err ;
|
||||||
err = ZeroScrap( );
|
err = ZeroScrap( );
|
||||||
#endif
|
#endif
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("Failed to empty the clipboard."));
|
wxLogSysError(_("Failed to empty the clipboard."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxClipboard::Flush()
|
bool wxClipboard::Flush()
|
||||||
@@ -220,9 +220,9 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
array[i].GetId().c_str() );
|
array[i].GetId().c_str() );
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
OSErr err = noErr ;
|
OSErr err = noErr ;
|
||||||
#else
|
#else
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch ( array[i].GetType() )
|
switch ( array[i].GetType() )
|
||||||
@@ -232,26 +232,27 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
{
|
{
|
||||||
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
|
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
|
||||||
wxString str(textDataObject->GetText());
|
wxString str(textDataObject->GetText());
|
||||||
wxString mac ;
|
wxString mac ;
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
if ( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
|
mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mac = textDataObject->GetText() ;
|
mac = textDataObject->GetText() ;
|
||||||
}
|
}
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
|
err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
|
||||||
#else
|
#else
|
||||||
ScrapRef scrap;
|
ScrapRef scrap;
|
||||||
err = GetCurrentScrap (&scrap);
|
err = GetCurrentScrap (&scrap);
|
||||||
if ( !err )
|
if ( !err )
|
||||||
{
|
{
|
||||||
err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
|
err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
case wxDF_METAFILE:
|
case wxDF_METAFILE:
|
||||||
@@ -259,25 +260,26 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
wxMetafileDataObject* metaFileDataObject =
|
wxMetafileDataObject* metaFileDataObject =
|
||||||
(wxMetafileDataObject*) data;
|
(wxMetafileDataObject*) data;
|
||||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||||
HLock( (Handle) pict ) ;
|
HLock( (Handle) pict ) ;
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||||
#else
|
#else
|
||||||
ScrapRef scrap;
|
ScrapRef scrap;
|
||||||
err = GetCurrentScrap (&scrap);
|
err = GetCurrentScrap (&scrap);
|
||||||
if ( !err )
|
if ( !err )
|
||||||
{
|
{
|
||||||
err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
|
err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
HUnlock( (Handle) pict ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
case wxDF_DIB:
|
case wxDF_DIB:
|
||||||
default:
|
default:
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -299,34 +301,34 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
|
|||||||
return m_data->IsSupported( dataFormat ) ;
|
return m_data->IsSupported( dataFormat ) ;
|
||||||
}
|
}
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
ScrapRef scrapRef;
|
ScrapRef scrapRef;
|
||||||
|
|
||||||
err = GetCurrentScrap( &scrapRef );
|
err = GetCurrentScrap( &scrapRef );
|
||||||
if ( err != noTypeErr && err != memFullErr )
|
if ( err != noTypeErr && err != memFullErr )
|
||||||
{
|
{
|
||||||
ScrapFlavorFlags flavorFlags;
|
ScrapFlavorFlags flavorFlags;
|
||||||
Size byteCount;
|
Size byteCount;
|
||||||
|
|
||||||
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
||||||
{
|
{
|
||||||
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
||||||
{
|
{
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
long offset ;
|
long offset ;
|
||||||
Handle datahandle = NewHandle(0) ;
|
Handle datahandle = NewHandle(0) ;
|
||||||
HLock( datahandle ) ;
|
HLock( datahandle ) ;
|
||||||
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
||||||
HUnlock( datahandle ) ;
|
HUnlock( datahandle ) ;
|
||||||
bool hasData = GetHandleSize( datahandle ) > 0 ;
|
bool hasData = GetHandleSize( datahandle ) > 0 ;
|
||||||
DisposeHandle( datahandle ) ;
|
DisposeHandle( datahandle ) ;
|
||||||
return hasData ;
|
return hasData ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -179,7 +179,7 @@ void wxTopLevelWindowMac::Iconize(bool iconize)
|
|||||||
|
|
||||||
bool wxTopLevelWindowMac::IsIconized() const
|
bool wxTopLevelWindowMac::IsIconized() const
|
||||||
{
|
{
|
||||||
// mac dialogs cannot be iconized
|
// mac dialogs cannot be iconized
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x += m_x;
|
event.m_x += m_x;
|
||||||
event.m_y += m_y;
|
event.m_y += m_y;
|
||||||
|
|
||||||
/*
|
|
||||||
wxPoint origin = GetClientAreaOrigin() ;
|
|
||||||
|
|
||||||
event.m_x += origin.x ;
|
|
||||||
event.m_y += origin.y ;
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
if ( wxTheApp->s_captureWindow )
|
if ( wxTheApp->s_captureWindow )
|
||||||
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x = x ;
|
event.m_x = x ;
|
||||||
event.m_y = y ;
|
event.m_y = y ;
|
||||||
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
if ( ev->what == mouseUp )
|
if ( ev->what == mouseUp )
|
||||||
{
|
{
|
||||||
wxTheApp->s_captureWindow = NULL ;
|
wxTheApp->s_captureWindow = NULL ;
|
||||||
|
@@ -352,9 +352,9 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
|
|||||||
|
|
||||||
MacRootWindowToWindow( x , y ) ;
|
MacRootWindowToWindow( x , y ) ;
|
||||||
if ( x )
|
if ( x )
|
||||||
x -= MacGetLeftBorderSize() ;
|
x -= MacGetLeftBorderSize() ;
|
||||||
if ( y )
|
if ( y )
|
||||||
y -= MacGetTopBorderSize() ;
|
y -= MacGetTopBorderSize() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMac::DoClientToScreen(int *x, int *y) const
|
void wxWindowMac::DoClientToScreen(int *x, int *y) const
|
||||||
@@ -362,10 +362,10 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
|
|||||||
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
||||||
|
|
||||||
if ( x )
|
if ( x )
|
||||||
x += MacGetLeftBorderSize() ;
|
x += MacGetLeftBorderSize() ;
|
||||||
if ( y )
|
if ( y )
|
||||||
y += MacGetTopBorderSize() ;
|
y += MacGetTopBorderSize() ;
|
||||||
|
|
||||||
MacWindowToRootWindow( x , y ) ;
|
MacWindowToRootWindow( x , y ) ;
|
||||||
|
|
||||||
Point localwhere = { 0,0 };
|
Point localwhere = { 0,0 };
|
||||||
@@ -678,12 +678,12 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
|
|||||||
|
|
||||||
void wxWindow::SetTitle(const wxString& title)
|
void wxWindow::SetTitle(const wxString& title)
|
||||||
{
|
{
|
||||||
m_label = title ;
|
m_label = title ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxWindow::GetTitle() const
|
wxString wxWindow::GetTitle() const
|
||||||
{
|
{
|
||||||
return m_label ;
|
return m_label ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowMac::Show(bool show)
|
bool wxWindowMac::Show(bool show)
|
||||||
@@ -1023,17 +1023,17 @@ void wxWindowMac::MacPaintBorders( int left , int top )
|
|||||||
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
|
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_THEME_BORDER
|
#if wxMAC_USE_THEME_BORDER
|
||||||
Rect rect = { top , left , m_height + top , m_width + left } ;
|
Rect rect = { top , left , m_height + top , m_width + left } ;
|
||||||
SInt32 border = 0 ;
|
SInt32 border = 0 ;
|
||||||
/*
|
/*
|
||||||
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
||||||
InsetRect( &rect , border , border );
|
InsetRect( &rect , border , border );
|
||||||
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
||||||
#else
|
#else
|
||||||
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
|
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
|
||||||
RGBForeColor( &face );
|
RGBForeColor( &face );
|
||||||
MoveTo( left + 0 , top + m_height - 2 );
|
MoveTo( left + 0 , top + m_height - 2 );
|
||||||
LineTo( left + 0 , top + 0 );
|
LineTo( left + 0 , top + 0 );
|
||||||
@@ -1066,7 +1066,7 @@ void wxWindowMac::MacPaintBorders( int left , int top )
|
|||||||
}
|
}
|
||||||
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 ) ;
|
RGBForeColor( &black ) ;
|
||||||
FrameRect( &rect ) ;
|
FrameRect( &rect ) ;
|
||||||
}
|
}
|
||||||
@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
|
|||||||
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
||||||
{
|
{
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
|
|
||||||
Point pt = { screenpoint.y , screenpoint.x } ;
|
Point pt = { screenpoint.y , screenpoint.x } ;
|
||||||
if ( ::FindWindow( pt , &window ) == 3 )
|
if ( ::FindWindow( pt , &window ) == 3 )
|
||||||
{
|
{
|
||||||
wxPoint point( screenpoint ) ;
|
|
||||||
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
point = win->ScreenToClient( point ) ;
|
// No, this yields the CLIENT are, we need the whole frame. RR.
|
||||||
point += win->GetClientAreaOrigin() ;
|
// 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 ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
|
|||||||
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
||||||
wxToolTip::RelayEvent( this , event);
|
wxToolTip::RelayEvent( this , event);
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent( event ) ;
|
GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1435,11 +1447,11 @@ void wxWindowMac::Update()
|
|||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
win->MacUpdate( 0 ) ;
|
win->MacUpdate( 0 ) ;
|
||||||
if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
|
if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
|
||||||
{
|
{
|
||||||
QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
|
QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
||||||
@@ -1769,23 +1781,23 @@ long wxWindowMac::MacGetLeftBorderSize( ) const
|
|||||||
|
|
||||||
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
|
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
|
||||||
{
|
{
|
||||||
SInt32 border = 3 ;
|
SInt32 border = 3 ;
|
||||||
#if wxMAC_USE_THEME_BORDER
|
#if wxMAC_USE_THEME_BORDER
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return border ;
|
return border ;
|
||||||
}
|
}
|
||||||
else if ( m_windowStyle &wxDOUBLE_BORDER)
|
else if ( m_windowStyle &wxDOUBLE_BORDER)
|
||||||
{
|
{
|
||||||
SInt32 border = 3 ;
|
SInt32 border = 3 ;
|
||||||
#if wxMAC_USE_THEME_BORDER
|
#if wxMAC_USE_THEME_BORDER
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return border ;
|
return border ;
|
||||||
}
|
}
|
||||||
else if (m_windowStyle &wxSIMPLE_BORDER)
|
else if (m_windowStyle &wxSIMPLE_BORDER)
|
||||||
{
|
{
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: ??/??/98
|
// Created: ??/??/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) AUTHOR
|
// Copyright: (c) AUTHOR
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -39,12 +39,12 @@ static const wxChar *TRACE_CLIPBOARD = _T("clipboard");
|
|||||||
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
||||||
{
|
{
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
OSErr err = noErr ;
|
OSErr err = noErr ;
|
||||||
#else
|
#else
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
#endif
|
#endif
|
||||||
void * data = NULL ;
|
void * data = NULL ;
|
||||||
|
|
||||||
switch (dataFormat.GetType())
|
switch (dataFormat.GetType())
|
||||||
{
|
{
|
||||||
case wxDF_OEMTEXT:
|
case wxDF_OEMTEXT:
|
||||||
@@ -61,57 +61,57 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
ScrapRef scrapRef;
|
ScrapRef scrapRef;
|
||||||
|
|
||||||
err = GetCurrentScrap( &scrapRef );
|
err = GetCurrentScrap( &scrapRef );
|
||||||
if ( err != noTypeErr && err != memFullErr )
|
if ( err != noTypeErr && err != memFullErr )
|
||||||
{
|
{
|
||||||
ScrapFlavorFlags flavorFlags;
|
ScrapFlavorFlags flavorFlags;
|
||||||
Size byteCount;
|
Size byteCount;
|
||||||
|
|
||||||
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
||||||
{
|
{
|
||||||
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
||||||
{
|
{
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
byteCount++ ;
|
byteCount++ ;
|
||||||
|
|
||||||
data = new char[ byteCount ] ;
|
data = new char[ byteCount ] ;
|
||||||
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
|
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
|
||||||
{
|
{
|
||||||
*len = byteCount ;
|
*len = byteCount ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
((char*)data)[byteCount] = 0 ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delete[] ((char *)data) ;
|
delete[] ((char *)data) ;
|
||||||
data = NULL ;
|
data = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
long offset ;
|
long offset ;
|
||||||
Handle datahandle = NewHandle(0) ;
|
Handle datahandle = NewHandle(0) ;
|
||||||
HLock( datahandle ) ;
|
HLock( datahandle ) ;
|
||||||
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
||||||
HUnlock( datahandle ) ;
|
HUnlock( datahandle ) ;
|
||||||
if ( GetHandleSize( datahandle ) > 0 )
|
if ( GetHandleSize( datahandle ) > 0 )
|
||||||
{
|
{
|
||||||
long byteCount = GetHandleSize( datahandle ) ;
|
long byteCount = GetHandleSize( datahandle ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
data = new char[ byteCount + 1] ;
|
data = new char[ byteCount + 1] ;
|
||||||
else
|
else
|
||||||
data = new char[ byteCount ] ;
|
data = new char[ byteCount ] ;
|
||||||
|
|
||||||
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
((char*)data)[byteCount] = 0 ;
|
||||||
* len = byteCount ;
|
* len = byteCount ;
|
||||||
}
|
}
|
||||||
DisposeHandle( datahandle ) ;
|
DisposeHandle( datahandle ) ;
|
||||||
#endif
|
#endif
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
@@ -156,16 +156,16 @@ void wxClipboard::Clear()
|
|||||||
m_data = (wxDataObject*) NULL;
|
m_data = (wxDataObject*) NULL;
|
||||||
}
|
}
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
err = ClearCurrentScrap( );
|
err = ClearCurrentScrap( );
|
||||||
#else
|
#else
|
||||||
OSErr err ;
|
OSErr err ;
|
||||||
err = ZeroScrap( );
|
err = ZeroScrap( );
|
||||||
#endif
|
#endif
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("Failed to empty the clipboard."));
|
wxLogSysError(_("Failed to empty the clipboard."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxClipboard::Flush()
|
bool wxClipboard::Flush()
|
||||||
@@ -220,9 +220,9 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
array[i].GetId().c_str() );
|
array[i].GetId().c_str() );
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
OSErr err = noErr ;
|
OSErr err = noErr ;
|
||||||
#else
|
#else
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch ( array[i].GetType() )
|
switch ( array[i].GetType() )
|
||||||
@@ -232,26 +232,27 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
{
|
{
|
||||||
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
|
wxTextDataObject* textDataObject = (wxTextDataObject*) data;
|
||||||
wxString str(textDataObject->GetText());
|
wxString str(textDataObject->GetText());
|
||||||
wxString mac ;
|
wxString mac ;
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
if ( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
|
mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mac = textDataObject->GetText() ;
|
mac = textDataObject->GetText() ;
|
||||||
}
|
}
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
|
err = PutScrap( mac.Length() , 'TEXT' , mac.c_str() ) ;
|
||||||
#else
|
#else
|
||||||
ScrapRef scrap;
|
ScrapRef scrap;
|
||||||
err = GetCurrentScrap (&scrap);
|
err = GetCurrentScrap (&scrap);
|
||||||
if ( !err )
|
if ( !err )
|
||||||
{
|
{
|
||||||
err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
|
err = PutScrapFlavor (scrap, 'TEXT', 0, mac.Length(), mac.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
case wxDF_METAFILE:
|
case wxDF_METAFILE:
|
||||||
@@ -259,25 +260,26 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
wxMetafileDataObject* metaFileDataObject =
|
wxMetafileDataObject* metaFileDataObject =
|
||||||
(wxMetafileDataObject*) data;
|
(wxMetafileDataObject*) data;
|
||||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||||
HLock( (Handle) pict ) ;
|
HLock( (Handle) pict ) ;
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
err = PutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||||
#else
|
#else
|
||||||
ScrapRef scrap;
|
ScrapRef scrap;
|
||||||
err = GetCurrentScrap (&scrap);
|
err = GetCurrentScrap (&scrap);
|
||||||
if ( !err )
|
if ( !err )
|
||||||
{
|
{
|
||||||
err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
|
err = PutScrapFlavor (scrap, 'PICT', 0, GetHandleSize((Handle) pict), *pict);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
HUnlock( (Handle) pict ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
case wxDF_DIB:
|
case wxDF_DIB:
|
||||||
default:
|
default:
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -299,34 +301,34 @@ bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
|
|||||||
return m_data->IsSupported( dataFormat ) ;
|
return m_data->IsSupported( dataFormat ) ;
|
||||||
}
|
}
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
OSStatus err = noErr;
|
OSStatus err = noErr;
|
||||||
ScrapRef scrapRef;
|
ScrapRef scrapRef;
|
||||||
|
|
||||||
err = GetCurrentScrap( &scrapRef );
|
err = GetCurrentScrap( &scrapRef );
|
||||||
if ( err != noTypeErr && err != memFullErr )
|
if ( err != noTypeErr && err != memFullErr )
|
||||||
{
|
{
|
||||||
ScrapFlavorFlags flavorFlags;
|
ScrapFlavorFlags flavorFlags;
|
||||||
Size byteCount;
|
Size byteCount;
|
||||||
|
|
||||||
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
||||||
{
|
{
|
||||||
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
||||||
{
|
{
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
long offset ;
|
long offset ;
|
||||||
Handle datahandle = NewHandle(0) ;
|
Handle datahandle = NewHandle(0) ;
|
||||||
HLock( datahandle ) ;
|
HLock( datahandle ) ;
|
||||||
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
GetScrap( datahandle , dataFormat.GetFormatId() , &offset ) ;
|
||||||
HUnlock( datahandle ) ;
|
HUnlock( datahandle ) ;
|
||||||
bool hasData = GetHandleSize( datahandle ) > 0 ;
|
bool hasData = GetHandleSize( datahandle ) > 0 ;
|
||||||
DisposeHandle( datahandle ) ;
|
DisposeHandle( datahandle ) ;
|
||||||
return hasData ;
|
return hasData ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -179,7 +179,7 @@ void wxTopLevelWindowMac::Iconize(bool iconize)
|
|||||||
|
|
||||||
bool wxTopLevelWindowMac::IsIconized() const
|
bool wxTopLevelWindowMac::IsIconized() const
|
||||||
{
|
{
|
||||||
// mac dialogs cannot be iconized
|
// mac dialogs cannot be iconized
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,13 +420,6 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x += m_x;
|
event.m_x += m_x;
|
||||||
event.m_y += m_y;
|
event.m_y += m_y;
|
||||||
|
|
||||||
/*
|
|
||||||
wxPoint origin = GetClientAreaOrigin() ;
|
|
||||||
|
|
||||||
event.m_x += origin.x ;
|
|
||||||
event.m_y += origin.y ;
|
|
||||||
*/
|
|
||||||
|
|
||||||
event.m_timeStamp = ev->when;
|
event.m_timeStamp = ev->when;
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
if ( wxTheApp->s_captureWindow )
|
if ( wxTheApp->s_captureWindow )
|
||||||
@@ -437,6 +430,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
|
|||||||
event.m_x = x ;
|
event.m_x = x ;
|
||||||
event.m_y = y ;
|
event.m_y = y ;
|
||||||
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
wxTheApp->s_captureWindow->GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
if ( ev->what == mouseUp )
|
if ( ev->what == mouseUp )
|
||||||
{
|
{
|
||||||
wxTheApp->s_captureWindow = NULL ;
|
wxTheApp->s_captureWindow = NULL ;
|
||||||
|
@@ -352,9 +352,9 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const
|
|||||||
|
|
||||||
MacRootWindowToWindow( x , y ) ;
|
MacRootWindowToWindow( x , y ) ;
|
||||||
if ( x )
|
if ( x )
|
||||||
x -= MacGetLeftBorderSize() ;
|
x -= MacGetLeftBorderSize() ;
|
||||||
if ( y )
|
if ( y )
|
||||||
y -= MacGetTopBorderSize() ;
|
y -= MacGetTopBorderSize() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMac::DoClientToScreen(int *x, int *y) const
|
void wxWindowMac::DoClientToScreen(int *x, int *y) const
|
||||||
@@ -362,10 +362,10 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
|
|||||||
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
WindowRef window = (WindowRef) MacGetRootWindow() ;
|
||||||
|
|
||||||
if ( x )
|
if ( x )
|
||||||
x += MacGetLeftBorderSize() ;
|
x += MacGetLeftBorderSize() ;
|
||||||
if ( y )
|
if ( y )
|
||||||
y += MacGetTopBorderSize() ;
|
y += MacGetTopBorderSize() ;
|
||||||
|
|
||||||
MacWindowToRootWindow( x , y ) ;
|
MacWindowToRootWindow( x , y ) ;
|
||||||
|
|
||||||
Point localwhere = { 0,0 };
|
Point localwhere = { 0,0 };
|
||||||
@@ -678,12 +678,12 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const
|
|||||||
|
|
||||||
void wxWindow::SetTitle(const wxString& title)
|
void wxWindow::SetTitle(const wxString& title)
|
||||||
{
|
{
|
||||||
m_label = title ;
|
m_label = title ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxWindow::GetTitle() const
|
wxString wxWindow::GetTitle() const
|
||||||
{
|
{
|
||||||
return m_label ;
|
return m_label ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowMac::Show(bool show)
|
bool wxWindowMac::Show(bool show)
|
||||||
@@ -1023,17 +1023,17 @@ void wxWindowMac::MacPaintBorders( int left , int top )
|
|||||||
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
|
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
|
||||||
{
|
{
|
||||||
#if wxMAC_USE_THEME_BORDER
|
#if wxMAC_USE_THEME_BORDER
|
||||||
Rect rect = { top , left , m_height + top , m_width + left } ;
|
Rect rect = { top , left , m_height + top , m_width + left } ;
|
||||||
SInt32 border = 0 ;
|
SInt32 border = 0 ;
|
||||||
/*
|
/*
|
||||||
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
||||||
InsetRect( &rect , border , border );
|
InsetRect( &rect , border , border );
|
||||||
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
DrawThemeListBoxFrame(&rect,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
DrawThemePrimaryGroup(&rect ,IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
|
||||||
#else
|
#else
|
||||||
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
|
bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
|
||||||
RGBForeColor( &face );
|
RGBForeColor( &face );
|
||||||
MoveTo( left + 0 , top + m_height - 2 );
|
MoveTo( left + 0 , top + m_height - 2 );
|
||||||
LineTo( left + 0 , top + 0 );
|
LineTo( left + 0 , top + 0 );
|
||||||
@@ -1066,7 +1066,7 @@ void wxWindowMac::MacPaintBorders( int left , int top )
|
|||||||
}
|
}
|
||||||
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 ) ;
|
RGBForeColor( &black ) ;
|
||||||
FrameRect( &rect ) ;
|
FrameRect( &rect ) ;
|
||||||
}
|
}
|
||||||
@@ -1350,15 +1350,25 @@ bool wxWindowMac::MacGetWindowFromPointSub( const wxPoint &point , wxWindowMac**
|
|||||||
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMac** outWin )
|
||||||
{
|
{
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
|
|
||||||
Point pt = { screenpoint.y , screenpoint.x } ;
|
Point pt = { screenpoint.y , screenpoint.x } ;
|
||||||
if ( ::FindWindow( pt , &window ) == 3 )
|
if ( ::FindWindow( pt , &window ) == 3 )
|
||||||
{
|
{
|
||||||
wxPoint point( screenpoint ) ;
|
|
||||||
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
wxWindowMac* win = wxFindWinFromMacWindow( window ) ;
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
point = win->ScreenToClient( point ) ;
|
// No, this yields the CLIENT are, we need the whole frame. RR.
|
||||||
point += win->GetClientAreaOrigin() ;
|
// 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 ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1426,9 @@ bool wxWindowMac::MacDispatchMouseEvent(wxMouseEvent& event)
|
|||||||
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
|| event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
||||||
wxToolTip::RelayEvent( this , event);
|
wxToolTip::RelayEvent( this , event);
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent( event ) ;
|
GetEventHandler()->ProcessEvent( event ) ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1435,11 +1447,11 @@ void wxWindowMac::Update()
|
|||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
win->MacUpdate( 0 ) ;
|
win->MacUpdate( 0 ) ;
|
||||||
if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
|
if ( QDIsPortBuffered( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) ) )
|
||||||
{
|
{
|
||||||
QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
|
QDFlushPortBuffer( GetWindowPort( (WindowRef) win->MacGetWindowRef() ) , NULL ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
wxTopLevelWindowMac* wxWindowMac::MacGetTopLevelWindow() const
|
||||||
@@ -1769,23 +1781,23 @@ long wxWindowMac::MacGetLeftBorderSize( ) const
|
|||||||
|
|
||||||
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
|
if (m_windowStyle & wxRAISED_BORDER || m_windowStyle & wxSUNKEN_BORDER )
|
||||||
{
|
{
|
||||||
SInt32 border = 3 ;
|
SInt32 border = 3 ;
|
||||||
#if wxMAC_USE_THEME_BORDER
|
#if wxMAC_USE_THEME_BORDER
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return border ;
|
return border ;
|
||||||
}
|
}
|
||||||
else if ( m_windowStyle &wxDOUBLE_BORDER)
|
else if ( m_windowStyle &wxDOUBLE_BORDER)
|
||||||
{
|
{
|
||||||
SInt32 border = 3 ;
|
SInt32 border = 3 ;
|
||||||
#if wxMAC_USE_THEME_BORDER
|
#if wxMAC_USE_THEME_BORDER
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return border ;
|
return border ;
|
||||||
}
|
}
|
||||||
else if (m_windowStyle &wxSIMPLE_BORDER)
|
else if (m_windowStyle &wxSIMPLE_BORDER)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user