void Treeview1_DragMotion(object o, DragMotionArgs args) { TreeViewDropPosition pos; TreePath path; TreeIter iter; if (!treeview1.GetDestRowAtPos(args.X, args.Y, out path, out pos)) { return; } if (!listStore.GetIter(out iter, path)) { return; } if (treeview1.Model.GetValue(iter, 2).ToString() != ID_FILE) { treeview1.SetDragDestRow(path, pos); } else if (pos == TreeViewDropPosition.IntoOrBefore || pos == TreeViewDropPosition.Before) { treeview1.SetDragDestRow(path, TreeViewDropPosition.Before); } else { treeview1.SetDragDestRow(path, TreeViewDropPosition.After); } Gdk.Drag.Status(args.Context, args.Context.SuggestedAction, args.Time); args.RetVal = true; }
void HandleDragMotion(object o, DragMotionArgs args) { if (!preview && Root.Count > 0 && (Literal.FocusedLiterals.Count == 0 || Children.Length > 2)) { Preview(); preview = true; } }
protected override bool OnDragOver(DragMotionArgs e) { if (!e.Context.GetDataPresent(typeof(ModelDragData)) || typeof(WidgetObject).IsAssignableFrom((e.Context.GetDragData() as ModelDragData).MetaData.Type)) { return(base.OnDragOver(e)); } e.SetAllowDragAction((DragAction)0); return(false); }
protected override bool OnDragOver(DragMotionArgs e) { if (!e.Context.GetDataPresent(typeof(ModelDragData)) || !((e.Context.GetDragData() as ModelDragData).MetaData.Type != typeof(PanelObject))) { return(base.OnDragOver(e)); } e.SetAllowDragAction((DragAction)0); return(false); }
private static void HandlePopsiteMotion(object sender, DragMotionArgs args) { if (popup_timer == 0) { popup_timer = GLib.Timeout.Add(500, new TimeoutHandler(HandlePopupCallback)); } args.RetVal = true; }
private void GroupsTree_DragMotion(object o, DragMotionArgs args) { TreePath path; TreeViewDropPosition pos; if (BusinessDomain.LoggedUser.UserLevel == UserAccessLevel.Operator || !groupsTree.GetDestRowAtPos(args.X, args.Y, out path, out pos)) { args.RetVal = false; return; } if (Drag.GetSourceWidget(args.Context) == groupsTree) { TreeIter selectedRow; if (groupsTree.Selection.GetSelected(out selectedRow)) { if (groupsTree.Model.GetValue(selectedRow, 2) == deletedGroup) { args.RetVal = false; return; } TreePath draggedPath = groupsTree.Model.GetPath(selectedRow); if (!draggedPath.Equals(path) && !draggedPath.IsAncestor(path)) { TreeIter destRow; groupsTree.Model.GetIter(out destRow, path); if (groupsTree.Model.GetValue(destRow, 2) == deletedGroup) { args.RetVal = false; return; } groupsTree.SetDragDestRow(path, pos); } } } else { switch (pos) { case TreeViewDropPosition.Before: groupsTree.SetDragDestRow(path, TreeViewDropPosition.IntoOrBefore); break; case TreeViewDropPosition.After: groupsTree.SetDragDestRow(path, TreeViewDropPosition.IntoOrAfter); break; } } Gdk.Drag.Status(args.Context, args.Context.SuggestedAction, args.Time); args.RetVal = true; }
private static void HandlePopupMotion(object sender, DragMotionArgs args) { if (!in_popup) { in_popup = true; if (popdown_timer != 0) { Console.WriteLine("removed popdown"); GLib.Source.Remove(popdown_timer); popdown_timer = 0; } } args.RetVal = true; }
protected override bool OnDragOver(DragMotionArgs e) { bool result; if (e.Context.GetDataPresent(typeof(ResourceInfoDragData))) { if (!this.CanReceiveResourceObject(e.Context.GetDragData() as ResourceInfoDragData)) { e.SetAllowDragAction((DragAction)0); result = false; return(result); } } result = base.OnDragOver(e); return(result); }
protected override bool OnDragOver(DragMotionArgs e) { bool result; if (e.Context.GetDataPresent(typeof(ModelDragData))) { ModelDragData modelDragData = e.Context.GetDragData() as ModelDragData; if (!typeof(WidgetObject).IsAssignableFrom(modelDragData.MetaData.Type)) { e.SetAllowDragAction((DragAction)0); result = false; return(result); } } result = base.OnDragOver(e); return(result); }
private void GroupsTree_DragMotion(object o, DragMotionArgs args) { if (Drag.GetSourceWidget(args.Context) == groupsPanel.GroupsTree) { return; } TreePath path; TreeViewDropPosition pos; if (!groupsPanel.GroupsTree.GetDestRowAtPos(args.X, args.Y, out path, out pos)) { args.RetVal = false; return; } foreach (int index in grid.Selection) { User entity = (User)grid.Model [index]; if (entity.CanEdit()) { continue; } args.RetVal = false; return; } switch (pos) { case TreeViewDropPosition.Before: groupsPanel.GroupsTree.SetDragDestRow(path, TreeViewDropPosition.IntoOrBefore); break; case TreeViewDropPosition.After: groupsPanel.GroupsTree.SetDragDestRow(path, TreeViewDropPosition.IntoOrAfter); break; } Gdk.Drag.Status(args.Context, args.Context.SuggestedAction, args.Time); args.RetVal = true; }
private void ImageEventBox_DragMotion(object o, DragMotionArgs args) { object dragData = args.Context.GetDragData(); ResourceInfoDragData resourceInfoDragData = dragData as ResourceInfoDragData; if (resourceInfoDragData == null) { args.SetAllowDragAction((DragAction)0); args.RetVal = true; } else { ResourceFile resourceFile = resourceInfoDragData.Items.FirstOrDefault <ResourceItem>() as ResourceFile; if (resourceFile == null || !this.CheckResource(resourceFile)) { args.SetAllowDragAction((DragAction)0); args.RetVal = true; } } }
private static void HandleTargetDragMotion(object sender, DragMotionArgs args) { if (!have_drag) { have_drag = true; // FIXME? Kinda wonky binding. (sender as Gtk.Image).Pixbuf = trashcan_open_pixbuf; } Widget source_widget = Gtk.Drag.GetSourceWidget(args.Context); Console.WriteLine("motion, source {0}", source_widget == null ? "null" : source_widget.ToString()); Atom [] targets = args.Context.ListTargets(); foreach (Atom a in targets) { Console.WriteLine(a.Name); } Gdk.Drag.Status(args.Context, args.Context.SuggestedAction, args.Time); args.RetVal = true; }
public void HandleDragMotion(object o, DragMotionArgs args) { TreePath path; TreeViewDropPosition position = TreeViewDropPosition.IntoOrAfter; GetPathAtPos(args.X, args.Y, out path); if (path == null) { return; } // Tags can be dropped before, after, or into another tag if (args.Context.Targets[0].Name == "application/x-fspot-tags") { Gdk.Rectangle rect = GetCellArea(path, Columns[0]); double vpos = Math.Abs(rect.Y - args.Y) / (double)rect.Height; if (vpos < 0.2) { position = TreeViewDropPosition.Before; } else if (vpos > 0.8) { position = TreeViewDropPosition.After; } } SetDragDestRow(path, position); // Scroll if within 20 pixels of the top or bottom of the tag list if (args.Y < 20) { Vadjustment.Value -= 30; } else if (((o as Gtk.Widget).Allocation.Height - args.Y) < 20) { Vadjustment.Value += 30; } }