Пример #1
0
 /// <summary>
 /// Creates an icon for a button that displays a list of all tabs.
 /// </summary>
 protected Point[] CreateAllTabsButtonIcon(TabViewLayout layout, Rectangle rect, int size)
 {
     if (layout == TabViewLayout.Vertical)
     {
         return(VectorIcons.DownArrow(rect, size));
     }
     else
     {
         return(VectorIcons.RightArrow(rect, size));
     }
 }
Пример #2
0
 /// <summary>
 /// Creates a rectangle for the tab bar.
 /// </summary>
 public Rectangle CreateTabsBarRect(TabViewLayout layout, int size)
 {
     if (layout == TabViewLayout.Vertical)
     {
         return(new Rectangle(0, 0, size, this.Height));
     }
     else
     {
         return(new Rectangle(0, 0, this.Width, size));
     }
 }
Пример #3
0
        /// <summary>
        /// Updates the layout and causes rendering.
        /// </summary>
        public virtual void UpdateLayout()
        {
            TabViewLayout layout = TabsBarLayout;

            tabsBarRect          = CreateTabsBarRect(layout, tabsBarSize);
            tabsBarSeparatorRect = CreateTabsBarSeparatorRect(layout, tabsBarRect, tabsBarSeparatorSize);
            allTabsButtonRect    = CreateAllTabsButtonRect(layout, tabsBarRect, allTabsButtonSize);
            allTabsButtonIcon    = CreateAllTabsButtonIcon(layout, allTabsButtonRect, allTabsIconSize);

            UpdateTabsBarLayout();
            UpdatePanelsLayout();

            this.Invalidate();
        }
Пример #4
0
 /// <summary>
 /// Creates a rectangle for a button that displays a list of all tabs.
 /// </summary>
 public Rectangle CreateAllTabsButtonRect(TabViewLayout layout, Rectangle tabsBar, int size)
 {
     if (layout == TabViewLayout.Vertical)
     {
         return(new Rectangle(
                    tabsBar.Left, tabsBar.Bottom - size,
                    tabsBar.Width, size));
     }
     else
     {
         return(new Rectangle(
                    tabsBar.Right - size, tabsBar.Top,
                    size, tabsBar.Height));
     }
 }
Пример #5
0
 /// <summary>
 /// Creates a rectangle for the line that separates the tab bar and the tab view.
 /// </summary>
 public virtual Rectangle CreateTabsBarSeparatorRect(TabViewLayout layout, Rectangle tabsBar, int size)
 {
     if (layout == TabViewLayout.Vertical)
     {
         return(new Rectangle(
                    tabsBar.Right, tabsBar.Top,
                    size, tabsBar.Height));
     }
     else
     {
         return(new Rectangle(
                    tabsBar.Left, tabsBar.Bottom,
                    tabsBar.Width, size));
     }
 }
Пример #6
0
        /// <summary>
        /// Returns the number of tabs that fit on the tab bar.
        /// </summary>
        protected virtual private int GetDisplayedTabs(List <TabData> tabs, Rectangle tabsBar, TabViewLayout layout)
        {
            int displayedTabs = -1;

            if (layout == TabViewLayout.Vertical)
            {
                for (int i = 0; i < tabs.Count; i++)
                {
                    if (tabs[i].tabRect.Bottom > tabsBar.Bottom)
                    {
                        displayedTabs = i;
                        break;
                    }
                }
            }
            else
            {
                for (int i = 0; i < tabs.Count; i++)
                {
                    if (tabs[i].tabRect.Right > tabsBar.Right)
                    {
                        displayedTabs = i;
                        break;
                    }
                }
            }

            if (displayedTabs > 0)
            {
                Rectangle previewTabRect = tabs[displayedTabs - 1].tabRect;

                if (layout == TabViewLayout.Vertical)
                {
                    if (previewTabRect.Bottom > allTabsButtonRect.Top)
                    {
                        displayedTabs--;
                    }
                }
                else
                {
                    if (previewTabRect.Right > allTabsButtonRect.Left)
                    {
                        displayedTabs--;
                    }
                }
            }

            return(displayedTabs);
        }