Stetic.ObjectWrapper.DropObject C# (CSharp) Method

DropObject() protected method

protected DropObject ( string data, Gtk obj ) : void
data string
obj Gtk
return void
        protected internal virtual void DropObject(string data, Gtk.Widget obj)
        {
            // Called by DND.Drop
        }

Usage Example

Exemplo n.º 1
0
        // Call this from a DragDrop event to receive the dragged widget
        public static void Drop(Gdk.DragContext ctx, uint time, ObjectWrapper targetWrapper, string dropData)
        {
            if (dropCallback == null)
            {
                Gtk.Widget w = Drop(ctx, (Gtk.Widget)targetWrapper.Wrapped, time);
                targetWrapper.DropObject(dropData, w);
                return;
            }

            Cancel();
            Gtk.Drag.Finish(ctx, true, true, time);

            Gtk.Application.Invoke(delegate
            {
                IProject project = targetWrapper.Project;
                string uid       = targetWrapper.UndoId;
                string tname     = ((Wrapper.Widget)targetWrapper).GetTopLevel().Wrapped.Name;

                // This call may cause the project to be reloaded
                dragWidget = dropCallback();
                if (dragWidget == null)
                {
                    return;
                }

                if (targetWrapper.IsDisposed)
                {
                    // The project has been reloaded. Find the wrapper again.
                    Gtk.Widget twidget = project.GetTopLevel(tname);
                    ObjectWrapper ow   = ObjectWrapper.Lookup(twidget);
                    if (ow != null)
                    {
                        targetWrapper = ow.FindObjectByUndoId(uid);
                    }
                    else
                    {
                        targetWrapper = null;
                    }

                    if (targetWrapper == null)
                    {
                        // Target wrapper not found. Just ignore the drop.
                        return;
                    }
                }

                targetWrapper.DropObject(dropData, dragWidget);
            });
        }
All Usage Examples Of Stetic.ObjectWrapper::DropObject