Пример #1
0
 /// <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));
 }
Пример #2
0
		/// <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;
		}
Пример #3
0
        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;
        }
Пример #4
0
        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");
        }
Пример #5
0
		/// <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 HandleTagSelectionDragDataGet (object sender, DragDataGetArgs args)
	{		
		UriList list = new UriList (SelectedPhotos ());

		switch (args.Info) {
		case (uint) TargetType.TagList:
			Byte [] data = Encoding.UTF8.GetBytes (list.ToString ());
			Atom [] targets = args.Context.Targets;
			
			args.SelectionData.Set (targets[0], 8, data, data.Length);
			break;
		}
	}
Пример #7
0
        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 ());
        }
Пример #8
0
		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()));
		}
Пример #9
0
 private void Data_Get(object o, DragDataGetArgs args)
 {
     Atom [] targets = args.Context.Targets;
     args.SelectionData.Set (targets [0], 8,  System.Text.Encoding.UTF8.GetBytes ("sending message from tree"));
 }
Пример #10
0
	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!";
	}
Пример #11
0
		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;
			}
		}
Пример #12
0
 void ddgh(object sender, DragDataGetArgs args)
 {
     Console.WriteLine ("DragDataGet..");
     args.SelectionData.Text = "text";
 }
 /// <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[] {});
             }
         }
     }
 }
Пример #14
0
        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));
        }
 /// <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.
     }
 }
Пример #16
0
		void HandleIconViewDragDataGet (object sender, DragDataGetArgs args)
		{
			if (args.Info == (uint)DragDropTargets.TargetType.UriList) {
				var uris = from p in SelectedPhotos ()
				                       select p.DefaultVersion.Uri;
				args.SelectionData.SetUriListData (new UriList (uris), args.Context.Targets [0]);
				return;
			}

			if (args.Info == DragDropTargets.PhotoListEntry.Info) {
				args.SelectionData.SetPhotosData (SelectedPhotos (), args.Context.Targets [0]);
				return;
			}

			if (args.Info == DragDropTargets.RootWindowEntry.Info) {
				HandleSetAsBackgroundCommand (null, null);
				return;
			}
		}
Пример #17
0
    private void OnDragDataGet(object o, DragDataGetArgs args)
    {
        if (SelectedObjectNr != NONE){
            Atom[] Targets = args.Context.Targets;

            foreach (Atom target in Targets){
                if (target.Name == "BadguyName") {
                    if (SelectedObjectNr != 0) { //HACK: don't try to send the name of the arrow (null)
                        //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
            }
        }
    }
Пример #18
0
        private void OnDragDataGet(object o, DragDataGetArgs args)
        {
            if (args.SelectionData.Target != "text/uri-list")
                return;

            VirtualMachine machine = GetSelectedMachine ();

            args.SelectionData.Set (Gdk.Atom.Intern ("text/uri-list", false),
                                    8, Encoding.UTF8.GetBytes (controller.Manager.GetDesktopFileName (machine)));
        }
    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
    }
Пример #20
0
		void HandleDragDataGet (object sender, DragDataGetArgs args)
		{
			if (args.Info == DragDropTargets.TagListEntry.Info) {
				args.SelectionData.SetTagsData (TagHighlight, args.Context.Targets[0]);
			}
		}
Пример #21
0
        void HandleIconViewDragDataGet(object sender, DragDataGetArgs args)
        {
            if (args.Info == DragDropTargets.UriListEntry.Info) {
                args.SelectionData.SetUriListData (new UriList (SelectedPhotos ()), args.Context.Targets[0]);
                return;
            }

            if (args.Info == DragDropTargets.PhotoListEntry.Info) {
                args.SelectionData.SetPhotosData (SelectedPhotos (), args.Context.Targets[0]);
                return;
            }

            if (args.Info == DragDropTargets.RootWindowEntry.Info) {
                HandleSetAsBackgroundCommand (null, null);
                return;
            }
        }
Пример #22
0
	void HandleIconViewDragDataGet (object sender, DragDataGetArgs args)
	{		
		switch (args.Info) {
		case (uint) TargetType.UriList:
		case (uint) TargetType.PhotoList:
			UriList list = new UriList (SelectedPhotos ());
			Byte [] data = Encoding.UTF8.GetBytes (list.ToString ());
			Atom [] targets = args.Context.Targets;
			args.SelectionData.Set (targets[0], 8, data, data.Length);
			break;
		case (uint) TargetType.RootWindow:
			HandleSetAsBackgroundCommand (null, null);
                        break;
		}
		       
	}
Пример #23
0
 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;
        }
 }
        void OnDragDataGet(object sender, DragDataGetArgs args)
        {
            if (drag_item == null)
                return;

            ConsumeItem (drag_item);
            drag_item = null;
        }
Пример #25
0
 private void GetDataOfPhotoDragged(object o, DragDataGetArgs args)
 {
     Gdk.Atom[] types = args.Context.Targets;
       byte[] bytes = System.Text.Encoding.UTF8.GetBytes("");
       args.SelectionData.Set(types[0], 8, bytes, bytes.Length);
 }
Пример #26
0
        void HandleDragDataGet(object sender, DragDataGetArgs args)
        {
            Logger.Debug ("ImagesFileView.HandleDragDataGet. Sender {0}, args {1}", sender, args.Info);

            string file;
            TreeIter iter;
            TreePath[] items = SelectedItems;
            PathList list = new PathList ();

            for (int i = 0; i < items.Length; i++)
            {
                store.GetIter (out iter, items [i]);
                file = (string) store.GetValue (iter, 0);
                Logger.Debug ("ImagesFileView.HandleDragDataGet. Dropped {0}", file);
                list.Add (file);
            }

            switch (args.Info) {
            case 2: {

                Byte [] data = Encoding.UTF8.GetBytes (list.ToString ());
                Atom [] targets = args.Context.Targets;
                args.SelectionData.Set (targets[0], 2, data);
                Logger.Debug ("ImagesFileView.HandleDragDataGet. Data.Length {0}", data.Length);
                return;
            }
            default:
                Logger.Debug ("ImagesFileView.HandleDragDataGet. Drop cancelled");
                break;
            }

            args.RetVal = true;
        }
Пример #27
0
		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);
		}
Пример #28
0
		void HandleDragDataGet (object o, DragDataGetArgs args)
		{
			if (dragItem != null) {
				TextEditor.CaretToDragCaretPosition ();
				((IToolboxConsumer)this).ConsumeItem (dragItem);
				dragItem = null;
			}
		}
Пример #29
0
 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...");
     }
 }