コード例 #1
0
ファイル: ViewHostTab.cs プロジェクト: Kuzq/gitter
        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;
        }
コード例 #2
0
ファイル: ViewHost.cs プロジェクト: Kuzq/gitter
        /// <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;
        }
コード例 #3
0
ファイル: ViewHost.cs プロジェクト: Kuzq/gitter
 /// <summary>Destroy tabs control.</summary>
 private void RemoveTabs()
 {
     if(_tabs != null)
     {
         _tabs.Parent = null;
         _tabs.Dispose();
         _tabs = null;
     }
 }
コード例 #4
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)
            {
                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);
                }
            }
        }
コード例 #5
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);
                }
            }
        }
コード例 #6
0
ファイル: ViewRenderer.cs プロジェクト: Kuzq/gitter
 public abstract void RenderViewHostTabsBackground(ViewHostTabs tabs, PaintEventArgs e);