private bool FindTabPageCollection( TabGroupSequence nodeGroup, Crownwood.DotNetMagic.Controls.TabPage tabPage, out TabPageCollection containingCollection) { for (var i = 0; i < nodeGroup.Count; i++) { var node = nodeGroup[i]; if (node.IsSequence) { var found = FindTabPageCollection(node as TabGroupSequence, tabPage, out containingCollection); if (found) { return(true); } } if (node.IsLeaf) { var leaf = (TabGroupLeaf)node; if (leaf.TabPages.Contains(tabPage)) { containingCollection = leaf.TabPages; return(true); } } } containingCollection = null; return(false); }
private void CreateStackTab(StackTabPage page) { StackTab stackTab = new StackTab(page, DockStyle.Top); if (_component.StackStyle == StackStyle.ShowMultiple) { stackTab.TitleBar.ActAsButton = ActAsButton.JustArrow; stackTab.TitleBar.ArrowButton = ArrowButton.DownArrow; } else { stackTab.TitleBar.ActAsButton = ActAsButton.WholeControl; stackTab.TitleBar.ArrowButton = ArrowButton.None; } stackTab.ButtonClicked += OnTabButtonClick; stackTab.TitleClicked += OnTabTitleClicked; stackTab.TitleDoubleClicked += OnTabTitleDoubleClicked; TabGroupLeaf tgl = _stackTabControl.RootSequence.AddNewLeaf(); tgl.MinimumSize = stackTab.MinimumRequestedSize; // Prevent user from resizing tgl.ResizeBarLock = _component.StackStyle == StackStyle.ShowMultiple ? false : true; Crownwood.DotNetMagic.Controls.TabPage tabPageUI = new Crownwood.DotNetMagic.Controls.TabPage(page.Name, stackTab); tabPageUI.Tag = page; tgl.TabPages.Add(tabPageUI); RecalculateTabSizes(); }
private void OnInsertedPage(int index, object value) { // If no page is currently selected if (_selectedIndex == -1) { // Then make the inserted page selected _selectedIndex = index; } else { // If inserting the new page before the currently selected page, need to dump // the selected index to reflect this change in contents if (index <= _selectedIndex) { _selectedIndex++; } } // Cast to correct type Crownwood.DotNetMagic.Controls.TabPage page = value as Crownwood.DotNetMagic.Controls.TabPage; // Grab the content instance of the page Content c = page.Tag as Content; // Hook into change in its properties c.PropertyChanged += new Content.PropChangeHandler(OnContentChanged); ResizeControl(); Recalculate(); Invalidate(); }
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 OpenLeaf(TabGroupLeaf tgl, decimal space) { if (tgl == null) { return; } // Only open the leaf visually, it does not set a leaf active Crownwood.DotNetMagic.Controls.TabPage tabPageUI = tgl.TabPages[0]; StackTabPage page = (StackTabPage)tabPageUI.Tag; StackTab stackTab = (StackTab)tabPageUI.Control; if (page.Component.IsStarted == false) { page.Component.Start(); } if (stackTab.ApplicationComponentControl == null) { stackTab.ApplicationComponentControl = (Control)_component.GetPageView(page).GuiElement; stackTab.ApplicationComponentControl.Dock = DockStyle.Fill; } SetArrowState(stackTab.TitleBar, true); tgl.Space = space; }
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)); } } }
private void OnControlPageChanged(TabbedGroups tg, Crownwood.DotNetMagic.Controls.TabPage selectedPage) { if (_component.StackStyle == StackStyle.ShowMultiple) { if (selectedPage != null) { ChangeComponentPageFromLeaf(tg.LeafForPage(selectedPage)); } } }
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Tag != null && e.Node.Tag is IDatabaseObject) { DatabaseObject baseObject = e.Node.Tag as DatabaseObject; var oldTab = tabControlDetail.TabPages[baseObject.Name]; if (oldTab != null) { tabControlDetail.SelectedTab = oldTab; oldTab.Focus(); } else { if (baseObject.ObjectType == Enums.ObjectTypeEnum.TABLE) { var table = ((Table)e.Node.Tag); TableInformation tableinfo = new TableInformation(); tableinfo.Dock = DockStyle.Fill; tableinfo.SelectedTable = table; var tab = new Crownwood.DotNetMagic.Controls.TabPage(); tab.Title = table.Name; tab.Controls.Add(tableinfo); tabControlDetail.TabPages.Add(tab); tabControlDetail.SelectedTab = tab; tableinfo.Build(); } else if (baseObject.ObjectType != Enums.ObjectTypeEnum.INDEX && baseObject.ObjectType != Enums.ObjectTypeEnum.Key && baseObject.ObjectType != Enums.ObjectTypeEnum.Database && baseObject.ObjectType != Enums.ObjectTypeEnum.Column && baseObject.ObjectType != Enums.ObjectTypeEnum.Schema ) { var dbObject = ((DatabaseObject)e.Node.Tag); ScriptControl scriptControl = new ScriptControl(); scriptControl.DbObject = dbObject; scriptControl.Dock = DockStyle.Fill; var tab = new Crownwood.DotNetMagic.Controls.TabPage(); tab.Title = dbObject.Name; tab.Controls.Add(scriptControl); tabControlDetail.TabPages.Add(tab); tabControlDetail.SelectedTab = tab; scriptControl.Build(); } } } }
private void OnRemovedPage(int index, object value) { // Cast to correct type Crownwood.DotNetMagic.Controls.TabPage page = value as Crownwood.DotNetMagic.Controls.TabPage; // Grab the content instance of the page Content c = page.Tag as Content; // Unhook from change in its properties c.PropertyChanged -= new Content.PropChangeHandler(OnContentChanged); ResizeControl(); Recalculate(); Invalidate(); }
private void RemoveStackTab(StackTabPage page) { for (int i = 0; i < _stackTabControl.RootSequence.Count; i++) { TabGroupLeaf tgl = (TabGroupLeaf)_stackTabControl.RootSequence[i]; Crownwood.DotNetMagic.Controls.TabPage tabPageUI = CollectionUtils.FirstElement <Crownwood.DotNetMagic.Controls.TabPage>(tgl.TabPages); if (tabPageUI.Tag == page) { // remove the tab page // note that this automatically removes the parent leaf, since it is the only tab tgl.TabPages.Remove(tabPageUI); break; } } RecalculateTabSizes(); }
private void tabloBilgileriToolStripMenuItem_Click(object sender, EventArgs e) { var dbItem = treeView1.SelectedNode.Tag as Table; if (dbItem != null) { TableInformation tableinfo = new TableInformation(); tableinfo.Dock = DockStyle.Fill; tableinfo.SelectedTable = dbItem; var tab = new Crownwood.DotNetMagic.Controls.TabPage(); tab.Controls.Add(tableinfo); tab.Title = "Tablo Bilgileri"; tabControlDetail.TabPages.Add(tab); tableinfo.Build(); } }
private void HighlightLeaf(TabGroupLeaf tgl, bool highlight) { Crownwood.DotNetMagic.Controls.TabPage tabPageUI = tgl.TabPages[0]; StackTab stackTab = (StackTab)tabPageUI.Control; if (highlight) { stackTab.TitleBar.Style = _activeStyle; _stackTabControl.ActiveLeaf = tgl; stackTab.Select(); stackTab.Focus(); } else { stackTab.TitleBar.Style = _inactiveStyle; } }
private void TabbedGroupPageChangedEventHandler(TabbedGroups tg, Crownwood.DotNetMagic.Controls.TabPage tp) { // de-activate the previous workspace before activating the new one var lastActive = _workspaceActivationOrder.LastElement; if (lastActive != null) { lastActive.SetActiveStatus(false); } // important to check tp != null to account for the case where the last workspace closes var nowActive = (tp != null) ? (WorkspaceView)tp.Tag : null; if (nowActive != null) { nowActive.SetVisibleStatus(true); // the very first time the page is selected, need to change its visible status nowActive.SetActiveStatus(true); _workspaceActivationOrder.Add(nowActive); } }
private void tsCompare_Click(object sender, EventArgs e) { OpenFileDialog of = new OpenFileDialog(); if (of.ShowDialog() == System.Windows.Forms.DialogResult.OK) { DatabaseFactory factory = DatabaseFactory.DeSerialize(of.FileName); CompareResultControl result = new CompareResultControl(); result.SourceDatabase = _db; result.DestinationDatabase = factory; result.Dock = DockStyle.Fill; var tab = new Crownwood.DotNetMagic.Controls.TabPage(); tab.Controls.Add(result); tab.Title = "Karşılaştır"; tabControl1.TabPages.Add(tab); result.Compare(); } }
public static void RegisterEnvironmentTab(ICodeweaverPlugin _this, string TabText, int TabIcon, Control TabContent) { // Make sure there isn't already a tab with this same control in it if (g.OtherTabs.FindByControl(TabContent) != null) { return; } // Add the tab Crownwood.DotNetMagic.Controls.TabPage newpage = new Crownwood.DotNetMagic.Controls.TabPage( TabText, TabContent, g.Main.ilDocBar, TabIcon ); // Add the tab to the collection g.OtherTabs.Add(new PrimaryTab <Control>(newpage, TabContent, _this)); // Display the tab in the interface g.Main.tabMain.ActiveLeaf.TabPages.Add(newpage); }
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 static Crownwood.DotNetMagic.Controls.TitleBar GetTitleBarForPage(Crownwood.DotNetMagic.Controls.TabPage page) { return(((StackTab)page.Control).TitleBar); }
public static void RegisterEnvironmentTab(ICodeweaverPlugin _this, string TabText, int TabIcon, Control TabContent) { // Make sure there isn't already a tab with this same control in it if (g.OtherTabs.FindByControl(TabContent) != null) return; // Add the tab Crownwood.DotNetMagic.Controls.TabPage newpage = new Crownwood.DotNetMagic.Controls.TabPage( TabText, TabContent, g.Main.ilDocBar, TabIcon ); // Add the tab to the collection g.OtherTabs.Add(new PrimaryTab<Control>(newpage, TabContent, _this)); // Display the tab in the interface g.Main.tabMain.ActiveLeaf.TabPages.Add(newpage); }
public DrawTab(Crownwood.DotNetMagic.Controls.TabPage tabPage, Rectangle drawRect, int index) { _index = index; _tabPage = tabPage; _drawRect = drawRect; }
private void NavigateTo(string title, string address, int iconindex = 0) { if (openInDefaultBrowserToolStripMenuItem.Checked) { new ShellExecute { Path = address, Verb = ShellExecute.OpenFile }.Execute(); } else { var mb = new MaxBrowser(address); var newPage = new TabPage(title, mb, iconindex) { Selected = true }; if (tabbedGroupsWebSites.ActiveLeaf != null) { tabbedGroupsWebSites.ActiveLeaf.TabPages.Add(newPage); mb.Navigate(address); } } }
/// <summary> /// Raises the Paint event. /// </summary> /// <param name="e">A PaintEventArgs that contains the event data. </param> protected override void OnPaint(PaintEventArgs e) { Pen borderPen = new Pen(ControlPaint.LightLight(base.ForeColor)); // Fill background in required color if (_style == VisualStyle.IDE) { using (SolidBrush fillBrush = new SolidBrush(_backIDE)) e.Graphics.FillRectangle(fillBrush, this.ClientRectangle); } else if (_style == VisualStyle.IDE2005) { borderPen.Dispose(); if (this.dockingManager.Customize) { CommandDraw.DrawGradientBackground(e.Graphics, this, ColorCustomize.BackColor, ColorCustomize.BackColor, ColorCustomize.BackColor, true); borderPen = new Pen(ColorCustomize.BorderColor); } else { CommandDraw.DrawGradientBackground(e.Graphics, this, _colorDetails.BaseColor, _colorDetails.BaseColor1, _colorDetails.BaseColor2, true); borderPen = new Pen(SystemColors.ControlDark); } } else if (_style == VisualStyle.Office2003) { using (SolidBrush fillBrush = new SolidBrush(_colorDetails.BaseColor)) e.Graphics.FillRectangle(fillBrush, this.ClientRectangle); borderPen.Dispose(); borderPen = new Pen(_colorDetails.MenuSeparatorColor); } else { using (SolidBrush fillBrush = new SolidBrush(this.BackColor)) e.Graphics.FillRectangle(fillBrush, this.ClientRectangle); } // Style specific outline drawing DrawOutline(e.Graphics, true); // Draw each of the draw objects foreach (DrawTab dt in _drawTabs) { Rectangle drawRect = dt.DrawRect; AdjustRectForEdge(ref drawRect); // Style specific cell outline drawing DrawOutlineForCell(e.Graphics, borderPen, drawRect); // Draw the image in the left/top of the cell Crownwood.DotNetMagic.Controls.TabPage page = dt.TabPage; int xDraw; int yDraw; switch (_edge) { case Edge.Left: case Edge.Right: xDraw = drawRect.Left + (drawRect.Width - _imageVector) / 2; yDraw = drawRect.Top + _imageGap; break; case Edge.Top: case Edge.Bottom: case Edge.None: default: xDraw = drawRect.Left + _imageGap; yDraw = drawRect.Top + (drawRect.Height - _imageVector) / 2; break; } if ((page.Icon != null) || (page.Image != null) || ((page.ImageIndex != -1) && (page.ImageList != null))) { if (page.Icon != null) { // Draw the actual icon e.Graphics.DrawIcon(page.Icon, new Rectangle(xDraw, yDraw, _imageVector, _imageVector)); } else { Image drawImage; if (page.Image != null) { drawImage = page.Image; } else { drawImage = page.ImageList.Images[page.ImageIndex]; } // Draw the actual image e.Graphics.DrawImage(drawImage, new Rectangle(xDraw, yDraw, _imageVector, _imageVector)); // Must dispose of images taken from an image list, as they are copies and not references if (page.Image == null) { drawImage.Dispose(); } } } // Is anything currently selected if ((_selectedIndex != -1) || _stubsShowAll) { // Is this page selected? if ((page == _tabPages[_selectedIndex]) || _stubsShowAll) { Rectangle textRect; using (StringFormat drawFormat = new StringFormat()) { drawFormat.FormatFlags = StringFormatFlags.NoClip | StringFormatFlags.NoWrap; drawFormat.Alignment = StringAlignment.Center; drawFormat.LineAlignment = StringAlignment.Center; // Create text drawing rectangle switch (_edge) { case Edge.Left: case Edge.Right: textRect = new Rectangle(drawRect.Left, yDraw + _imageVector + _imageGap, drawRect.Width, drawRect.Height - _imageVector - _imageGap * 2); drawFormat.FormatFlags |= StringFormatFlags.DirectionVertical; break; case Edge.Top: case Edge.Bottom: case Edge.None: default: textRect = new Rectangle(xDraw + _imageVector + _imageGap, drawRect.Top, drawRect.Width - _imageVector - _imageGap * 2, drawRect.Height); break; } Color brushColor = this.ForeColor; if (_style == VisualStyle.IDE) { brushColor = ControlPaint.Light(brushColor); } using (SolidBrush drawBrush = new SolidBrush(brushColor)) e.Graphics.DrawString(page.Title, this.Font, drawBrush, textRect, drawFormat); } } } } borderPen.Dispose(); // Style specific outline drawing DrawOutline(e.Graphics, false); base.OnPaint(e); }