コード例 #1
0
ファイル: ExplorerView.cs プロジェクト: hut104/ApsimX
 /// <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
ファイル: Literal.cs プロジェクト: Yetangitu/f-spot
        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
ファイル: LdapTreeView.cs プロジェクト: MrJoe/lat
        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);
			}
		}
コード例 #6
0
	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
ファイル: Tree.cs プロジェクト: MonoBrasil/historico
 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
ファイル: TestDnd.cs プロジェクト: ystk/debian-gtk-sharp2
	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
ファイル: EditModsDialog.cs プロジェクト: Altreus/MultiMC
 void ddgh(object sender, DragDataGetArgs args)
 {
     Console.WriteLine ("DragDataGet..");
     args.SelectionData.Text = "text";
 }
コード例 #13
0
 /// <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
ファイル: SearchResultsTreeView.cs プロジェクト: MrJoe/lat
        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));
        }
コード例 #15
0
 /// <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
ファイル: MainWindow.cs プロジェクト: mono/f-spot
		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
ファイル: VMView.cs プロジェクト: snorp/vmx-manager
        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)));
        }
コード例 #19
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
    }
コード例 #20
0
ファイル: TagSelectionWidget.cs プロジェクト: mono/f-spot
		void HandleDragDataGet (object sender, DragDataGetArgs args)
		{
			if (args.Info == DragDropTargets.TagListEntry.Info) {
				args.SelectionData.SetTagsData (TagHighlight, args.Context.Targets[0]);
			}
		}
コード例 #21
0
ファイル: MainWindow.cs プロジェクト: iainlane/f-spot
        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;
        }
 }
コード例 #24
0
        void OnDragDataGet(object sender, DragDataGetArgs args)
        {
            if (drag_item == null)
                return;

            ConsumeItem (drag_item);
            drag_item = null;
        }
コード例 #25
0
ファイル: DeskFlickrUI.cs プロジェクト: joshuacox/dfo
 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
ファイル: ImagesFileView.cs プロジェクト: GNOME/mistelix
        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
ファイル: DocumentIconView.cs プロジェクト: GNOME/pdfmod
 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...");
     }
 }