void HandleDragBegin(object o, Gtk.DragBeginArgs args) { EventsRootWidget.DragEnd += HandleWidgetDragEnd; EventsRootWidget.DragFailed += HandleDragFailed; EventsRootWidget.DragDataDelete += HandleDragDataDelete; EventsRootWidget.DragDataGet += HandleWidgetDragDataGet; }
void HandleWidgetDragBegin(object o, Gtk.DragBeginArgs args) { // If SetDragSource has not been called, ignore the event if (DragDropInfo.SourceDragAction == default(Gdk.DragAction)) { return; } DragStartData sdata = null; ApplicationContext.InvokeUserCode(delegate { sdata = EventSink.OnDragStarted(); }); if (sdata == null) { return; } DragDropInfo.CurrentDragData = sdata.Data; if (sdata.ImageBackend != null) { var gi = (GtkImage)sdata.ImageBackend; var img = gi.ToPixbuf(ApplicationContext, Widget); Gtk.Drag.SetIconPixbuf(args.Context, img, (int)sdata.HotX, (int)sdata.HotY); } HandleDragBegin(null, args); }
private static void SetDragImage(Gtk.TreeView menuLayout, Gtk.DragBeginArgs args) { var selection = menuLayout.Selection; var firstSelectedPath = selection.GetSelectedRows().First(); Gtk.TreeIter iter; if (menuLayout.Model.GetIter(out iter, firstSelectedPath)) { var firstDraggedItem = menuLayout.Model.GetValue(iter, 0) as FileNodeViewModel; string text; Gdk.Pixbuf icon; if (selection.CountSelectedRows() > 1) { text = "<Multiple Items>"; icon = firstDraggedItem is FolderViewModel ? DragMultipleItemsFolderImage : DragMultipleItemsProgramImage; } else { text = firstDraggedItem.LongName; icon = firstDraggedItem.Icon; } var dragWidget = new DragDropImage(icon, text); Gtk.Drag.SetIconWidget(args.Context, dragWidget, 0, 0); } }
void HandleWidgetDragBegin(object o, Gtk.DragBeginArgs args) { // If SetDragSource has not been called, ignore the event if (DragDropInfo.SourceDragAction == default(Gdk.DragAction)) { return; } DragStartData sdata = null; Toolkit.Invoke(delegate { sdata = EventSink.OnDragStarted(); }); if (sdata == null) { return; } DragDropInfo.CurrentDragData = sdata.Data; if (sdata.ImageBackend != null) { Gtk.Drag.SetIconPixbuf(args.Context, (Gdk.Pixbuf)sdata.ImageBackend, (int)sdata.HotX, (int)sdata.HotY); } HandleDragBegin(null, args); }
/// <summary> /// Handles the drag begin event. /// </summary> /// <param name="o">The menu layout Gtk.TreeView.</param> /// <param name="args">The event data.</param> protected void HandleDragBegin(object o, Gtk.DragBeginArgs args) { DebugDragDrop("HandleDragBegin"); var menuLayoutView = o as Gtk.TreeView; SetDragImage(menuLayoutView, args); }
void HandleDragBegin(object o, Gtk.DragBeginArgs args) { Console.WriteLine("Begin drag"); Widget.DragEnd += HandleWidgetDragEnd; Widget.DragFailed += HandleDragFailed; Widget.DragDataDelete += HandleDragDataDelete; Widget.DragDataGet += HandleWidgetDragDataGet; }
/// <summary> /// Handles the drag begin event. /// </summary> /// <param name="o">The ROM list Gtk.TreeView.</param> /// <param name="args">The event data.</param> protected void HandleDragBegin(object o, Gtk.DragBeginArgs args) { var numItemsSelected = ViewModel.CurrentSelection.Count; DebugDragDrop("HandleDragBegin: numItemsSelected: " + numItemsSelected); var dragImage = numItemsSelected > 1 ? DragMultipleRomsImage : DragOneRomImage; var dragText = numItemsSelected > 1 ? "<Multiple Items>" : ViewModel.CurrentSelection.First().Name; var dragWidget = new DragDropImage(dragImage, dragText); Gtk.Drag.SetIconWidget(args.Context, dragWidget, 0, 0); }
void HandleWidgetDragBegin(object o, Gtk.DragBeginArgs args) { DragStartData sdata = null; Toolkit.Invoke(delegate { sdata = EventSink.OnDragStarted(); }); if (sdata == null) { return; } DragDropInfo.CurrentDragData = sdata.Data; if (sdata.ImageBackend != null) { Gtk.Drag.SetIconPixbuf(args.Context, (Gdk.Pixbuf)sdata.ImageBackend, (int)sdata.HotX, (int)sdata.HotY); } HandleDragBegin(null, args); }
void Begin(object o, Gtk.DragBeginArgs args) { Gtk.Drag.SetIconPixbuf(args.Context, Image, (int)HotX, (int)HotY); Widget.DragBegin -= Begin; }
protected void HandleTreeViewDragBegin(object o, Gtk.DragBeginArgs args) { Gdk.Pixmap pm = treeView.CreateRowDragIcon(treeView.Selection.GetSelectedRows()[0]); Gdk.Pixbuf pb = Gdk.Pixbuf.FromDrawable(pm, pm.Colormap, 0, 0, 0, 0, -1, -1); Gtk.Drag.SetIconPixbuf(args.Context, pb, 0, 0); }