bool EnableDragSource( const wxDataFormat &format );
bool EnableDropTarget( const wxDataFormat &format );
+ void RemoveDropHint();
wxDragResult OnDragOver( wxDataFormat format, wxCoord x, wxCoord y, wxDragResult def );
bool OnDrop( wxDataFormat format, wxCoord x, wxCoord y );
wxDragResult OnData( wxDataFormat format, wxCoord x, wxCoord y, wxDragResult def );
bool m_dropEnabled;
wxDataFormat m_dropFormat;
+ bool m_dropHint;
+ unsigned int m_dropHintLine;
// for double click logic
unsigned int m_lineLastClicked,
m_dragEnabled = false;
m_dropEnabled = false;
+ m_dropHint = false;
+ m_dropHintLine = (unsigned int) -1;
m_hasFocus = false;
return true;
}
+void wxDataViewMainWindow::RemoveDropHint()
+{
+ if (m_dropHint)
+ {
+ m_dropHint = false;
+ RefreshRow( m_dropHintLine );
+ m_dropHintLine = (unsigned int) -1;
+ }
+}
+
wxDragResult wxDataViewMainWindow::OnDragOver( wxDataFormat format, wxCoord x, wxCoord y, wxDragResult def )
{
int xx = x;
unsigned int row = GetLineAt( yy );
if ((row >= GetRowCount()) || (yy > GetEndOfLastCol()))
+ {
+ RemoveDropHint();
return wxDragNone;
+ }
wxDataViewItem item = GetItemByRow( row );
event.SetModel( model );
event.SetDataFormat( format );
if (!m_owner->HandleWindowEvent( event ))
+ {
+ RemoveDropHint();
return wxDragNone;
+ }
if (!event.IsAllowed())
+ {
+ RemoveDropHint();
return wxDragNone;
+ }
+
+
+ if (m_dropHint && (row != m_dropHintLine))
+ RefreshRow( m_dropHintLine );
+ m_dropHint = true;
+ m_dropHintLine = row;
+ RefreshRow( row );
return def;
}
bool wxDataViewMainWindow::OnDrop( wxDataFormat format, wxCoord x, wxCoord y )
{
+ RemoveDropHint();
+
int xx = x;
int yy = y;
m_owner->CalcUnscrolledPosition( xx, yy, &xx, &yy );
if (!event.IsAllowed())
return false;
-
+
return true;
}
void wxDataViewMainWindow::OnLeave()
{
+ RemoveDropHint();
}
void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
);
}
}
+
+ if (m_dropHint)
+ {
+ wxRect rect( x_start, GetLineStart( m_dropHintLine ), x_last, GetLineHeight( m_dropHintLine ) );
+ dc.SetPen( *wxBLACK_PEN );
+ dc.SetBrush( *wxTRANSPARENT_BRUSH );
+ dc.DrawRectangle( rect );
+ }
wxDataViewColumn *expander = GetOwner()->GetExpanderColumn();
if (!expander)