コード例 #1
0
        protected override bool OnDragDrop(Gdk.DragContext context, int x, int y, uint time_)
        {
            y = TranslateToListY(y);
            if (Gtk.Drag.GetSourceWidget(context) == this)
            {
                PlaylistSource playlist = ServiceManager.SourceManager.ActiveSource as PlaylistSource;
                if (playlist != null)
                {
                    //Gtk.Drag.
                    int row = GetRowAtY(y);
                    if (row != GetRowAtY(y + RowHeight / 2))
                    {
                        row += 1;
                    }

                    if (playlist.TrackModel.Selection.Contains(row))
                    {
                        // can't drop within the selection
                        return(false);
                    }

                    playlist.ReorderSelectedTracks(row);
                    return(true);
                }
            }

            return(false);
        }