Пример #1
0
        private int GetInsertionIndex(TreeViewDropPosition pos, ref T group)
        {
            int insertionIndex = group.Children.Count;

            switch (pos)
            {
            case TreeViewDropPosition.Before:
                if (group.Parent == null)
                {
                    insertionIndex = groups.IndexOf(group);
                    group          = null;
                }
                else
                {
                    insertionIndex = group.Parent.Children.IndexOf(group);
                    group          = group.Parent;
                }
                break;

            case TreeViewDropPosition.After:
                if (group.Parent == null)
                {
                    insertionIndex = Math.Min(groups.Count, groups.IndexOf(group) + 1);
                    group          = null;
                }
                else
                {
                    insertionIndex = Math.Min(group.Parent.Children.Count, group.Parent.Children.IndexOf(group) + 1);
                    group          = group.Parent;
                }
                break;
            }
            return(insertionIndex);
        }
Пример #2
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;
            }
        }
Пример #3
0
 void DisableDragInto(TreePath path, DragContext context, uint time, TreeViewDropPosition pos)
 {
     if (pos == TreeViewDropPosition.IntoOrAfter)
     {
         pos = TreeViewDropPosition.After;
     }
     else if (pos == TreeViewDropPosition.IntoOrBefore)
     {
         pos = TreeViewDropPosition.Before;
     }
     SetDragDestRow(path, pos);
     Gdk.Drag.Status(context, context.SuggestedAction, time);
 }
Пример #4
0
        protected TViewModel GetTimelineAtPosition(int x, int y, out TreeIter iter, out TreeViewDropPosition pos)
        {
            TreePath path;

            GetDestRowAtPos(x, y, out path, out pos);

            if (path == null)
            {
                iter = TreeIter.Zero;
                pos  = TreeViewDropPosition.After;
                return(null);
            }
            Model.GetIter(out iter, path);
            var timeline = Model.GetValue(iter, COL_DATA) as TViewModel;

            iter = ConvertToRootIter(iter);
            return(timeline);
        }
Пример #5
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 before, after, or into another tag
            if (args.Context.Targets[0].Name == "application/x-fspot-tags")
            {
                Gdk.Rectangle rect = GetCellArea(path, 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;
                }
            }

            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;
            }
        }
Пример #6
0
 void DisableDragInto(TreePath path, DragContext context, uint time, TreeViewDropPosition pos)
 {
     if (pos == TreeViewDropPosition.IntoOrAfter) {
         pos = TreeViewDropPosition.After;
     } else if (pos == TreeViewDropPosition.IntoOrBefore) {
         pos = TreeViewDropPosition.Before;
     }
     SetDragDestRow (path, pos);
     dropPos = pos;
     Gdk.Drag.Status (context, context.SuggestedAction, time);
 }
Пример #7
0
 public void Insert
     (IntPtr handle, IntPtr ins, TreeViewDropPosition pos)
 {
     pointer_list_model_insert(Raw, handle, ins, (uint)pos);
 }