public ViewHostTab(ViewHostTabs tabs, ViewBase view) : base(view, tabs.Side) { Verify.Argument.IsNotNull(tabs, "tabs"); _tabs = tabs; _viewHost = tabs.ViewHost; _buttons = new ViewButtons(tabs); if(_viewHost.IsDocumentWell) { _buttons.SetAvailableButtons(ViewButtonType.Close); } _buttons.Height = Renderer.TabHeight + Renderer.TabFooterHeight; _buttons.ButtonClick += OnButtonClick; }
/// <summary>Creates <see cref="ViewHostTabs"/> control.</summary> /// <param name="size">Control size.</param> private void SpawnTabs(Size size) { Verify.State.IsTrue(_tabs == null, "Tabs are already spawned."); var tabHeight = Renderer.TabHeight; if(_isDocumentWell) { _tabs = new ViewHostTabs(this, AnchorStyles.Top) { Bounds = new Rectangle( 0, 0, size.Width, tabHeight + Renderer.TabFooterHeight), Anchor = ViewConstants.AnchorDockTop, }; } else { _tabs = new ViewHostTabs(this, AnchorStyles.Bottom) { Bounds = new Rectangle( 0, size.Height - tabHeight, size.Width, tabHeight), Anchor = ViewConstants.AnchorDockBottom, }; } _tabs.Parent = this; }
/// <summary>Destroy tabs control.</summary> private void RemoveTabs() { if(_tabs != null) { _tabs.Parent = null; _tabs.Dispose(); _tabs = null; } }
public override void RenderViewHostTabsBackground(ViewHostTabs tabs, PaintEventArgs e) { var graphics = e.Graphics; using(var brush = new SolidBrush(ColorTable.ViewHostTabsBackground)) { graphics.FillRectangle(brush, e.ClipRectangle); } if(tabs.ViewHost.IsDocumentWell) { using(var brush = new SolidBrush( tabs.ViewHost.IsActive ? ColorTable.ViewHostTabsSelectedBackgroundActiveEnd : ColorTable.ViewHostTabsSelectedBackgroundNormalEnd)) { var rc = new RectangleF( -0.5f, -0.5f + Constants.TabHeight, tabs.Width + 1, Constants.TabFooterHeight + 1); var ltCorner = ((tabs.LeftButtons == null || tabs.LeftButtons.Width == 0) && tabs[tabs.FirstTabIndex].IsActive) ? 0 : 2; graphics.FillRoundedRectangle(brush, rc, ltCorner, 2, 0, 0); } } }
public override void RenderViewHostTabsBackground(ViewHostTabs tabs, PaintEventArgs e) { var graphics = e.Graphics; using(var brush = new SolidBrush(ColorTable.ViewHostTabsBackground)) { graphics.FillRectangle(brush, e.ClipRectangle); } if(tabs.ViewHost.IsDocumentWell) { var tabsFooterColor = tabs.ViewHost.IsActive ? ColorTable.DocTabsFooterActive : ColorTable.DocTabsFooterNormal; using(var brush = new SolidBrush(tabsFooterColor)) { graphics.FillRectangle(brush, 0, Constants.TabHeight, tabs.Width, Constants.TabFooterHeight); } } }
public abstract void RenderViewHostTabsBackground(ViewHostTabs tabs, PaintEventArgs e);