cleanup - reformat
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36670 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b10ca83467
commit
6eae1f7d48
@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/mac/carbon/combobox.cpp
|
// Name: src/mac/carbon/combobox.cpp
|
||||||
// Purpose: wxComboBox class
|
// Purpose: wxComboBox class
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor, Dan "Bud" Keith (composite combobox)
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
@ -20,14 +20,14 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
|
||||||
|
|
||||||
// composite combobox implementation by Dan "Bud" Keith bud@otsys.com
|
|
||||||
|
|
||||||
|
|
||||||
static int nextPopUpMenuId = 1000 ;
|
static int nextPopUpMenuId = 1000 ;
|
||||||
|
|
||||||
MenuHandle NewUniqueMenu()
|
MenuHandle NewUniqueMenu()
|
||||||
{
|
{
|
||||||
MenuHandle handle = NewMenu( nextPopUpMenuId , "\pMenu" ) ;
|
MenuHandle handle = NewMenu( nextPopUpMenuId , "\pMenu" ) ;
|
||||||
nextPopUpMenuId++ ;
|
nextPopUpMenuId++ ;
|
||||||
|
|
||||||
return handle ;
|
return handle ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,19 +93,17 @@ protected:
|
|||||||
event.SetInt( m_cb->GetSelection() );
|
event.SetInt( m_cb->GetSelection() );
|
||||||
event.SetEventObject( m_cb );
|
event.SetEventObject( m_cb );
|
||||||
|
|
||||||
// This will invoke the dialog default action, such
|
// This will invoke the dialog default action,
|
||||||
// as the clicking the default button.
|
// such as the clicking the default button.
|
||||||
|
|
||||||
if (!m_cb->GetEventHandler()->ProcessEvent( event ))
|
if (!m_cb->GetEventHandler()->ProcessEvent( event ))
|
||||||
{
|
{
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) {
|
while ( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
|
||||||
parent = parent->GetParent() ;
|
parent = parent->GetParent() ;
|
||||||
}
|
|
||||||
if ( parent && parent->GetDefaultItem() )
|
if ( parent && parent->GetDefaultItem() )
|
||||||
{
|
{
|
||||||
wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
|
wxButton *def = wxDynamicCast(parent->GetDefaultItem(), wxButton);
|
||||||
wxButton);
|
|
||||||
if ( def && def->IsEnabled() )
|
if ( def && def->IsEnabled() )
|
||||||
{
|
{
|
||||||
wxCommandEvent event( wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
|
wxCommandEvent event( wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
|
||||||
@ -166,6 +164,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_cb = cb;
|
m_cb = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPopupWidth() const
|
int GetPopupWidth() const
|
||||||
{
|
{
|
||||||
switch ( GetWindowVariant() )
|
switch ( GetWindowVariant() )
|
||||||
@ -173,6 +172,7 @@ public:
|
|||||||
case wxWINDOW_VARIANT_NORMAL :
|
case wxWINDOW_VARIANT_NORMAL :
|
||||||
case wxWINDOW_VARIANT_LARGE :
|
case wxWINDOW_VARIANT_LARGE :
|
||||||
return 24 ;
|
return 24 ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return 21 ;
|
return 21 ;
|
||||||
}
|
}
|
||||||
@ -197,11 +197,13 @@ protected:
|
|||||||
TextEvent.SetEventObject( m_cb );
|
TextEvent.SetEventObject( m_cb );
|
||||||
m_cb->ProcessCommand( TextEvent );
|
m_cb->ProcessCommand( TextEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize() const
|
virtual wxSize DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxSize sz = wxChoice::DoGetBestSize() ;
|
wxSize sz = wxChoice::DoGetBestSize() ;
|
||||||
if (! m_cb->HasFlag(wxCB_READONLY) )
|
if (! m_cb->HasFlag(wxCB_READONLY) )
|
||||||
sz.x = GetPopupWidth() ;
|
sz.x = GetPopupWidth() ;
|
||||||
|
|
||||||
return sz ;
|
return sz ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,17 +225,19 @@ wxComboBox::~wxComboBox()
|
|||||||
// delete the controls now, don't leave them alive even though they would
|
// delete the controls now, don't leave them alive even though they would
|
||||||
// still be eventually deleted by our parent - but it will be too late, the
|
// still be eventually deleted by our parent - but it will be too late, the
|
||||||
// user code expects them to be gone now
|
// user code expects them to be gone now
|
||||||
if (m_text != NULL) {
|
if (m_text != NULL)
|
||||||
|
{
|
||||||
delete m_text;
|
delete m_text;
|
||||||
m_text = NULL;
|
m_text = NULL;
|
||||||
}
|
}
|
||||||
if (m_choice != NULL) {
|
|
||||||
|
if (m_choice != NULL)
|
||||||
|
{
|
||||||
delete m_choice;
|
delete m_choice;
|
||||||
m_choice = NULL;
|
m_choice = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// geometry
|
// geometry
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -242,6 +246,7 @@ wxSize wxComboBox::DoGetBestSize() const
|
|||||||
{
|
{
|
||||||
if (!m_choice && !m_text)
|
if (!m_choice && !m_text)
|
||||||
return GetSize();
|
return GetSize();
|
||||||
|
|
||||||
wxSize size = m_choice->GetBestSize();
|
wxSize size = m_choice->GetBestSize();
|
||||||
|
|
||||||
if ( m_text != NULL )
|
if ( m_text != NULL )
|
||||||
@ -249,6 +254,7 @@ wxSize wxComboBox::DoGetBestSize() const
|
|||||||
wxSize sizeText = m_text->GetBestSize();
|
wxSize sizeText = m_text->GetBestSize();
|
||||||
if (sizeText.y > size.y)
|
if (sizeText.y > size.y)
|
||||||
size.y = sizeText.y;
|
size.y = sizeText.y;
|
||||||
|
|
||||||
size.x = m_choice->GetPopupWidth() + sizeText.x + MARGIN;
|
size.x = m_choice->GetPopupWidth() + sizeText.x + MARGIN;
|
||||||
size.x += TEXTFOCUSBORDER ;
|
size.x += TEXTFOCUSBORDER ;
|
||||||
size.y += 2 * TEXTFOCUSBORDER ;
|
size.y += 2 * TEXTFOCUSBORDER ;
|
||||||
@ -258,6 +264,7 @@ wxSize wxComboBox::DoGetBestSize() const
|
|||||||
// clipping is too tight
|
// clipping is too tight
|
||||||
size.y += 1 ;
|
size.y += 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,13 +282,12 @@ void wxComboBox::DoMoveWindow(int x, int y, int width, int height)
|
|||||||
{
|
{
|
||||||
wxCoord wText = width - m_choice->GetPopupWidth() - MARGIN;
|
wxCoord wText = width - m_choice->GetPopupWidth() - MARGIN;
|
||||||
m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1);
|
m_text->SetSize(TEXTFOCUSBORDER, TEXTFOCUSBORDER, wText, -1);
|
||||||
|
|
||||||
// put it at an inset of 1 to have outer area shadows drawn as well
|
// put it at an inset of 1 to have outer area shadows drawn as well
|
||||||
m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , TEXTFOCUSBORDER, m_choice->GetPopupWidth() , -1);
|
m_choice->SetSize(TEXTFOCUSBORDER + wText + MARGIN - 1 , TEXTFOCUSBORDER, m_choice->GetPopupWidth() , -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// operations forwarded to the subcontrols
|
// operations forwarded to the subcontrols
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@ -307,25 +313,22 @@ bool wxComboBox::Show(bool show)
|
|||||||
|
|
||||||
void wxComboBox::SetFocus()
|
void wxComboBox::SetFocus()
|
||||||
{
|
{
|
||||||
if ( m_text != NULL) {
|
if ( m_text != NULL)
|
||||||
m_text->SetFocus();
|
m_text->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void wxComboBox::DelegateTextChanged( const wxString& value )
|
void wxComboBox::DelegateTextChanged( const wxString& value )
|
||||||
{
|
{
|
||||||
SetStringSelection( value );
|
SetStringSelection( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxComboBox::DelegateChoice( const wxString& value )
|
void wxComboBox::DelegateChoice( const wxString& value )
|
||||||
{
|
{
|
||||||
SetStringSelection( value );
|
SetStringSelection( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::Create(wxWindow *parent,
|
||||||
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& value,
|
const wxString& value,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
@ -340,12 +343,13 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
chs.GetStrings(), style, validator, name );
|
chs.GetStrings(), style, validator, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxComboBox::Create(wxWindow *parent,
|
||||||
bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& value,
|
const wxString& value,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
int n, const wxString choices[],
|
int n,
|
||||||
|
const wxString choices[],
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
@ -379,7 +383,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_choice->DoAppend( choices[ i ] );
|
m_choice->DoAppend( choices[ i ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetBestSize(size); // Needed because it is a wxControlWithItems
|
// Needed because it is a wxControlWithItems
|
||||||
|
SetBestSize(size);
|
||||||
SetStringSelection(value);
|
SetStringSelection(value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -390,13 +395,9 @@ wxString wxComboBox::GetValue() const
|
|||||||
wxString result;
|
wxString result;
|
||||||
|
|
||||||
if ( m_text == NULL )
|
if ( m_text == NULL )
|
||||||
{
|
|
||||||
result = m_choice->GetString( m_choice->GetSelection() );
|
result = m_choice->GetString( m_choice->GetSelection() );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
result = m_text->GetValue();
|
result = m_text->GetValue();
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -415,29 +416,24 @@ void wxComboBox::SetValue(const wxString& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations
|
||||||
|
|
||||||
void wxComboBox::Copy()
|
void wxComboBox::Copy()
|
||||||
{
|
{
|
||||||
if ( m_text != NULL )
|
if ( m_text != NULL )
|
||||||
{
|
|
||||||
m_text->Copy();
|
m_text->Copy();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void wxComboBox::Cut()
|
void wxComboBox::Cut()
|
||||||
{
|
{
|
||||||
if ( m_text != NULL )
|
if ( m_text != NULL )
|
||||||
{
|
|
||||||
m_text->Cut();
|
m_text->Cut();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void wxComboBox::Paste()
|
void wxComboBox::Paste()
|
||||||
{
|
{
|
||||||
if ( m_text != NULL )
|
if ( m_text != NULL )
|
||||||
{
|
|
||||||
m_text->Paste();
|
m_text->Paste();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void wxComboBox::SetEditable(bool editable)
|
void wxComboBox::SetEditable(bool editable)
|
||||||
{
|
{
|
||||||
@ -563,10 +559,8 @@ void wxComboBox::SetSelection(int n)
|
|||||||
m_choice->SetSelection( n );
|
m_choice->SetSelection( n );
|
||||||
|
|
||||||
if ( m_text != NULL )
|
if ( m_text != NULL )
|
||||||
{
|
|
||||||
m_text->SetValue( GetString( n ) );
|
m_text->SetValue( GetString( n ) );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
int wxComboBox::FindString(const wxString& s, bool bCase) const
|
||||||
{
|
{
|
||||||
@ -657,12 +651,15 @@ bool wxComboBox::CanRedo() const
|
|||||||
|
|
||||||
wxInt32 wxComboBox::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
wxInt32 wxComboBox::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
/* For consistency with other platforms, clicking in the text area does not constitute a selection
|
/*
|
||||||
|
For consistency with other platforms, clicking in the text area does not constitute a selection
|
||||||
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
|
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId );
|
||||||
event.SetInt(GetSelection());
|
event.SetInt(GetSelection());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetString(GetStringSelection());
|
event.SetString(GetStringSelection());
|
||||||
ProcessCommand(event);*/
|
ProcessCommand(event);
|
||||||
|
*/
|
||||||
|
|
||||||
return noErr ;
|
return noErr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: dnd.cpp
|
// Name: dnd.cpp
|
||||||
// Purpose: wxDropTarget, wxDropSource, wxDataObject implementation
|
// Purpose: wxDropTarget, wxDropSource implementations
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
@ -25,20 +25,21 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global
|
// globals
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxMacEnsureTrackingHandlersInstalled() ;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
wxWindow* m_currentTargetWindow ;
|
wxWindow* m_currentTargetWindow ;
|
||||||
wxDropTarget* m_currentTarget ;
|
wxDropTarget* m_currentTarget ;
|
||||||
wxDropSource* m_currentSource ;
|
wxDropSource* m_currentSource ;
|
||||||
} MacTrackingGlobals ;
|
}
|
||||||
|
MacTrackingGlobals ;
|
||||||
|
|
||||||
MacTrackingGlobals gTrackingGlobals ;
|
MacTrackingGlobals gTrackingGlobals ;
|
||||||
|
|
||||||
|
void wxMacEnsureTrackingHandlersInstalled() ;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// wxDropTarget
|
// wxDropTarget
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -53,14 +54,13 @@ wxDragResult wxDropTarget::OnDragOver( wxCoord WXUNUSED(x),
|
|||||||
wxCoord WXUNUSED(y),
|
wxCoord WXUNUSED(y),
|
||||||
wxDragResult def )
|
wxDragResult def )
|
||||||
{
|
{
|
||||||
|
|
||||||
return CurrentDragHasSupportedFormat() ? def : wxDragNone;
|
return CurrentDragHasSupportedFormat() ? def : wxDragNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
|
bool wxDropTarget::OnDrop( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
|
||||||
{
|
{
|
||||||
if (!m_dataObject)
|
if (!m_dataObject)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return CurrentDragHasSupportedFormat() ;
|
return CurrentDragHasSupportedFormat() ;
|
||||||
}
|
}
|
||||||
@ -98,21 +98,26 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
|
|||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] array ;
|
delete [] array ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !supported )
|
if ( !supported )
|
||||||
{
|
{
|
||||||
UInt16 items ;
|
UInt16 items ;
|
||||||
OSErr result;
|
OSErr result;
|
||||||
CountDragItems((DragReference)m_currentDrag, &items);
|
|
||||||
for (UInt16 index = 1; index <= items && supported == false ; ++index)
|
|
||||||
{
|
|
||||||
ItemReference theItem;
|
ItemReference theItem;
|
||||||
FlavorType theType ;
|
FlavorType theType ;
|
||||||
UInt16 flavors = 0 ;
|
UInt16 flavors = 0 ;
|
||||||
|
|
||||||
|
CountDragItems((DragReference)m_currentDrag, &items);
|
||||||
|
for (UInt16 index = 1; index <= items && !supported ; ++index)
|
||||||
|
{
|
||||||
|
flavors = 0 ;
|
||||||
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
||||||
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
||||||
|
|
||||||
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
||||||
{
|
{
|
||||||
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
||||||
@ -124,16 +129,17 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return supported ;
|
return supported ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDropTarget::GetData()
|
bool wxDropTarget::GetData()
|
||||||
{
|
{
|
||||||
if (!m_dataObject)
|
if (!m_dataObject)
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if ( !CurrentDragHasSupportedFormat() )
|
if ( !CurrentDragHasSupportedFormat() )
|
||||||
return FALSE ;
|
return false ;
|
||||||
|
|
||||||
bool transferred = false ;
|
bool transferred = false ;
|
||||||
if ( gTrackingGlobals.m_currentSource != NULL )
|
if ( gTrackingGlobals.m_currentSource != NULL )
|
||||||
@ -166,20 +172,25 @@ bool wxDropTarget::GetData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] array ;
|
delete [] array ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !transferred )
|
if ( !transferred )
|
||||||
{
|
{
|
||||||
UInt16 items ;
|
UInt16 items ;
|
||||||
OSErr result;
|
OSErr result;
|
||||||
|
ItemReference theItem;
|
||||||
|
FlavorType theType ;
|
||||||
|
FlavorFlags theFlags;
|
||||||
|
UInt16 flavors ;
|
||||||
bool firstFileAdded = false ;
|
bool firstFileAdded = false ;
|
||||||
|
|
||||||
CountDragItems((DragReference)m_currentDrag, &items);
|
CountDragItems((DragReference)m_currentDrag, &items);
|
||||||
for (UInt16 index = 1; index <= items; ++index)
|
for (UInt16 index = 1; index <= items; ++index)
|
||||||
{
|
{
|
||||||
ItemReference theItem;
|
flavors = 0 ;
|
||||||
FlavorType theType ;
|
|
||||||
UInt16 flavors = 0 ;
|
|
||||||
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
||||||
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
||||||
bool hasPreferredFormat = false ;
|
bool hasPreferredFormat = false ;
|
||||||
@ -202,12 +213,12 @@ bool wxDropTarget::GetData()
|
|||||||
wxDataFormat format(theType) ;
|
wxDataFormat format(theType) ;
|
||||||
if ( (hasPreferredFormat && format == preferredFormat) || (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format )))
|
if ( (hasPreferredFormat && format == preferredFormat) || (!hasPreferredFormat && m_dataObject->IsSupportedFormat( format )))
|
||||||
{
|
{
|
||||||
FlavorFlags theFlags;
|
|
||||||
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
|
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
|
||||||
if (result == noErr)
|
if (result == noErr)
|
||||||
{
|
{
|
||||||
Size dataSize ;
|
Size dataSize ;
|
||||||
Ptr theData ;
|
Ptr theData ;
|
||||||
|
|
||||||
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
|
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
|
||||||
if ( theType == kScrapFlavorTypeText )
|
if ( theType == kScrapFlavorTypeText )
|
||||||
{
|
{
|
||||||
@ -222,6 +233,7 @@ bool wxDropTarget::GetData()
|
|||||||
dataSize++ ;
|
dataSize++ ;
|
||||||
dataSize++ ;
|
dataSize++ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
theData = new char[dataSize];
|
theData = new char[dataSize];
|
||||||
GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
|
GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
|
||||||
if ( theType == kScrapFlavorTypeText )
|
if ( theType == kScrapFlavorTypeText )
|
||||||
@ -247,12 +259,14 @@ bool wxDropTarget::GetData()
|
|||||||
((wxFileDataObject*)m_dataObject)->SetData( 0 , "" ) ;
|
((wxFileDataObject*)m_dataObject)->SetData( 0 , "" ) ;
|
||||||
firstFileAdded = true ;
|
firstFileAdded = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
|
((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_dataObject->SetData( format, dataSize, theData );
|
m_dataObject->SetData( format, dataSize, theData );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] theData;
|
delete [] theData;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
@ -260,7 +274,8 @@ bool wxDropTarget::GetData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE ;
|
|
||||||
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@ -296,29 +311,27 @@ wxDropSource::~wxDropSource()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxDragResult wxDropSource::DoDragDrop(int flags)
|
wxDragResult wxDropSource::DoDragDrop(int flags)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( m_data, wxT("Drop source: no data") );
|
wxASSERT_MSG( m_data, wxT("Drop source: no data") );
|
||||||
|
|
||||||
if (!m_data)
|
if (!m_data)
|
||||||
return (wxDragResult) wxDragNone;
|
return (wxDragResult) wxDragNone;
|
||||||
|
|
||||||
if (m_data->GetFormatCount() == 0)
|
if (m_data->GetFormatCount() == 0)
|
||||||
return (wxDragResult) wxDragNone;
|
return (wxDragResult) wxDragNone;
|
||||||
|
|
||||||
OSErr result;
|
OSErr result;
|
||||||
DragReference theDrag;
|
DragReference theDrag;
|
||||||
RgnHandle dragRegion;
|
RgnHandle dragRegion;
|
||||||
if ((result = NewDrag(&theDrag)))
|
if ((result = NewDrag(&theDrag)) != noErr)
|
||||||
{
|
|
||||||
return wxDragNone ;
|
return wxDragNone ;
|
||||||
}
|
|
||||||
// add data to drag
|
// add data to drag
|
||||||
size_t formatCount = m_data->GetFormatCount() ;
|
size_t formatCount = m_data->GetFormatCount() ;
|
||||||
wxDataFormat *formats = new wxDataFormat[formatCount] ;
|
wxDataFormat *formats = new wxDataFormat[formatCount] ;
|
||||||
m_data->GetAllFormats( formats ) ;
|
m_data->GetAllFormats( formats ) ;
|
||||||
ItemReference theItem = 1 ;
|
ItemReference theItem = 1 ;
|
||||||
|
|
||||||
for ( size_t i = 0 ; i < formatCount ; ++i )
|
for ( size_t i = 0 ; i < formatCount ; ++i )
|
||||||
{
|
{
|
||||||
size_t dataSize = m_data->GetDataSize( formats[i] ) ;
|
size_t dataSize = m_data->GetDataSize( formats[i] ) ;
|
||||||
@ -336,6 +349,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
|
|||||||
dataSize-- ;
|
dataSize-- ;
|
||||||
dataPtr[ dataSize ] = 0 ;
|
dataPtr[ dataSize ] = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
||||||
}
|
}
|
||||||
else if (type == kDragFlavorTypeHFS )
|
else if (type == kDragFlavorTypeHFS )
|
||||||
@ -346,6 +360,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
|
|||||||
|
|
||||||
wxMacFilename2FSSpec( wxString( dataPtr , *wxConvCurrent ) , &theFlavor.fileSpec ) ;
|
wxMacFilename2FSSpec( wxString( dataPtr , *wxConvCurrent ) , &theFlavor.fileSpec ) ;
|
||||||
|
|
||||||
|
memset( &cat, 0, sizeof(cat) );
|
||||||
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
|
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
|
||||||
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
|
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
|
||||||
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
|
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
|
||||||
@ -354,16 +369,22 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
|
|||||||
if (err == noErr)
|
if (err == noErr)
|
||||||
{
|
{
|
||||||
theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
|
theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
|
||||||
if (theFlavor.fileSpec.parID == fsRtParID) {
|
if (theFlavor.fileSpec.parID == fsRtParID)
|
||||||
|
{
|
||||||
theFlavor.fileCreator = 'MACS';
|
theFlavor.fileCreator = 'MACS';
|
||||||
theFlavor.fileType = 'disk';
|
theFlavor.fileType = 'disk';
|
||||||
} else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
|
}
|
||||||
|
else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0)
|
||||||
|
{
|
||||||
theFlavor.fileCreator = 'MACS';
|
theFlavor.fileCreator = 'MACS';
|
||||||
theFlavor.fileType = 'fold';
|
theFlavor.fileType = 'fold';
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
|
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
|
||||||
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
|
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
|
AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,30 +392,38 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
|
|||||||
{
|
{
|
||||||
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] dataPtr ;
|
delete [] dataPtr ;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] formats ;
|
delete [] formats ;
|
||||||
|
|
||||||
dragRegion = NewRgn();
|
dragRegion = NewRgn();
|
||||||
RgnHandle tempRgn = NewRgn() ;
|
RgnHandle tempRgn = NewRgn() ;
|
||||||
|
|
||||||
EventRecord* ev = NULL ;
|
EventRecord* ev = NULL ;
|
||||||
|
|
||||||
#if !TARGET_CARBON // TODO
|
#if !TARGET_CARBON // TODO
|
||||||
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
|
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
|
||||||
#else
|
#else
|
||||||
|
{
|
||||||
EventRecord rec ;
|
EventRecord rec ;
|
||||||
ev = &rec ;
|
ev = &rec ;
|
||||||
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
|
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const short dragRegionOuterBoundary = 10 ;
|
const short dragRegionOuterBoundary = 10 ;
|
||||||
const short dragRegionInnerBoundary = 9 ;
|
const short dragRegionInnerBoundary = 9 ;
|
||||||
|
|
||||||
SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary ,
|
SetRectRgn(
|
||||||
|
dragRegion , ev->where.h - dragRegionOuterBoundary ,
|
||||||
ev->where.v - dragRegionOuterBoundary ,
|
ev->where.v - dragRegionOuterBoundary ,
|
||||||
ev->where.h + dragRegionOuterBoundary ,
|
ev->where.h + dragRegionOuterBoundary ,
|
||||||
ev->where.v + dragRegionOuterBoundary ) ;
|
ev->where.v + dragRegionOuterBoundary ) ;
|
||||||
|
|
||||||
SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary ,
|
SetRectRgn(
|
||||||
|
tempRgn , ev->where.h - dragRegionInnerBoundary ,
|
||||||
ev->where.v - dragRegionInnerBoundary ,
|
ev->where.v - dragRegionInnerBoundary ,
|
||||||
ev->where.h + dragRegionInnerBoundary ,
|
ev->where.h + dragRegionInnerBoundary ,
|
||||||
ev->where.v + dragRegionInnerBoundary ) ;
|
ev->where.v + dragRegionInnerBoundary ) ;
|
||||||
@ -414,26 +443,21 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
|
|||||||
bool optionDown = GetCurrentKeyModifiers() & optionKey ;
|
bool optionDown = GetCurrentKeyModifiers() & optionKey ;
|
||||||
wxDragResult dndresult = wxDragCopy ;
|
wxDragResult dndresult = wxDragCopy ;
|
||||||
if ( flags != wxDrag_CopyOnly )
|
if ( flags != wxDrag_CopyOnly )
|
||||||
{
|
|
||||||
// on mac the option key is always the indication for copy
|
// on mac the option key is always the indication for copy
|
||||||
dndresult = optionDown ? wxDragCopy : wxDragMove;
|
dndresult = optionDown ? wxDragCopy : wxDragMove;
|
||||||
}
|
|
||||||
return dndresult;
|
return dndresult;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDropSource::MacInstallDefaultCursor(wxDragResult effect)
|
bool wxDropSource::MacInstallDefaultCursor(wxDragResult effect)
|
||||||
{
|
{
|
||||||
const wxCursor& cursor = GetCursor(effect);
|
const wxCursor& cursor = GetCursor(effect);
|
||||||
if ( cursor.Ok() )
|
bool result = cursor.Ok();
|
||||||
{
|
|
||||||
|
if ( result )
|
||||||
cursor.MacInstall() ;
|
cursor.MacInstall() ;
|
||||||
|
|
||||||
return TRUE;
|
return result;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gTrackingGlobalsInstalled = false ;
|
bool gTrackingGlobalsInstalled = false ;
|
||||||
@ -441,9 +465,11 @@ bool gTrackingGlobalsInstalled = false ;
|
|||||||
// passing the globals via refcon is not needed by the CFM and later architectures anymore
|
// passing the globals via refcon is not needed by the CFM and later architectures anymore
|
||||||
// but I'll leave it in there, just in case...
|
// but I'll leave it in there, just in case...
|
||||||
|
|
||||||
pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow,
|
pascal OSErr wxMacWindowDragTrackingHandler(
|
||||||
|
DragTrackingMessage theMessage, WindowPtr theWindow,
|
||||||
void *handlerRefCon, DragReference theDrag) ;
|
void *handlerRefCon, DragReference theDrag) ;
|
||||||
pascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow, void *handlerRefCon,
|
pascal OSErr wxMacWindowDragReceiveHandler(
|
||||||
|
WindowPtr theWindow, void *handlerRefCon,
|
||||||
DragReference theDrag) ;
|
DragReference theDrag) ;
|
||||||
|
|
||||||
void wxMacEnsureTrackingHandlersInstalled()
|
void wxMacEnsureTrackingHandlersInstalled()
|
||||||
@ -454,6 +480,7 @@ void wxMacEnsureTrackingHandlersInstalled()
|
|||||||
|
|
||||||
result = InstallTrackingHandler(NewDragTrackingHandlerUPP(wxMacWindowDragTrackingHandler), 0L,&gTrackingGlobals);
|
result = InstallTrackingHandler(NewDragTrackingHandlerUPP(wxMacWindowDragTrackingHandler), 0L,&gTrackingGlobals);
|
||||||
wxASSERT( result == noErr ) ;
|
wxASSERT( result == noErr ) ;
|
||||||
|
|
||||||
result = InstallReceiveHandler(NewDragReceiveHandlerUPP(wxMacWindowDragReceiveHandler), 0L, &gTrackingGlobals);
|
result = InstallReceiveHandler(NewDragReceiveHandlerUPP(wxMacWindowDragReceiveHandler), 0L, &gTrackingGlobals);
|
||||||
wxASSERT( result == noErr ) ;
|
wxASSERT( result == noErr ) ;
|
||||||
|
|
||||||
@ -461,7 +488,8 @@ void wxMacEnsureTrackingHandlersInstalled()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, WindowPtr theWindow,
|
pascal OSErr wxMacWindowDragTrackingHandler(
|
||||||
|
DragTrackingMessage theMessage, WindowPtr theWindow,
|
||||||
void *handlerRefCon, DragReference theDrag)
|
void *handlerRefCon, DragReference theDrag)
|
||||||
{
|
{
|
||||||
MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon;
|
MacTrackingGlobals* trackingGlobals = (MacTrackingGlobals*) handlerRefCon;
|
||||||
@ -476,13 +504,14 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
switch (theMessage)
|
switch (theMessage)
|
||||||
{
|
{
|
||||||
case kDragTrackingEnterHandler:
|
case kDragTrackingEnterHandler:
|
||||||
break;
|
|
||||||
case kDragTrackingLeaveHandler:
|
case kDragTrackingLeaveHandler:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDragTrackingEnterWindow:
|
case kDragTrackingEnterWindow:
|
||||||
trackingGlobals->m_currentTargetWindow = NULL ;
|
trackingGlobals->m_currentTargetWindow = NULL ;
|
||||||
trackingGlobals->m_currentTarget = NULL ;
|
trackingGlobals->m_currentTarget = NULL ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDragTrackingInWindow:
|
case kDragTrackingInWindow:
|
||||||
if (toplevel == NULL)
|
if (toplevel == NULL)
|
||||||
break;
|
break;
|
||||||
@ -491,12 +520,11 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
localMouse = mouse;
|
localMouse = mouse;
|
||||||
GlobalToLocal(&localMouse);
|
GlobalToLocal(&localMouse);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
wxWindow *win = NULL ;
|
wxWindow *win = NULL ;
|
||||||
ControlPartCode controlPart ;
|
ControlPartCode controlPart ;
|
||||||
ControlRef control = wxMacFindControlUnderMouse( toplevel , localMouse ,
|
ControlRef control = wxMacFindControlUnderMouse(
|
||||||
|
toplevel , localMouse ,
|
||||||
theWindow , &controlPart ) ;
|
theWindow , &controlPart ) ;
|
||||||
if ( control )
|
if ( control )
|
||||||
win = wxFindControlFromMacControl( control ) ;
|
win = wxFindControlFromMacControl( control ) ;
|
||||||
@ -523,24 +551,23 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
trackingGlobals->m_currentTargetWindow = NULL ;
|
trackingGlobals->m_currentTargetWindow = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
// this window is entered
|
// this window is entered
|
||||||
trackingGlobals->m_currentTargetWindow = win ;
|
trackingGlobals->m_currentTargetWindow = win ;
|
||||||
trackingGlobals->m_currentTarget = win->GetDropTarget() ;
|
trackingGlobals->m_currentTarget = win->GetDropTarget() ;
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( trackingGlobals->m_currentTarget )
|
if ( trackingGlobals->m_currentTarget )
|
||||||
{
|
{
|
||||||
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
|
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
|
||||||
result = trackingGlobals->m_currentTarget->OnEnter(
|
result = trackingGlobals->m_currentTarget->OnEnter( localx , localy , result ) ;
|
||||||
localx , localy , result ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( result != wxDragNone )
|
if ( result != wxDragNone )
|
||||||
{
|
{
|
||||||
int x , y ;
|
int x , y ;
|
||||||
|
|
||||||
x = y = 0 ;
|
x = y = 0 ;
|
||||||
win->MacWindowToRootWindow( &x , &y ) ;
|
win->MacWindowToRootWindow( &x , &y ) ;
|
||||||
RgnHandle hiliteRgn = NewRgn() ;
|
RgnHandle hiliteRgn = NewRgn() ;
|
||||||
@ -557,15 +584,14 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
if ( trackingGlobals->m_currentTarget )
|
if ( trackingGlobals->m_currentTarget )
|
||||||
{
|
{
|
||||||
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
|
trackingGlobals->m_currentTarget->SetCurrentDrag( theDrag ) ;
|
||||||
trackingGlobals->m_currentTarget->OnDragOver(
|
trackingGlobals->m_currentTarget->OnDragOver( localx , localy , result ) ;
|
||||||
localx , localy , result ) ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// set cursor for OnEnter and OnDragOver
|
// set cursor for OnEnter and OnDragOver
|
||||||
if ( trackingGlobals->m_currentSource && trackingGlobals->m_currentSource->GiveFeedback( result ) == FALSE )
|
if ( !trackingGlobals->m_currentSource && trackingGlobals->m_currentSource->GiveFeedback( result ) )
|
||||||
{
|
{
|
||||||
if ( trackingGlobals->m_currentSource->MacInstallDefaultCursor( result ) == FALSE )
|
if ( !trackingGlobals->m_currentSource->MacInstallDefaultCursor( result ) )
|
||||||
{
|
{
|
||||||
switch ( result )
|
switch ( result )
|
||||||
{
|
{
|
||||||
@ -575,12 +601,14 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
cursor.MacInstall() ;
|
cursor.MacInstall() ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxDragMove :
|
case wxDragMove :
|
||||||
{
|
{
|
||||||
wxCursor cursor(wxCURSOR_ARROW) ;
|
wxCursor cursor(wxCURSOR_ARROW) ;
|
||||||
cursor.MacInstall() ;
|
cursor.MacInstall() ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case wxDragNone :
|
case wxDragNone :
|
||||||
{
|
{
|
||||||
wxCursor cursor(wxCURSOR_NO_ENTRY) ;
|
wxCursor cursor(wxCURSOR_NO_ENTRY) ;
|
||||||
@ -591,14 +619,15 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
case wxDragError:
|
case wxDragError:
|
||||||
case wxDragLink:
|
case wxDragLink:
|
||||||
case wxDragCancel:
|
case wxDragCancel:
|
||||||
|
default:
|
||||||
// put these here to make gcc happy
|
// put these here to make gcc happy
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDragTrackingLeaveWindow:
|
case kDragTrackingLeaveWindow:
|
||||||
if (trackingGlobals->m_currentTarget)
|
if (trackingGlobals->m_currentTarget)
|
||||||
{
|
{
|
||||||
@ -609,11 +638,16 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
}
|
}
|
||||||
trackingGlobals->m_currentTargetWindow = NULL ;
|
trackingGlobals->m_currentTargetWindow = NULL ;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
return(noErr);
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow,
|
return noErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
pascal OSErr wxMacWindowDragReceiveHandler(
|
||||||
|
WindowPtr theWindow,
|
||||||
void *handlerRefCon,
|
void *handlerRefCon,
|
||||||
DragReference theDrag)
|
DragReference theDrag)
|
||||||
{
|
{
|
||||||
@ -629,7 +663,8 @@ pascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow,
|
|||||||
GlobalToLocal(&localMouse);
|
GlobalToLocal(&localMouse);
|
||||||
localx = localMouse.h ;
|
localx = localMouse.h ;
|
||||||
localy = localMouse.v ;
|
localy = localMouse.v ;
|
||||||
//TODO : should we use client coordinates
|
|
||||||
|
// TODO : should we use client coordinates?
|
||||||
if ( trackingGlobals->m_currentTargetWindow )
|
if ( trackingGlobals->m_currentTargetWindow )
|
||||||
trackingGlobals->m_currentTargetWindow->MacRootWindowToWindow( &localx , &localy ) ;
|
trackingGlobals->m_currentTargetWindow->MacRootWindowToWindow( &localx , &localy ) ;
|
||||||
if ( trackingGlobals->m_currentTarget->OnDrop( localx , localy ) )
|
if ( trackingGlobals->m_currentTarget->OnDrop( localx , localy ) )
|
||||||
@ -639,6 +674,8 @@ pascal OSErr wxMacWindowDragReceiveHandler(WindowPtr theWindow,
|
|||||||
trackingGlobals->m_currentTarget->OnData( localx , localy , result ) ;
|
trackingGlobals->m_currentTarget->OnData( localx , localy , result ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(noErr);
|
|
||||||
|
return noErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user