1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDropTarget class
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
11 #pragma implementation "dnd.h"
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
21 #if wxUSE_DRAG_AND_DROP
23 #include "wx/window.h"
25 #include "wx/gdicmn.h"
29 #include "wx/gtk/private.h"
31 #include <gdk/gdkprivate.h>
33 #include <gtk/gtkdnd.h>
34 #include <gtk/gtkselection.h>
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
40 extern void wxapp_install_idle_handler();
43 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
50 //----------------------------------------------------------------------------
52 //----------------------------------------------------------------------------
54 extern bool g_blockEventsOnDrag
;
56 // the flags used for the last DoDragDrop()
57 static long gs_flagsForDrag
= 0;
59 // the trace mask we use with wxLogTrace() - call
60 // wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here
61 // (there are quite a few of them, so don't enable this by default)
62 static const wxChar
*TRACE_DND
= _T("dnd");
64 //----------------------------------------------------------------------------
66 //----------------------------------------------------------------------------
68 /* Copyright (c) Julian Smart */
69 static const char * page_xpm
[] = {
70 /* columns rows colors chars-per-pixel */
119 " 56477<<<<8<<9&:X ",
120 " 59642%&*=-;<09&:5 ",
121 " 5q9642%&*=-<<<<<# ",
122 " 5qqw777<<<<<88:>+ ",
123 " erqq9642%&*=t;::+ ",
124 " eyrqq9642%&*=t;:O ",
125 " eyywwww777<<<<t;O ",
126 " e0yyrqq9642%&*=to ",
127 " e00yyrqq9642%&*=o ",
128 " eu0wwwwwww777<&*X ",
129 " euu00yyrqq9642%&X ",
130 " eiuu00yyrqq9642%X ",
131 " eiiwwwwwwwwww742$ ",
132 " eiiiuu00yyrqq964$ ",
133 " eiiiiuu00yyrqq96$ ",
134 " eiiiiiuu00yyrqq95 ",
135 " eiiiiiiuu00yyrqq5 ",
136 " eeeeeeeeeeeeee55e ",
145 // ============================================================================
147 // ============================================================================
149 // ----------------------------------------------------------------------------
150 // convert between GTK+ and wxWidgets DND constants
151 // ----------------------------------------------------------------------------
153 static wxDragResult
ConvertFromGTK(long action
)
157 case GDK_ACTION_COPY
:
160 case GDK_ACTION_LINK
:
163 case GDK_ACTION_MOVE
:
170 // ----------------------------------------------------------------------------
172 // ----------------------------------------------------------------------------
175 static void target_drag_leave( GtkWidget
*WXUNUSED(widget
),
176 GdkDragContext
*context
,
177 guint
WXUNUSED(time
),
178 wxDropTarget
*drop_target
)
180 if (g_isIdle
) wxapp_install_idle_handler();
182 /* inform the wxDropTarget about the current GdkDragContext.
183 this is only valid for the duration of this call */
184 drop_target
->SetDragContext( context
);
186 /* we don't need return values. this event is just for
188 drop_target
->OnLeave();
190 /* this has to be done because GDK has no "drag_enter" event */
191 drop_target
->m_firstMotion
= true;
193 /* after this, invalidate the drop_target's GdkDragContext */
194 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
198 // ----------------------------------------------------------------------------
200 // ----------------------------------------------------------------------------
203 static gboolean
target_drag_motion( GtkWidget
*WXUNUSED(widget
),
204 GdkDragContext
*context
,
208 wxDropTarget
*drop_target
)
210 if (g_isIdle
) wxapp_install_idle_handler();
212 /* Owen Taylor: "if the coordinates not in a drop zone,
213 return FALSE, otherwise call gtk_drag_status() and
216 /* inform the wxDropTarget about the current GdkDragContext.
217 this is only valid for the duration of this call */
218 drop_target
->SetDragContext( context
);
220 // GTK+ always supposes that we want to copy the data by default while we
221 // might want to move it, so examine not only suggested_action - which is
222 // only good if we don't have our own preferences - but also the actions
225 if (drop_target
->GetDefaultAction() == wxDragNone
)
227 // use default action set by wxDropSource::DoDragDrop()
228 if ( (gs_flagsForDrag
& wxDrag_DefaultMove
) == wxDrag_DefaultMove
&&
229 (context
->actions
& GDK_ACTION_MOVE
) )
231 // move is requested by the program and allowed by GTK+ - do it, even
232 // though suggested_action may be currently wxDragCopy
235 else // use whatever GTK+ says we should
237 result
= ConvertFromGTK(context
->suggested_action
);
239 if ( (result
== wxDragMove
) && !(gs_flagsForDrag
& wxDrag_AllowMove
) )
241 // we're requested to move but we can't
246 else if (drop_target
->GetDefaultAction() == wxDragMove
&&
247 (context
->actions
& GDK_ACTION_MOVE
))
253 if (context
->actions
& GDK_ACTION_COPY
)
255 else if (context
->actions
& GDK_ACTION_MOVE
)
261 if (drop_target
->m_firstMotion
)
263 /* the first "drag_motion" event substitutes a "drag_enter" event */
264 result
= drop_target
->OnEnter( x
, y
, result
);
268 /* give program a chance to react (i.e. to say no by returning FALSE) */
269 result
= drop_target
->OnDragOver( x
, y
, result
);
272 bool ret
= wxIsDragResultOk( result
);
275 GdkDragAction action
;
276 if (result
== wxDragCopy
)
277 action
= GDK_ACTION_COPY
;
278 else if (result
== wxDragLink
)
279 action
= GDK_ACTION_LINK
;
281 action
= GDK_ACTION_MOVE
;
283 gdk_drag_status( context
, action
, time
);
286 /* after this, invalidate the drop_target's GdkDragContext */
287 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
289 /* this has to be done because GDK has no "drag_enter" event */
290 drop_target
->m_firstMotion
= false;
296 // ----------------------------------------------------------------------------
298 // ----------------------------------------------------------------------------
301 static gboolean
target_drag_drop( GtkWidget
*widget
,
302 GdkDragContext
*context
,
306 wxDropTarget
*drop_target
)
308 if (g_isIdle
) wxapp_install_idle_handler();
310 /* Owen Taylor: "if the drop is not in a drop zone,
311 return FALSE, otherwise, if you aren't accepting
312 the drop, call gtk_drag_finish() with success == FALSE
313 otherwise call gtk_drag_data_get()" */
315 // printf( "drop.\n" );
317 /* this seems to make a difference between not accepting
318 due to wrong target area and due to wrong format. let
319 us hope that this is not required.. */
321 /* inform the wxDropTarget about the current GdkDragContext.
322 this is only valid for the duration of this call */
323 drop_target
->SetDragContext( context
);
325 /* inform the wxDropTarget about the current drag widget.
326 this is only valid for the duration of this call */
327 drop_target
->SetDragWidget( widget
);
329 /* inform the wxDropTarget about the current drag time.
330 this is only valid for the duration of this call */
331 drop_target
->SetDragTime( time
);
334 wxDragResult result = wxDragMove;
335 if (context->suggested_action == GDK_ACTION_COPY) result = wxDragCopy;
338 /* reset the block here as someone might very well
339 show a dialog as a reaction to a drop and this
340 wouldn't work without events */
341 g_blockEventsOnDrag
= false;
343 bool ret
= drop_target
->OnDrop( x
, y
);
347 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned FALSE") );
349 /* cancel the whole thing */
350 gtk_drag_finish( context
,
351 FALSE
, /* no success */
352 FALSE
, /* don't delete data on dropping side */
357 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned TRUE") );
360 /* disable GUI threads */
363 GdkAtom format
= drop_target
->GetMatchingPair();
365 // this does happen somehow, see bug 555111
366 wxCHECK_MSG( format
, FALSE
, _T("no matching GdkAtom for format?") )
369 GdkDragAction action = GDK_ACTION_MOVE;
370 if (result == wxDragCopy) action == GDK_ACTION_COPY;
371 context->action = action;
373 /* this should trigger an "drag_data_received" event */
374 gtk_drag_get_data( widget
,
380 /* re-enable GUI threads */
384 /* after this, invalidate the drop_target's GdkDragContext */
385 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
387 /* after this, invalidate the drop_target's drag widget */
388 drop_target
->SetDragWidget( (GtkWidget
*) NULL
);
390 /* this has to be done because GDK has no "drag_enter" event */
391 drop_target
->m_firstMotion
= true;
397 // ----------------------------------------------------------------------------
398 // "drag_data_received"
399 // ----------------------------------------------------------------------------
402 static void target_drag_data_received( GtkWidget
*WXUNUSED(widget
),
403 GdkDragContext
*context
,
406 GtkSelectionData
*data
,
407 guint
WXUNUSED(info
),
409 wxDropTarget
*drop_target
)
411 if (g_isIdle
) wxapp_install_idle_handler();
413 /* Owen Taylor: "call gtk_drag_finish() with
416 if ((data
->length
<= 0) || (data
->format
!= 8))
418 /* negative data length and non 8-bit data format
419 qualifies for junk */
420 gtk_drag_finish (context
, FALSE
, FALSE
, time
);
425 wxLogTrace(TRACE_DND
, wxT( "Drop target: data received event") );
427 /* inform the wxDropTarget about the current GtkSelectionData.
428 this is only valid for the duration of this call */
429 drop_target
->SetDragData( data
);
431 wxDragResult result
= ConvertFromGTK(context
->action
);
433 if ( wxIsDragResultOk( drop_target
->OnData( x
, y
, result
) ) )
435 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned TRUE") );
437 /* tell GTK that data transfer was successful */
438 gtk_drag_finish( context
, TRUE
, FALSE
, time
);
442 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned FALSE") );
444 /* tell GTK that data transfer was not successful */
445 gtk_drag_finish( context
, FALSE
, FALSE
, time
);
448 /* after this, invalidate the drop_target's drag data */
449 drop_target
->SetDragData( (GtkSelectionData
*) NULL
);
453 //----------------------------------------------------------------------------
455 //----------------------------------------------------------------------------
457 wxDropTarget::wxDropTarget( wxDataObject
*data
)
458 : wxDropTargetBase( data
)
460 m_firstMotion
= true;
461 m_dragContext
= (GdkDragContext
*) NULL
;
462 m_dragWidget
= (GtkWidget
*) NULL
;
463 m_dragData
= (GtkSelectionData
*) NULL
;
467 wxDragResult
wxDropTarget::OnDragOver( wxCoord
WXUNUSED(x
),
471 // GetMatchingPair() checks for m_dataObject too, no need to do it here
473 // disable the debug message from GetMatchingPair() - there are too many
479 return (GetMatchingPair() != (GdkAtom
) 0) ? def
: wxDragNone
;
482 bool wxDropTarget::OnDrop( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
) )
487 return (GetMatchingPair() != (GdkAtom
) 0);
490 wxDragResult
wxDropTarget::OnData( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
496 if (GetMatchingPair() == (GdkAtom
) 0)
499 return GetData() ? def
: wxDragNone
;
502 GdkAtom
wxDropTarget::GetMatchingPair()
510 GList
*child
= m_dragContext
->targets
;
513 GdkAtom formatAtom
= (GdkAtom
) GPOINTER_TO_INT(child
->data
);
514 wxDataFormat
format( formatAtom
);
517 wxLogTrace(TRACE_DND
, wxT("Drop target: drag has format: %s"),
518 format
.GetId().c_str());
521 if (m_dataObject
->IsSupportedFormat( format
))
530 bool wxDropTarget::GetData()
538 wxDataFormat
dragFormat( m_dragData
->target
);
540 if (!m_dataObject
->IsSupportedFormat( dragFormat
))
543 m_dataObject
->SetData( dragFormat
, (size_t)m_dragData
->length
, (const void*)m_dragData
->data
);
548 void wxDropTarget::UnregisterWidget( GtkWidget
*widget
)
550 wxCHECK_RET( widget
!= NULL
, wxT("unregister widget is NULL") );
552 gtk_drag_dest_unset( widget
);
554 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
555 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
557 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
558 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
560 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
561 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
563 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
564 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
567 void wxDropTarget::RegisterWidget( GtkWidget
*widget
)
569 wxCHECK_RET( widget
!= NULL
, wxT("register widget is NULL") );
571 /* gtk_drag_dest_set() determines what default behaviour we'd like
572 GTK to supply. we don't want to specify out targets (=formats)
573 or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
574 not GTK_DEST_DEFAULT_DROP). instead we react individually to
575 "drag_motion" and "drag_drop" events. this makes it possible
576 to allow dropping on only a small area. we should set
577 GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
578 highlighting if dragging over standard controls, but this
579 seems to be broken without the other two. */
581 gtk_drag_dest_set( widget
,
582 (GtkDestDefaults
) 0, /* no default behaviour */
583 (GtkTargetEntry
*) NULL
, /* we don't supply any formats here */
584 0, /* number of targets = 0 */
585 (GdkDragAction
) 0 ); /* we don't supply any actions here */
587 gtk_signal_connect( GTK_OBJECT(widget
), "drag_leave",
588 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
590 gtk_signal_connect( GTK_OBJECT(widget
), "drag_motion",
591 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
593 gtk_signal_connect( GTK_OBJECT(widget
), "drag_drop",
594 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
596 gtk_signal_connect( GTK_OBJECT(widget
), "drag_data_received",
597 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
600 //----------------------------------------------------------------------------
602 //----------------------------------------------------------------------------
606 source_drag_data_get (GtkWidget
*WXUNUSED(widget
),
607 GdkDragContext
*WXUNUSED(context
),
608 GtkSelectionData
*selection_data
,
609 guint
WXUNUSED(info
),
610 guint
WXUNUSED(time
),
611 wxDropSource
*drop_source
)
613 if (g_isIdle
) wxapp_install_idle_handler();
615 wxDataFormat
format( selection_data
->target
);
617 wxLogTrace(TRACE_DND
, wxT("Drop source: format requested: %s"),
618 format
.GetId().c_str());
620 drop_source
->m_retValue
= wxDragCancel
;
622 wxDataObject
*data
= drop_source
->GetDataObject();
626 wxLogTrace(TRACE_DND
, wxT("Drop source: no data object") );
630 if (!data
->IsSupportedFormat(format
))
632 wxLogTrace(TRACE_DND
, wxT("Drop source: unsupported format") );
636 if (data
->GetDataSize(format
) == 0)
638 wxLogTrace(TRACE_DND
, wxT("Drop source: empty data") );
642 size_t size
= data
->GetDataSize(format
);
644 // printf( "data size: %d.\n", (int)data_size );
646 guchar
*d
= new guchar
[size
];
648 if (!data
->GetDataHere( format
, (void*)d
))
655 /* disable GUI threads */
658 gtk_selection_data_set( selection_data
,
659 selection_data
->target
,
665 /* enable GUI threads */
672 //----------------------------------------------------------------------------
673 // "drag_data_delete"
674 //----------------------------------------------------------------------------
677 static void source_drag_data_delete( GtkWidget
*WXUNUSED(widget
),
678 GdkDragContext
*context
,
679 wxDropSource
*WXUNUSED(drop_source
) )
682 wxapp_install_idle_handler();
684 // printf( "Drag source: drag_data_delete\n" );
688 //----------------------------------------------------------------------------
690 //----------------------------------------------------------------------------
693 static void source_drag_begin( GtkWidget
*WXUNUSED(widget
),
694 GdkDragContext
*WXUNUSED(context
),
695 wxDropSource
*WXUNUSED(drop_source
) )
698 wxapp_install_idle_handler();
700 // printf( "Drag source: drag_begin.\n" );
704 //----------------------------------------------------------------------------
706 //----------------------------------------------------------------------------
709 static void source_drag_end( GtkWidget
*WXUNUSED(widget
),
710 GdkDragContext
*WXUNUSED(context
),
711 wxDropSource
*drop_source
)
713 if (g_isIdle
) wxapp_install_idle_handler();
715 // printf( "Drag source: drag_end.\n" );
717 drop_source
->m_waiting
= false;
721 //-----------------------------------------------------------------------------
722 // "configure_event" from m_iconWindow
723 //-----------------------------------------------------------------------------
727 gtk_dnd_window_configure_callback( GtkWidget
*WXUNUSED(widget
), GdkEventConfigure
*WXUNUSED(event
), wxDropSource
*source
)
730 wxapp_install_idle_handler();
732 source
->GiveFeedback( ConvertFromGTK(source
->m_dragContext
->action
) );
738 //---------------------------------------------------------------------------
740 //---------------------------------------------------------------------------
742 wxDropSource::wxDropSource(wxWindow
*win
,
743 const wxIcon
&iconCopy
,
744 const wxIcon
&iconMove
,
745 const wxIcon
&iconNone
)
749 m_iconWindow
= (GtkWidget
*) NULL
;
752 m_widget
= win
->m_widget
;
753 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
755 m_retValue
= wxDragCancel
;
757 SetIcons(iconCopy
, iconMove
, iconNone
);
760 wxDropSource::wxDropSource(wxDataObject
& data
,
762 const wxIcon
&iconCopy
,
763 const wxIcon
&iconMove
,
764 const wxIcon
&iconNone
)
770 m_iconWindow
= (GtkWidget
*) NULL
;
773 m_widget
= win
->m_widget
;
774 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
776 m_retValue
= wxDragCancel
;
778 SetIcons(iconCopy
, iconMove
, iconNone
);
781 void wxDropSource::SetIcons(const wxIcon
&iconCopy
,
782 const wxIcon
&iconMove
,
783 const wxIcon
&iconNone
)
785 m_iconCopy
= iconCopy
;
786 m_iconMove
= iconMove
;
787 m_iconNone
= iconNone
;
789 if ( !m_iconCopy
.Ok() )
790 m_iconCopy
= wxIcon(page_xpm
);
791 if ( !m_iconMove
.Ok() )
792 m_iconMove
= m_iconCopy
;
793 if ( !m_iconNone
.Ok() )
794 m_iconNone
= m_iconCopy
;
797 wxDropSource::~wxDropSource()
801 void wxDropSource::PrepareIcon( int action
, GdkDragContext
*context
)
803 // get the right icon to display
805 if ( action
& GDK_ACTION_MOVE
)
807 else if ( action
& GDK_ACTION_COPY
)
813 if ( icon
->GetMask() )
814 mask
= icon
->GetMask()->GetBitmap();
816 mask
= (GdkBitmap
*)NULL
;
818 GdkPixmap
*pixmap
= icon
->GetPixmap();
821 gdk_window_get_size (pixmap
, &width
, &height
);
823 GdkColormap
*colormap
= gtk_widget_get_colormap( m_widget
);
825 gtk_widget_push_visual (gdk_colormap_get_visual (colormap
));
827 gtk_widget_push_colormap (colormap
);
829 m_iconWindow
= gtk_window_new (GTK_WINDOW_POPUP
);
830 gtk_widget_set_events (m_iconWindow
, GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
);
831 gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow
), TRUE
);
834 gtk_widget_pop_visual ();
836 gtk_widget_pop_colormap ();
838 gtk_widget_set_usize (m_iconWindow
, width
, height
);
839 gtk_widget_realize (m_iconWindow
);
841 gtk_signal_connect( GTK_OBJECT(m_iconWindow
), "configure_event",
842 GTK_SIGNAL_FUNC(gtk_dnd_window_configure_callback
), (gpointer
)this );
844 gdk_window_set_back_pixmap (m_iconWindow
->window
, pixmap
, FALSE
);
847 gtk_widget_shape_combine_mask (m_iconWindow
, mask
, 0, 0);
849 gtk_drag_set_icon_widget( context
, m_iconWindow
, 0, 0 );
852 wxDragResult
wxDropSource::DoDragDrop(int flags
)
854 wxCHECK_MSG( m_data
&& m_data
->GetFormatCount(), wxDragNone
,
855 wxT("Drop source: no data") );
858 if (g_blockEventsOnDrag
)
862 g_blockEventsOnDrag
= true;
868 GtkTargetList
*target_list
= gtk_target_list_new( (GtkTargetEntry
*) NULL
, 0 );
870 wxDataFormat
*array
= new wxDataFormat
[ m_data
->GetFormatCount() ];
871 m_data
->GetAllFormats( array
);
872 size_t count
= m_data
->GetFormatCount();
873 for (size_t i
= 0; i
< count
; i
++)
875 GdkAtom atom
= array
[i
];
876 wxLogTrace(TRACE_DND
, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom
));
877 gtk_target_list_add( target_list
, atom
, 0, 0 );
881 GdkEventMotion event
;
882 event
.window
= m_widget
->window
;
885 GdkModifierType state
;
886 gdk_window_get_pointer( event
.window
, &x
, &y
, &state
);
890 event
.time
= (guint32
)GDK_CURRENT_TIME
;
892 /* GTK wants to know which button was pressed which caused the dragging */
893 int button_number
= 0;
894 if (event
.state
& GDK_BUTTON1_MASK
) button_number
= 1;
895 else if (event
.state
& GDK_BUTTON2_MASK
) button_number
= 2;
896 else if (event
.state
& GDK_BUTTON3_MASK
) button_number
= 3;
899 /* disable GUI threads */
902 /* don't start dragging if no button is down */
905 int action
= GDK_ACTION_COPY
;
906 if ( flags
& wxDrag_AllowMove
)
907 action
|= GDK_ACTION_MOVE
;
909 // VZ: as we already use g_blockEventsOnDrag it shouldn't be that bad
910 // to use a global to pass the flags to the drop target but I'd
911 // surely prefer a better way to do it
912 gs_flagsForDrag
= flags
;
914 GdkDragContext
*context
= gtk_drag_begin( m_widget
,
916 (GdkDragAction
)action
,
917 button_number
, /* number of mouse button which started drag */
918 (GdkEvent
*) &event
);
920 m_dragContext
= context
;
922 PrepareIcon( action
, context
);
925 gtk_main_iteration();
927 m_retValue
= ConvertFromGTK(context
->action
);
928 if ( m_retValue
== wxDragNone
)
929 m_retValue
= wxDragCancel
;
933 /* re-enable GUI threads */
936 g_blockEventsOnDrag
= false;
943 void wxDropSource::RegisterWindow()
945 if (!m_widget
) return;
947 gtk_signal_connect( GTK_OBJECT(m_widget
), "drag_data_get",
948 GTK_SIGNAL_FUNC (source_drag_data_get
), (gpointer
) this);
949 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_data_delete",
950 GTK_SIGNAL_FUNC (source_drag_data_delete
), (gpointer
) this );
951 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_begin",
952 GTK_SIGNAL_FUNC (source_drag_begin
), (gpointer
) this );
953 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_end",
954 GTK_SIGNAL_FUNC (source_drag_end
), (gpointer
) this );
958 void wxDropSource::UnregisterWindow()
960 if (!m_widget
) return;
962 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
963 GTK_SIGNAL_FUNC(source_drag_data_get
), (gpointer
) this );
964 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
965 GTK_SIGNAL_FUNC(source_drag_data_delete
), (gpointer
) this );
966 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
967 GTK_SIGNAL_FUNC(source_drag_begin
), (gpointer
) this );
968 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
969 GTK_SIGNAL_FUNC(source_drag_end
), (gpointer
) this );
973 // wxUSE_DRAG_AND_DROP