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"
23 #include "wx/gdicmn.h"
26 #include "wx/gtk1/private.h"
28 #include <gdk/gdkprivate.h>
30 #include <gtk/gtkdnd.h>
31 #include <gtk/gtkselection.h>
33 //-----------------------------------------------------------------------------
35 //-----------------------------------------------------------------------------
37 extern void wxapp_install_idle_handler();
40 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
47 //----------------------------------------------------------------------------
49 //----------------------------------------------------------------------------
51 extern bool g_blockEventsOnDrag
;
53 // the flags used for the last DoDragDrop()
54 static long gs_flagsForDrag
= 0;
56 // the trace mask we use with wxLogTrace() - call
57 // wxLog::AddTraceMask(TRACE_DND) to enable the trace messages from here
58 // (there are quite a few of them, so don't enable this by default)
59 static const wxChar
*TRACE_DND
= _T("dnd");
61 //----------------------------------------------------------------------------
63 //----------------------------------------------------------------------------
65 /* Copyright (c) Julian Smart */
66 static const char * page_xpm
[] = {
67 /* columns rows colors chars-per-pixel */
116 " 56477<<<<8<<9&:X ",
117 " 59642%&*=-;<09&:5 ",
118 " 5q9642%&*=-<<<<<# ",
119 " 5qqw777<<<<<88:>+ ",
120 " erqq9642%&*=t;::+ ",
121 " eyrqq9642%&*=t;:O ",
122 " eyywwww777<<<<t;O ",
123 " e0yyrqq9642%&*=to ",
124 " e00yyrqq9642%&*=o ",
125 " eu0wwwwwww777<&*X ",
126 " euu00yyrqq9642%&X ",
127 " eiuu00yyrqq9642%X ",
128 " eiiwwwwwwwwww742$ ",
129 " eiiiuu00yyrqq964$ ",
130 " eiiiiuu00yyrqq96$ ",
131 " eiiiiiuu00yyrqq95 ",
132 " eiiiiiiuu00yyrqq5 ",
133 " eeeeeeeeeeeeee55e ",
142 // ============================================================================
144 // ============================================================================
146 // ----------------------------------------------------------------------------
147 // convert between GTK+ and wxWidgets DND constants
148 // ----------------------------------------------------------------------------
150 static wxDragResult
ConvertFromGTK(long action
)
154 case GDK_ACTION_COPY
:
157 case GDK_ACTION_LINK
:
160 case GDK_ACTION_MOVE
:
167 // ----------------------------------------------------------------------------
169 // ----------------------------------------------------------------------------
172 static void target_drag_leave( GtkWidget
*WXUNUSED(widget
),
173 GdkDragContext
*context
,
174 guint
WXUNUSED(time
),
175 wxDropTarget
*drop_target
)
177 if (g_isIdle
) wxapp_install_idle_handler();
179 /* inform the wxDropTarget about the current GdkDragContext.
180 this is only valid for the duration of this call */
181 drop_target
->SetDragContext( context
);
183 /* we don't need return values. this event is just for
185 drop_target
->OnLeave();
187 /* this has to be done because GDK has no "drag_enter" event */
188 drop_target
->m_firstMotion
= true;
190 /* after this, invalidate the drop_target's GdkDragContext */
191 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
195 // ----------------------------------------------------------------------------
197 // ----------------------------------------------------------------------------
200 static gboolean
target_drag_motion( GtkWidget
*WXUNUSED(widget
),
201 GdkDragContext
*context
,
205 wxDropTarget
*drop_target
)
207 if (g_isIdle
) wxapp_install_idle_handler();
209 /* Owen Taylor: "if the coordinates not in a drop zone,
210 return FALSE, otherwise call gtk_drag_status() and
213 /* inform the wxDropTarget about the current GdkDragContext.
214 this is only valid for the duration of this call */
215 drop_target
->SetDragContext( context
);
217 // GTK+ always supposes that we want to copy the data by default while we
218 // might want to move it, so examine not only suggested_action - which is
219 // only good if we don't have our own preferences - but also the actions
222 if (drop_target
->GetDefaultAction() == wxDragNone
)
224 // use default action set by wxDropSource::DoDragDrop()
225 if ( (gs_flagsForDrag
& wxDrag_DefaultMove
) == wxDrag_DefaultMove
&&
226 (context
->actions
& GDK_ACTION_MOVE
) )
228 // move is requested by the program and allowed by GTK+ - do it, even
229 // though suggested_action may be currently wxDragCopy
232 else // use whatever GTK+ says we should
234 result
= ConvertFromGTK(context
->suggested_action
);
236 if ( (result
== wxDragMove
) && !(gs_flagsForDrag
& wxDrag_AllowMove
) )
238 // we're requested to move but we can't
243 else if (drop_target
->GetDefaultAction() == wxDragMove
&&
244 (context
->actions
& GDK_ACTION_MOVE
))
250 if (context
->actions
& GDK_ACTION_COPY
)
252 else if (context
->actions
& GDK_ACTION_MOVE
)
258 if (drop_target
->m_firstMotion
)
260 /* the first "drag_motion" event substitutes a "drag_enter" event */
261 result
= drop_target
->OnEnter( x
, y
, result
);
265 /* give program a chance to react (i.e. to say no by returning FALSE) */
266 result
= drop_target
->OnDragOver( x
, y
, result
);
269 bool ret
= wxIsDragResultOk( result
);
272 GdkDragAction action
;
273 if (result
== wxDragCopy
)
274 action
= GDK_ACTION_COPY
;
275 else if (result
== wxDragLink
)
276 action
= GDK_ACTION_LINK
;
278 action
= GDK_ACTION_MOVE
;
280 gdk_drag_status( context
, action
, time
);
283 /* after this, invalidate the drop_target's GdkDragContext */
284 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
286 /* this has to be done because GDK has no "drag_enter" event */
287 drop_target
->m_firstMotion
= false;
293 // ----------------------------------------------------------------------------
295 // ----------------------------------------------------------------------------
298 static gboolean
target_drag_drop( GtkWidget
*widget
,
299 GdkDragContext
*context
,
303 wxDropTarget
*drop_target
)
305 if (g_isIdle
) wxapp_install_idle_handler();
307 /* Owen Taylor: "if the drop is not in a drop zone,
308 return FALSE, otherwise, if you aren't accepting
309 the drop, call gtk_drag_finish() with success == FALSE
310 otherwise call gtk_drag_data_get()" */
312 // printf( "drop.\n" );
314 /* this seems to make a difference between not accepting
315 due to wrong target area and due to wrong format. let
316 us hope that this is not required.. */
318 /* inform the wxDropTarget about the current GdkDragContext.
319 this is only valid for the duration of this call */
320 drop_target
->SetDragContext( context
);
322 /* inform the wxDropTarget about the current drag widget.
323 this is only valid for the duration of this call */
324 drop_target
->SetDragWidget( widget
);
326 /* inform the wxDropTarget about the current drag time.
327 this is only valid for the duration of this call */
328 drop_target
->SetDragTime( time
);
331 wxDragResult result = wxDragMove;
332 if (context->suggested_action == GDK_ACTION_COPY) result = wxDragCopy;
335 /* reset the block here as someone might very well
336 show a dialog as a reaction to a drop and this
337 wouldn't work without events */
338 g_blockEventsOnDrag
= false;
340 bool ret
= drop_target
->OnDrop( x
, y
);
344 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned FALSE") );
346 /* cancel the whole thing */
347 gtk_drag_finish( context
,
348 FALSE
, /* no success */
349 FALSE
, /* don't delete data on dropping side */
354 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnDrop returned TRUE") );
357 /* disable GUI threads */
360 GdkAtom format
= drop_target
->GetMatchingPair();
362 // this does happen somehow, see bug 555111
363 wxCHECK_MSG( format
, FALSE
, _T("no matching GdkAtom for format?") );
366 GdkDragAction action = GDK_ACTION_MOVE;
367 if (result == wxDragCopy) action == GDK_ACTION_COPY;
368 context->action = action;
370 /* this should trigger an "drag_data_received" event */
371 gtk_drag_get_data( widget
,
377 /* re-enable GUI threads */
381 /* after this, invalidate the drop_target's GdkDragContext */
382 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
384 /* after this, invalidate the drop_target's drag widget */
385 drop_target
->SetDragWidget( (GtkWidget
*) NULL
);
387 /* this has to be done because GDK has no "drag_enter" event */
388 drop_target
->m_firstMotion
= true;
394 // ----------------------------------------------------------------------------
395 // "drag_data_received"
396 // ----------------------------------------------------------------------------
399 static void target_drag_data_received( GtkWidget
*WXUNUSED(widget
),
400 GdkDragContext
*context
,
403 GtkSelectionData
*data
,
404 guint
WXUNUSED(info
),
406 wxDropTarget
*drop_target
)
408 if (g_isIdle
) wxapp_install_idle_handler();
410 /* Owen Taylor: "call gtk_drag_finish() with
413 if ((data
->length
<= 0) || (data
->format
!= 8))
415 /* negative data length and non 8-bit data format
416 qualifies for junk */
417 gtk_drag_finish (context
, FALSE
, FALSE
, time
);
422 wxLogTrace(TRACE_DND
, wxT( "Drop target: data received event") );
424 /* inform the wxDropTarget about the current GtkSelectionData.
425 this is only valid for the duration of this call */
426 drop_target
->SetDragData( data
);
428 wxDragResult result
= ConvertFromGTK(context
->action
);
430 if ( wxIsDragResultOk( drop_target
->OnData( x
, y
, result
) ) )
432 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned TRUE") );
434 /* tell GTK that data transfer was successful */
435 gtk_drag_finish( context
, TRUE
, FALSE
, time
);
439 wxLogTrace(TRACE_DND
, wxT( "Drop target: OnData returned FALSE") );
441 /* tell GTK that data transfer was not successful */
442 gtk_drag_finish( context
, FALSE
, FALSE
, time
);
445 /* after this, invalidate the drop_target's drag data */
446 drop_target
->SetDragData( (GtkSelectionData
*) NULL
);
450 //----------------------------------------------------------------------------
452 //----------------------------------------------------------------------------
454 wxDropTarget::wxDropTarget( wxDataObject
*data
)
455 : wxDropTargetBase( data
)
457 m_firstMotion
= true;
458 m_dragContext
= (GdkDragContext
*) NULL
;
459 m_dragWidget
= (GtkWidget
*) NULL
;
460 m_dragData
= (GtkSelectionData
*) NULL
;
464 wxDragResult
wxDropTarget::OnDragOver( wxCoord
WXUNUSED(x
),
468 // GetMatchingPair() checks for m_dataObject too, no need to do it here
470 // disable the debug message from GetMatchingPair() - there are too many
476 return (GetMatchingPair() != (GdkAtom
) 0) ? def
: wxDragNone
;
479 bool wxDropTarget::OnDrop( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
) )
484 return (GetMatchingPair() != (GdkAtom
) 0);
487 wxDragResult
wxDropTarget::OnData( wxCoord
WXUNUSED(x
), wxCoord
WXUNUSED(y
),
493 if (GetMatchingPair() == (GdkAtom
) 0)
496 return GetData() ? def
: wxDragNone
;
499 GdkAtom
wxDropTarget::GetMatchingPair()
507 GList
*child
= m_dragContext
->targets
;
510 GdkAtom formatAtom
= GPOINTER_TO_INT(child
->data
);
511 wxDataFormat
format( formatAtom
);
514 wxLogTrace(TRACE_DND
, wxT("Drop target: drag has format: %s"),
515 format
.GetId().c_str());
518 if (m_dataObject
->IsSupportedFormat( format
))
527 bool wxDropTarget::GetData()
535 wxDataFormat
dragFormat( m_dragData
->target
);
537 if (!m_dataObject
->IsSupportedFormat( dragFormat
))
540 m_dataObject
->SetData( dragFormat
, (size_t)m_dragData
->length
, (const void*)m_dragData
->data
);
545 void wxDropTarget::UnregisterWidget( GtkWidget
*widget
)
547 wxCHECK_RET( widget
!= NULL
, wxT("unregister widget is NULL") );
549 gtk_drag_dest_unset( widget
);
551 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
552 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
554 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
555 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
557 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
558 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
560 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
561 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
564 void wxDropTarget::RegisterWidget( GtkWidget
*widget
)
566 wxCHECK_RET( widget
!= NULL
, wxT("register widget is NULL") );
568 /* gtk_drag_dest_set() determines what default behaviour we'd like
569 GTK to supply. we don't want to specify out targets (=formats)
570 or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
571 not GTK_DEST_DEFAULT_DROP). instead we react individually to
572 "drag_motion" and "drag_drop" events. this makes it possible
573 to allow dropping on only a small area. we should set
574 GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
575 highlighting if dragging over standard controls, but this
576 seems to be broken without the other two. */
578 gtk_drag_dest_set( widget
,
579 (GtkDestDefaults
) 0, /* no default behaviour */
580 (GtkTargetEntry
*) NULL
, /* we don't supply any formats here */
581 0, /* number of targets = 0 */
582 (GdkDragAction
) 0 ); /* we don't supply any actions here */
584 gtk_signal_connect( GTK_OBJECT(widget
), "drag_leave",
585 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
587 gtk_signal_connect( GTK_OBJECT(widget
), "drag_motion",
588 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
590 gtk_signal_connect( GTK_OBJECT(widget
), "drag_drop",
591 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
593 gtk_signal_connect( GTK_OBJECT(widget
), "drag_data_received",
594 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
597 //----------------------------------------------------------------------------
599 //----------------------------------------------------------------------------
603 source_drag_data_get (GtkWidget
*WXUNUSED(widget
),
604 GdkDragContext
*WXUNUSED(context
),
605 GtkSelectionData
*selection_data
,
606 guint
WXUNUSED(info
),
607 guint
WXUNUSED(time
),
608 wxDropSource
*drop_source
)
610 if (g_isIdle
) wxapp_install_idle_handler();
612 wxDataFormat
format( selection_data
->target
);
614 wxLogTrace(TRACE_DND
, wxT("Drop source: format requested: %s"),
615 format
.GetId().c_str());
617 drop_source
->m_retValue
= wxDragCancel
;
619 wxDataObject
*data
= drop_source
->GetDataObject();
623 wxLogTrace(TRACE_DND
, wxT("Drop source: no data object") );
627 if (!data
->IsSupportedFormat(format
))
629 wxLogTrace(TRACE_DND
, wxT("Drop source: unsupported format") );
633 if (data
->GetDataSize(format
) == 0)
635 wxLogTrace(TRACE_DND
, wxT("Drop source: empty data") );
639 size_t size
= data
->GetDataSize(format
);
641 // printf( "data size: %d.\n", (int)data_size );
643 guchar
*d
= new guchar
[size
];
645 if (!data
->GetDataHere( format
, (void*)d
))
652 /* disable GUI threads */
655 gtk_selection_data_set( selection_data
,
656 selection_data
->target
,
662 /* enable GUI threads */
669 //----------------------------------------------------------------------------
670 // "drag_data_delete"
671 //----------------------------------------------------------------------------
674 static void source_drag_data_delete( GtkWidget
*WXUNUSED(widget
),
675 GdkDragContext
*context
,
676 wxDropSource
*WXUNUSED(drop_source
) )
679 wxapp_install_idle_handler();
681 // printf( "Drag source: drag_data_delete\n" );
685 //----------------------------------------------------------------------------
687 //----------------------------------------------------------------------------
690 static void source_drag_begin( GtkWidget
*WXUNUSED(widget
),
691 GdkDragContext
*WXUNUSED(context
),
692 wxDropSource
*WXUNUSED(drop_source
) )
695 wxapp_install_idle_handler();
697 // printf( "Drag source: drag_begin.\n" );
701 //----------------------------------------------------------------------------
703 //----------------------------------------------------------------------------
706 static void source_drag_end( GtkWidget
*WXUNUSED(widget
),
707 GdkDragContext
*WXUNUSED(context
),
708 wxDropSource
*drop_source
)
710 if (g_isIdle
) wxapp_install_idle_handler();
712 // printf( "Drag source: drag_end.\n" );
714 drop_source
->m_waiting
= false;
718 //-----------------------------------------------------------------------------
719 // "configure_event" from m_iconWindow
720 //-----------------------------------------------------------------------------
724 gtk_dnd_window_configure_callback( GtkWidget
*WXUNUSED(widget
), GdkEventConfigure
*WXUNUSED(event
), wxDropSource
*source
)
727 wxapp_install_idle_handler();
729 source
->GiveFeedback( ConvertFromGTK(source
->m_dragContext
->action
) );
735 //---------------------------------------------------------------------------
737 //---------------------------------------------------------------------------
739 wxDropSource::wxDropSource(wxWindow
*win
,
740 const wxIcon
&iconCopy
,
741 const wxIcon
&iconMove
,
742 const wxIcon
&iconNone
)
746 m_iconWindow
= (GtkWidget
*) NULL
;
749 m_widget
= win
->m_widget
;
750 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
752 m_retValue
= wxDragCancel
;
754 SetIcons(iconCopy
, iconMove
, iconNone
);
757 wxDropSource::wxDropSource(wxDataObject
& data
,
759 const wxIcon
&iconCopy
,
760 const wxIcon
&iconMove
,
761 const wxIcon
&iconNone
)
767 m_iconWindow
= (GtkWidget
*) NULL
;
770 m_widget
= win
->m_widget
;
771 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
773 m_retValue
= wxDragCancel
;
775 SetIcons(iconCopy
, iconMove
, iconNone
);
778 void wxDropSource::SetIcons(const wxIcon
&iconCopy
,
779 const wxIcon
&iconMove
,
780 const wxIcon
&iconNone
)
782 m_iconCopy
= iconCopy
;
783 m_iconMove
= iconMove
;
784 m_iconNone
= iconNone
;
786 if ( !m_iconCopy
.Ok() )
787 m_iconCopy
= wxIcon(page_xpm
);
788 if ( !m_iconMove
.Ok() )
789 m_iconMove
= m_iconCopy
;
790 if ( !m_iconNone
.Ok() )
791 m_iconNone
= m_iconCopy
;
794 wxDropSource::~wxDropSource()
798 void wxDropSource::PrepareIcon( int action
, GdkDragContext
*context
)
800 // get the right icon to display
802 if ( action
& GDK_ACTION_MOVE
)
804 else if ( action
& GDK_ACTION_COPY
)
810 if ( icon
->GetMask() )
811 mask
= icon
->GetMask()->GetBitmap();
813 mask
= (GdkBitmap
*)NULL
;
815 GdkPixmap
*pixmap
= icon
->GetPixmap();
818 gdk_window_get_size (pixmap
, &width
, &height
);
820 GdkColormap
*colormap
= gtk_widget_get_colormap( m_widget
);
821 gtk_widget_push_visual (gdk_colormap_get_visual (colormap
));
822 gtk_widget_push_colormap (colormap
);
824 m_iconWindow
= gtk_window_new (GTK_WINDOW_POPUP
);
825 gtk_widget_set_events (m_iconWindow
, GDK_BUTTON_PRESS_MASK
| GDK_BUTTON_RELEASE_MASK
);
826 gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow
), TRUE
);
828 gtk_widget_pop_visual ();
829 gtk_widget_pop_colormap ();
831 gtk_widget_set_usize (m_iconWindow
, width
, height
);
832 gtk_widget_realize (m_iconWindow
);
834 gtk_signal_connect( GTK_OBJECT(m_iconWindow
), "configure_event",
835 GTK_SIGNAL_FUNC(gtk_dnd_window_configure_callback
), (gpointer
)this );
837 gdk_window_set_back_pixmap (m_iconWindow
->window
, pixmap
, FALSE
);
840 gtk_widget_shape_combine_mask (m_iconWindow
, mask
, 0, 0);
842 gtk_drag_set_icon_widget( context
, m_iconWindow
, 0, 0 );
845 wxDragResult
wxDropSource::DoDragDrop(int flags
)
847 wxCHECK_MSG( m_data
&& m_data
->GetFormatCount(), wxDragNone
,
848 wxT("Drop source: no data") );
851 if (g_blockEventsOnDrag
)
855 g_blockEventsOnDrag
= true;
861 GtkTargetList
*target_list
= gtk_target_list_new( (GtkTargetEntry
*) NULL
, 0 );
863 wxDataFormat
*array
= new wxDataFormat
[ m_data
->GetFormatCount() ];
864 m_data
->GetAllFormats( array
);
865 size_t count
= m_data
->GetFormatCount();
866 for (size_t i
= 0; i
< count
; i
++)
868 GdkAtom atom
= array
[i
];
869 wxLogTrace(TRACE_DND
, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom
));
870 gtk_target_list_add( target_list
, atom
, 0, 0 );
874 GdkEventMotion event
;
875 event
.window
= m_widget
->window
;
878 GdkModifierType state
;
879 gdk_window_get_pointer( event
.window
, &x
, &y
, &state
);
883 event
.time
= (guint32
)GDK_CURRENT_TIME
;
885 /* GTK wants to know which button was pressed which caused the dragging */
886 int button_number
= 0;
887 if (event
.state
& GDK_BUTTON1_MASK
) button_number
= 1;
888 else if (event
.state
& GDK_BUTTON2_MASK
) button_number
= 2;
889 else if (event
.state
& GDK_BUTTON3_MASK
) button_number
= 3;
892 /* disable GUI threads */
895 /* don't start dragging if no button is down */
898 int action
= GDK_ACTION_COPY
;
899 if ( flags
& wxDrag_AllowMove
)
900 action
|= GDK_ACTION_MOVE
;
902 // VZ: as we already use g_blockEventsOnDrag it shouldn't be that bad
903 // to use a global to pass the flags to the drop target but I'd
904 // surely prefer a better way to do it
905 gs_flagsForDrag
= flags
;
907 GdkDragContext
*context
= gtk_drag_begin( m_widget
,
909 (GdkDragAction
)action
,
910 button_number
, /* number of mouse button which started drag */
911 (GdkEvent
*) &event
);
913 m_dragContext
= context
;
915 PrepareIcon( action
, context
);
918 gtk_main_iteration();
920 m_retValue
= ConvertFromGTK(context
->action
);
921 if ( m_retValue
== wxDragNone
)
922 m_retValue
= wxDragCancel
;
926 /* re-enable GUI threads */
929 g_blockEventsOnDrag
= false;
936 void wxDropSource::RegisterWindow()
938 if (!m_widget
) return;
940 gtk_signal_connect( GTK_OBJECT(m_widget
), "drag_data_get",
941 GTK_SIGNAL_FUNC (source_drag_data_get
), (gpointer
) this);
942 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_data_delete",
943 GTK_SIGNAL_FUNC (source_drag_data_delete
), (gpointer
) this );
944 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_begin",
945 GTK_SIGNAL_FUNC (source_drag_begin
), (gpointer
) this );
946 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_end",
947 GTK_SIGNAL_FUNC (source_drag_end
), (gpointer
) this );
951 void wxDropSource::UnregisterWindow()
953 if (!m_widget
) return;
955 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
956 GTK_SIGNAL_FUNC(source_drag_data_get
), (gpointer
) this );
957 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
958 GTK_SIGNAL_FUNC(source_drag_data_delete
), (gpointer
) this );
959 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
960 GTK_SIGNAL_FUNC(source_drag_begin
), (gpointer
) this );
961 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
962 GTK_SIGNAL_FUNC(source_drag_end
), (gpointer
) this );
966 // wxUSE_DRAG_AND_DROP