1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxDropTarget class
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 ///////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_DRAG_AND_DROP
19 #include "wx/window.h"
21 #include "wx/gdicmn.h"
25 #include "wx/gtk/private.h"
27 #include <gdk/gdkprivate.h>
29 #include <gtk/gtkdnd.h>
30 #include <gtk/gtkselection.h>
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 extern void wxapp_install_idle_handler();
39 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
46 //----------------------------------------------------------------------------
48 //----------------------------------------------------------------------------
50 extern bool g_blockEventsOnDrag
;
52 // the flags used for the last DoDragDrop()
53 static long gs_flagsForDrag
= 0;
55 // the trace mask we use with wxLogTrace() - call
56 // wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here
57 // (there are quite a few of them, so don't enable this by default)
58 static const wxChar
*TRACE_DND
= _T("dnd");
60 //----------------------------------------------------------------------------
62 //----------------------------------------------------------------------------
64 /* Copyright (c) Julian Smart */
65 static const char * page_xpm
[] = {
66 /* columns rows colors chars-per-pixel */
115 " 56477<<<<8<<9&:X ",
116 " 59642%&*=-;<09&:5 ",
117 " 5q9642%&*=-<<<<<# ",
118 " 5qqw777<<<<<88:>+ ",
119 " erqq9642%&*=t;::+ ",
120 " eyrqq9642%&*=t;:O ",
121 " eyywwww777<<<<t;O ",
122 " e0yyrqq9642%&*=to ",
123 " e00yyrqq9642%&*=o ",
124 " eu0wwwwwww777<&*X ",
125 " euu00yyrqq9642%&X ",
126 " eiuu00yyrqq9642%X ",
127 " eiiwwwwwwwwww742$ ",
128 " eiiiuu00yyrqq964$ ",
129 " eiiiiuu00yyrqq96$ ",
130 " eiiiiiuu00yyrqq95 ",
131 " eiiiiiiuu00yyrqq5 ",
132 " eeeeeeeeeeeeee55e ",
141 // ============================================================================
143 // ============================================================================
145 // ----------------------------------------------------------------------------
146 // convert between GTK+ and wxWidgets DND constants
147 // ----------------------------------------------------------------------------
149 static wxDragResult
ConvertFromGTK(long action
)
153 case GDK_ACTION_COPY
:
156 case GDK_ACTION_LINK
:
159 case GDK_ACTION_MOVE
:
166 // ----------------------------------------------------------------------------
168 // ----------------------------------------------------------------------------
171 static void target_drag_leave( GtkWidget
*WXUNUSED(widget
),
172 GdkDragContext
*context
,
173 guint
WXUNUSED(time
),
174 wxDropTarget
*drop_target
)
176 if (g_isIdle
) wxapp_install_idle_handler();
178 /* inform the wxDropTarget about the current GdkDragContext.
179 this is only valid for the duration of this call */
180 drop_target
->SetDragContext( context
);
182 /* we don't need return values. this event is just for
184 drop_target
->OnLeave();
186 /* this has to be done because GDK has no "drag_enter" event */
187 drop_target
->m_firstMotion
= true;
189 /* after this, invalidate the drop_target's GdkDragContext */
190 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
194 // ----------------------------------------------------------------------------
196 // ----------------------------------------------------------------------------
199 static gboolean
target_drag_motion( GtkWidget
*WXUNUSED(widget
),
200 GdkDragContext
*context
,
204 wxDropTarget
*drop_target
)
206 if (g_isIdle
) wxapp_install_idle_handler();
208 /* Owen Taylor: "if the coordinates not in a drop zone,
209 return FALSE, otherwise call gtk_drag_status() and
212 /* inform the wxDropTarget about the current GdkDragContext.
213 this is only valid for the duration of this call */
214 drop_target
->SetDragContext( context
);
216 // GTK+ always supposes that we want to copy the data by default while we
217 // might want to move it, so examine not only suggested_action - which is
218 // only good if we don't have our own preferences - but also the actions
221 if (drop_target
->GetDefaultAction() == wxDragNone
)
223 // use default action set by wxDropSource::DoDragDrop()
224 if ( (gs_flagsForDrag
& wxDrag_DefaultMove
) == wxDrag_DefaultMove
&&
225 (context
->actions
& GDK_ACTION_MOVE
) )
227 // move is requested by the program and allowed by GTK+ - do it, even
228 // though suggested_action may be currently wxDragCopy
231 else // use whatever GTK+ says we should
233 result
= ConvertFromGTK(context
->suggested_action
);
235 if ( (result
== wxDragMove
) && !(gs_flagsForDrag
& wxDrag_AllowMove
) )
237 // we're requested to move but we can't
242 else if (drop_target
->GetDefaultAction() == wxDragMove
&&
243 (context
->actions
& GDK_ACTION_MOVE
))
249 if (context
->actions
& GDK_ACTION_COPY
)
251 else if (context
->actions
& GDK_ACTION_MOVE
)
257 if (drop_target
->m_firstMotion
)
259 /* the first "drag_motion" event substitutes a "drag_enter" event */
260 result
= drop_target
->OnEnter( x
, y
, result
);
264 /* give program a chance to react (i.e. to say no by returning FALSE) */
265 result
= drop_target
->OnDragOver( x
, y
, result
);
268 bool ret
= wxIsDragResultOk( result
);
271 GdkDragAction action
;
272 if (result
== wxDragCopy
)
273 action
= GDK_ACTION_COPY
;
274 else if (result
== wxDragLink
)
275 action
= GDK_ACTION_LINK
;
277 action
= GDK_ACTION_MOVE
;
279 gdk_drag_status( context
, action
, time
);
282 /* after this, invalidate the drop_target's GdkDragContext */
283 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
285 /* this has to be done because GDK has no "drag_enter" event */
286 drop_target
->m_firstMotion
= false;
292 // ----------------------------------------------------------------------------
294 // ----------------------------------------------------------------------------
297 static gboolean
target_drag_drop( GtkWidget
*widget
,
298 GdkDragContext
*context
,
302 wxDropTarget
*drop_target
)
304 if (g_isIdle
) wxapp_install_idle_handler();
306 /* Owen Taylor: "if the drop is not in a drop zone,
307 return FALSE, otherwise, if you aren't accepting
308 the drop, call gtk_drag_finish() with success == FALSE
309 otherwise call gtk_drag_data_get()" */
311 // printf( "drop.\n" );
313 /* this seems to make a difference between not accepting
314 due to wrong target area and due to wrong format. let
315 us hope that this is not required.. */
317 /* inform the wxDropTarget about the current GdkDragContext.
318 this is only valid for the duration of this call */
319 drop_target
->SetDragContext( context
);
321 /* inform the wxDropTarget about the current drag widget.
322 this is only valid for the duration of this call */
323 drop_target
->SetDragWidget( widget
);
325 /* inform the wxDropTarget about the current drag time.
326 this is only valid for the duration of this call */
327 drop_target
->SetDragTime( time
);
330 wxDragResult result = wxDragMove;
331 if (context->suggested_action == GDK_ACTION_COPY) result = wxDragCopy;
334 /* reset the block here as someone might very well
335 show a dialog as a reaction to a drop and this
336 wouldn't work without events */
337 g_blockEventsOnDrag
= false;
339 bool ret
= drop_target
->OnDrop( x
, y
);
343 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned FALSE") );
345 /* cancel the whole thing */
346 gtk_drag_finish( context
,
347 FALSE
, /* no success */
348 FALSE
, /* don't delete data on dropping side */
353 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned TRUE") );
356 /* disable GUI threads */
359 GdkAtom format
= drop_target
->GetMatchingPair();
361 // this does happen somehow, see bug 555111
362 wxCHECK_MSG( format
, FALSE
, _T("no matching GdkAtom for format?") )
365 GdkDragAction action = GDK_ACTION_MOVE;
366 if (result == wxDragCopy) action == GDK_ACTION_COPY;
367 context->action = action;
369 /* this should trigger an "drag_data_received" event */
370 gtk_drag_get_data( widget
,
376 /* re-enable GUI threads */
380 /* after this, invalidate the drop_target's GdkDragContext */
381 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
383 /* after this, invalidate the drop_target's drag widget */
384 drop_target
->SetDragWidget( (GtkWidget
*) NULL
);
386 /* this has to be done because GDK has no "drag_enter" event */
387 drop_target
->m_firstMotion
= true;
393 // ----------------------------------------------------------------------------
394 // "drag_data_received"
395 // ----------------------------------------------------------------------------
398 static void target_drag_data_received( GtkWidget
*WXUNUSED(widget
),
399 GdkDragContext
*context
,
402 GtkSelectionData
*data
,
403 guint
WXUNUSED(info
),
405 wxDropTarget
*drop_target
)
407 if (g_isIdle
) wxapp_install_idle_handler();
409 /* Owen Taylor: "call gtk_drag_finish() with
412 if ((data
->length
<= 0) || (data
->format
!= 8))
414 /* negative data length and non 8-bit data format
415 qualifies for junk */
416 gtk_drag_finish (context
, FALSE
, FALSE
, time
);
421 wxLogTrace(TRACE_DND
, wxT( "Drop target: data received event") );
423 /* inform the wxDropTarget about the current GtkSelectionData.
424 this is only valid for the duration of this call */
425 drop_target
->SetDragData( data
);
427 wxDragResult result
= ConvertFromGTK(context
->action
);
429 if ( wxIsDragResultOk( drop_target
->OnData( x
, y
, result
) ) )
431 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned TRUE") );
433 /* tell GTK that data transfer was successful */
434 gtk_drag_finish( context
, TRUE
, FALSE
, time
);
438 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned FALSE") );
440 /* tell GTK that data transfer was not successful */
441 gtk_drag_finish( context
, FALSE
, FALSE
, time
);
444 /* after this, invalidate the drop_target's drag data */
445 drop_target
->SetDragData( (GtkSelectionData
*) NULL
);
449 //----------------------------------------------------------------------------
451 //----------------------------------------------------------------------------
453 wxDropTarget::wxDropTarget( wxDataObject
*data
)
454 : wxDropTargetBase( data
)
456 m_firstMotion
= true;
457 m_dragContext
= (GdkDragContext
*) NULL
;
458 m_dragWidget
= (GtkWidget
*) NULL
;
459 m_dragData
= (GtkSelectionData
*) NULL
;
463 wxDragResult
wxDropTarget::OnDragOver( wxCoord
WXUNUSED(x
),
467 // GetMatchingPair() checks for m_dataObject too, no need to do it here
469 // disable the debug message from GetMatchingPair() - there are too many
475 return (GetMatchingPair() != (GdkAtom
) 0) ? def
: wxDragNone
;
478 bool wxDropTarget::OnDrop( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
) )
483 return (GetMatchingPair() != (GdkAtom
) 0);
486 wxDragResult
wxDropTarget::OnData( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
492 if (GetMatchingPair() == (GdkAtom
) 0)
495 return GetData() ? def
: wxDragNone
;
498 GdkAtom
wxDropTarget::GetMatchingPair()
506 GList
*child
= m_dragContext
->targets
;
509 // in GTK+ 1.x GdkAtom was a gulong, but now it's a pointer
510 GdkAtom formatAtom
= (GdkAtom
)
515 wxDataFormat
format( formatAtom
);
518 wxLogTrace(TRACE_DND
, wxT("Drop target: drag has format: %s"),
519 format
.GetId().c_str());
522 if (m_dataObject
->IsSupportedFormat( format
))
531 bool wxDropTarget::GetData()
539 wxDataFormat
dragFormat( m_dragData
->target
);
541 if (!m_dataObject
->IsSupportedFormat( dragFormat
))
544 m_dataObject
->SetData( dragFormat
, (size_t)m_dragData
->length
, (const void*)m_dragData
->data
);
549 void wxDropTarget::UnregisterWidget( GtkWidget
*widget
)
551 wxCHECK_RET( widget
!= NULL
, wxT("unregister widget is NULL") );
553 gtk_drag_dest_unset( widget
);
555 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
556 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
558 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
559 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
561 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
562 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
564 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
565 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
568 void wxDropTarget::RegisterWidget( GtkWidget
*widget
)
570 wxCHECK_RET( widget
!= NULL
, wxT("register widget is NULL") );
572 /* gtk_drag_dest_set() determines what default behaviour we'd like
573 GTK to supply. we don't want to specify out targets (=formats)
574 or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
575 not GTK_DEST_DEFAULT_DROP). instead we react individually to
576 "drag_motion" and "drag_drop" events. this makes it possible
577 to allow dropping on only a small area. we should set
578 GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
579 highlighting if dragging over standard controls, but this
580 seems to be broken without the other two. */
582 gtk_drag_dest_set( widget
,
583 (GtkDestDefaults
) 0, /* no default behaviour */
584 (GtkTargetEntry
*) NULL
, /* we don't supply any formats here */
585 0, /* number of targets = 0 */
586 (GdkDragAction
) 0 ); /* we don't supply any actions here */
588 gtk_signal_connect( GTK_OBJECT(widget
), "drag_leave",
589 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
591 gtk_signal_connect( GTK_OBJECT(widget
), "drag_motion",
592 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
594 gtk_signal_connect( GTK_OBJECT(widget
), "drag_drop",
595 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
597 gtk_signal_connect( GTK_OBJECT(widget
), "drag_data_received",
598 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
601 //----------------------------------------------------------------------------
603 //----------------------------------------------------------------------------
607 source_drag_data_get (GtkWidget
*WXUNUSED(widget
),
608 GdkDragContext
*WXUNUSED(context
),
609 GtkSelectionData
*selection_data
,
610 guint
WXUNUSED(info
),
611 guint
WXUNUSED(time
),
612 wxDropSource
*drop_source
)
614 if (g_isIdle
) wxapp_install_idle_handler();
616 wxDataFormat
format( selection_data
->target
);
618 wxLogTrace(TRACE_DND
, wxT("Drop source: format requested: %s"),
619 format
.GetId().c_str());
621 drop_source
->m_retValue
= wxDragCancel
;
623 wxDataObject
*data
= drop_source
->GetDataObject();
627 wxLogTrace(TRACE_DND
, wxT("Drop source: no data object") );
631 if (!data
->IsSupportedFormat(format
))
633 wxLogTrace(TRACE_DND
, wxT("Drop source: unsupported format") );
637 if (data
->GetDataSize(format
) == 0)
639 wxLogTrace(TRACE_DND
, wxT("Drop source: empty data") );
643 size_t size
= data
->GetDataSize(format
);
645 // printf( "data size: %d.\n", (int)data_size );
647 guchar
*d
= new guchar
[size
];
649 if (!data
->GetDataHere( format
, (void*)d
))
656 /* disable GUI threads */
659 gtk_selection_data_set( selection_data
,
660 selection_data
->target
,
666 /* enable GUI threads */
673 //----------------------------------------------------------------------------
674 // "drag_data_delete"
675 //----------------------------------------------------------------------------
678 static void source_drag_data_delete( GtkWidget
*WXUNUSED(widget
),
679 GdkDragContext
*context
,
680 wxDropSource
*WXUNUSED(drop_source
) )
683 wxapp_install_idle_handler();
685 // printf( "Drag source: drag_data_delete\n" );
689 //----------------------------------------------------------------------------
691 //----------------------------------------------------------------------------
694 static void source_drag_begin( GtkWidget
*WXUNUSED(widget
),
695 GdkDragContext
*WXUNUSED(context
),
696 wxDropSource
*WXUNUSED(drop_source
) )
699 wxapp_install_idle_handler();
701 // printf( "Drag source: drag_begin.\n" );
705 //----------------------------------------------------------------------------
707 //----------------------------------------------------------------------------
710 static void source_drag_end( GtkWidget
*WXUNUSED(widget
),
711 GdkDragContext
*WXUNUSED(context
),
712 wxDropSource
*drop_source
)
714 if (g_isIdle
) wxapp_install_idle_handler();
716 // printf( "Drag source: drag_end.\n" );
718 drop_source
->m_waiting
= false;
722 //-----------------------------------------------------------------------------
723 // "configure_event" from m_iconWindow
724 //-----------------------------------------------------------------------------
728 gtk_dnd_window_configure_callback( GtkWidget
*WXUNUSED(widget
), GdkEventConfigure
*WXUNUSED(event
), wxDropSource
*source
)
731 wxapp_install_idle_handler();
733 source
->GiveFeedback( ConvertFromGTK(source
->m_dragContext
->action
) );
739 //---------------------------------------------------------------------------
741 //---------------------------------------------------------------------------
743 wxDropSource::wxDropSource(wxWindow
*win
,
744 const wxIcon
&iconCopy
,
745 const wxIcon
&iconMove
,
746 const wxIcon
&iconNone
)
750 m_iconWindow
= (GtkWidget
*) NULL
;
753 m_widget
= win
->m_widget
;
754 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
756 m_retValue
= wxDragCancel
;
758 SetIcons(iconCopy
, iconMove
, iconNone
);
761 wxDropSource::wxDropSource(wxDataObject
& data
,
763 const wxIcon
&iconCopy
,
764 const wxIcon
&iconMove
,
765 const wxIcon
&iconNone
)
771 m_iconWindow
= (GtkWidget
*) NULL
;
774 m_widget
= win
->m_widget
;
775 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
777 m_retValue
= wxDragCancel
;
779 SetIcons(iconCopy
, iconMove
, iconNone
);
782 void wxDropSource::SetIcons(const wxIcon
&iconCopy
,
783 const wxIcon
&iconMove
,
784 const wxIcon
&iconNone
)
786 m_iconCopy
= iconCopy
;
787 m_iconMove
= iconMove
;
788 m_iconNone
= iconNone
;
790 if ( !m_iconCopy
.Ok() )
791 m_iconCopy
= wxIcon(page_xpm
);
792 if ( !m_iconMove
.Ok() )
793 m_iconMove
= m_iconCopy
;
794 if ( !m_iconNone
.Ok() )
795 m_iconNone
= m_iconCopy
;
798 wxDropSource::~wxDropSource()
802 void wxDropSource::PrepareIcon( int action
, GdkDragContext
*context
)
804 // get the right icon to display
806 if ( action
& GDK_ACTION_MOVE
)
808 else if ( action
& GDK_ACTION_COPY
)
814 if ( icon
->GetMask() )
815 mask
= icon
->GetMask()->GetBitmap();
817 mask
= (GdkBitmap
*)NULL
;
819 GdkPixmap
*pixmap
= icon
->GetPixmap();
822 gdk_window_get_size (pixmap
, &width
, &height
);
824 GdkColormap
*colormap
= gtk_widget_get_colormap( m_widget
);
826 gtk_widget_push_visual (gdk_colormap_get_visual (colormap
));
828 gtk_widget_push_colormap (colormap
);
830 m_iconWindow
= gtk_window_new (GTK_WINDOW_POPUP
);
831 gtk_widget_set_events (m_iconWindow
, GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
);
832 gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow
), TRUE
);
835 gtk_widget_pop_visual ();
837 gtk_widget_pop_colormap ();
839 gtk_widget_set_usize (m_iconWindow
, width
, height
);
840 gtk_widget_realize (m_iconWindow
);
842 gtk_signal_connect( GTK_OBJECT(m_iconWindow
), "configure_event",
843 GTK_SIGNAL_FUNC(gtk_dnd_window_configure_callback
), (gpointer
)this );
845 gdk_window_set_back_pixmap (m_iconWindow
->window
, pixmap
, FALSE
);
848 gtk_widget_shape_combine_mask (m_iconWindow
, mask
, 0, 0);
850 gtk_drag_set_icon_widget( context
, m_iconWindow
, 0, 0 );
853 wxDragResult
wxDropSource::DoDragDrop(int flags
)
855 wxCHECK_MSG( m_data
&& m_data
->GetFormatCount(), wxDragNone
,
856 wxT("Drop source: no data") );
859 if (g_blockEventsOnDrag
)
863 g_blockEventsOnDrag
= true;
869 GtkTargetList
*target_list
= gtk_target_list_new( (GtkTargetEntry
*) NULL
, 0 );
871 wxDataFormat
*array
= new wxDataFormat
[ m_data
->GetFormatCount() ];
872 m_data
->GetAllFormats( array
);
873 size_t count
= m_data
->GetFormatCount();
874 for (size_t i
= 0; i
< count
; i
++)
876 GdkAtom atom
= array
[i
];
877 wxLogTrace(TRACE_DND
, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom
));
878 gtk_target_list_add( target_list
, atom
, 0, 0 );
882 GdkEventMotion event
;
883 event
.window
= m_widget
->window
;
886 GdkModifierType state
;
887 gdk_window_get_pointer( event
.window
, &x
, &y
, &state
);
891 event
.time
= (guint32
)GDK_CURRENT_TIME
;
893 /* GTK wants to know which button was pressed which caused the dragging */
894 int button_number
= 0;
895 if (event
.state
& GDK_BUTTON1_MASK
) button_number
= 1;
896 else if (event
.state
& GDK_BUTTON2_MASK
) button_number
= 2;
897 else if (event
.state
& GDK_BUTTON3_MASK
) button_number
= 3;
900 /* disable GUI threads */
903 /* don't start dragging if no button is down */
906 int action
= GDK_ACTION_COPY
;
907 if ( flags
& wxDrag_AllowMove
)
908 action
|= GDK_ACTION_MOVE
;
910 // VZ: as we already use g_blockEventsOnDrag it shouldn't be that bad
911 // to use a global to pass the flags to the drop target but I'd
912 // surely prefer a better way to do it
913 gs_flagsForDrag
= flags
;
915 GdkDragContext
*context
= gtk_drag_begin( m_widget
,
917 (GdkDragAction
)action
,
918 button_number
, /* number of mouse button which started drag */
919 (GdkEvent
*) &event
);
921 m_dragContext
= context
;
923 PrepareIcon( action
, context
);
926 gtk_main_iteration();
928 m_retValue
= ConvertFromGTK(context
->action
);
929 if ( m_retValue
== wxDragNone
)
930 m_retValue
= wxDragCancel
;
934 /* re-enable GUI threads */
937 g_blockEventsOnDrag
= false;
944 void wxDropSource::RegisterWindow()
946 if (!m_widget
) return;
948 gtk_signal_connect( GTK_OBJECT(m_widget
), "drag_data_get",
949 GTK_SIGNAL_FUNC (source_drag_data_get
), (gpointer
) this);
950 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_data_delete",
951 GTK_SIGNAL_FUNC (source_drag_data_delete
), (gpointer
) this );
952 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_begin",
953 GTK_SIGNAL_FUNC (source_drag_begin
), (gpointer
) this );
954 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_end",
955 GTK_SIGNAL_FUNC (source_drag_end
), (gpointer
) this );
959 void wxDropSource::UnregisterWindow()
961 if (!m_widget
) return;
963 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
964 GTK_SIGNAL_FUNC(source_drag_data_get
), (gpointer
) this );
965 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
966 GTK_SIGNAL_FUNC(source_drag_data_delete
), (gpointer
) this );
967 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
968 GTK_SIGNAL_FUNC(source_drag_begin
), (gpointer
) this );
969 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
970 GTK_SIGNAL_FUNC(source_drag_end
), (gpointer
) this );
974 // wxUSE_DRAG_AND_DROP