internal void MovePageToLeaf(TabGroupLeaf leaf) { // Remember original auto compact mode bool autoCompact = _tabbedGroups.AutoCompact; // Turn mode off as it interferes with reorganisation _tabbedGroups.AutoCompact = false; // Get the requested tab page to be moved to new leaf River.Orqa.Controls.Controls.TabPage tp = _tabControl.SelectedTab; // Remove page from ourself _tabControl.TabPages.Remove(tp); // Add into the new leaf leaf.TabPages.Add(tp); // Make new leaf the active one _tabbedGroups.ActiveLeaf = leaf; River.Orqa.Controls.Controls.TabControl tc = leaf.GroupControl as Controls.TabControl; // Select the newly added page tc.SelectedTab = tp; // Reset compacting mode as we have updated the structure _tabbedGroups.AutoCompact = autoCompact; // Do we need to compact? if (_tabbedGroups.AutoCompact) { _tabbedGroups.Compact(); } }
protected override void WndProc(ref Message msg) { // Test for the left mouse down windows message if (msg.Msg == (int)Win32.Msgs.WM_LBUTTONDOWN) { // Get access to the TabControl we are the designer for River.Orqa.Controls.Controls.TabControl tabControl = this.SelectionService.PrimarySelection as River.Orqa.Controls.Controls.TabControl; // Check we have a valid object reference if (tabControl != null) { // Extract the mouse position int xPos = (short)((uint)msg.LParam & 0x0000FFFFU); int yPos = (short)(((uint)msg.LParam & 0xFFFF0000U) >> 16); // Ask the TabControl to change tabs according to mouse message tabControl.ExternalMouseTest(msg.HWnd, new Point(xPos, yPos)); } } else { if (msg.Msg == (int)Win32.Msgs.WM_LBUTTONDBLCLK) { // Get access to the TabControl we are the designer for River.Orqa.Controls.Controls.TabControl tabControl = this.SelectionService.PrimarySelection as River.Orqa.Controls.Controls.TabControl; // Check we have a valid object reference if (tabControl != null) { // Extract the mouse position int xPos = (short)((uint)msg.LParam & 0x0000FFFFU); int yPos = (short)(((uint)msg.LParam & 0xFFFF0000U) >> 16); // Ask the TabControl to process a double click over an arrow as a simple // click of the arrow button. In which case we return immediately to prevent // the base class from using the double to generate the default event if (tabControl.WantDoubleClick(msg.HWnd, new Point(xPos, yPos))) { return; } } } } base.WndProc(ref msg); }
public WindowContentTabbed(DockingManager manager, VisualStyle vs) : base(manager, vs) { _redocker = null; _activeContent = null; // Create the TabControl used for viewing the Content windows _tabControl = new Controls.TabControl(); // It should always occupy the remaining space after all details _tabControl.Dock = DockStyle.Fill; // Show tabs only if two or more tab pages exist _tabControl.HideTabsMode = River.Orqa.Controls.Controls.TabControl.HideTabsModes.HideUsingLogic; // Hook into the TabControl notifications _tabControl.GotFocus += new EventHandler(OnTabControlGotFocus); _tabControl.LostFocus += new EventHandler(OnTabControlLostFocus); _tabControl.PageGotFocus += new EventHandler(OnTabControlGotFocus); _tabControl.PageLostFocus += new EventHandler(OnTabControlLostFocus); _tabControl.SelectionChanged += new EventHandler(OnSelectionChanged); _tabControl.PageDragStart += new MouseEventHandler(OnPageDragStart); _tabControl.PageDragMove += new MouseEventHandler(OnPageDragMove); _tabControl.PageDragEnd += new MouseEventHandler(OnPageDragEnd); _tabControl.PageDragQuit += new MouseEventHandler(OnPageDragQuit); _tabControl.DoubleClickTab += new Controls.TabControl.DoubleClickTabHandler(OnDoubleClickTab); _tabControl.Font = manager.TabControlFont; _tabControl.BackColor = manager.BackColor; _tabControl.ForeColor = manager.InactiveTextColor; // Define the visual style required _tabControl.Style = vs; // Allow developers a chance to override default settings manager.OnTabControlCreated(_tabControl); switch (vs) { case VisualStyle.IDE: Controls.Add(_tabControl); break; case VisualStyle.Plain: // Only the border at the pages edge and not around the whole control _tabControl.InsetBorderPagesOnly = !_manager.PlainTabBorder; // We want a border around the TabControl so it is indented and looks consistent // with the Plain look and feel, so use the helper Control 'BorderForControl' BorderForControl bfc = new BorderForControl(_tabControl, _plainBorder); // It should always occupy the remaining space after all details bfc.Dock = DockStyle.Fill; // Define the default border border bfc.BackColor = _manager.BackColor; // When in 'VisualStyle.Plain' we need to Controls.Add(bfc); break; } // Need to hook into message pump so that the ESCAPE key can be // intercepted when in redocking mode Application.AddMessageFilter(this); }