Esempio n. 1
0
        static void OnSwDragMotion(object o, Gtk.DragMotionArgs args)
        {
            ScrolledWindow sw = (ScrolledWindow)o;

            int w = sw.Allocation.Width;
            int h = sw.Allocation.Height;

            ScrollAdjustment(sw.Vadjustment, args.Y, h);
            ScrollAdjustment(sw.Hadjustment, args.X, w);
        }
	public void HandleTagSelectionDragMotion (object o, DragMotionArgs args)
	{
		TreePath path;
        TreeViewDropPosition position = TreeViewDropPosition.IntoOrAfter;
		tag_selection_widget.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 = tag_selection_widget.GetCellArea(path, tag_selection_widget.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;
            }
        }

		tag_selection_widget.SetDragDestRow (path, position);

		// Scroll if within 20 pixels of the top or bottom of the tag list
		if (args.Y < 20)
			tag_selection_scrolled.Vadjustment.Value -= 30;
        else if (((o as Gtk.Widget).Allocation.Height - args.Y) < 20)
			tag_selection_scrolled.Vadjustment.Value += 30;
	}
Esempio n. 3
0
		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 into another tag
			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;
		}
		/// <summary>
		/// Emitted on drop site.
		/// Set RetVal == cursor is over drop zone
		/// if (RetVal) Gdk.Drag.Status, unless the decision cannot be made, in which case it may be defered by
		/// a get data call
		/// </summary>
		void HandleDragMotion (object o, DragMotionArgs args)
		{
			if (RepositionMode)
				return;
			
			ExternalDragActive = !InternalDragActive;
			Owner.UpdateHoverText ();
			Owner.SetTooltipVisibility ();
			
			if (marker != args.Context.GetHashCode ()) {
				marker = args.Context.GetHashCode ();
				drag_known = false;
			}
			
			// we own the drag if InternalDragActive is true, lets not be silly
			if (!drag_known && !InternalDragActive) {
				drag_known = true;
				Gdk.Atom atom = Gtk.Drag.DestFindTarget (Owner, args.Context, null);
				if (atom != null) {
					Gtk.Drag.GetData (Owner, args.Context, atom, args.Time);
					drag_data_requested = true;
				} else {
					Gdk.Drag.Status (args.Context, DragAction.Private, args.Time);
				}
			} else {
				Gdk.Drag.Status (args.Context, DragAction.Copy, args.Time);
			}
			args.RetVal = true;
		}
Esempio n. 5
0
 public static void SetAllowDragAction(this DragMotionArgs args, DragAction action)
 {
     Gdk.Drag.Status(args.Context, action, args.Time);
 }
Esempio n. 6
0
        /// <summary>Node has been dragged over another node. Allow a drop here?</summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event data.</param>
        private void OnDragOver(object sender, DragMotionArgs e)
        {
            //e.Effect = DragDropEffects.None;
            e.RetVal = false;

            // Get the drop location
            TreePath path;
            TreeIter dest;
            if (treeview1.GetPathAtPos(e.X, e.Y, out path) && treemodel.GetIter(out dest, path))
            {
                AllowDropArgs Args = new AllowDropArgs();
                Args.NodePath = FullPath(path);
                Drag.GetData(treeview1, e.Context, e.Context.Targets[0], e.Time);
                if (DragDropData != null)
                {
                    Args.DragObject = DragDropData;
                    if (AllowDrop != null)
                    {
                        AllowDrop(this, Args);
                        if (Args.Allow)
                        {
                            e.RetVal = true;
                            string SourceParent = null;
                            if (sourcePathOfItemBeingDragged != null)
                                SourceParent = StringUtilities.ParentName(sourcePathOfItemBeingDragged);

                            // Now determine the effect. If the drag originated from a different view
                            // (e.g. a toolbox or another file) then only copy is supported.
                            if (sourcePathOfItemBeingDragged == null)
                                Gdk.Drag.Status(e.Context, Gdk.DragAction.Copy, e.Time);
                            else if (SourceParent == Args.NodePath)
                                Gdk.Drag.Status(e.Context, Gdk.DragAction.Copy, e.Time);
                            else
                            // The "SuggestedAction" will normally be Copy, but will be Move
                            // if shift is pressed, and Link if Ctrl-Shift is pressed
                                Gdk.Drag.Status(e.Context, e.Context.SuggestedAction, e.Time);

                        }
                        else
                            Gdk.Drag.Status(e.Context, 0, e.Time);
                    }
                }
            }
        }
Esempio n. 7
0
        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;
        }
Esempio n. 8
0
 protected void OnDrawCupboardDragMotion(object o, DragMotionArgs args)
 {
     logger.Debug ("Drag motion x={0} y={1}", args.X, args.Y);
     int CubePosX = (args.X + (int)(CubePxSize * 1.5) - CurrentDrag.IconPosX - OrderCupboard.CupboardZeroX) / CubePxSize;
     int CubePosY = (args.Y + (int)(CubePxSize * 1.5) - CurrentDrag.IconPosY - OrderCupboard.CupboardZeroY) / CubePxSize;
     //Для того что бы корректно посчитать 0 ячейку добавли 1, сейчас онимаем.
     CubePosX--; CubePosY--;
     logger.Debug ("CupBoard pos x={0} y={1}", CubePosX, CubePosY);
     bool CanDrag = OrderCupboard.TestPutCube(CurrentDrag.cube, CubePosX, CubePosY);
     if (CanDrag)
         Gdk.Drag.Status(args.Context, args.Context.SuggestedAction,	args.Time);
     else
         Gdk.Drag.Status(args.Context, Gdk.DragAction.Private, args.Time);
     args.RetVal = true;
 }
