Пример #1
0
        void HandleHoveredItemChanged(object sender, HoveredItemChangedArgs e)
        {
            if (InternalDragActive && DragItemsCanInteract(drag_item, Owner.HoveredItem))
            {
                int destPos = Owner.HoveredItem.Position;

                // drag right
                if (drag_item.Position < destPos)
                {
                    foreach (AbstractDockItem adi in ProviderForItem(drag_item).Items
                             .Where(i => i.Position > drag_item.Position && i.Position <= destPos))
                    {
                        adi.Position--;
                    }
                    // drag left
                }
                else if (drag_item.Position > destPos)
                {
                    foreach (AbstractDockItem adi in ProviderForItem(drag_item).Items
                             .Where(i => i.Position < drag_item.Position && i.Position >= destPos))
                    {
                        adi.Position++;
                    }
                }
                drag_item.Position = destPos;

                Owner.UpdateCollectionBuffer();
                Owner.Preferences.SyncPreferences();
            }

            if (drag_hover_timer > 0)
            {
                GLib.Source.Remove(drag_hover_timer);
                drag_hover_timer = 0;
            }

            if (ExternalDragActive && drag_data != null)
            {
                drag_hover_timer = GLib.Timeout.Add(1500, delegate {
                    AbstractDockItem item = Owner.HoveredItem;
                    if (item != null)
                    {
                        item.Scrolled(ScrollDirection.Down, Gdk.ModifierType.None);
                    }
                    return(true);
                });
            }
        }
Пример #2
0
		void HandleHoveredItemChanged (object sender, HoveredItemChangedArgs e)
		{
			if (InternalDragActive && DragItemsCanInteract (drag_item, Owner.HoveredItem)) {
				int destPos = Owner.HoveredItem.Position;
				
				// drag right
				if (drag_item.Position < destPos) {
					foreach (AbstractDockItem adi in ProviderForItem (drag_item).Items
								.Where (i => i.Position > drag_item.Position && i.Position <= destPos))
						adi.Position--;
				// drag left
				} else if (drag_item.Position > destPos) {
					foreach (AbstractDockItem adi in ProviderForItem (drag_item).Items
								.Where (i => i.Position < drag_item.Position && i.Position >= destPos))
						adi.Position++;
				}
				drag_item.Position = destPos;
				
				Owner.UpdateCollectionBuffer ();
				Owner.Preferences.SyncPreferences ();
			}
			
			if (drag_hover_timer > 0) {
				GLib.Source.Remove (drag_hover_timer);
				drag_hover_timer = 0;
			}
			
			if (ExternalDragActive && drag_data != null)
				drag_hover_timer = GLib.Timeout.Add (1500, delegate {
					AbstractDockItem item = Owner.HoveredItem;
					if (item != null)
						item.Scrolled (ScrollDirection.Down, Gdk.ModifierType.None);
					return true;
				});
		}