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 bool g_blockEventsOnDrag
;
37 //----------------------------------------------------------------------------
39 //----------------------------------------------------------------------------
42 static char * gv_xpm
[] = {
56 " ....XX....XX....XX. ",
57 " .XXX.XXX..XXXX..XXX.... ",
58 " .XXXXXXXXXXXXXXXXXXX.XXX. ",
59 " .XXXXXXXXXXXXXXXXXXXXXXXX. ",
60 " .XXXXXXXXXXXXXXXXXXXXXXXX. ",
61 " ..XXXXXXXXXXXXXXXXXXXXXX. ",
62 " .XXXXXXXXXXXXXXXXXX... ",
63 " ..XXXXXXXXXXXXXXXX. ",
64 " .XXXXXXXXXXXXXXXX. ",
65 " .XXXXXXXXXXXXXXXX. ",
66 " .XXXXXXXXXXXXXXXXX. ",
67 " .XXXXXXXXXXXXXXXXX. ",
68 " .XXXXXXXXXXXXXXXXXX. ",
69 " .XXXXXXXXXXXXXXXXXXX. ",
70 " .XXXXXXXXXXXXXXXXXXXXX. ",
71 " .XXXXXXXXXXXXXX.XXXXXXX. ",
72 " .XXXXXXX.XXXXXXX.XXXXXXX. ",
73 " .XXXXXXXX.XXXXXXX.XXXXXXX. ",
74 " .XXXXXXX...XXXXX...XXXXX. ",
75 " .XXXXXXX. ..... ..... ",
83 static char * page_xpm
[] = {
84 /* width height ncolors chars_per_pixel */
93 " ................... ",
94 " .XXXXXXXXXXXXXXXXX.. ",
95 " .XXXXXXXXXXXXXXXXX.o. ",
96 " .XXXXXXXXXXXXXXXXX.oo. ",
97 " .XXXXXXXXXXXXXXXXX.ooo. ",
98 " .XXXXXXXXXXXXXXXXX.oooo. ",
99 " .XXXXXXXXXXXXXXXXX....... ",
100 " .XXXXXOOOOOOOOOOXXXooooo. ",
101 " .XXXXXXXXXXXXXXXXXXooooo. ",
102 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
103 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
104 " .XXXXXXXOOOOOOOOOXXXXXXX. ",
105 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
106 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
107 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
108 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
109 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
110 " .XXXXXXXOOOOOOOOOXXXXXXX. ",
111 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
112 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
113 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
114 " .XXXXXOOOOOOOOOOXXXXXXXX. ",
115 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
116 " .XXXXXXOOOOOOOOOOXXXXXXX. ",
117 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
118 " .XXXXXOOOOOOOXXXXXXXXXXX. ",
119 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
120 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
121 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
122 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
123 " .XXXXXXXXXXXXXXXXXXXXXXX. ",
124 " ......................... "};
128 // ----------------------------------------------------------------------------
130 // ----------------------------------------------------------------------------
132 static void target_drag_leave( GtkWidget
*WXUNUSED(widget
),
133 GdkDragContext
*context
,
134 guint
WXUNUSED(time
),
135 wxDropTarget
*drop_target
)
137 /* inform the wxDropTarget about the current GdkDragContext.
138 this is only valid for the duration of this call */
139 drop_target
->SetDragContext( context
);
141 /* we don't need return values. this event is just for
143 drop_target
->OnLeave();
145 /* this has to be done because GDK has no "drag_enter" event */
146 drop_target
->m_firstMotion
= TRUE
;
148 /* after this, invalidate the drop_target's GdkDragContext */
149 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
152 // ----------------------------------------------------------------------------
154 // ----------------------------------------------------------------------------
156 static gboolean
target_drag_motion( GtkWidget
*WXUNUSED(widget
),
157 GdkDragContext
*context
,
161 wxDropTarget
*drop_target
)
163 /* Owen Taylor: "if the coordinates not in a drop zone,
164 return FALSE, otherwise call gtk_drag_status() and
167 /* inform the wxDropTarget about the current GdkDragContext.
168 this is only valid for the duration of this call */
169 drop_target
->SetDragContext( context
);
171 if (drop_target
->m_firstMotion
)
173 /* the first "drag_motion" event substitutes a "drag_enter" event */
174 drop_target
->OnEnter();
177 /* give program a chance to react (i.e. to say no by returning FALSE) */
178 bool ret
= drop_target
->OnMove( x
, y
);
180 /* we don't yet handle which "actions" (i.e. copy or move)
181 the target accepts. so far we simply accept the
182 suggested action. TODO. */
184 gdk_drag_status( context
, context
->suggested_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 /* Owen Taylor: "if the drop is not in a drop zone,
207 return FALSE, otherwise, if you aren't accepting
208 the drop, call gtk_drag_finish() with success == FALSE
209 otherwise call gtk_drag_data_get()" */
211 // printf( "drop.\n" );
213 /* this seems to make a difference between not accepting
214 due to wrong target area and due to wrong format. let
215 us hope that this is not required.. */
217 /* inform the wxDropTarget about the current GdkDragContext.
218 this is only valid for the duration of this call */
219 drop_target
->SetDragContext( context
);
221 /* inform the wxDropTarget about the current drag widget.
222 this is only valid for the duration of this call */
223 drop_target
->SetDragWidget( widget
);
225 /* inform the wxDropTarget about the current drag time.
226 this is only valid for the duration of this call */
227 drop_target
->SetDragTime( time
);
229 bool ret
= drop_target
->OnDrop( x
, y
);
233 /* cancel the whole thing */
234 gtk_drag_finish( context
,
235 FALSE
, /* no success */
236 FALSE
, /* don't delete data on dropping side */
240 /* after this, invalidate the drop_target's GdkDragContext */
241 drop_target
->SetDragContext( (GdkDragContext
*) NULL
);
243 /* after this, invalidate the drop_target's drag widget */
244 drop_target
->SetDragWidget( (GtkWidget
*) NULL
);
246 /* this has to be done because GDK has no "drag_enter" event */
247 drop_target
->m_firstMotion
= TRUE
;
252 // ----------------------------------------------------------------------------
253 // "drag_data_received"
254 // ----------------------------------------------------------------------------
256 static void target_drag_data_received( GtkWidget
*WXUNUSED(widget
),
257 GdkDragContext
*context
,
260 GtkSelectionData
*data
,
261 guint
WXUNUSED(info
),
263 wxDropTarget
*drop_target
)
265 /* Owen Taylor: "call gtk_drag_finish() with
268 // printf( "data received.\n" );
270 if ((data
->length
<= 0) || (data
->format
!= 8))
272 /* negative data length and non 8-bit data format
273 qualifies for junk */
274 gtk_drag_finish (context
, FALSE
, FALSE
, time
);
276 // printf( "no data.\n" );
281 /* inform the wxDropTarget about the current GtkSelectionData.
282 this is only valid for the duration of this call */
283 drop_target
->SetDragData( data
);
285 if (drop_target
->OnData( x
, y
))
287 /* tell GTK that data transfer was successfull */
288 gtk_drag_finish( context
, TRUE
, FALSE
, time
);
292 /* tell GTK that data transfer was not successfull */
293 gtk_drag_finish( context
, FALSE
, FALSE
, time
);
296 /* after this, invalidate the drop_target's drag data */
297 drop_target
->SetDragData( (GtkSelectionData
*) NULL
);
300 //----------------------------------------------------------------------------
302 //----------------------------------------------------------------------------
304 wxDropTarget::wxDropTarget()
306 m_firstMotion
= TRUE
;
307 m_dragContext
= (GdkDragContext
*) NULL
;
308 m_dragWidget
= (GtkWidget
*) NULL
;
309 m_dragData
= (GtkSelectionData
*) NULL
;
313 wxDropTarget::~wxDropTarget()
317 void wxDropTarget::OnEnter()
321 void wxDropTarget::OnLeave()
325 bool wxDropTarget::OnMove( int WXUNUSED(x
), int WXUNUSED(y
) )
330 bool wxDropTarget::OnDrop( int WXUNUSED(x
), int WXUNUSED(y
) )
335 bool wxDropTarget::OnData( int WXUNUSED(x
), int WXUNUSED(y
) )
340 bool wxDropTarget::RequestData( wxDataFormat format
)
342 if (!m_dragContext
) return FALSE
;
343 if (!m_dragWidget
) return FALSE
;
346 wxPrintf( _T("format: %s.\n"), format.GetId().c_str() );
347 if (format.GetType() == wxDF_PRIVATE) wxPrintf( _T("private data.\n") );
348 if (format.GetType() == wxDF_TEXT) wxPrintf( _T("text data.\n") );
351 /* this should trigger an "drag_data_received" event */
352 gtk_drag_get_data( m_dragWidget
,
360 bool wxDropTarget::IsSupported( wxDataFormat format
)
362 if (!m_dragContext
) return FALSE
;
364 GList
*child
= m_dragContext
->targets
;
367 GdkAtom formatAtom
= (GdkAtom
) GPOINTER_TO_INT(child
->data
);
369 // char *name = gdk_atom_name( formatAtom );
370 // if (name) printf( "Format available: %s.\n", name );
372 if (formatAtom
== format
.GetAtom()) return TRUE
;
379 bool wxDropTarget::GetData( wxDataObject
*data_object
)
381 if (!m_dragData
) return FALSE
;
383 if (m_dragData
->target
!= data_object
->GetFormat().GetAtom()) return FALSE
;
385 if (data_object
->GetFormat().GetType() == wxDF_TEXT
)
387 wxTextDataObject
*text_object
= (wxTextDataObject
*)data_object
;
388 text_object
->SetText( (const char*)m_dragData
->data
);
391 if (data_object
->GetFormat().GetType() == wxDF_FILENAME
)
395 if (data_object
->GetFormat().GetType() == wxDF_PRIVATE
)
397 wxPrivateDataObject
*priv_object
= (wxPrivateDataObject
*)data_object
;
398 priv_object
->SetData( (const char*)m_dragData
->data
, (size_t)m_dragData
->length
);
404 void wxDropTarget::UnregisterWidget( GtkWidget
*widget
)
406 wxCHECK_RET( widget
!= NULL
, _T("unregister widget is NULL") );
408 gtk_drag_dest_unset( widget
);
410 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
411 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
413 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
414 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
416 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
417 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
419 gtk_signal_disconnect_by_func( GTK_OBJECT(widget
),
420 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
423 void wxDropTarget::RegisterWidget( GtkWidget
*widget
)
425 wxCHECK_RET( widget
!= NULL
, _T("register widget is NULL") );
427 /* gtk_drag_dest_set() determines what default behaviour we'd like
428 GTK to supply. we don't want to specify out targets (=formats)
429 or actions in advance (i.e. not GTK_DEST_DEFAULT_MOTION and
430 not GTK_DEST_DEFAULT_DROP). instead we react individually to
431 "drag_motion" and "drag_drop" events. this makes it possible
432 to allow dropping on only a small area. we should set
433 GTK_DEST_DEFAULT_HIGHLIGHT as this will switch on the nice
434 highlighting if dragging over standard controls, but this
435 seems to be broken without the other two. */
437 gtk_drag_dest_set( widget
,
438 (GtkDestDefaults
) 0, /* no default behaviour */
439 (GtkTargetEntry
*) NULL
, /* we don't supply any formats here */
440 0, /* number of targets = 0 */
441 (GdkDragAction
) 0 ); /* we don't supply any actions here */
443 gtk_signal_connect( GTK_OBJECT(widget
), "drag_leave",
444 GTK_SIGNAL_FUNC(target_drag_leave
), (gpointer
) this );
446 gtk_signal_connect( GTK_OBJECT(widget
), "drag_motion",
447 GTK_SIGNAL_FUNC(target_drag_motion
), (gpointer
) this );
449 gtk_signal_connect( GTK_OBJECT(widget
), "drag_drop",
450 GTK_SIGNAL_FUNC(target_drag_drop
), (gpointer
) this );
452 gtk_signal_connect( GTK_OBJECT(widget
), "drag_data_received",
453 GTK_SIGNAL_FUNC(target_drag_data_received
), (gpointer
) this );
456 //-------------------------------------------------------------------------
458 //-------------------------------------------------------------------------
460 bool wxTextDropTarget::OnMove( int WXUNUSED(x
), int WXUNUSED(y
) )
462 return IsSupported( wxDF_TEXT
);
465 bool wxTextDropTarget::OnDrop( int WXUNUSED(x
), int WXUNUSED(y
) )
467 if (IsSupported( wxDF_TEXT
))
469 RequestData( wxDF_TEXT
);
476 bool wxTextDropTarget::OnData( int x
, int y
)
478 wxTextDataObject data
;
479 if (!GetData( &data
)) return FALSE
;
481 OnDropText( x
, y
, data
.GetText() );
486 //-------------------------------------------------------------------------
487 // wxPrivateDropTarget
488 //-------------------------------------------------------------------------
490 wxPrivateDropTarget::wxPrivateDropTarget()
492 m_id
= wxTheApp
->GetAppName();
495 wxPrivateDropTarget::wxPrivateDropTarget( const wxString
&id
)
500 bool wxPrivateDropTarget::OnMove( int WXUNUSED(x
), int WXUNUSED(y
) )
502 return IsSupported( m_id
);
505 bool wxPrivateDropTarget::OnDrop( int WXUNUSED(x
), int WXUNUSED(y
) )
507 if (!IsSupported( m_id
))
516 bool wxPrivateDropTarget::OnData( int x
, int y
)
518 if (!IsSupported( m_id
)) return FALSE
;
520 wxPrivateDataObject data
;
521 if (!GetData( &data
)) return FALSE
;
523 OnDropData( x
, y
, data
.GetData(), data
.GetSize() );
528 //----------------------------------------------------------------------------
529 // A drop target which accepts files (dragged from File Manager or Explorer)
530 //----------------------------------------------------------------------------
532 bool wxFileDropTarget::OnMove( int WXUNUSED(x
), int WXUNUSED(y
) )
534 return IsSupported( wxDF_FILENAME
);
537 bool wxFileDropTarget::OnDrop( int x
, int y
)
539 if (IsSupported( wxDF_FILENAME
))
541 RequestData( wxDF_FILENAME
);
548 bool wxFileDropTarget::OnData( int x
, int y
)
550 wxFileDataObject data
;
551 if (!GetData( &data
)) return FALSE
;
553 /* get number of substrings /root/mytext.txt/0/root/myothertext.txt/0/0 */
556 size_t size
= data
.GetFiles().Length();
557 wxChar
*text
= WXSTRINGCAST data
.GetFiles();
558 for ( i
= 0; i
< size
; i
++)
559 if (text
[i
] == 0) number
++;
561 if (number
== 0) return FALSE
;
563 wxChar
**files
= new wxChar
*[number
];
565 text
= WXSTRINGCAST data
.GetFiles();
566 for (i
= 0; i
< number
; i
++)
569 int len
= wxStrlen( text
);
573 OnDropFiles( x
, y
, number
, files
);
580 //----------------------------------------------------------------------------
582 //----------------------------------------------------------------------------
585 source_drag_data_get (GtkWidget
*WXUNUSED(widget
),
586 GdkDragContext
*context
,
587 GtkSelectionData
*selection_data
,
588 guint
WXUNUSED(info
),
589 guint
WXUNUSED(time
),
590 wxDropSource
*drop_source
)
592 // printf( "Provide data!\n" );
594 // char *name = gdk_atom_name( selection_data->target );
595 // if (name) printf( "Format requested: %s.\n", name );
597 wxNode
*node
= drop_source
->m_data
->m_dataObjects
.First();
600 wxDataObject
*data_object
= (wxDataObject
*) node
->Data();
601 if (data_object
->GetFormat().GetAtom() == selection_data
->target
)
603 // printf( "format found.\n" );
605 size_t data_size
= data_object
->GetSize();
609 // printf( "data size: %d.\n", (int)data_size );
611 guchar
*buffer
= new guchar
[data_size
];
612 data_object
->WriteData( buffer
);
614 gtk_selection_data_set( selection_data
,
615 selection_data
->target
,
622 /* so far only copy, no moves. TODO. */
623 drop_source
->m_retValue
= wxDragCopy
;
632 drop_source
->m_retValue
= wxDragCancel
;
635 //----------------------------------------------------------------------------
636 // "drag_data_delete"
637 //----------------------------------------------------------------------------
639 static void source_drag_data_delete( GtkWidget
*WXUNUSED(widget
),
640 GdkDragContext
*WXUNUSED(context
),
641 wxDropSource
*drop_source
)
643 // printf( "Delete the data!\n" );
645 drop_source
->m_retValue
= wxDragMove
;
648 //----------------------------------------------------------------------------
650 //----------------------------------------------------------------------------
652 static void source_drag_begin( GtkWidget
*WXUNUSED(widget
),
653 GdkDragContext
*WXUNUSED(context
),
654 wxDropSource
*WXUNUSED(drop_source
) )
656 // printf( "drag_begin.\n" );
659 //----------------------------------------------------------------------------
661 //----------------------------------------------------------------------------
663 static void source_drag_end( GtkWidget
*WXUNUSED(widget
),
664 GdkDragContext
*WXUNUSED(context
),
665 wxDropSource
*drop_source
)
667 // printf( "drag_end.\n" );
669 drop_source
->m_waiting
= FALSE
;
672 //---------------------------------------------------------------------------
674 //---------------------------------------------------------------------------
676 wxDropSource::wxDropSource( wxWindow
*win
, const wxIcon
&go
, const wxIcon
&stop
)
678 g_blockEventsOnDrag
= TRUE
;
682 m_widget
= win
->m_widget
;
683 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
685 m_data
= (wxDataBroker
*) NULL
;
686 m_retValue
= wxDragCancel
;
688 m_defaultCursor
= wxCursor( wxCURSOR_NO_ENTRY
);
689 m_goaheadCursor
= wxCursor( wxCURSOR_HAND
);
692 if (wxNullIcon
== go
) m_goIcon
= wxIcon( page_xpm
);
694 if (wxNullIcon
== stop
) m_stopIcon
= wxIcon( gv_xpm
);
697 wxDropSource::wxDropSource( wxDataObject
*data
, wxWindow
*win
, const wxIcon
&go
, const wxIcon
&stop
)
702 m_widget
= win
->m_widget
;
703 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
704 m_retValue
= wxDragCancel
;
708 m_data
= new wxDataBroker();
713 m_data
= (wxDataBroker
*) NULL
;
716 m_defaultCursor
= wxCursor( wxCURSOR_NO_ENTRY
);
717 m_goaheadCursor
= wxCursor( wxCURSOR_HAND
);
720 if (wxNullIcon
== go
) m_goIcon
= wxIcon( page_xpm
);
722 if (wxNullIcon
== stop
) m_stopIcon
= wxIcon( gv_xpm
);
725 wxDropSource::wxDropSource( wxDataBroker
*data
, wxWindow
*win
)
728 m_widget
= win
->m_widget
;
729 if (win
->m_wxwindow
) m_widget
= win
->m_wxwindow
;
730 m_retValue
= wxDragCancel
;
734 m_defaultCursor
= wxCursor( wxCURSOR_NO_ENTRY
);
735 m_goaheadCursor
= wxCursor( wxCURSOR_HAND
);
738 void wxDropSource::SetData( wxDataObject
*data
)
740 if (m_data
) delete m_data
;
744 m_data
= new wxDataBroker();
749 m_data
= (wxDataBroker
*) NULL
;
753 void wxDropSource::SetData( wxDataBroker
*data
)
755 if (m_data
) delete m_data
;
760 wxDropSource::~wxDropSource(void)
762 if (m_data
) delete m_data
;
764 g_blockEventsOnDrag
= FALSE
;
767 wxDragResult
wxDropSource::DoDragDrop( bool WXUNUSED(bAllowMove
) )
769 wxASSERT_MSG( m_data
, _T("wxDragSource: no data") );
771 if (!m_data
) return (wxDragResult
) wxDragNone
;
773 g_blockEventsOnDrag
= TRUE
;
779 GdkAtom atom
= gdk_atom_intern( "STRING", FALSE
);
780 // wxPrintf( _T("atom id: %d.\n"), (int)atom );
782 GtkTargetList
*target_list
= gtk_target_list_new( (GtkTargetEntry
*) NULL
, 0 );
783 gtk_target_list_add( target_list
, atom
, 0, 0 );
785 GdkEventMotion event
;
786 event
.window
= m_widget
->window
;
789 GdkModifierType state
;
790 gdk_window_get_pointer( event
.window
, &x
, &y
, &state
);
794 event
.time
= GDK_CURRENT_TIME
;
796 /* GTK wants to know which button was pressed which caused the dragging */
797 int button_number
= 0;
798 if (event
.state
& GDK_BUTTON1_MASK
) button_number
= 1;
799 else if (event
.state
& GDK_BUTTON2_MASK
) button_number
= 2;
800 else if (event
.state
& GDK_BUTTON3_MASK
) button_number
= 3;
802 /* don't start dragging if no button is down */
805 GdkDragContext
*context
= gtk_drag_begin( m_widget
,
808 button_number
, /* number of mouse button which started drag */
809 (GdkEvent
*) &event
);
811 wxMask
*mask
= m_goIcon
.GetMask();
812 GdkBitmap
*bm
= (GdkBitmap
*) NULL
;
813 if (mask
) bm
= mask
->GetBitmap();
814 GdkPixmap
*pm
= m_goIcon
.GetPixmap();
816 gtk_drag_set_icon_pixmap( context
,
817 gtk_widget_get_colormap( m_widget
),
823 while (m_waiting
) gtk_main_iteration();;
826 g_blockEventsOnDrag
= FALSE
;
833 void wxDropSource::RegisterWindow()
835 if (!m_widget
) return;
837 gtk_signal_connect( GTK_OBJECT(m_widget
), "drag_data_get",
838 GTK_SIGNAL_FUNC (source_drag_data_get
), (gpointer
) this);
839 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_data_delete",
840 GTK_SIGNAL_FUNC (source_drag_data_delete
), (gpointer
) this );
841 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_begin",
842 GTK_SIGNAL_FUNC (source_drag_begin
), (gpointer
) this );
843 gtk_signal_connect (GTK_OBJECT(m_widget
), "drag_end",
844 GTK_SIGNAL_FUNC (source_drag_end
), (gpointer
) this );
848 void wxDropSource::UnregisterWindow()
850 if (!m_widget
) return;
852 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
853 GTK_SIGNAL_FUNC(source_drag_data_get
), (gpointer
) this );
854 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
855 GTK_SIGNAL_FUNC(source_drag_data_delete
), (gpointer
) this );
856 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
857 GTK_SIGNAL_FUNC(source_drag_begin
), (gpointer
) this );
858 gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget
),
859 GTK_SIGNAL_FUNC(source_drag_end
), (gpointer
) this );
864 // wxUSE_DRAG_AND_DROP