예제 #1
0
        public void TabStartDrag(TabItem tab, Point mousePosition)
        {
            reorderingVisual = new DragDropTabVisual(tab);

            // set visual location and show it
            reorderingVisual.Location = GetVisualLocation(tab, mousePosition);
            reorderingVisual.Show();

            // refocus the main form
            Form parentForm = this.FindForm();

            if (parentForm != null)
            {
                parentForm.Activate();
            }

            // set the tab that is reordered
            reorderingTab = tab;
            reordering    = true;
        }
예제 #2
0
        public void TabEndDrag(TabItem tab, Point mousePosition)
        {
            if (reorderingVisual != null)
            {
                // destroy the visual
                reorderingVisual.Hide();
                reorderingVisual.Dispose();
                reorderingVisual = null;
            }

            // do the reordering
            // get the index of the tab below the mouse
            int insertIndex = GetReorderInsertLocation(tab, mousePosition);

            // get the insert direction
            lastInsertDirection = GetInsertDirection(tab, mousePosition, insertIndex);

            if (lastInsertDirection != InsertDirection.None)
            {
                if (lastInsertDirection == InsertDirection.Left)
                {
                    InsertTabAt(reorderingTab, insertIndex);
                }
                else
                {
                    InsertTabAt(reorderingTab, insertIndex + 1);
                }
            }

            reorderingTab = null;

            // remove insertion marker
            lastInsertDirection = InsertDirection.None;
            this.Invalidate();
            reordering = false;
        }
예제 #3
0
        public void TabStartDrag(TabItem tab, Point mousePosition)
        {
            reorderingVisual = new DragDropTabVisual(tab);

            // set visual location and show it
            reorderingVisual.Location = GetVisualLocation(tab, mousePosition);
            reorderingVisual.Show();

            // refocus the main form
            Form parentForm = this.FindForm();

            if(parentForm != null) {
                parentForm.Activate();
            }

            // set the tab that is reordered
            reorderingTab = tab;
            reordering = true;
        }
예제 #4
0
        public void TabEndDrag(TabItem tab, Point mousePosition)
        {
            if(reorderingVisual != null) {
                // destroy the visual
                reorderingVisual.Hide();
                reorderingVisual.Dispose();
                reorderingVisual = null;
            }

            // do the reordering
            // get the index of the tab below the mouse
            int insertIndex = GetReorderInsertLocation(tab, mousePosition);

            // get the insert direction
            lastInsertDirection = GetInsertDirection(tab, mousePosition, insertIndex);

            if(lastInsertDirection != InsertDirection.None) {
                if(lastInsertDirection == InsertDirection.Left) {
                    InsertTabAt(reorderingTab, insertIndex);
                }
                else {
                    InsertTabAt(reorderingTab, insertIndex + 1);
                }
            }

            reorderingTab = null;

            // remove insertion marker
            lastInsertDirection = InsertDirection.None;
            this.Invalidate();
            reordering = false;
        }