Esempio n. 9
0
	private static void HandlePopsiteMotion (object sender, DragMotionArgs args)
	{
		if (popup_timer == 0)
			popup_timer = GLib.Timeout.Add (500, new TimeoutHandler (HandlePopupCallback));

		args.RetVal = true;
	}
	public void HandleTagSelectionDragMotion (object o, DragMotionArgs args)
	{
		TreePath path;

		if (!tag_selection_widget.GetPathAtPos (args.X, args.Y, out path))
			return;

		tag_selection_widget.SetDragDestRow (path, Gtk.TreeViewDropPosition.IntoOrAfter);

		//Scroll if required
		if (args.Y < 20)
			tag_selection_scrolled.Vadjustment.Value -= 30;
		if (((o as Gtk.Widget).Allocation.Height - args.Y) < 20)
			tag_selection_scrolled.Vadjustment.Value += 30;
	}
Esempio n. 11
0
	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;
	}
Esempio n. 12
0
	private static void HandleTargetDragMotion (object sender, DragMotionArgs args)
	{
		if (! have_drag) {
			have_drag = true;
			// FIXME?  Kinda wonky binding.
			(sender as Gtk.Image).FromPixbuf = 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.Targets;
		foreach (Atom a in targets)
			Console.WriteLine (a.Name); 

		Gdk.Drag.Status (args.Context, args.Context.SuggestedAction, args.Time);
		args.RetVal = true;
	}
 private void OnDragMotion(object o, DragMotionArgs args)
 {
     System.Console.WriteLine("Motion: " + args.X + " - " + args.Y);
     //Console.WriteLine("Blup: " + args.Context
 }
	void HandlePhotoViewDragMotion (object sender, DragMotionArgs args)
	{
		//Widget source = Gtk.Drag.GetSourceWidget (args.Context);
		//Console.WriteLine ("Drag Motion {0}", source == null ? "null" : source.TypeName);

		Gdk.Drag.Status (args.Context, args.Context.SuggestedAction, args.Time);
		args.RetVal = true;
	}
    private void OnDragMotion(object o, DragMotionArgs args)
    {
        dragging = true;

        Vector MousePos = new Vector((float) args.X - BORDER_LEFT + TILE_WIDTH / 2, (float) args.Y);
        int row = (int) Math.Floor( MousePos.Y / ROW_HEIGHT );
        int column = (int) Math.Floor (MousePos.X / COLUMN_WIDTH);
        insertOnEnd = ( column >= TILES_PER_ROW );	//This is true on every end of line
        int selected = TILES_PER_ROW * row + column;
        if( selected  > badguys.Count )
            selected = badguys.Count;
        if( SelectedObjectNr != selected ){
            SelectedObjectNr = selected;
            QueueDraw();		//redraw on any change of selected ID
        }
    }
Esempio n. 16
0
        void HandleDragMotion(object o, DragMotionArgs args)
        {
            if (preview)
                return;

            if (preview_widget == null) {
                preview_widget = new Gtk.Label (" | ");
                box.Add (preview_widget);
            }

            preview_widget.Show ();
        }
Esempio n. 17
0
 private void OnDragMotion(object o, DragMotionArgs args)
 {
     //pass motion event to editor
     if(Editor != null) {
         MousePos = MouseToWorld(new Vector((float) args.X, (float) args.Y));
         Editor.OnMouseMotion(MousePos, ModifierType.Button1Mask);
     }
 }
Esempio n. 18
0
 private void OnIconViewDragMotion(object o, DragMotionArgs args)
 {
     Gdk.Drag.Status(args.Context, args.Context.SuggestedAction, args.Time);
        args.RetVal = true;
 }
Esempio n. 19
0
		void HandleIconViewDragMotion (object sender, DragMotionArgs args)
		{
			Gdk.Drag.Status (args.Context, args.Context.SuggestedAction, args.Time);
			args.RetVal = true;
		}
Esempio n. 20
0
 private void OnIconViewDragMotion(object o, DragMotionArgs args)
 {
     Console.WriteLine("iFolderWindow.OnIconViewDragMotion()");
        Gdk.Drag.Status(args.Context, args.Context.SuggestedAction, args.Time);
        args.RetVal = true;
 }
Esempio n. 21
0
 protected void OnImageDocDragMotion(object o, DragMotionArgs args)
 {
     Console.WriteLine ("x={0} y={1}", args.X, args.Y);
 }
Esempio n. 22
0
 private void HandleDragMotion(object o, DragMotionArgs args)
 {
     if (!preview && rootTerm.Count > 0 && (Literal.FocusedLiterals.Count == 0 || Children.Length > 2)) {
         Preview ();
         preview = true;
     }
 }
Esempio n. 23
0
 void HandleBugsListDragMotion(object o, DragMotionArgs args)
 {
     if (draggedBugs != null) {
         if (!CheckAndDrop (args.X, args.Y, false, args.Context)) {
             Gdk.Drag.Status (args.Context, (Gdk.DragAction)0, args.Time);
             args.RetVal = true;
         }
     }
 }