1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/dnd.cpp
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"
13 #if wxUSE_DRAG_AND_DROP
22 #include "wx/window.h"
25 #include "wx/gdicmn.h"
27 #include "wx/gtk1/private.h"
29 #include <gdk/gdkprivate.h>
31 #include <gtk/gtkdnd.h>
32 #include <gtk/gtkselection.h>
34 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
38 extern void wxapp_install_idle_handler();
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
48 //----------------------------------------------------------------------------
50 //----------------------------------------------------------------------------
52 extern bool g_blockEventsOnDrag
;
54 // the flags used for the last DoDragDrop()
55 static long gs_flagsForDrag
= 0;
57 // the trace mask we use with wxLogTrace() - call
58 // wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here
59 // (there are quite a few of them, so don't enable this by default)
60 static const wxChar
*TRACE_DND
= _T("dnd");
62 //----------------------------------------------------------------------------
64 //----------------------------------------------------------------------------
66 /* Copyright (c) Julian Smart */
67 static const char * page_xpm
[] = {
68 /* columns rows colors chars-per-pixel */
117 " 56477<<<<8<<9&:X ",
118 " 59642%&*=-;<09&:5 ",
119 " 5q9642%&*=-<<<<<# ",
120 " 5qqw777<<<<<88:>+ ",
121 " erqq9642%&*=t;::+ ",
122 " eyrqq9642%&*=t;:O ",
123 " eyywwww777<<<<t;O ",
124 " e0yyrqq9642%&*=to ",
125 " e00yyrqq9642%&*=o ",
126 " eu0wwwwwww777<&*X ",
127 " euu00yyrqq9642%&X ",
128 " eiuu00yyrqq9642%X ",
129 " eiiwwwwwwwwww742$ ",
130 " eiiiuu00yyrqq964$ ",
131 " eiiiiuu00yyrqq96$ ",
132 " eiiiiiuu00yyrqq95 ",
133 " eiiiiiiuu00yyrqq5 ",
134 " eeeeeeeeeeeeee55e ",
143 // ============================================================================
145 // ============================================================================
147 // ----------------------------------------------------------------------------
148 // convert between GTK+ and wxWidgets DND constants
149 // ----------------------------------------------------------------------------
151 static wxDragResult
ConvertFromGTK(long action
)
155 case GDK_ACTION_COPY
:
158 case GDK_ACTION_LINK
:
161 case GDK_ACTION_MOVE
:
168 // ----------------------------------------------------------------------------
170 // ----------------------------------------------------------------------------
173 static void target_drag_leave( GtkWidget
*WXUNUSED(widget
),
174 GdkDragContext
*context
,
175 guint
WXUNUSED(time
),
176 wxDropTarget
*drop_target
)
178 if (g_isIdle
) wxapp_install_idle_handler();
180 /* inform the wxDropTarget about the current GdkDragContext.
181 this is only valid for the duration of this call */
182 drop_target
->SetDragContext( context
);
184 /* we don't need return values. this event is just for
186 drop_target
->OnLeave();
188 /* this has to be done because GDK has no "drag_enter" event */
189 drop_target
->m_firstMotion
= true;
191 /* after this, invalidate the drop_target's GdkDragContext */
192 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
196 // ----------------------------------------------------------------------------
198 // ----------------------------------------------------------------------------
201 static gboolean
target_drag_motion( GtkWidget
*WXUNUSED(widget
),
202 GdkDragContext
*context
,
206 wxDropTarget
*drop_target
)
208 if (g_isIdle
) wxapp_install_idle_handler();
210 /* Owen Taylor: "if the coordinates not in a drop zone,
211 return FALSE, otherwise call gtk_drag_status() and
214 /* inform the wxDropTarget about the current GdkDragContext.
215 this is only valid for the duration of this call */
216 drop_target
->SetDragContext( context
);
218 // GTK+ always supposes that we want to copy the data by default while we
219 // might want to move it, so examine not only suggested_action - which is
220 // only good if we don't have our own preferences - but also the actions
223 if (drop_target
->GetDefaultAction() == wxDragNone
)
225 // use default action set by wxDropSource::DoDragDrop()
226 if ( (gs_flagsForDrag
& wxDrag_DefaultMove
) == wxDrag_DefaultMove
&&
227 (context
->actions
& GDK_ACTION_MOVE
) )
229 // move is requested by the program and allowed by GTK+ - do it, even
230 // though suggested_action may be currently wxDragCopy
233 else // use whatever GTK+ says we should
235 result
= ConvertFromGTK(context
->suggested_action
);
237 if ( (result
== wxDragMove
) && !(gs_flagsForDrag
& wxDrag_AllowMove
) )
239 // we're requested to move but we can't
244 else if (drop_target
->GetDefaultAction() == wxDragMove
&&
245 (context
->actions
& GDK_ACTION_MOVE
))
251 if (context
->actions
& GDK_ACTION_COPY
)
253 else if (context
->actions
& GDK_ACTION_MOVE
)
259 if (drop_target
->m_firstMotion
)
261 /* the first "drag_motion" event substitutes a "drag_enter" event */
262 result
= drop_target
->OnEnter( x
, y
, result
);
266 /* give program a chance to react (i.e. to say no by returning FALSE) */
267 result
= drop_target
->OnDragOver( x
, y
, result
);
270 bool ret
= wxIsDragResultOk( result
);
273 GdkDragAction action
;
274 if (result
== wxDragCopy
)
275 action
= GDK_ACTION_COPY
;
276 else if (result
== wxDragLink
)
277 action
= GDK_ACTION_LINK
;
279 action
= GDK_ACTION_MOVE
;
281 gdk_drag_status( context
, action
, time
);
284 /* after this, invalidate the drop_target's GdkDragContext */
285 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
287 /* this has to be done because GDK has no "drag_enter" event */
288 drop_target
->m_firstMotion
= false;
294 // ----------------------------------------------------------------------------
296 // ----------------------------------------------------------------------------
299 static gboolean
target_drag_drop( GtkWidget
*widget
,
300 GdkDragContext
*context
,
304 wxDropTarget
*drop_target
)
306 if (g_isIdle
) wxapp_install_idle_handler();
308 /* Owen Taylor: "if the drop is not in a drop zone,
309 return FALSE, otherwise, if you aren't accepting
310 the drop, call gtk_drag_finish() with success == FALSE
311 otherwise call gtk_drag_data_get()" */
313 // printf( "drop.\n" );
315 /* this seems to make a difference between not accepting
316 due to wrong target area and due to wrong format. let
317 us hope that this is not required.. */
319 /* inform the wxDropTarget about the current GdkDragContext.
320 this is only valid for the duration of this call */
321 drop_target
->SetDragContext( context
);
323 /* inform the wxDropTarget about the current drag widget.
324 this is only valid for the duration of this call */
325 drop_target
->SetDragWidget( widget
);
327 /* inform the wxDropTarget about the current drag time.
328 this is only valid for the duration of this call */
329 drop_target
->SetDragTime( time
);
332 wxDragResult result = wxDragMove;
333 if (context->suggested_action == GDK_ACTION_COPY) result = wxDragCopy;
336 /* reset the block here as someone might very well
337 show a dialog as a reaction to a drop and this
338 wouldn't work without events */
339 g_blockEventsOnDrag
= false;
341 bool ret
= drop_target
->OnDrop( x
, y
);
345 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned FALSE") );
347 /* cancel the whole thing */
348 gtk_drag_finish( context
,
349 FALSE
, /* no success */
350 FALSE
, /* don't delete data on dropping side */
355 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned TRUE") );
358 /* disable GUI threads */
361 GdkAtom format
= drop_target
->GetMatchingPair();
363 // this does happen somehow, see bug 555111
364 wxCHECK_MSG( format
, FALSE
, _T("no matching GdkAtom for format?") );
367 GdkDragAction action = GDK_ACTION_MOVE;
368 if (result == wxDragCopy) action == GDK_ACTION_COPY;
369 context->action = action;
371 /* this should trigger an "drag_data_received" event */
372 gtk_drag_get_data( widget
,
378 /* re-enable GUI threads */
382 /* after this, invalidate the drop_target's GdkDragContext */
383 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
385 /* after this, invalidate the drop_target's drag widget */
386 drop_target
->SetDragWidget( (GtkWidget
*) NULL
);
388 /* this has to be done because GDK has no "drag_enter" event */
389 drop_target
->m_firstMotion
= true;
395 // ----------------------------------------------------------------------------
396 // "drag_data_received"
397 // ----------------------------------------------------------------------------
400 static void target_drag_data_received( GtkWidget
*WXUNUSED(widget
),
401 GdkDragContext
*context
,
404 GtkSelectionData
*data
,
405 guint
WXUNUSED(info
),
407 wxDropTarget
*drop_target
)
409 if (g_isIdle
) wxapp_install_idle_handler();
411 /* Owen Taylor: "call gtk_drag_finish() with
414 if ((data
->length
<= 0) || (data
->format
!= 8))
416 /* negative data length and non 8-bit data format
417 qualifies for junk */
418 gtk_drag_finish (context
, FALSE
, FALSE
, time
);
423 wxLogTrace(TRACE_DND
, wxT( "Drop target: data received event") );
425 /* inform the wxDropTarget about the current GtkSelectionData.
426 this is only valid for the duration of this call */
427 drop_target
->SetDragData( data
);
429 wxDragResult result
= ConvertFromGTK(context
->action
);
431 if ( wxIsDragResultOk( drop_target
->OnData( x
, y
, result
) ) )
433 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned TRUE") );
435 /* tell GTK that data transfer was successful */
436 gtk_drag_finish( context
, TRUE
, FALSE
, time
);
440 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned FALSE") );
442 /* tell GTK that data transfer was not successful */
443 gtk_drag_finish( context
, FALSE
, FALSE
, time
);
446 /* after this, invalidate the drop_target's drag data */
447 drop_target
->SetDragData( (GtkSelectionData
*) NULL
);
451 //----------------------------------------------------------------------------
453 //----------------------------------------------------------------------------
455 wxDropTarget::wxDropTarget( wxDataObject
*data
)
456 : wxDropTargetBase( data
)
458 m_firstMotion
= true;
459 m_dragContext
= (GdkDragContext
*) NULL
;
460 m_dragWidget
= (GtkWidget
*) NULL
;
461 m_dragData
= (GtkSelectionData
*) NULL
;
465 wxDragResult
wxDropTarget::OnDragOver( wxCoord
WXUNUSED(x
),
469 // GetMatchingPair() checks for m_dataObject too, no need to do it here
471 // disable the debug message from GetMatchingPair() - there are too many
477 return (GetMatchingPair() != (GdkAtom
) 0) ? def
: wxDragNone
;
480 bool wxDropTarget::OnDrop( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
) )
485 return (GetMatchingPair() != (GdkAtom
) 0);
488 wxDragResult
wxDropTarget::OnData( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
494 if (GetMatchingPair() == (GdkAtom
) 0)
497 return GetData() ? def
: wxDragNone
;
500 GdkAtom
wxDropTarget::GetMatchingPair()
508 GList
*child
= m_dragContext
->targets
;
511 GdkAtom formatAtom
= GPOINTER_TO_INT(child
->data
);
512 wxDataFormat
format( formatAtom
);
515 wxLogTrace(TRACE_DND
, wxT("Drop target: drag has format: %s"),
516 format
.GetId().c_str());
519 if (m_dataObject
->IsSupportedFormat( format
))
528 bool wxDropTarget::GetData()
536 wxDataFormat
dragFormat( m_dragData
->target
);
538 if (!m_dataObject
->IsSupportedFormat( dragFormat
))
541 m_dataObject
->SetData( dragFormat
, (size_t)m_dragData
->length
, (const void*)m_dragData
->data
);
546 void wxDropTarget::UnregisterWidget( GtkWidget
*widget
)
548 wxCHECK_RET( widget
!= NULL
, wxT("unregister widget is NULL") );
550 gtk_drag_dest_unset( widget
);
552 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
553 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
555 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
556 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
558 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
559 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
561 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
562 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
565 void wxDropTarget::RegisterWidget( GtkWidget
*widget
)
567 wxCHECK_RET( widget
!= NULL
, wxT("register widget is NULL") );
569 /* gtk_drag_dest_set() determines what default behaviour we'd like
570 GTK to supply. we don't want to specify out targets (=formats)
571 or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
572 not GTK_DEST_DEFAULT_DROP). instead we react individually to
573 "drag_motion" and "drag_drop" events. this makes it possible
574 to allow dropping on only a small area. we should set
575 GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
576 highlighting if dragging over standard controls, but this
577 seems to be broken without the other two. */
579 gtk_drag_dest_set( widget
,
580 (GtkDestDefaults
) 0, /* no default behaviour */
581 (GtkTargetEntry
*) NULL
, /* we don't supply any formats here */
582 0, /* number of targets = 0 */
583 (GdkDragAction
) 0 ); /* we don't supply any actions here */
585 gtk_signal_connect( GTK_OBJECT(widget
), "drag_leave",
586 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
588 gtk_signal_connect( GTK_OBJECT(widget
), "drag_motion",
589 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
591 gtk_signal_connect( GTK_OBJECT(widget
), "drag_drop",
592 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
594 gtk_signal_connect( GTK_OBJECT(widget
), "drag_data_received",
595 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
598 //----------------------------------------------------------------------------
600 //----------------------------------------------------------------------------
604 source_drag_data_get (GtkWidget
*WXUNUSED(widget
),
605 GdkDragContext
*WXUNUSED(context
),
606 GtkSelectionData
*selection_data
,
607 guint
WXUNUSED(info
),
608 guint
WXUNUSED(time
),
609 wxDropSource
*drop_source
)
611 if (g_isIdle
) wxapp_install_idle_handler();
613 wxDataFormat
format( selection_data
->target
);
615 wxLogTrace(TRACE_DND
, wxT("Drop source: format requested: %s"),
616 format
.GetId().c_str());
618 drop_source
->m_retValue
= wxDragCancel
;
620 wxDataObject
*data
= drop_source
->GetDataObject();
624 wxLogTrace(TRACE_DND
, wxT("Drop source: no data object") );
628 if (!data
->IsSupportedFormat(format
))
630 wxLogTrace(TRACE_DND
, wxT("Drop source: unsupported format") );
634 if (data
->GetDataSize(format
) == 0)
636 wxLogTrace(TRACE_DND
, wxT("Drop source: empty data") );
640 size_t size
= data
->GetDataSize(format
);
642 // printf( "data size: %d.\n", (int)data_size );
644 guchar
*d
= new guchar
[size
];
646 if (!data
->GetDataHere( format
, (void*)d
))
653 /* disable GUI threads */
656 gtk_selection_data_set( selection_data
,
657 selection_data
->target
,
663 /* enable GUI threads */
670 //----------------------------------------------------------------------------
671 // "drag_data_delete"
672 //----------------------------------------------------------------------------
675 static void source_drag_data_delete( GtkWidget
*WXUNUSED(widget
),
676 GdkDragContext
*context
,
677 wxDropSource
*WXUNUSED(drop_source
) )
680 wxapp_install_idle_handler();
682 // printf( "Drag source: drag_data_delete\n" );
686 //----------------------------------------------------------------------------
688 //----------------------------------------------------------------------------
691 static void source_drag_begin( GtkWidget
*WXUNUSED(widget
),
692 GdkDragContext
*WXUNUSED(context
),
693 wxDropSource
*WXUNUSED(drop_source
) )
696 wxapp_install_idle_handler();
698 // printf( "Drag source: drag_begin.\n" );
702 //----------------------------------------------------------------------------
704 //----------------------------------------------------------------------------
707 static void source_drag_end( GtkWidget
*WXUNUSED(widget
),
708 GdkDragContext
*WXUNUSED(context
),
709 wxDropSource
*drop_source
)
711 if (g_isIdle
) wxapp_install_idle_handler();
713 // printf( "Drag source: drag_end.\n" );
715 drop_source
->m_waiting
= false;
719 //-----------------------------------------------------------------------------
720 // "configure_event" from m_iconWindow
721 //-----------------------------------------------------------------------------
725 gtk_dnd_window_configure_callback( GtkWidget
*WXUNUSED(widget
), GdkEventConfigure
*WXUNUSED(event
), wxDropSource
*source
)
728 wxapp_install_idle_handler();
730 source
->GiveFeedback( ConvertFromGTK(source
->m_dragContext
->action
) );
736 //---------------------------------------------------------------------------
738 //---------------------------------------------------------------------------
740 wxDropSource::wxDropSource(wxWindow
*win
,
741 const wxIcon
&iconCopy
,
742 const wxIcon
&iconMove
,
743 const wxIcon
&iconNone
)
747 m_iconWindow
= (GtkWidget
*) NULL
;
750 m_widget
= win
->m_widget
;
751 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
753 m_retValue
= wxDragCancel
;
755 SetIcons(iconCopy
, iconMove
, iconNone
);
758 wxDropSource::wxDropSource(wxDataObject
& data
,
760 const wxIcon
&iconCopy
,
761 const wxIcon
&iconMove
,
762 const wxIcon
&iconNone
)
768 m_iconWindow
= (GtkWidget
*) NULL
;
771 m_widget
= win
->m_widget
;
772 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
774 m_retValue
= wxDragCancel
;
776 SetIcons(iconCopy
, iconMove
, iconNone
);
779 void wxDropSource::SetIcons(const wxIcon
&iconCopy
,
780 const wxIcon
&iconMove
,
781 const wxIcon
&iconNone
)
783 m_iconCopy
= iconCopy
;
784 m_iconMove
= iconMove
;
785 m_iconNone
= iconNone
;
787 if ( !m_iconCopy
.Ok() )
788 m_iconCopy
= wxIcon(page_xpm
);
789 if ( !m_iconMove
.Ok() )
790 m_iconMove
= m_iconCopy
;
791 if ( !m_iconNone
.Ok() )
792 m_iconNone
= m_iconCopy
;
795 wxDropSource::~wxDropSource()
799 void wxDropSource::PrepareIcon( int action
, GdkDragContext
*context
)
801 // get the right icon to display
803 if ( action
& GDK_ACTION_MOVE
)
805 else if ( action
& GDK_ACTION_COPY
)
811 if ( icon
->GetMask() )
812 mask
= icon
->GetMask()->GetBitmap();
814 mask
= (GdkBitmap
*)NULL
;
816 GdkPixmap
*pixmap
= icon
->GetPixmap();
819 gdk_window_get_size (pixmap
, &width
, &height
);
821 GdkColormap
*colormap
= gtk_widget_get_colormap( m_widget
);
822 gtk_widget_push_visual (gdk_colormap_get_visual (colormap
));
823 gtk_widget_push_colormap (colormap
);
825 m_iconWindow
= gtk_window_new (GTK_WINDOW_POPUP
);
826 gtk_widget_set_events (m_iconWindow
, GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
);
827 gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow
), TRUE
);
829 gtk_widget_pop_visual ();
830 gtk_widget_pop_colormap ();
832 gtk_widget_set_usize (m_iconWindow
, width
, height
);
833 gtk_widget_realize (m_iconWindow
);
835 gtk_signal_connect( GTK_OBJECT(m_iconWindow
), "configure_event",
836 GTK_SIGNAL_FUNC(gtk_dnd_window_configure_callback
), (gpointer
)this );
838 gdk_window_set_back_pixmap (m_iconWindow
->window
, pixmap
, FALSE
);
841 gtk_widget_shape_combine_mask (m_iconWindow
, mask
, 0, 0);
843 gtk_drag_set_icon_widget( context
, m_iconWindow
, 0, 0 );
846 wxDragResult
wxDropSource::DoDragDrop(int flags
)
848 wxCHECK_MSG( m_data
&& m_data
->GetFormatCount(), wxDragNone
,
849 wxT("Drop source: no data") );
852 if (g_blockEventsOnDrag
)
856 g_blockEventsOnDrag
= true;
862 GtkTargetList
*target_list
= gtk_target_list_new( (GtkTargetEntry
*) NULL
, 0 );
864 wxDataFormat
*array
= new wxDataFormat
[ m_data
->GetFormatCount() ];
865 m_data
->GetAllFormats( array
);
866 size_t count
= m_data
->GetFormatCount();
867 for (size_t i
= 0; i
< count
; i
++)
869 GdkAtom atom
= array
[i
];
870 wxLogTrace(TRACE_DND
, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom
));
871 gtk_target_list_add( target_list
, atom
, 0, 0 );
875 GdkEventMotion event
;
876 event
.window
= m_widget
->window
;
879 GdkModifierType state
;
880 gdk_window_get_pointer( event
.window
, &x
, &y
, &state
);
884 event
.time
= (guint32
)GDK_CURRENT_TIME
;
886 /* GTK wants to know which button was pressed which caused the dragging */
887 int button_number
= 0;
888 if (event
.state
& GDK_BUTTON1_MASK
) button_number
= 1;
889 else if (event
.state
& GDK_BUTTON2_MASK
) button_number
= 2;
890 else if (event
.state
& GDK_BUTTON3_MASK
) button_number
= 3;
893 /* disable GUI threads */
896 /* don't start dragging if no button is down */
899 int action
= GDK_ACTION_COPY
;
900 if ( flags
& wxDrag_AllowMove
)
901 action
|= GDK_ACTION_MOVE
;
903 // VZ: as we already use g_blockEventsOnDrag it shouldn't be that bad
904 // to use a global to pass the flags to the drop target but I'd
905 // surely prefer a better way to do it
906 gs_flagsForDrag
= flags
;
908 GdkDragContext
*context
= gtk_drag_begin( m_widget
,
910 (GdkDragAction
)action
,
911 button_number
, /* number of mouse button which started drag */
912 (GdkEvent
*) &event
);
914 m_dragContext
= context
;
916 PrepareIcon( action
, context
);
919 gtk_main_iteration();
921 m_retValue
= ConvertFromGTK(context
->action
);
922 if ( m_retValue
== wxDragNone
)
923 m_retValue
= wxDragCancel
;
927 /* re-enable GUI threads */
930 g_blockEventsOnDrag
= false;
937 void wxDropSource::RegisterWindow()
939 if (!m_widget
) return;
941 gtk_signal_connect( GTK_OBJECT(m_widget
), "drag_data_get",
942 GTK_SIGNAL_FUNC (source_drag_data_get
), (gpointer
) this);
943 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_data_delete",
944 GTK_SIGNAL_FUNC (source_drag_data_delete
), (gpointer
) this );
945 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_begin",
946 GTK_SIGNAL_FUNC (source_drag_begin
), (gpointer
) this );
947 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_end",
948 GTK_SIGNAL_FUNC (source_drag_end
), (gpointer
) this );
952 void wxDropSource::UnregisterWindow()
954 if (!m_widget
) return;
956 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
957 GTK_SIGNAL_FUNC(source_drag_data_get
), (gpointer
) this );
958 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
959 GTK_SIGNAL_FUNC(source_drag_data_delete
), (gpointer
) this );
960 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
961 GTK_SIGNAL_FUNC(source_drag_begin
), (gpointer
) this );
962 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
963 GTK_SIGNAL_FUNC(source_drag_end
), (gpointer
) this );
967 // wxUSE_DRAG_AND_DROP