public TabGroupLeaf(TabbedGroups tabbedGroups, TabGroupBase parent)
            : base(tabbedGroups, parent)
        {
            // Create our managed tab control instance
            _tabControl = new Controls.TabControl();

            // We need page drag to begin when mouse dragged a small distance
            _tabControl.DragFromControl = false;

            // We need to monitor attempts to drag into the tab control
            _dragEntered = false;
            _tabControl.AllowDrop = true;
            _tabControl.DragDrop += new DragEventHandler(OnControlDragDrop);
            _tabControl.DragEnter += new DragEventHandler(OnControlDragEnter);
            _tabControl.DragLeave += new EventHandler(OnControlDragLeave);

            // Need notification when page drag begins
            _tabControl.PageDragStart += new MouseEventHandler(OnPageDragStart);
            _tabControl.PageDragMove += new MouseEventHandler(OnPageDragMove);
            _tabControl.PageDragEnd += new MouseEventHandler(OnPageDragEnd);
            _tabControl.PageDragQuit += new MouseEventHandler(OnPageDragQuit);

            // Hook into tab page collection events
            _tabControl.TabPages.Cleared += new CollectionClear(OnTabPagesCleared);
            _tabControl.TabPages.Inserted += new CollectionChange(OnTabPagesInserted);
            _tabControl.TabPages.Removed += new CollectionChange(OnTabPagesRemoved);

            // Hook into page level events
            _tabControl.GotFocus += new EventHandler(OnGainedFocus);
            _tabControl.PageGotFocus += new EventHandler(OnGainedFocus);
            _tabControl.ClosePressed += new EventHandler(OnClose);

            // Manager only created at start of drag operation
            _targetManager = null;

            DefinePopupMenuForControl(_tabControl);

            // Setup the correct 'HideTabsMode' for the control
            Notify(TabGroupBase.NotifyCode.DisplayTabMode);

            // Define the default setup of TabControl and allow developer to customize
            _tabbedGroups.OnTabControlCreated(_tabControl);
        }
        protected void OnPageDragStart(object sender, MouseEventArgs e)
        {
            // Save the current cursor value
            _savedCursor = _tabControl.Cursor;

            // Manager will create hot zones and draw dragging rectangle
            _targetManager = new TargetManager(_tabbedGroups, this, _tabControl);
        }
Beispiel #3
0
        protected void OnPageDragStart(object sender, MouseEventArgs e)
        {
            // Cannot drag tab pages when the layout is locked
            if (!_tabbedGroups.LayoutLock)
            {
                // Save the current cursor value
                _savedCursor = _tabControl.Cursor;

                // Manager will create hot zones and draw dragging rectangle
                _targetManager = new TargetManager(_tabbedGroups, this, _tabControl);
            }
        }
        protected void OnPageDragQuit(object sender, MouseEventArgs e)
        {
            // Give manager chance to cleanup
            _targetManager.Quit();

            // No longer need the manager
            _targetManager = null;

            // Restore the original cursor
            _tabControl.Cursor = _savedCursor;
        }
Beispiel #5
0
        protected void OnPageDragQuit(object sender, MouseEventArgs e)
        {
            // Cannot drag tab pages when the layout is locked
            if (!_tabbedGroups.LayoutLock)
            {
                // Give manager chance to cleanup
                _targetManager.Quit();

                // No longer need the manager
                _targetManager = null;

                // Restore the original cursor
                _tabControl.Cursor = _savedCursor;
            }
        }