コード例 #1
0
ファイル: Literal.cs プロジェクト: Yetangitu/f-spot
        void HandleDragBegin(object sender, DragBeginArgs args)
        {
            Gtk.Drag.SetIconPixbuf (args.Context, image.Pixbuf, 0, 0);

            focusedLiterals.Add (this);

            // Hide the tag and any separators that only exist because of it
            container.Visible = false;
            hiddenWidgets.Add (container);
            foreach (Widget w in LogicWidget.Box.HangersOn (this)) {
                hiddenWidgets.Add (w);
                w.Visible = false;
            }
        }
コード例 #2
0
 private void OnDragBegin( object sender, DragBeginArgs args )
 {
     drag_buffer = getSelectedIndexes();
 }
コード例 #3
0
	//
	// IconView Drag Handlers
	//

	void HandleIconViewDragBegin (object sender, DragBeginArgs args)
	{
		Photo [] photos = SelectedPhotos ();
		
		if (photos.Length > 0) {
			int len = Math.Min (photos.Length, 4);
			int size = 48;
			int border  = 2;
			int csize = size/2 + len * size / 2 + 2 * border ;
			
			Pixbuf container = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, csize, csize);
			container.Fill (0x00000000);

			bool use_icon = false;;
			while (len-- > 0) {
				string thumbnail_path = FSpot.ThumbnailGenerator.ThumbnailPath (photos [len].DefaultVersionUri);
				FSpot.PixbufCache.CacheEntry entry = icon_view.Cache.Lookup (thumbnail_path);

				Pixbuf thumbnail = null;
				if (entry != null) {
					if (FSpot.ColorManagement.IsEnabled) {
						//FIXME
						thumbnail = entry.ShallowCopyPixbuf ();
						thumbnail = thumbnail.Copy ();
						FSpot.ColorManagement.ApplyScreenProfile (thumbnail);
					}
					else
						thumbnail = entry.ShallowCopyPixbuf ();
				}
				
				if (thumbnail != null) {
					Pixbuf small = PixbufUtils.ScaleToMaxSize (thumbnail, size, size);				

					int x = border + len * (size/2) + (size - small.Width)/2;
					int y = border + len * (size/2) + (size - small.Height)/2;
					Pixbuf box = new Pixbuf (container, x - border, y - border, 
								 small.Width + 2 * border, small.Height + 2 * border);

					box.Fill (0x000000ff);
					small.CopyArea (0, 0, small.Width, small.Height, container, x, y); 
					
					thumbnail.Dispose ();
					small.Dispose ();
					use_icon = true;
				}
			}
			if (use_icon)
				Gtk.Drag.SetIconPixbuf (args.Context, container, 0, 0);
			container.Dispose ();
		}
	}
コード例 #4
0
	void HandleTagSelectionDragBegin (object sender, DragBeginArgs args)
	{
		Tag [] tags = tag_selection_widget.TagHighlight;
		int len = tags.Length;
		int size = 32;
		int csize = size/2 + len * size / 2 + 2;
		
		Pixbuf container = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, csize, csize);
		container.Fill (0x00000000);
		
		bool use_icon = false;;
		while (len-- > 0) {
			Pixbuf thumbnail = tags[len].Icon;
			
			if (thumbnail != null) {
				Pixbuf small = PixbufUtils.ScaleToMaxSize (thumbnail, size, size);				
				
				int x = len * (size/2) + (size - small.Width)/2;
				int y = len * (size/2) + (size - small.Height)/2;

				small.Composite (container, x, y, small.Width, small.Height, x, y, 1.0, 1.0, Gdk.InterpType.Nearest, 0xff);
				small.Dispose ();

				use_icon = true;
			}
		}
		if (use_icon)
			Gtk.Drag.SetIconPixbuf (args.Context, container, 0, 0);
		container.Dispose ();
	}
コード例 #5
0
ファイル: BugsViewWidget.cs プロジェクト: slluis/bugziller
 void HandleBugsListDragBegin(object o, DragBeginArgs args)
 {
     draggedBugs = GetSelection ();
 }
コード例 #6
0
		/// <summary>
		/// Emitted on the drag source when drag is started
		/// </summary>
		void HandleDragBegin (object o, DragBeginArgs args)
		{
			Owner.CursorTracker.RequestHighResolution (this);
			InternalDragActive = true;
			Keyboard.Grab (Owner.GdkWindow, true, Gtk.Global.CurrentEventTime);
			drag_canceled = false;
			
			if (proxy_window != null) {
				EnableDragTo ();
				proxy_window = null;
			}
			
			Gdk.Pixbuf pbuf;
			drag_item = Owner.HoveredItem;
			original_item_pos.Clear ();
			
			// If we are in Reposition Mode or over a non-draggable item
			// dont drag it!
			if (drag_item is INonPersistedItem || RepositionMode)
				drag_item = null;
			
			if (drag_item != null) {
				foreach (AbstractDockItem adi in ProviderForItem (drag_item).Items)
					original_item_pos [adi] = adi.Position;
				
				using (DockySurface surface = new DockySurface ((int) (1.2 * Owner.ZoomedIconSize), (int) (1.2 * Owner.ZoomedIconSize))) {
					pbuf = Owner.HoveredItem.IconSurface (surface, (int) (1.2 * Owner.ZoomedIconSize), Owner.IconSize, 0).LoadToPixbuf ();
				}
			} else {
				pbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
			}
			
			Gtk.Drag.SetIconPixbuf (args.Context, pbuf, pbuf.Width / 2, pbuf.Height / 2);
			pbuf.Dispose ();
			
			// Set up a cursor tracker so we can move the window on the fly
			if (RepositionMode)
				Owner.CursorTracker.CursorPositionChanged += HandleCursorPositionChanged;
		}
