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 //-----------------------------------------------------------------------------
45 //----------------------------------------------------------------------------
47 //----------------------------------------------------------------------------
49 extern bool g_blockEventsOnDrag
;
51 // the trace mask we use with wxLogTrace() - call
52 // wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here
53 // (there are quite a few of them, so don't enable this by default)
54 static const wxChar
*TRACE_DND
= _T("dnd");
56 //----------------------------------------------------------------------------
58 //----------------------------------------------------------------------------
61 static const char * page_xpm
[] = {
62 /* width height ncolors chars_per_pixel */
71 " ................... ",
72 " .XXXXXXXXXXXXXXXXX.. ",
73 " .XXXXXXXXXXXXXXXXX.o. ",
74 " .XXXXXXXXXXXXXXXXX.oo. ",
75 " .XXXXXXXXXXXXXXXXX.ooo. ",
76 " .XXXXXXXXXXXXXXXXX.oooo. ",
77 " .XXXXXXXXXXXXXXXXX....... ",
78 " .XXXXXOOOOOOOOOOXXXooooo. ",
79 " .XXXXXXXXXXXXXXXXXXooooo. ",
80 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
81 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
82 " .XXXXXXXOOOOOOOOOXXXXXXX. ",
83 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
84 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
85 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
86 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
87 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
88 " .XXXXXXXOOOOOOOOOXXXXXXX. ",
89 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
90 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
91 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
92 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
93 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
94 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
95 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
96 " .XXXXXOOOOOOOXXXXXXXXXXX. ",
97 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
98 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
99 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
100 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
101 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
102 " ......................... "};
106 // ----------------------------------------------------------------------------
108 // ----------------------------------------------------------------------------
110 static void target_drag_leave( GtkWidget
*WXUNUSED(widget
),
111 GdkDragContext
*context
,
112 guint
WXUNUSED(time
),
113 wxDropTarget
*drop_target
)
115 if (g_isIdle
) wxapp_install_idle_handler();
117 /* inform the wxDropTarget about the current GdkDragContext.
118 this is only valid for the duration of this call */
119 drop_target
->SetDragContext( context
);
121 /* we don't need return values. this event is just for
123 drop_target
->OnLeave();
125 /* this has to be done because GDK has no "drag_enter" event */
126 drop_target
->m_firstMotion
= TRUE
;
128 /* after this, invalidate the drop_target's GdkDragContext */
129 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
132 // ----------------------------------------------------------------------------
134 // ----------------------------------------------------------------------------
136 static gboolean
target_drag_motion( GtkWidget
*WXUNUSED(widget
),
137 GdkDragContext
*context
,
141 wxDropTarget
*drop_target
)
143 if (g_isIdle
) wxapp_install_idle_handler();
145 /* Owen Taylor: "if the coordinates not in a drop zone,
146 return FALSE, otherwise call gtk_drag_status() and
149 /* inform the wxDropTarget about the current GdkDragContext.
150 this is only valid for the duration of this call */
151 drop_target
->SetDragContext( context
);
154 if ( context
->suggested_action
== GDK_ACTION_COPY
)
156 else if ( context
->suggested_action
== GDK_ACTION_LINK
)
161 if (drop_target
->m_firstMotion
)
163 /* the first "drag_motion" event substitutes a "drag_enter" event */
164 result
= drop_target
->OnEnter( x
, y
, result
);
168 /* give program a chance to react (i.e. to say no by returning FALSE) */
169 result
= drop_target
->OnDragOver( x
, y
, result
);
172 bool ret
= wxIsDragResultOk( result
);
175 GdkDragAction action
;
176 if (result
== wxDragCopy
)
177 action
= GDK_ACTION_COPY
;
178 else if (result
== wxDragLink
)
179 action
= GDK_ACTION_LINK
;
181 action
= GDK_ACTION_MOVE
;
183 gdk_drag_status( context
, action
, time
);
186 /* after this, invalidate the drop_target's GdkDragContext */
187 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
189 /* this has to be done because GDK has no "drag_enter" event */
190 drop_target
->m_firstMotion
= FALSE
;
195 // ----------------------------------------------------------------------------
197 // ----------------------------------------------------------------------------
199 static gboolean
target_drag_drop( GtkWidget
*widget
,
200 GdkDragContext
*context
,
204 wxDropTarget
*drop_target
)
206 if (g_isIdle
) wxapp_install_idle_handler();
208 /* Owen Taylor: "if the drop is not in a drop zone,
209 return FALSE, otherwise, if you aren't accepting
210 the drop, call gtk_drag_finish() with success == FALSE
211 otherwise call gtk_drag_data_get()" */
213 // printf( "drop.\n" );
215 /* this seems to make a difference between not accepting
216 due to wrong target area and due to wrong format. let
217 us hope that this is not required.. */
219 /* inform the wxDropTarget about the current GdkDragContext.
220 this is only valid for the duration of this call */
221 drop_target
->SetDragContext( context
);
223 /* inform the wxDropTarget about the current drag widget.
224 this is only valid for the duration of this call */
225 drop_target
->SetDragWidget( widget
);
227 /* inform the wxDropTarget about the current drag time.
228 this is only valid for the duration of this call */
229 drop_target
->SetDragTime( time
);
232 wxDragResult result = wxDragMove;
233 if (context->suggested_action == GDK_ACTION_COPY) result = wxDragCopy;
236 /* reset the block here as someone might very well
237 show a dialog as a reaction to a drop and this
238 wouldn't work without events */
239 g_blockEventsOnDrag
= FALSE
;
241 bool ret
= drop_target
->OnDrop( x
, y
);
245 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned FALSE") );
247 /* cancel the whole thing */
248 gtk_drag_finish( context
,
249 FALSE
, /* no success */
250 FALSE
, /* don't delete data on dropping side */
255 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned TRUE") );
258 /* disable GUI threads */
261 GdkAtom format
= drop_target
->GetMatchingPair();
265 GdkDragAction action = GDK_ACTION_MOVE;
266 if (result == wxDragCopy) action == GDK_ACTION_COPY;
267 context->action = action;
269 /* this should trigger an "drag_data_received" event */
270 gtk_drag_get_data( widget
,
276 /* re-enable GUI threads */
280 /* after this, invalidate the drop_target's GdkDragContext */
281 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
283 /* after this, invalidate the drop_target's drag widget */
284 drop_target
->SetDragWidget( (GtkWidget
*) NULL
);
286 /* this has to be done because GDK has no "drag_enter" event */
287 drop_target
->m_firstMotion
= TRUE
;
292 // ----------------------------------------------------------------------------
293 // "drag_data_received"
294 // ----------------------------------------------------------------------------
296 static void target_drag_data_received( GtkWidget
*WXUNUSED(widget
),
297 GdkDragContext
*context
,
300 GtkSelectionData
*data
,
301 guint
WXUNUSED(info
),
303 wxDropTarget
*drop_target
)
305 if (g_isIdle
) wxapp_install_idle_handler();
307 /* Owen Taylor: "call gtk_drag_finish() with
310 if ((data
->length
<= 0) || (data
->format
!= 8))
312 /* negative data length and non 8-bit data format
313 qualifies for junk */
314 gtk_drag_finish (context
, FALSE
, FALSE
, time
);
319 wxLogTrace(TRACE_DND
, wxT( "Drop target: data received event") );
321 /* inform the wxDropTarget about the current GtkSelectionData.
322 this is only valid for the duration of this call */
323 drop_target
->SetDragData( data
);
326 if ( context
->suggested_action
== GDK_ACTION_COPY
)
328 else if ( context
->suggested_action
== GDK_ACTION_LINK
)
333 if ( wxIsDragResultOk( drop_target
->OnData( x
, y
, result
) ) )
335 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned TRUE") );
337 /* tell GTK that data transfer was successfull */
338 gtk_drag_finish( context
, TRUE
, FALSE
, time
);
342 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned FALSE") );
344 /* tell GTK that data transfer was not successfull */
345 gtk_drag_finish( context
, FALSE
, FALSE
, time
);
348 /* after this, invalidate the drop_target's drag data */
349 drop_target
->SetDragData( (GtkSelectionData
*) NULL
);
352 //----------------------------------------------------------------------------
354 //----------------------------------------------------------------------------
356 wxDropTarget::wxDropTarget( wxDataObject
*data
)
357 : wxDropTargetBase( data
)
359 m_firstMotion
= TRUE
;
360 m_dragContext
= (GdkDragContext
*) NULL
;
361 m_dragWidget
= (GtkWidget
*) NULL
;
362 m_dragData
= (GtkSelectionData
*) NULL
;
366 wxDragResult
wxDropTarget::OnDragOver( wxCoord
WXUNUSED(x
),
370 // GetMatchingPair() checks for m_dataObject too, no need to do it here
372 // disable the debug message from GetMatchingPair() - there are too many
378 return (GetMatchingPair() != (GdkAtom
) 0) ? def
: wxDragNone
;
381 bool wxDropTarget::OnDrop( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
) )
386 return (GetMatchingPair() != (GdkAtom
) 0);
389 wxDragResult
wxDropTarget::OnData( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
395 if (GetMatchingPair() == (GdkAtom
) 0)
398 return GetData() ? def
: wxDragNone
;
401 GdkAtom
wxDropTarget::GetMatchingPair()
409 GList
*child
= m_dragContext
->targets
;
412 GdkAtom formatAtom
= (GdkAtom
) GPOINTER_TO_INT(child
->data
);
413 wxDataFormat
format( formatAtom
);
416 wxLogTrace(TRACE_DND
, wxT("Drop target: drag has format: %s"),
417 format
.GetId().c_str());
420 if (m_dataObject
->IsSupportedFormat( format
))
429 bool wxDropTarget::GetData()
437 wxDataFormat
dragFormat( m_dragData
->target
);
439 if (!m_dataObject
->IsSupportedFormat( dragFormat
))
442 m_dataObject
->SetData( dragFormat
, (size_t)m_dragData
->length
, (const void*)m_dragData
->data
);
447 void wxDropTarget::UnregisterWidget( GtkWidget
*widget
)
449 wxCHECK_RET( widget
!= NULL
, wxT("unregister widget is NULL") );
451 gtk_drag_dest_unset( widget
);
453 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
454 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
456 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
457 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
459 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
460 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
462 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
463 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
466 void wxDropTarget::RegisterWidget( GtkWidget
*widget
)
468 wxCHECK_RET( widget
!= NULL
, wxT("register widget is NULL") );
470 /* gtk_drag_dest_set() determines what default behaviour we'd like
471 GTK to supply. we don't want to specify out targets (=formats)
472 or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
473 not GTK_DEST_DEFAULT_DROP). instead we react individually to
474 "drag_motion" and "drag_drop" events. this makes it possible
475 to allow dropping on only a small area. we should set
476 GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
477 highlighting if dragging over standard controls, but this
478 seems to be broken without the other two. */
480 gtk_drag_dest_set( widget
,
481 (GtkDestDefaults
) 0, /* no default behaviour */
482 (GtkTargetEntry
*) NULL
, /* we don't supply any formats here */
483 0, /* number of targets = 0 */
484 (GdkDragAction
) 0 ); /* we don't supply any actions here */
486 gtk_signal_connect( GTK_OBJECT(widget
), "drag_leave",
487 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
489 gtk_signal_connect( GTK_OBJECT(widget
), "drag_motion",
490 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
492 gtk_signal_connect( GTK_OBJECT(widget
), "drag_drop",
493 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
495 gtk_signal_connect( GTK_OBJECT(widget
), "drag_data_received",
496 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
499 //----------------------------------------------------------------------------
501 //----------------------------------------------------------------------------
504 source_drag_data_get (GtkWidget
*WXUNUSED(widget
),
505 GdkDragContext
*WXUNUSED(context
),
506 GtkSelectionData
*selection_data
,
507 guint
WXUNUSED(info
),
508 guint
WXUNUSED(time
),
509 wxDropSource
*drop_source
)
511 if (g_isIdle
) wxapp_install_idle_handler();
513 wxDataFormat
format( selection_data
->target
);
515 wxLogTrace(TRACE_DND
, wxT("Drop source: format requested: %s"),
516 format
.GetId().c_str());
518 drop_source
->m_retValue
= wxDragCancel
;
520 wxDataObject
*data
= drop_source
->GetDataObject();
524 wxLogTrace(TRACE_DND
, wxT("Drop source: no data object") );
528 if (!data
->IsSupportedFormat(format
))
530 wxLogTrace(TRACE_DND
, wxT("Drop source: unsupported format") );
534 if (data
->GetDataSize(format
) == 0)
536 wxLogTrace(TRACE_DND
, wxT("Drop source: empty data") );
540 size_t size
= data
->GetDataSize(format
);
542 // printf( "data size: %d.\n", (int)data_size );
544 guchar
*d
= new guchar
[size
];
546 if (!data
->GetDataHere( format
, (void*)d
))
553 /* disable GUI threads */
556 gtk_selection_data_set( selection_data
,
557 selection_data
->target
,
563 /* enable GUI threads */
569 //----------------------------------------------------------------------------
570 // "drag_data_delete"
571 //----------------------------------------------------------------------------
573 static void source_drag_data_delete( GtkWidget
*WXUNUSED(widget
),
574 GdkDragContext
*context
,
575 wxDropSource
*WXUNUSED(drop_source
) )
578 wxapp_install_idle_handler();
580 // printf( "Drag source: drag_data_delete\n" );
583 //----------------------------------------------------------------------------
585 //----------------------------------------------------------------------------
587 static void source_drag_begin( GtkWidget
*WXUNUSED(widget
),
588 GdkDragContext
*WXUNUSED(context
),
589 wxDropSource
*WXUNUSED(drop_source
) )
592 wxapp_install_idle_handler();
594 // printf( "Drag source: drag_begin.\n" );
597 //----------------------------------------------------------------------------
599 //----------------------------------------------------------------------------
601 static void source_drag_end( GtkWidget
*WXUNUSED(widget
),
602 GdkDragContext
*WXUNUSED(context
),
603 wxDropSource
*drop_source
)
605 if (g_isIdle
) wxapp_install_idle_handler();
607 // printf( "Drag source: drag_end.\n" );
609 drop_source
->m_waiting
= FALSE
;
612 //-----------------------------------------------------------------------------
613 // "configure_event" from m_iconWindow
614 //-----------------------------------------------------------------------------
617 gtk_dnd_window_configure_callback( GtkWidget
*WXUNUSED(widget
), GdkEventConfigure
*WXUNUSED(event
), wxDropSource
*source
)
620 wxapp_install_idle_handler();
622 wxDragResult action
= wxDragNone
;
623 if (source
->m_dragContext
->action
== GDK_ACTION_COPY
) action
= wxDragCopy
;
624 if (source
->m_dragContext
->action
== GDK_ACTION_LINK
) action
= wxDragLink
;
625 if (source
->m_dragContext
->action
== GDK_ACTION_MOVE
) action
= wxDragMove
;
627 source
->GiveFeedback( action
);
632 //---------------------------------------------------------------------------
634 //---------------------------------------------------------------------------
636 wxDropSource::wxDropSource(wxWindow
*win
,
637 const wxIcon
&iconCopy
,
638 const wxIcon
&iconMove
,
639 const wxIcon
&iconNone
)
643 m_iconWindow
= (GtkWidget
*) NULL
;
646 m_widget
= win
->m_widget
;
647 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
649 m_retValue
= wxDragCancel
;
651 SetIcons(iconCopy
, iconMove
, iconNone
);
654 wxDropSource::wxDropSource(wxDataObject
& data
,
656 const wxIcon
&iconCopy
,
657 const wxIcon
&iconMove
,
658 const wxIcon
&iconNone
)
664 m_iconWindow
= (GtkWidget
*) NULL
;
667 m_widget
= win
->m_widget
;
668 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
670 m_retValue
= wxDragCancel
;
672 SetIcons(iconCopy
, iconMove
, iconNone
);
675 void wxDropSource::SetIcons(const wxIcon
&iconCopy
,
676 const wxIcon
&iconMove
,
677 const wxIcon
&iconNone
)
679 m_iconCopy
= iconCopy
;
680 m_iconMove
= iconMove
;
681 m_iconNone
= iconNone
;
683 if ( !m_iconCopy
.Ok() )
684 m_iconCopy
= wxIcon(page_xpm
);
685 if ( !m_iconMove
.Ok() )
686 m_iconMove
= m_iconCopy
;
687 if ( !m_iconNone
.Ok() )
688 m_iconNone
= m_iconCopy
;
691 wxDropSource::~wxDropSource()
695 void wxDropSource::PrepareIcon( int action
, GdkDragContext
*context
)
697 // get the right icon to display
699 if ( action
& GDK_ACTION_MOVE
)
701 else if ( action
& GDK_ACTION_COPY
)
707 if ( icon
->GetMask() )
708 mask
= icon
->GetMask()->GetBitmap();
710 mask
= (GdkBitmap
*)NULL
;
712 GdkPixmap
*pixmap
= icon
->GetPixmap();
715 gdk_window_get_size (pixmap
, &width
, &height
);
717 GdkColormap
*colormap
= gtk_widget_get_colormap( m_widget
);
719 gtk_widget_push_visual (gdk_colormap_get_visual (colormap
));
721 gtk_widget_push_colormap (colormap
);
723 m_iconWindow
= gtk_window_new (GTK_WINDOW_POPUP
);
724 gtk_widget_set_events (m_iconWindow
, GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
);
725 gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow
), TRUE
);
728 gtk_widget_pop_visual ();
730 gtk_widget_pop_colormap ();
732 gtk_widget_set_usize (m_iconWindow
, width
, height
);
733 gtk_widget_realize (m_iconWindow
);
735 gtk_signal_connect( GTK_OBJECT(m_iconWindow
), "configure_event",
736 GTK_SIGNAL_FUNC(gtk_dnd_window_configure_callback
), (gpointer
)this );
738 gdk_window_set_back_pixmap (m_iconWindow
->window
, pixmap
, FALSE
);
741 gtk_widget_shape_combine_mask (m_iconWindow
, mask
, 0, 0);
743 gtk_drag_set_icon_widget( context
, m_iconWindow
, 0, 0 );
746 wxDragResult
wxDropSource::DoDragDrop( bool allowMove
)
748 wxASSERT_MSG( m_data
, wxT("Drop source: no data") );
751 return (wxDragResult
) wxDragNone
;
753 if (m_data
->GetFormatCount() == 0)
754 return (wxDragResult
) wxDragNone
;
757 if (g_blockEventsOnDrag
)
758 return (wxDragResult
) wxDragNone
;
761 g_blockEventsOnDrag
= TRUE
;
767 GtkTargetList
*target_list
= gtk_target_list_new( (GtkTargetEntry
*) NULL
, 0 );
769 wxDataFormat
*array
= new wxDataFormat
[ m_data
->GetFormatCount() ];
770 m_data
->GetAllFormats( array
);
771 for (size_t i
= 0; i
< m_data
->GetFormatCount(); i
++)
773 GdkAtom atom
= array
[i
];
774 wxLogTrace(TRACE_DND
, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom
));
775 gtk_target_list_add( target_list
, atom
, 0, 0 );
779 GdkEventMotion event
;
780 event
.window
= m_widget
->window
;
783 GdkModifierType state
;
784 gdk_window_get_pointer( event
.window
, &x
, &y
, &state
);
788 event
.time
= (guint32
)GDK_CURRENT_TIME
;
790 /* GTK wants to know which button was pressed which caused the dragging */
791 int button_number
= 0;
792 if (event
.state
& GDK_BUTTON1_MASK
) button_number
= 1;
793 else if (event
.state
& GDK_BUTTON2_MASK
) button_number
= 2;
794 else if (event
.state
& GDK_BUTTON3_MASK
) button_number
= 3;
797 /* disable GUI threads */
800 /* don't start dragging if no button is down */
803 int action
= GDK_ACTION_COPY
;
805 action
|= GDK_ACTION_MOVE
;
806 GdkDragContext
*context
= gtk_drag_begin( m_widget
,
808 (GdkDragAction
)action
,
809 button_number
, /* number of mouse button which started drag */
810 (GdkEvent
*) &event
);
812 m_dragContext
= context
;
814 PrepareIcon( action
, context
);
816 while (m_waiting
) gtk_main_iteration();
818 if (context
->action
== GDK_ACTION_COPY
)
819 m_retValue
= wxDragCopy
;
820 if (context
->action
== GDK_ACTION_LINK
)
821 m_retValue
= wxDragLink
;
822 if (context
->action
== GDK_ACTION_MOVE
)
823 m_retValue
= wxDragMove
;
827 /* re-enable GUI threads */
830 g_blockEventsOnDrag
= FALSE
;
837 void wxDropSource::RegisterWindow()
839 if (!m_widget
) return;
841 gtk_signal_connect( GTK_OBJECT(m_widget
), "drag_data_get",
842 GTK_SIGNAL_FUNC (source_drag_data_get
), (gpointer
) this);
843 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_data_delete",
844 GTK_SIGNAL_FUNC (source_drag_data_delete
), (gpointer
) this );
845 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_begin",
846 GTK_SIGNAL_FUNC (source_drag_begin
), (gpointer
) this );
847 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_end",
848 GTK_SIGNAL_FUNC (source_drag_end
), (gpointer
) this );
852 void wxDropSource::UnregisterWindow()
854 if (!m_widget
) return;
856 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
857 GTK_SIGNAL_FUNC(source_drag_data_get
), (gpointer
) this );
858 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
859 GTK_SIGNAL_FUNC(source_drag_data_delete
), (gpointer
) this );
860 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
861 GTK_SIGNAL_FUNC(source_drag_begin
), (gpointer
) this );
862 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
863 GTK_SIGNAL_FUNC(source_drag_end
), (gpointer
) this );
867 // wxUSE_DRAG_AND_DROP