void OnSearchDragDataGet(object o, DragDataGetArgs args) { Gtk.TreeModel model; Gtk.TreeIter iter; if (!this.Selection.GetSelected(out model, out iter)) { return; } string dn = (string)model.GetValue(iter, 0); SearchResultExportEventArgs myargs = new SearchResultExportEventArgs(dn, true); if (Export != null) { Export(this, myargs); } if (myargs.Data == null) { return; } Atom[] targets = args.Context.Targets; args.SelectionData.Set(targets[0], 8, System.Text.Encoding.UTF8.GetBytes(myargs.Data)); }
protected void Data_Get(object o, DragDataGetArgs args) { Atom[] targets = args.Context.Targets; string name; if (o is EventBox) { name = (o as EventBox).Name; } else { name = (o as Button).Image.Name; } switch (name) { case "Table2Chair": args.SelectionData.Set(targets[0], 8, System.Text.Encoding.UTF8.GetBytes("Table2Chair")); break; case "Table4Chair": args.SelectionData.Set(targets[0], 8, System.Text.Encoding.UTF8.GetBytes("Table4Chair")); break; case "Table6Chair": args.SelectionData.Set(targets[0], 8, System.Text.Encoding.UTF8.GetBytes("Table6Chair")); break; case "Table8Chair": args.SelectionData.Set(targets[0], 8, System.Text.Encoding.UTF8.GetBytes("Table8Chair")); break; } }
void HandleDragDataGet(object sender, DragDataGetArgs args) { args.RetVal = true; switch (args.Info) { case (uint)MainWindow.TargetType.TagList: case (uint)MainWindow.TargetType.TagQueryItem: Byte [] data = Encoding.UTF8.GetBytes(String.Empty); Atom [] targets = args.Context.Targets; args.SelectionData.Set(targets[0], 8, data, data.Length); return; default: // Drop cancelled args.RetVal = false; foreach (Widget w in hiddenWidgets) { w.Visible = true; } focusedLiterals = null; break; } }
private void MultiDragTreeView_DragDataGet(object o, DragDataGetArgs args) { if (args.Context.Targets[0].Name == "text/internal-list") { args.SelectionData.Set(args.Context.Targets[0], 8, System.Text.Encoding.UTF8.GetBytes("")); } }
void HandleDragDataGet(object sender, DragDataGetArgs args) { args.RetVal = true; if (args.Info == DragDropTargets.TagListEntry.Info || args.Info == DragDropTargets.TagQueryEntry.Info) { // FIXME: do really write data Byte [] data = Encoding.UTF8.GetBytes(String.Empty); Atom [] targets = args.Context.Targets; args.SelectionData.Set(targets [0], 8, data, data.Length); return; } // Drop cancelled args.RetVal = false; foreach (Widget w in hiddenWidgets) { w.Visible = true; } focusedLiterals = null; }
void HandleDragDataGet(object sender, DragDataGetArgs args) { if (args.Info == DragDropTargets.TagListEntry.Info) { args.SelectionData.SetTagsData(TagHighlight, args.Context.Targets[0]); } }
private void OnDragDataGet(object o, DragDataGetArgs args) { Atom[] Targets = args.Context.Targets; args.SelectionData.Set(Targets[0], 8, System.Text.Encoding.UTF8.GetBytes(draggedBadguy)); draggedBadguy = ""; //badguy was succesfully moved }
/// <summary>Node has been dropped. Send to presenter.</summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event data.</param> private void OnDragDataGet(object sender, DragDataGetArgs e) { Gdk.Atom[] targets = e.Context.Targets; IntPtr data = (IntPtr)dragSourceHandle; Int64 ptrInt = data.ToInt64(); e.SelectionData.Set(targets[0], 8, BitConverter.GetBytes(ptrInt)); }
protected void HandleDragDataGet(object o, DragDataGetArgs args) { for (int i = 0; i < ValidTargets.Length; i++) { FillSelectionData(args.SelectionData, (i < ValidTargets.Length - 1) ? (uint)0 : (uint)1); } args.SelectionData.Text = GetTimeAsString(copyBuffer); }
/// <summary> /// Starts filling data into selection /// </summary> /// <param name="o"> /// Object <see cref="System.Object"/> /// </param> /// <param name="args"> /// Arguments <see cref="DragDataGetArgs"/> /// </param> protected void HandleDragDataGet(object o, DragDataGetArgs args) { for (int i = 0; i < ValidTargets.Length; i++) { FillSelectionData(args.SelectionData, (i < ValidTargets.Length - 1) ? (uint)0 : (uint)1); } args.SelectionData.Text = TargetUrl; }
/// <summary>Get data to be sent to presenter.</summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event data.</param> private void OnDragDataGet(object sender, DragDataGetArgs e) { IntPtr data = (IntPtr)dragSourceHandle; Int64 ptrInt = data.ToInt64(); Gdk.Atom target = Drag.DestFindTarget(sender as Widget, e.Context, null); e.SelectionData.Set(target, 8, BitConverter.GetBytes(ptrInt)); }
/// <summary> /// Emitted on the drag source to fetch drag data /// </summary> void HandleDragDataGet(object o, DragDataGetArgs args) { if (InternalDragActive && drag_item != null && !(drag_item is INonPersistedItem)) { string uri = string.Format("docky://{0}\r\n", drag_item.UniqueID()); byte[] data = System.Text.Encoding.UTF8.GetBytes(uri); args.SelectionData.Set(args.SelectionData.Target, 8, data, data.Length); } }
void Widget_DragDataGet(object o, DragDataGetArgs args) { if (toolbox.SelectedNode is IDragDataToolboxNode node) { foreach (var format in node.Formats) { args.SelectionData.Set(Gdk.Atom.Intern(format, false), 8, node.GetData(format)); } } }
private static void HandleSourceDragDataGet(object sender, DragDataGetArgs args) { if (args.Info == (uint)TargetType.RootWindow) { Console.WriteLine("I was dropped on the rootwin"); } else { args.SelectionData.Text = "I'm data!"; } }
private void OnTorrentDragDataGet(object o, DragDataGetArgs args) { // TODO: Support dragging multiple torrents to a label Download manager; manager = torrentController.SelectedDownload; if (manager == null) { return; } args.SelectionData.Set(Gdk.Atom.Intern("application/x-monotorrent-Download-objects", false), 8, manager.Torrent.InfoHash.ToArray()); }
private void OnTorrentDragDataGet(object o, DragDataGetArgs args) { // TODO: Support dragging multiple torrents to a label TorrentManager manager; manager = torrentController.GetSelectedTorrent(); if (manager == null) { return; } args.SelectionData.Set(Gdk.Atom.Intern("application/x-monotorrent-torrentmanager-objects", false), 8, Encoding.UTF8.GetBytes(manager.GetHashCode().ToString())); }
/// <summary> /// Handler prepares drag data. /// See the EnableDrop and HandleDragDataReceived in the ExperimentCanvasPad /// where receiving of the data is done. /// </summary> /// <param name='o'> /// O. /// </param> /// <param name='args'> /// Arguments. /// </param> private void HandleDragDataGet(object source, DragDataGetArgs args) { TreeView treeView = source as TreeView; TreeIter selectedItem; if (treeView != null && treeView.Selection.GetSelected(out selectedItem)) { ComponentsLibraryNode selectedNode = treeView.Model.GetValue(selectedItem, 0) as ComponentsLibraryNode; if (selectedNode.Data != null) { args.SelectionData.Set(args.SelectionData.Target, args.SelectionData.Format, new byte[] {}); // we send empty byte array just to trigger a drag&drop event. Drop handler will access componentsLibrary once again to get selected node. } } }
/// <summary>Node has been dropped. Send to presenter.</summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event data.</param> private void OnDragDataGet(object sender, DragDataGetArgs e) { try { IntPtr data = (IntPtr)dragSourceHandle; Int64 ptrInt = data.ToInt64(); Gdk.Atom target = Drag.DestFindTarget(sender as Widget, e.Context, null); if (target != Gdk.Atom.Intern("GDK_NONE", false)) { e.SelectionData.Set(target, 8, BitConverter.GetBytes(ptrInt)); } } catch (Exception err) { ShowError(err); } }
private void OnDragDataGet(object o, DragDataGetArgs args) { if (SelectedObjectNr != NONE) { Atom[] Targets = args.Context.Targets; foreach (Atom target in Targets) { if (target.Name == "BadguyName") { //TODO: Send only badguys into dispensers, no Doors, no Tilemaps.. args.SelectionData.Set(target, 8, System.Text.Encoding.UTF8.GetBytes(gameObjectTypes[SelectedObjectNr].Name.ToLower())); } //if (target.Name == "GameObject") //no data transmitted } } }
/// <summary> /// Handler prepares drag data. /// See the EnableDrop and HandleDragDataReceived in the ExperimentCanvasPad /// where receiving of the data is done. /// </summary> /// <param name='o'> /// O. /// </param> /// <param name='args'> /// Arguments. /// </param> private void HandleDragDataGet(object o, DragDataGetArgs args) { TreeView tv = o as TreeView; if (tv != null) { TreeIter item; if (tv.Selection.GetSelected(out item)) { //if dragged item in the tree is a metadatadefinition then signal drag data if (tv.Model.GetValue(item, 1) is MetadataDefinition) { //the byte array can be empty - previously definition was serialized, and deserialized by //DragDataReceived in experiment canvas, but we can avoid it //Also serialization didn't work for composite components definitions as its ComponentGraph is not serialized args.SelectionData.Set(args.SelectionData.Target, args.SelectionData.Format, new byte[] {}); } } } }
void HandleDragDataGet(object o, DragDataGetArgs args) { if (args.Info == move_internal_target.Info) { var pages = new Hyena.Gui.DragDropList <Page> (); pages.AddRange(SelectedPages); pages.AssignToSelection(args.SelectionData, Gdk.Atom.Intern(move_internal_target.Target, false)); args.RetVal = true; } else if (args.Info == move_external_target.Info) { string doc_and_pages = String.Format("{0}{1}{2}", document.CurrentStateUri, newline[0], String.Join(",", SelectedPages.Select(p => p.Index.ToString()).ToArray())); byte [] data = System.Text.Encoding.UTF8.GetBytes(doc_and_pages); args.SelectionData.Set(Gdk.Atom.Intern(move_external_target.Target, false), 8, data); args.RetVal = true; } else if (args.Info == uri_src_target.Info) { // TODO implement page extraction via DnD? Console.WriteLine("HandleDragDataGet, wants a uri list..."); } }
public void OnDragDataGet(object o, DragDataGetArgs args) { Log.Debug("BEGIN OnDragDataGet"); Gtk.TreeModel model; Gtk.TreeIter iter; if (!this.Selection.GetSelected(out model, out iter)) { return; } string dn = (string)model.GetValue(iter, (int)TreeCols.DN); string data = null; Log.Debug("Exporting entry: {0}", dn); if (!IsSingle) { string serverName = FindServerName(iter, model); if (serverName == null) { return; } conn = Global.Connections [serverName]; } Util.ExportData(conn, dn, out data); Atom[] targets = args.Context.Targets; args.SelectionData.Set(targets[0], 8, System.Text.Encoding.UTF8.GetBytes(data)); Log.Debug("END OnDragDataGet"); }
/// /// Event Handlers /// private void HandleDragDataGet(object o, DragDataGetArgs args) { if (holder == null || holder.iFolder == null) { return; } string ifolderID = this.holder.iFolder.ID; if (ifolderID == null) { return; } switch (args.Info) { case (uint)iFolderWindow.DragTargetType.iFolderID: Byte[] data = System.Text.Encoding.UTF8.GetBytes(ifolderID); Gdk.Atom[] targets = args.Context.Targets; args.SelectionData.Set(targets[0], 8, data, data.Length); break; } }
protected void HandleDragDataGet(object o, DragDataGetArgs args) { for (int i=0; i<ValidTargets.Length; i++) FillSelectionData (args.SelectionData, (i<ValidTargets.Length-1) ? (uint) 0 : (uint) 1); args.SelectionData.Text = GetTimeAsString (copyBuffer); }
public void DragDataGetHandler(object o, DragDataGetArgs args) { Console.WriteLine(args.Context.Targets[0].Name); }