コード例 #7
0
		protected void HandleDragBegin(object o, DragBeginArgs args)
		{
			Gdk.Pixbuf dragpic = GetDragPixbuf();
			Gtk.Drag.SetIconPixbuf (args.Context, dragpic, 0, 0);
			StoreBuffer();
		}
コード例 #8
0
ファイル: ImagesFileView.cs プロジェクト: GNOME/mistelix
 void HandleDragBegin(object sender, DragBeginArgs args)
 {
     Logger.Debug ("ImagesFileView.HandleDragBegin");
 }
コード例 #9
0
    private void OnDragBegin(object o, DragBeginArgs args)
    {
        if (SelectedObjectNr > -1){
            draggedID = SelectedObjectNr;
            draggedBadguy = badguys[SelectedObjectNr];
            Gtk.Drag.SetIconWidget( args.Context, SpriteViewWidget.CreateWindow(badguySprites[draggedBadguy]), -15, -15);

            dragging = true;
        }
        //update heigth
        SetSizeRequest( -1, ROW_HEIGHT * ((badguys.Count - 1) / TILES_PER_ROW + 1));
        LogManager.Log(LogLevel.Debug, "Dragstart of " + draggedBadguy);
    }
コード例 #10
0
ファイル: DeskFlickrUI.cs プロジェクト: joshuacox/dfo
 private void BeginDragSetIcon(object o, DragBeginArgs args)
 {
     TreePath path = treeview2.Selection.GetSelectedRows()[0];
       Photo p = GetPhoto(path);
       Drag.SetIconPixbuf(args.Context, p.Thumbnail, 0, 0);
 }
コード例 #11
0
 private void OnDragBegin(object o, DragBeginArgs args)
 {
     Gtk.Drag.SetIconWidget( args.Context, SpriteViewWidget.CreateWindow(gameObjectSprites[SelectedObjectNr]), -15, -15);
     LogManager.Log(LogLevel.Debug, "Dragstart");
 }
コード例 #12
0
ファイル: ProjectView.cs プロジェクト: Zodge/MonoGame
        void Treeview1_DragBegin (object o, DragBeginArgs args)
        {
            List<string> ids;
            GetSelectedTreePath(out siters, out ids);

            if (siters.Contains(GetBaseIter()))
                siters = new List<TreeIter>();
        }
コード例 #13
0
ファイル: Tree.cs プロジェクト: MonoBrasil/historico
 //PREVIEW!!
 private void Drag_Begin(object o, DragBeginArgs args)
 {
     Gdk.Pixbuf icon = MonoUML.IconLibrary.PixbufLoader.GetIconDnD ("unknown_dnd");
     object element = GetSelectedElement();
     object modifiedElement = element;
     DI.Diagram diagram;
     DI.GraphElement graphElement;
     UML.NamedElement umlNamedElement;
     if ((diagram = element as DI.Diagram) != null)
     {
         icon = MonoUML.IconLibrary.PixbufLoader.GetIconDnD ("no_dnd");
         System.Console.WriteLine ("diagram");
     }
     else if ((graphElement = element as DI.GraphElement) != null)
     {
         Uml2SemanticModelBridge bridge = graphElement.SemanticModel as Uml2SemanticModelBridge;
         if (bridge != null)
         {
             if((umlNamedElement = bridge.Element as UML.NamedElement) != null)
             {
                 icon = MonoUML.IconLibrary.PixbufLoader.GetIconDnD ("no_dnd");
                 System.Console.WriteLine ("DI.GraphElement");
                 //umlNamedElement.Name = newName;
                 //modifiedElement = umlNamedElement;
             }
         }
     }
     else if ((umlNamedElement = element as UML.NamedElement) != null)
     {
         string label, elementType, iconName;
         GetLabelAndType (umlNamedElement, out label, out elementType);
         iconName = elementType.ToLower() + "_dnd.png";
         icon = MonoUML.IconLibrary.PixbufLoader.GetIcon (iconName);
         System.Console.WriteLine ("umlNamedElement");
         Hub.Instance.DraggedElement = umlNamedElement;
         //umlNamedElement.Name = newName;
     }
     Gtk.Drag.SetIconPixbuf (args.Context, icon , 0, 0);
 }
