1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDropTarget class
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "dnd.h"
16 #if wxUSE_DRAG_AND_DROP
18 #include "wx/window.h"
20 #include "wx/gdicmn.h"
26 #include <gdk/gdkprivate.h>
28 #include <gtk/gtkdnd.h>
29 #include <gtk/gtkselection.h>
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 extern void wxapp_install_idle_handler();
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
43 extern void wxapp_install_thread_wakeup();
44 extern void wxapp_uninstall_thread_wakeup();
47 //----------------------------------------------------------------------------
49 //----------------------------------------------------------------------------
51 extern bool g_blockEventsOnDrag
;
53 // the trace mask we use with wxLogTrace() - call
54 // wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here
55 // (there are quite a few of them, so don't enable this by default)
56 static const wxChar
*TRACE_DND
= _T("dnd");
58 //----------------------------------------------------------------------------
60 //----------------------------------------------------------------------------
63 static char * page_xpm
[] = {
64 /* width height ncolors chars_per_pixel */
73 " ................... ",
74 " .XXXXXXXXXXXXXXXXX.. ",
75 " .XXXXXXXXXXXXXXXXX.o. ",
76 " .XXXXXXXXXXXXXXXXX.oo. ",
77 " .XXXXXXXXXXXXXXXXX.ooo. ",
78 " .XXXXXXXXXXXXXXXXX.oooo. ",
79 " .XXXXXXXXXXXXXXXXX....... ",
80 " .XXXXXOOOOOOOOOOXXXooooo. ",
81 " .XXXXXXXXXXXXXXXXXXooooo. ",
82 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
83 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
84 " .XXXXXXXOOOOOOOOOXXXXXXX. ",
85 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
86 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
87 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
88 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
89 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
90 " .XXXXXXXOOOOOOOOOXXXXXXX. ",
91 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
92 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
93 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
94 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
95 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
96 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
97 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
98 " .XXXXXOOOOOOOXXXXXXXXXXX. ",
99 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
100 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
101 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
102 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
103 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
104 " ......................... "};
108 // ----------------------------------------------------------------------------
110 // ----------------------------------------------------------------------------
112 static void target_drag_leave( GtkWidget
*WXUNUSED(widget
),
113 GdkDragContext
*context
,
114 guint
WXUNUSED(time
),
115 wxDropTarget
*drop_target
)
117 if (g_isIdle
) wxapp_install_idle_handler();
119 /* inform the wxDropTarget about the current GdkDragContext.
120 this is only valid for the duration of this call */
121 drop_target
->SetDragContext( context
);
123 /* we don't need return values. this event is just for
125 drop_target
->OnLeave();
127 /* this has to be done because GDK has no "drag_enter" event */
128 drop_target
->m_firstMotion
= TRUE
;
130 /* after this, invalidate the drop_target's GdkDragContext */
131 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
134 // ----------------------------------------------------------------------------
136 // ----------------------------------------------------------------------------
138 static gboolean
target_drag_motion( GtkWidget
*WXUNUSED(widget
),
139 GdkDragContext
*context
,
143 wxDropTarget
*drop_target
)
145 if (g_isIdle
) wxapp_install_idle_handler();
147 /* Owen Taylor: "if the coordinates not in a drop zone,
148 return FALSE, otherwise call gtk_drag_status() and
151 /* inform the wxDropTarget about the current GdkDragContext.
152 this is only valid for the duration of this call */
153 drop_target
->SetDragContext( context
);
156 if ( context
->suggested_action
== GDK_ACTION_COPY
)
158 else if ( context
->suggested_action
== GDK_ACTION_LINK
)
163 if (drop_target
->m_firstMotion
)
165 /* the first "drag_motion" event substitutes a "drag_enter" event */
166 result
= drop_target
->OnEnter( x
, y
, result
);
170 /* give program a chance to react (i.e. to say no by returning FALSE) */
171 result
= drop_target
->OnDragOver( x
, y
, result
);
174 bool ret
= wxIsDragResultOk( result
);
177 GdkDragAction action
;
178 if (result
== wxDragCopy
)
179 action
= GDK_ACTION_COPY
;
180 else if (result
== wxDragLink
)
181 action
= GDK_ACTION_LINK
;
183 action
= GDK_ACTION_MOVE
;
185 gdk_drag_status( context
, action
, time
);
188 /* after this, invalidate the drop_target's GdkDragContext */
189 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
191 /* this has to be done because GDK has no "drag_enter" event */
192 drop_target
->m_firstMotion
= FALSE
;
197 // ----------------------------------------------------------------------------
199 // ----------------------------------------------------------------------------
201 static gboolean
target_drag_drop( GtkWidget
*widget
,
202 GdkDragContext
*context
,
206 wxDropTarget
*drop_target
)
208 if (g_isIdle
) wxapp_install_idle_handler();
210 /* Owen Taylor: "if the drop is not in a drop zone,
211 return FALSE, otherwise, if you aren't accepting
212 the drop, call gtk_drag_finish() with success == FALSE
213 otherwise call gtk_drag_data_get()" */
215 // printf( "drop.\n" );
217 /* this seems to make a difference between not accepting
218 due to wrong target area and due to wrong format. let
219 us hope that this is not required.. */
221 /* inform the wxDropTarget about the current GdkDragContext.
222 this is only valid for the duration of this call */
223 drop_target
->SetDragContext( context
);
225 /* inform the wxDropTarget about the current drag widget.
226 this is only valid for the duration of this call */
227 drop_target
->SetDragWidget( widget
);
229 /* inform the wxDropTarget about the current drag time.
230 this is only valid for the duration of this call */
231 drop_target
->SetDragTime( time
);
234 wxDragResult result = wxDragMove;
235 if (context->suggested_action == GDK_ACTION_COPY) result = wxDragCopy;
238 /* reset the block here as someone might very well
239 show a dialog as a reaction to a drop and this
240 wouldn't work without events */
241 g_blockEventsOnDrag
= FALSE
;
243 bool ret
= drop_target
->OnDrop( x
, y
);
247 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned FALSE") );
249 /* cancel the whole thing */
250 gtk_drag_finish( context
,
251 FALSE
, /* no success */
252 FALSE
, /* don't delete data on dropping side */
257 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned TRUE") );
260 /* disable GUI threads */
261 wxapp_uninstall_thread_wakeup();
264 GdkAtom format
= drop_target
->GetMatchingPair();
268 GdkDragAction action = GDK_ACTION_MOVE;
269 if (result == wxDragCopy) action == GDK_ACTION_COPY;
270 context->action = action;
272 /* this should trigger an "drag_data_received" event */
273 gtk_drag_get_data( widget
,
279 /* re-enable GUI threads */
280 wxapp_install_thread_wakeup();
284 /* after this, invalidate the drop_target's GdkDragContext */
285 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
287 /* after this, invalidate the drop_target's drag widget */
288 drop_target
->SetDragWidget( (GtkWidget
*) NULL
);
290 /* this has to be done because GDK has no "drag_enter" event */
291 drop_target
->m_firstMotion
= TRUE
;
296 // ----------------------------------------------------------------------------
297 // "drag_data_received"
298 // ----------------------------------------------------------------------------
300 static void target_drag_data_received( GtkWidget
*WXUNUSED(widget
),
301 GdkDragContext
*context
,
304 GtkSelectionData
*data
,
305 guint
WXUNUSED(info
),
307 wxDropTarget
*drop_target
)
309 if (g_isIdle
) wxapp_install_idle_handler();
311 /* Owen Taylor: "call gtk_drag_finish() with
314 if ((data
->length
<= 0) || (data
->format
!= 8))
316 /* negative data length and non 8-bit data format
317 qualifies for junk */
318 gtk_drag_finish (context
, FALSE
, FALSE
, time
);
323 wxLogTrace(TRACE_DND
, wxT( "Drop target: data received event") );
325 /* inform the wxDropTarget about the current GtkSelectionData.
326 this is only valid for the duration of this call */
327 drop_target
->SetDragData( data
);
330 if ( context
->suggested_action
== GDK_ACTION_COPY
)
332 else if ( context
->suggested_action
== GDK_ACTION_LINK
)
337 if ( wxIsDragResultOk( drop_target
->OnData( x
, y
, result
) ) )
339 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned TRUE") );
341 /* tell GTK that data transfer was successfull */
342 gtk_drag_finish( context
, TRUE
, FALSE
, time
);
346 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned FALSE") );
348 /* tell GTK that data transfer was not successfull */
349 gtk_drag_finish( context
, FALSE
, FALSE
, time
);
352 /* after this, invalidate the drop_target's drag data */
353 drop_target
->SetDragData( (GtkSelectionData
*) NULL
);
356 //----------------------------------------------------------------------------
358 //----------------------------------------------------------------------------
360 wxDropTarget::wxDropTarget( wxDataObject
*data
)
361 : wxDropTargetBase( data
)
363 m_firstMotion
= TRUE
;
364 m_dragContext
= (GdkDragContext
*) NULL
;
365 m_dragWidget
= (GtkWidget
*) NULL
;
366 m_dragData
= (GtkSelectionData
*) NULL
;
370 wxDragResult
wxDropTarget::OnDragOver( wxCoord
WXUNUSED(x
),
374 // GetMatchingPair() checks for m_dataObject too, no need to do it here
376 // disable the debug message from GetMatchingPair() - there are too many
382 return (GetMatchingPair() != (GdkAtom
) 0) ? def
: wxDragNone
;
385 bool wxDropTarget::OnDrop( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
) )
390 return (GetMatchingPair() != (GdkAtom
) 0);
393 wxDragResult
wxDropTarget::OnData( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
399 if (GetMatchingPair() == (GdkAtom
) 0)
402 return GetData() ? def
: wxDragNone
;
405 GdkAtom
wxDropTarget::GetMatchingPair()
413 GList
*child
= m_dragContext
->targets
;
416 GdkAtom formatAtom
= (GdkAtom
) GPOINTER_TO_INT(child
->data
);
417 wxDataFormat
format( formatAtom
);
420 wxLogTrace(TRACE_DND
, wxT("Drop target: drag has format: %s"),
421 format
.GetId().c_str());
424 if (m_dataObject
->IsSupportedFormat( format
))
433 bool wxDropTarget::GetData()
441 wxDataFormat
dragFormat( m_dragData
->target
);
443 if (!m_dataObject
->IsSupportedFormat( dragFormat
))
446 m_dataObject
->SetData( dragFormat
, (size_t)m_dragData
->length
, (const void*)m_dragData
->data
);
451 void wxDropTarget::UnregisterWidget( GtkWidget
*widget
)
453 wxCHECK_RET( widget
!= NULL
, wxT("unregister widget is NULL") );
455 gtk_drag_dest_unset( widget
);
457 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
458 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
460 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
461 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
463 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
464 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
466 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
467 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
470 void wxDropTarget::RegisterWidget( GtkWidget
*widget
)
472 wxCHECK_RET( widget
!= NULL
, wxT("register widget is NULL") );
474 /* gtk_drag_dest_set() determines what default behaviour we'd like
475 GTK to supply. we don't want to specify out targets (=formats)
476 or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
477 not GTK_DEST_DEFAULT_DROP). instead we react individually to
478 "drag_motion" and "drag_drop" events. this makes it possible
479 to allow dropping on only a small area. we should set
480 GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
481 highlighting if dragging over standard controls, but this
482 seems to be broken without the other two. */
484 gtk_drag_dest_set( widget
,
485 (GtkDestDefaults
) 0, /* no default behaviour */
486 (GtkTargetEntry
*) NULL
, /* we don't supply any formats here */
487 0, /* number of targets = 0 */
488 (GdkDragAction
) 0 ); /* we don't supply any actions here */
490 gtk_signal_connect( GTK_OBJECT(widget
), "drag_leave",
491 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
493 gtk_signal_connect( GTK_OBJECT(widget
), "drag_motion",
494 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
496 gtk_signal_connect( GTK_OBJECT(widget
), "drag_drop",
497 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
499 gtk_signal_connect( GTK_OBJECT(widget
), "drag_data_received",
500 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
503 //----------------------------------------------------------------------------
505 //----------------------------------------------------------------------------
508 source_drag_data_get (GtkWidget
*WXUNUSED(widget
),
509 GdkDragContext
*WXUNUSED(context
),
510 GtkSelectionData
*selection_data
,
511 guint
WXUNUSED(info
),
512 guint
WXUNUSED(time
),
513 wxDropSource
*drop_source
)
515 if (g_isIdle
) wxapp_install_idle_handler();
517 wxDataFormat
format( selection_data
->target
);
519 wxLogTrace(TRACE_DND
, wxT("Drop source: format requested: %s"),
520 format
.GetId().c_str());
522 drop_source
->m_retValue
= wxDragCancel
;
524 wxDataObject
*data
= drop_source
->GetDataObject();
528 wxLogTrace(TRACE_DND
, wxT("Drop source: no data object") );
532 if (!data
->IsSupportedFormat(format
))
534 wxLogTrace(TRACE_DND
, wxT("Drop source: unsupported format") );
538 if (data
->GetDataSize(format
) == 0)
540 wxLogTrace(TRACE_DND
, wxT("Drop source: empty data") );
544 size_t size
= data
->GetDataSize(format
);
546 // printf( "data size: %d.\n", (int)data_size );
548 guchar
*d
= new guchar
[size
];
550 if (!data
->GetDataHere( format
, (void*)d
))
557 /* disable GUI threads */
558 wxapp_uninstall_thread_wakeup();
561 gtk_selection_data_set( selection_data
,
562 selection_data
->target
,
568 /* enable GUI threads */
569 wxapp_install_thread_wakeup();
575 //----------------------------------------------------------------------------
576 // "drag_data_delete"
577 //----------------------------------------------------------------------------
579 static void source_drag_data_delete( GtkWidget
*WXUNUSED(widget
),
580 GdkDragContext
*context
,
581 wxDropSource
*WXUNUSED(drop_source
) )
584 wxapp_install_idle_handler();
586 // printf( "Drag source: drag_data_delete\n" );
589 //----------------------------------------------------------------------------
591 //----------------------------------------------------------------------------
593 static void source_drag_begin( GtkWidget
*WXUNUSED(widget
),
594 GdkDragContext
*WXUNUSED(context
),
595 wxDropSource
*WXUNUSED(drop_source
) )
598 wxapp_install_idle_handler();
600 // printf( "Drag source: drag_begin.\n" );
603 //----------------------------------------------------------------------------
605 //----------------------------------------------------------------------------
607 static void source_drag_end( GtkWidget
*WXUNUSED(widget
),
608 GdkDragContext
*WXUNUSED(context
),
609 wxDropSource
*drop_source
)
611 if (g_isIdle
) wxapp_install_idle_handler();
613 // printf( "Drag source: drag_end.\n" );
615 drop_source
->m_waiting
= FALSE
;
618 //-----------------------------------------------------------------------------
619 // "configure_event" from m_iconWindow
620 //-----------------------------------------------------------------------------
623 gtk_dnd_window_configure_callback( GtkWidget
*WXUNUSED(widget
), GdkEventConfigure
*WXUNUSED(event
), wxDropSource
*source
)
626 wxapp_install_idle_handler();
628 wxDragResult action
= wxDragNone
;
629 if (source
->m_dragContext
->action
== GDK_ACTION_COPY
) action
= wxDragCopy
;
630 if (source
->m_dragContext
->action
== GDK_ACTION_LINK
) action
= wxDragLink
;
631 if (source
->m_dragContext
->action
== GDK_ACTION_MOVE
) action
= wxDragMove
;
633 source
->GiveFeedback( action
);
638 //---------------------------------------------------------------------------
640 //---------------------------------------------------------------------------
642 wxDropSource::wxDropSource(wxWindow
*win
,
643 const wxIcon
&iconCopy
,
644 const wxIcon
&iconMove
,
645 const wxIcon
&iconNone
)
649 m_iconWindow
= (GtkWidget
*) NULL
;
652 m_widget
= win
->m_widget
;
653 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
655 m_retValue
= wxDragCancel
;
657 SetIcons(iconCopy
, iconMove
, iconNone
);
660 wxDropSource::wxDropSource(wxDataObject
& data
,
662 const wxIcon
&iconCopy
,
663 const wxIcon
&iconMove
,
664 const wxIcon
&iconNone
)
670 m_iconWindow
= (GtkWidget
*) NULL
;
673 m_widget
= win
->m_widget
;
674 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
676 m_retValue
= wxDragCancel
;
678 SetIcons(iconCopy
, iconMove
, iconNone
);
681 void wxDropSource::SetIcons(const wxIcon
&iconCopy
,
682 const wxIcon
&iconMove
,
683 const wxIcon
&iconNone
)
685 m_iconCopy
= iconCopy
;
686 m_iconMove
= iconMove
;
687 m_iconNone
= iconNone
;
689 if ( !m_iconCopy
.Ok() )
690 m_iconCopy
= wxIcon(page_xpm
);
691 if ( !m_iconMove
.Ok() )
692 m_iconMove
= m_iconCopy
;
693 if ( !m_iconNone
.Ok() )
694 m_iconNone
= m_iconCopy
;
697 wxDropSource::~wxDropSource()
701 void wxDropSource::PrepareIcon( int action
, GdkDragContext
*context
)
703 // get the right icon to display
705 if ( action
& GDK_ACTION_MOVE
)
707 else if ( action
& GDK_ACTION_COPY
)
713 if ( icon
->GetMask() )
714 mask
= icon
->GetMask()->GetBitmap();
716 mask
= (GdkBitmap
*)NULL
;
718 GdkPixmap
*pixmap
= icon
->GetPixmap();
721 gdk_window_get_size (pixmap
, &width
, &height
);
723 GdkColormap
*colormap
= gtk_widget_get_colormap( m_widget
);
725 gtk_widget_push_visual (gdk_colormap_get_visual (colormap
));
727 gtk_widget_push_colormap (colormap
);
729 m_iconWindow
= gtk_window_new (GTK_WINDOW_POPUP
);
730 gtk_widget_set_events (m_iconWindow
, GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
);
731 gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow
), TRUE
);
734 gtk_widget_pop_visual ();
736 gtk_widget_pop_colormap ();
738 gtk_widget_set_usize (m_iconWindow
, width
, height
);
739 gtk_widget_realize (m_iconWindow
);
741 gtk_signal_connect( GTK_OBJECT(m_iconWindow
), "configure_event",
742 GTK_SIGNAL_FUNC(gtk_dnd_window_configure_callback
), (gpointer
)this );
744 gdk_window_set_back_pixmap (m_iconWindow
->window
, pixmap
, FALSE
);
747 gtk_widget_shape_combine_mask (m_iconWindow
, mask
, 0, 0);
749 gtk_drag_set_icon_widget( context
, m_iconWindow
, 0, 0 );
752 wxDragResult
wxDropSource::DoDragDrop( bool allowMove
)
754 wxASSERT_MSG( m_data
, wxT("Drop source: no data") );
757 return (wxDragResult
) wxDragNone
;
759 if (m_data
->GetFormatCount() == 0)
760 return (wxDragResult
) wxDragNone
;
763 if (g_blockEventsOnDrag
)
764 return (wxDragResult
) wxDragNone
;
767 g_blockEventsOnDrag
= TRUE
;
773 GtkTargetList
*target_list
= gtk_target_list_new( (GtkTargetEntry
*) NULL
, 0 );
775 wxDataFormat
*array
= new wxDataFormat
[ m_data
->GetFormatCount() ];
776 m_data
->GetAllFormats( array
);
777 for (size_t i
= 0; i
< m_data
->GetFormatCount(); i
++)
779 GdkAtom atom
= array
[i
];
780 wxLogTrace(TRACE_DND
, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom
));
781 gtk_target_list_add( target_list
, atom
, 0, 0 );
785 GdkEventMotion event
;
786 event
.window
= m_widget
->window
;
789 GdkModifierType state
;
790 gdk_window_get_pointer( event
.window
, &x
, &y
, &state
);
794 event
.time
= (guint32
)GDK_CURRENT_TIME
;
796 /* GTK wants to know which button was pressed which caused the dragging */
797 int button_number
= 0;
798 if (event
.state
& GDK_BUTTON1_MASK
) button_number
= 1;
799 else if (event
.state
& GDK_BUTTON2_MASK
) button_number
= 2;
800 else if (event
.state
& GDK_BUTTON3_MASK
) button_number
= 3;
803 /* disable GUI threads */
804 wxapp_uninstall_thread_wakeup();
807 /* don't start dragging if no button is down */
810 int action
= GDK_ACTION_COPY
;
812 action
|= GDK_ACTION_MOVE
;
813 GdkDragContext
*context
= gtk_drag_begin( m_widget
,
815 (GdkDragAction
)action
,
816 button_number
, /* number of mouse button which started drag */
817 (GdkEvent
*) &event
);
819 m_dragContext
= context
;
821 PrepareIcon( action
, context
);
823 while (m_waiting
) gtk_main_iteration();
825 if (context
->action
== GDK_ACTION_COPY
)
826 m_retValue
= wxDragCopy
;
827 if (context
->action
== GDK_ACTION_LINK
)
828 m_retValue
= wxDragLink
;
829 if (context
->action
== GDK_ACTION_MOVE
)
830 m_retValue
= wxDragMove
;
834 /* re-enable GUI threads */
835 wxapp_install_thread_wakeup();
838 g_blockEventsOnDrag
= FALSE
;
845 void wxDropSource::RegisterWindow()
847 if (!m_widget
) return;
849 gtk_signal_connect( GTK_OBJECT(m_widget
), "drag_data_get",
850 GTK_SIGNAL_FUNC (source_drag_data_get
), (gpointer
) this);
851 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_data_delete",
852 GTK_SIGNAL_FUNC (source_drag_data_delete
), (gpointer
) this );
853 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_begin",
854 GTK_SIGNAL_FUNC (source_drag_begin
), (gpointer
) this );
855 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_end",
856 GTK_SIGNAL_FUNC (source_drag_end
), (gpointer
) this );
860 void wxDropSource::UnregisterWindow()
862 if (!m_widget
) return;
864 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
865 GTK_SIGNAL_FUNC(source_drag_data_get
), (gpointer
) this );
866 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
867 GTK_SIGNAL_FUNC(source_drag_data_delete
), (gpointer
) this );
868 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
869 GTK_SIGNAL_FUNC(source_drag_begin
), (gpointer
) this );
870 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
871 GTK_SIGNAL_FUNC(source_drag_end
), (gpointer
) this );
875 // wxUSE_DRAG_AND_DROP