private void OnPageMoved(Crownwood.DotNetMagic.Controls.TabControl sender, Crownwood.DotNetMagic.Controls.TabPage page, int newIndex) { // Get the content for the page Content c = page.Tag as Content; // Move the content to reflect its matching page position Contents.SetIndex(newIndex, c); // Find its index position within the docking manager collection int cIndex = DockingManager.Contents.IndexOf(c); // Default to placing at its current position int reIndex = cIndex; // Search for each of the contents before the moved page for (int i = 0; i < newIndex; i++) { // Grab content to from required page Content search = sender.TabPages[i].Tag as Content; // Find position of content in collection int sIndex = DockingManager.Contents.IndexOf(search); // Ensure content is placed after all the contents before it in tab control if (sIndex > reIndex) { reIndex = sIndex; } } // Set new position of content to ensure it persists correctly DockingManager.Contents.SetIndex(reIndex, c); }
private void OnPageDragStart(Crownwood.DotNetMagic.Controls.TabControl sender, Crownwood.DotNetMagic.Controls.TabPage movePage, MouseEventArgs e) { // Is the user allowed to redock? if (DockingManager.AllowRedocking) { // Use allow to redock this particular content? if (this.RedockAllowed) { // Event page must specify its Content object Content c = movePage.Tag as Content; // Remember the position of the tab before it is removed _dragPageIndex = _tabControl.TabPages.IndexOf(movePage); // Force the entire window to redraw to ensure the Redocker does not start drawing // the XOR indicator before the window repaints itself. Otherwise the repainted // control will interfere with the XOR indicator. this.Refresh(); // Start redocking activity for the single Content of this WindowContent _redocker = Redocker.CreateRedocker(DockingManager.FeedbackStyle, _tabControl, c, this, new Point(e.X, e.Y)); } } }
/// <summary> /// Called to initialize a <see cref="Crownwood.DotNetMagic.Controls.TabControl"/>. Override /// this method to perform custom initialization. /// </summary> /// <param name="tabControl"></param> protected virtual void InitializeTabControl(Crownwood.DotNetMagic.Controls.TabControl tabControl) { if (tabControl == null) { return; } tabControl.TextTips = true; tabControl.ToolTips = false; tabControl.MaximumHeaderWidth = 256; }
private void OnPageDragQuit(Crownwood.DotNetMagic.Controls.TabControl sender, MouseEventArgs e) { // Are we currently in a redocking state? if (_redocker != null) { // Get redocker to quit _redocker.QuitTrackingMode(e); // No longer need the object _redocker = null; } }
private void OnPageDragEnd(Crownwood.DotNetMagic.Controls.TabControl sender, MouseEventArgs e) { // Are we currently in a redocking state? if (_redocker != null) { // Remove the page from the source Crownwood.DotNetMagic.Controls.TabPage removedPage = _tabControl.TabPages[_dragPageIndex]; _tabControl.TabPages.RemoveAt(_dragPageIndex); // Let the redocker finish off bool moved = _redocker.OnMouseUp(e); // If the tab was not positioned somewhere else if (!moved) { // Put back the page that was removed when dragging started _tabControl.TabPages.Insert(_dragPageIndex, removedPage); } // No longer need the object _redocker = null; } }
private void OnSelectionChanged(Crownwood.DotNetMagic.Controls.TabControl tabControl, Crownwood.DotNetMagic.Controls.TabPage oldPage, Crownwood.DotNetMagic.Controls.TabPage newPage) { if (tabControl.TabPages.Count == 0) { // Inform each detail of the change in title text NotifyFullTitleText(""); } else { // Inform each detail of the new title text if (tabControl.SelectedIndex != -1) { Content selectedContent = tabControl.SelectedTab.Tag as Content; NotifyAutoHideImage(selectedContent.AutoHidden); NotifyCloseButton(selectedContent.CloseButton); NotifyHideButton(selectedContent.HideButton); NotifyFullTitleText(selectedContent.FullTitle); NotifyShowCaptionBar(selectedContent.CaptionBar); } } }
private void OnDockingManagerTabControlCreated(Crownwood.DotNetMagic.Controls.TabControl tabControl) { InitializeTabControl(tabControl); }
private void OnTabbedGroupsTabControlCreated(TabbedGroups tabbedGroups, Crownwood.DotNetMagic.Controls.TabControl tabControl) { InitializeTabControl(tabControl); }