コード例 #14
0
        protected void OnDrawCupboardDragBegin(object o, DragBeginArgs args)
        {
            int MousePosX, MousePosY;
            drawCupboard.GetPointer(out MousePosX, out MousePosY);

            int CubePosX = (MousePosX - OrderCupboard.CupboardZeroX) / CubePxSize;
            int CubePosY = (MousePosY - OrderCupboard.CupboardZeroY) / CubePxSize;
            Cube cube = OrderCupboard.GetCube(CubePosX, CubePosY);

            if(cube == null) {
                args.RetVal = false;
                Gdk.Drag.Abort(args.Context, args.Context.StartTime);
                return;
            }

            Pixmap pix = new Pixmap(drawCupboard.GdkWindow, cube.CubesH * CubePxSize, cube.CubesV * CubePxSize);

            using (Context cr = Gdk.CairoHelper.Create(pix)) {
                cube.DrawCube(cr, CubePxSize, true);
            }
            Gdk.Pixbuf pixbuf = Gdk.Pixbuf.FromDrawable(pix, Gdk.Colormap.System, 0, 0, 0, 0, cube.CubesH * CubePxSize, cube.CubesV * CubePxSize);
            CurrentDrag.IconPosX = MousePosX - OrderCupboard.CupboardZeroX - (cube.BoardPositionX * CubePxSize);
            CurrentDrag.IconPosY = MousePosY - OrderCupboard.CupboardZeroY - (cube.BoardPositionY * CubePxSize);

            Gtk.Drag.SetIconPixbuf(args.Context, pixbuf, CurrentDrag.IconPosX, CurrentDrag.IconPosY);
            CurrentDrag.FromList = false;
            CurrentDrag.cube = cube;
        }
コード例 #15
0
 private void OnDragBegin(object o, DragBeginArgs args)
 {
     Console.WriteLine("Dragstart");
 }
コード例 #16
0
ファイル: LdapTreeView.cs プロジェクト: MrJoe/lat
 public void OnDragBegin(object o, DragBeginArgs args)
 {
     Gdk.Pixbuf pb = Pixbuf.LoadFromResource ("text-x-generic.png");
     Gtk.Drag.SetIconPixbuf (args.Context, pb, 0, 0);
 }
コード例 #17
0
ファイル: MainWindow.cs プロジェクト: mono/f-spot
		public void HandleIconViewDragBegin (object sender, DragBeginArgs args)
		{
			Photo[] photos = SelectedPhotos ();

			if (photos.Length > 0) {
				int len = Math.Min (photos.Length, 4);
				int size = 48;
				int border = 2;
				int csize = size / 2 + len * size / 2 + 2 * border;

				Pixbuf container = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, csize, csize);
				container.Fill (0x00000000);

				bool use_icon = false;
				;
				while (len-- > 0) {
					FSpot.PixbufCache.CacheEntry entry = icon_view.Cache.Lookup (photos [len].DefaultVersion.Uri);

					Pixbuf thumbnail = null;
					if (entry != null) {
						Cms.Profile screen_profile;
						if (FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
							thumbnail = entry.Pixbuf.Copy ();
							FSpot.ColorManagement.ApplyProfile (thumbnail, screen_profile);
						} else
							thumbnail = entry.ShallowCopyPixbuf ();
					}

					if (thumbnail != null) {
						Pixbuf small = thumbnail.ScaleToMaxSize (size, size);

						int x = border + len * (size / 2) + (size - small.Width) / 2;
						int y = border + len * (size / 2) + (size - small.Height) / 2;
						Pixbuf box = new Pixbuf (container, x - border, y - border,
							             small.Width + 2 * border, small.Height + 2 * border);

						box.Fill (0x000000ff);
						small.CopyArea (0, 0, small.Width, small.Height, container, x, y);

						thumbnail.Dispose ();
						small.Dispose ();
						use_icon = true;
					}
				}
				if (use_icon)
					Gtk.Drag.SetIconPixbuf (args.Context, container, 0, 0);
				container.Dispose ();
			}
		}
コード例 #18
0
ファイル: ExplorerView.cs プロジェクト: hut104/ApsimX
 /// <summary>Node has begun to be dragged.</summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event data.</param>
 private void OnDragBegin(object sender, DragBeginArgs e)
 {
     DragStartArgs args = new DragStartArgs();
     args.NodePath = SelectedNode; //  FullPath(e.Item as TreeNode);
     if (DragStarted != null)
     {
         DragStarted(this, args);
         if (args.DragObject != null)
         {
             sourcePathOfItemBeingDragged = args.NodePath;
             dragSourceHandle = GCHandle.Alloc(args.DragObject);
         }
     }
 }
コード例 #19
0
ファイル: DocumentIconView.cs プロジェクト: GNOME/pdfmod
 void HandleDragBegin (object o, DragBeginArgs args)
 {
     // Set the drag icon, otherwise it will be a whole page cell rendering,
     // which can be quite large and obscure the drop points
     bool single = SelectedItems.Length == 1;
     Gtk.Drag.SetIconStock (args.Context, single ? Stock.Dnd : Stock.DndMultiple, 0, 0);
 }