/// <summary>
        /// Initialize a new instance of the ViewLayoutBar class.
        /// </summary>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricGap">Metric for gap between each child item.</param>
        /// <param name="itemSizing">Method used to calculate item size.</param>
        /// <param name="itemAlignment">Method used to align items within lines.</param>
        /// <param name="barMultiline">Multline showing of items.</param>
        /// <param name="itemMinimumSize">Maximum allowed item size.</param>
        /// <param name="itemMaximumSize">Minimum allowed item size.</param>
        /// <param name="barMinimumHeight">Minimum height of the bar.</param>
        /// <param name="tabBorderStyle">Tab border style.</param>
        /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
        public ViewLayoutBar(IPaletteMetric paletteMetric,
                             PaletteMetricInt metricGap,
                             BarItemSizing itemSizing,
                             RelativePositionAlign itemAlignment,
                             BarMultiline barMultiline,
                             Size itemMinimumSize,
                             Size itemMaximumSize,
                             int barMinimumHeight,
                             TabBorderStyle tabBorderStyle,
                             bool reorderSelectedLine)
        {
            // Remember the source information
            _paletteMetric      = paletteMetric;
            _metricGap          = metricGap;
            BarItemSizing       = itemSizing;
            ItemAlignment       = itemAlignment;
            ItemMinimumSize     = itemMinimumSize;
            ItemMaximumSize     = itemMaximumSize;
            BarMinimumHeight    = barMinimumHeight;
            TabBorderStyle      = tabBorderStyle;
            BarMultiline        = barMultiline;
            ReorderSelectedLine = reorderSelectedLine;

            // Default other state
            Orientation     = VisualOrientation.Top;
            ItemOrientation = VisualOrientation.Top;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize a new instance of the NavigatorBar class.
        /// </summary>
        /// <param name="navigator">Reference to owning navigator instance.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public NavigatorBar(KryptonNavigator navigator,
                            NeedPaintHandler needPaint)
        {
            Debug.Assert(navigator != null);

            // Remember back reference
            _navigator = navigator;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default values
            _barAnimation      = true;
            _barFirstItemInset = 0;
            _barLastItemInset  = 0;
            _barOrientation    = VisualOrientation.Top;
            _barMinimumHeight  = _defaultBarMinimumHeight;
            _barMultiline      = BarMultiline.Singleline;
            _checkButtonStyle  = ButtonStyle.Standalone;
            _tabStyle          = TabStyle.HighProfile;
            _tabBorderStyle    = TabBorderStyle.RoundedOutsizeMedium;
            _itemAlignment     = RelativePositionAlign.Near;
            _itemMinimumSize   = _defaultItemMinimumSize;
            _itemMaximumSize   = _defaultItemMaximumSize;
            _itemOrientation   = ButtonOrientation.Auto;
            _itemSizing        = BarItemSizing.SameHeight;
            _barMapImage       = MapKryptonPageImage.Small;
            _barMapText        = MapKryptonPageText.TextTitle;
            _barMapExtraText   = MapKryptonPageText.None;
        }
Ejemplo n.º 3
0
        private void tabBorderStyles_CheckedChanged(object sender, EventArgs e)
        {
            // Cast to correct type
            RadioButton rb = (RadioButton)sender;

            if (rb.Checked)
            {
                TabBorderStyle enumVal = (TabBorderStyle)Enum.Parse(typeof(TabBorderStyle), rb.Tag.ToString());
                kryptonNavigator.Bar.TabBorderStyle = enumVal;
            }
        }
 /// <summary>
 /// Initialize a new instance of the ViewLayoutBarForTabs class.
 /// </summary>
 /// <param name="itemSizing">Method used to calculate item size.</param>
 /// <param name="itemAlignment">Method used to align items within lines.</param>
 /// <param name="barMultiline">Multline showing of items.</param>
 /// <param name="itemMinimumSize">Maximum allowed item size.</param>
 /// <param name="itemMaximumSize">Minimum allowed item size.</param>
 /// <param name="barMinimumHeight">Minimum height of the bar.</param>
 /// <param name="tabBorderStyle">Tab border style.</param>
 /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
 public ViewLayoutBarForTabs(BarItemSizing itemSizing,
                             RelativePositionAlign itemAlignment,
                             BarMultiline barMultiline,
                             Size itemMinimumSize,
                             Size itemMaximumSize,
                             int barMinimumHeight,
                             TabBorderStyle tabBorderStyle,
                             bool reorderSelectedLine)
     : base(itemSizing, itemAlignment, barMultiline, itemMinimumSize,
            itemMaximumSize, barMinimumHeight, tabBorderStyle, reorderSelectedLine)
 {
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initialize a new instance of the ViewLayoutBarForTabs class.
 /// </summary>
 /// <param name="itemSizing">Method used to calculate item size.</param>
 /// <param name="itemAlignment">Method used to align items within lines.</param>
 /// <param name="barMultiline">Multline showing of items.</param>
 /// <param name="itemMinimumSize">Maximum allowed item size.</param>
 /// <param name="itemMaximumSize">Minimum allowed item size.</param>
 /// <param name="barMinimumHeight">Minimum height of the bar.</param>
 /// <param name="tabBorderStyle">Tab border style.</param>
 /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
 public ViewLayoutBarForTabs(BarItemSizing itemSizing,
                             RelativePositionAlign itemAlignment,
                             BarMultiline barMultiline,
                             Size itemMinimumSize,
                             Size itemMaximumSize,
                             int barMinimumHeight,
                             TabBorderStyle tabBorderStyle,
                             bool reorderSelectedLine)
     : base(itemSizing, itemAlignment, barMultiline, itemMinimumSize,
            itemMaximumSize, barMinimumHeight, tabBorderStyle, reorderSelectedLine)
 {
 }
        private void UpdateTabBorderStyle()
        {
            // Cache the new border style
            TabBorderStyle tabBorderStyle = Navigator.Bar.TabBorderStyle;

            // Update the border style of each check button
            foreach (ViewDrawNavCheckButtonTab tab in _pageLookup.Values)
            {
                tab.TabBorderStyle = tabBorderStyle;
            }

            // Update border style used to space each tab item
            _layoutBar.TabBorderStyle = tabBorderStyle;
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initialize a new instance of the ViewLayoutBar class.
 /// </summary>
 /// <param name="itemSizing">Method used to calculate item size.</param>
 /// <param name="itemAlignment">Method used to align items within lines.</param>
 /// <param name="barMultiline">Multline showing of items.</param>
 /// <param name="itemMinimumSize">Maximum allowed item size.</param>
 /// <param name="itemMaximumSize">Minimum allowed item size.</param>
 /// <param name="barMinimumHeight">Minimum height of the bar.</param>
 /// <param name="tabBorderStyle">Tab border style.</param>
 /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
 public ViewLayoutBar(BarItemSizing itemSizing,
                      RelativePositionAlign itemAlignment,
                      BarMultiline barMultiline,
                      Size itemMinimumSize,
                      Size itemMaximumSize,
                      int barMinimumHeight,
                      TabBorderStyle tabBorderStyle,
                      bool reorderSelectedLine)
     : this(null, PaletteMetricInt.None, itemSizing, 
            itemAlignment, barMultiline, itemMinimumSize, 
            itemMaximumSize, barMinimumHeight, tabBorderStyle,
            reorderSelectedLine)
 {
 }
 /// <summary>
 /// Initialize a new instance of the ViewLayoutBar class.
 /// </summary>
 /// <param name="itemSizing">Method used to calculate item size.</param>
 /// <param name="itemAlignment">Method used to align items within lines.</param>
 /// <param name="barMultiline">Multline showing of items.</param>
 /// <param name="itemMinimumSize">Maximum allowed item size.</param>
 /// <param name="itemMaximumSize">Minimum allowed item size.</param>
 /// <param name="barMinimumHeight">Minimum height of the bar.</param>
 /// <param name="tabBorderStyle">Tab border style.</param>
 /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
 public ViewLayoutBar(BarItemSizing itemSizing,
                      RelativePositionAlign itemAlignment,
                      BarMultiline barMultiline,
                      Size itemMinimumSize,
                      Size itemMaximumSize,
                      int barMinimumHeight,
                      TabBorderStyle tabBorderStyle,
                      bool reorderSelectedLine)
     : this(null, PaletteMetricInt.None, itemSizing,
            itemAlignment, barMultiline, itemMinimumSize,
            itemMaximumSize, barMinimumHeight, tabBorderStyle,
            reorderSelectedLine)
 {
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Generate a graphics path that encloses the border itself.
 /// </summary>
 /// <param name="context">Rendering context.</param>
 /// <param name="rect">Target rectangle.</param>
 /// <param name="palette">Palette used for drawing.</param>
 /// <param name="orientation">Visual orientation of the border.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>GraphicsPath instance.</returns>
 public abstract GraphicsPath GetTabBorderPath(RenderContext context,
                                               Rectangle rect,
                                               IPaletteBorder palette,
                                               VisualOrientation orientation,
                                               PaletteState state,
                                               TabBorderStyle tabBorderStyle);
Ejemplo n.º 10
0
 /// <summary>
 /// Gets the padding used to position display elements completely inside border drawing.
 /// </summary>
 /// <param name="context">Layout context.</param>
 /// <param name="palette">Palette used for drawing.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="orientation">Visual orientation of the border.</param>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>Padding structure detailing all four edges.</returns>
 public abstract Padding GetTabBorderDisplayPadding(ViewLayoutContext context,
                                                    IPaletteBorder palette,
                                                    PaletteState state,
                                                    VisualOrientation orientation,
                                                    TabBorderStyle tabBorderStyle);
Ejemplo n.º 11
0
 /// <summary>
 /// Gets the spacing used to separate each tab border instance.
 /// </summary>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>Number of pixels to space instances.</returns>
 public override int GetTabBorderSpacingGap(TabBorderStyle tabBorderStyle)
 {
     switch (tabBorderStyle)
     {
         case TabBorderStyle.DockEqual:
         case TabBorderStyle.SquareEqualSmall:
             return _spacingTabSquareEqualSmall;
         case TabBorderStyle.SquareEqualMedium:
             return _spacingTabSquareEqualMedium;
         case TabBorderStyle.SquareEqualLarge:
             return _spacingTabSquareEqualLarge;
         case TabBorderStyle.DockOutsize:
         case TabBorderStyle.SquareOutsizeSmall:
             return _spacingTabSquareOutsizeSmall;
         case TabBorderStyle.SquareOutsizeMedium:
             return _spacingTabSquareOutsizeMedium;
         case TabBorderStyle.SquareOutsizeLarge:
             return _spacingTabSquareOutsizeLarge;
         case TabBorderStyle.RoundedEqualSmall:
             return _spacingTabRoundedEqualSmall;
         case TabBorderStyle.RoundedEqualMedium:
             return _spacingTabRoundedEqualMedium;
         case TabBorderStyle.RoundedEqualLarge:
             return _spacingTabRoundedEqualLarge;
         case TabBorderStyle.RoundedOutsizeSmall:
             return _spacingTabRoundedOutsizeSmall;
         case TabBorderStyle.RoundedOutsizeMedium:
             return _spacingTabRoundedOutsizeMedium;
         case TabBorderStyle.RoundedOutsizeLarge:
             return _spacingTabRoundedOutsizeLarge;
         case TabBorderStyle.SlantEqualNear:
         case TabBorderStyle.SlantEqualFar:
             return _spacingTabSlantEqual;
         case TabBorderStyle.SlantOutsizeNear:
         case TabBorderStyle.SlantOutsizeFar:
             return _spacingTabSlantOutsize;
         case TabBorderStyle.SlantEqualBoth:
             return _spacingTabSlantEqualBoth;
         case TabBorderStyle.SlantOutsizeBoth:
             return _spacingTabSlantOutsize * 2;
         case TabBorderStyle.OneNote:
             return _spacingTabOneNote;
         case TabBorderStyle.SmoothEqual:
             return _spacingTabSmoothE;
         case TabBorderStyle.SmoothOutsize:
             return _spacingTabSmoothO;
         default:
             // Should never happen!
             Debug.Assert(false);
             return 1;
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Generate a graphics path that encloses the border itself.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        /// <param name="rect">Target rectangle.</param>
        /// <param name="palette">Palette used for drawing.</param>
        /// <param name="orientation">Visual orientation of the border.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="tabBorderStyle">Style of tab border.</param>
        /// <returns>GraphicsPath instance.</returns>
        public override GraphicsPath GetTabBorderPath(RenderContext context,
                                                      Rectangle rect,
                                                      IPaletteBorder palette,
                                                      VisualOrientation orientation,
                                                      PaletteState state,
                                                      TabBorderStyle tabBorderStyle)
        {
            Debug.Assert(context != null);
            Debug.Assert(palette != null);

            // Validate parameter references
            if (context == null) throw new ArgumentNullException("context");
            if (palette == null) throw new ArgumentNullException("palette");

            Debug.Assert(context.Control != null);
            Debug.Assert(!context.Control.IsDisposed);

            // Use helper to create a border path in middle of the pen
            return CreateTabBorderBackPath(context.Control.RightToLeft, state, false, rect,
                                           palette.GetBorderWidth(state), tabBorderStyle, orientation,
                                           (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias));
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Gets if the tabs should be drawn from left to right for z-ordering.
 /// </summary>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>True for left to right, otherwise draw right to left.</returns>
 public override bool GetTabBorderLeftDrawing(TabBorderStyle tabBorderStyle)
 {
     switch (tabBorderStyle)
     {
         case TabBorderStyle.OneNote:
             return false;
         default:
             return true;
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Gets the padding used to position display elements completely inside border drawing.
        /// </summary>
        /// <param name="context">View layout context.</param>
        /// <param name="palette">Palette used for drawing.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="orientation">Visual orientation of the border.</param>
        /// <param name="tabBorderStyle">Style of tab border.</param>
        /// <returns>Padding structure detailing all four edges.</returns>
        public override Padding GetTabBorderDisplayPadding(ViewLayoutContext context,
                                                           IPaletteBorder palette,
                                                           PaletteState state,
                                                           VisualOrientation orientation,
                                                           TabBorderStyle tabBorderStyle)
        {
            Debug.Assert(palette != null);

            // Validate parameter reference
            if (palette == null) throw new ArgumentNullException("palette");

            // Get the width of the border
            int borderWidth = palette.GetBorderWidth(state);

            // Cache the right to left setting
            bool rtl = (context.Control.RightToLeft == RightToLeft.Yes);

            Padding ret = Padding.Empty;

            switch (tabBorderStyle)
            {
                case TabBorderStyle.DockEqual:
                case TabBorderStyle.SquareEqualMedium:
                case TabBorderStyle.SquareEqualSmall:
                case TabBorderStyle.SquareEqualLarge:
                case TabBorderStyle.RoundedEqualMedium:
                case TabBorderStyle.RoundedEqualSmall:
                case TabBorderStyle.RoundedEqualLarge:
                    ret = new Padding(borderWidth, borderWidth, borderWidth, 0);
                    break;
                case TabBorderStyle.DockOutsize:
                    ret = new Padding(borderWidth + _spacingTabDockOutsize, borderWidth + _spacingTabSquareOutsizeLarge, borderWidth + _spacingTabDockOutsize, 0);
                    break;
                case TabBorderStyle.SquareOutsizeMedium:
                case TabBorderStyle.SquareOutsizeSmall:
                case TabBorderStyle.SquareOutsizeLarge:
                case TabBorderStyle.RoundedOutsizeMedium:
                case TabBorderStyle.RoundedOutsizeSmall:
                case TabBorderStyle.RoundedOutsizeLarge:
                    ret = new Padding(borderWidth + _spacingTabOutsizePadding, borderWidth + _spacingTabOutsizePadding, borderWidth + _spacingTabOutsizePadding, 0);
                    break;
                case TabBorderStyle.SlantEqualNear:
                case TabBorderStyle.SlantOutsizeNear:
                    // Calculte the extra needed for the outsize variant
                    int x = (tabBorderStyle == TabBorderStyle.SlantOutsizeNear ? _spacingTabOutsizePadding : 0);

                    switch(orientation)
                    {
                        case VisualOrientation.Top:
                            if (rtl)
                                ret = new Padding(borderWidth + x, borderWidth + x, borderWidth + x + _spacingTabSlantPadding - 1, 0);
                            else
                                ret = new Padding(borderWidth + x + _spacingTabSlantPadding - 1, borderWidth + x, borderWidth + x, 0);
                            break;
                        case VisualOrientation.Left:
                            ret = new Padding(borderWidth + x + _spacingTabSlantPadding - 1, borderWidth + x, borderWidth + x, 0);
                            break;
                        case VisualOrientation.Right:
                            ret = new Padding(borderWidth + x, borderWidth + x, borderWidth + x + _spacingTabSlantPadding - 1, 0);
                            break;
                        case VisualOrientation.Bottom:
                            if (rtl)
                                ret = new Padding(borderWidth + x + _spacingTabSlantPadding - 1, borderWidth + x, borderWidth + x, 0);
                            else
                                ret = new Padding(borderWidth + x, borderWidth + x, borderWidth + x + _spacingTabSlantPadding - 1, 0);
                            break;
                    }
                    break;
                case TabBorderStyle.SlantEqualFar:
                case TabBorderStyle.SlantOutsizeFar:
                    // Calculte the extra needed for the outsize variant
                    int y = (tabBorderStyle == TabBorderStyle.SlantOutsizeFar ? _spacingTabOutsizePadding : 0);

                    switch (orientation)
                    {
                        case VisualOrientation.Top:
                            if (rtl)
                                ret = new Padding(borderWidth + y + _spacingTabSlantPadding - 1, borderWidth + y, borderWidth + y, 0);
                            else
                                ret = new Padding(borderWidth + y, borderWidth + y, borderWidth + y + _spacingTabSlantPadding - 1, 0);
                            break;
                        case VisualOrientation.Left:
                            ret = new Padding(borderWidth + y, borderWidth + y, borderWidth + y + _spacingTabSlantPadding - 1, 0);
                            break;
                        case VisualOrientation.Right:
                            ret = new Padding(borderWidth + y + _spacingTabSlantPadding - 1, borderWidth + y, borderWidth + y, 0);
                            break;
                        case VisualOrientation.Bottom:
                            if (rtl)
                                ret = new Padding(borderWidth + y, borderWidth + y, borderWidth + y + _spacingTabSlantPadding - 1, 0);
                            else
                                ret = new Padding(borderWidth + y + _spacingTabSlantPadding - 1, borderWidth + y, borderWidth + y, 0);
                            break;
                    }
                    break;
                case TabBorderStyle.SlantEqualBoth:
                case TabBorderStyle.SlantOutsizeBoth:
                    // Calculte the extra needed for the outsize variant
                    int z = (tabBorderStyle == TabBorderStyle.SlantOutsizeBoth ? _spacingTabOutsizePadding : 0);

                    ret = new Padding(borderWidth + z + _spacingTabSlantPadding - 1, borderWidth + z,
                                      borderWidth + z + _spacingTabSlantPadding - 1, 0);
                    break;
                case TabBorderStyle.OneNote:
                    // Is the current tab selected?
                    bool selected = (state == PaletteState.CheckedNormal) ||
                                    (state == PaletteState.CheckedPressed) ||
                                    (state == PaletteState.CheckedTracking);

                    // Find the correct edge padding values to use
                    int lp = (selected ? _spacingTabOneNoteLPS : _spacingTabOneNoteLPI);
                    int tp = (selected ? _spacingTabOneNoteTPS : _spacingTabOneNoteTPI);
                    int bp = (selected ? _spacingTabOneNoteBPS : _spacingTabOneNoteBPI);
                    int rp = (selected ? _spacingTabOneNoteRPS : _spacingTabOneNoteRPI);

                    switch (orientation)
                    {
                        case VisualOrientation.Top:
                            if (rtl)
                                ret = new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
                            else
                                ret = new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
                            break;
                        case VisualOrientation.Left:
                            ret = new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
                            break;
                        case VisualOrientation.Right:
                            ret = new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
                            break;
                        case VisualOrientation.Bottom:
                            if (rtl)
                                ret = new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
                            else
                                ret = new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
                            break;
                    }
                    break;
                case TabBorderStyle.SmoothEqual:
                    ret = new Padding(borderWidth + _spacingTabSmoothLRE, borderWidth + _spacingTabSmoothTE, borderWidth + _spacingTabSmoothLRE, 0);
                    break;
                case TabBorderStyle.SmoothOutsize:
                    ret = new Padding(borderWidth + _spacingTabSmoothLRO, borderWidth + _spacingTabSmoothTO, borderWidth + _spacingTabSmoothLRO, 0);
                    break;
                default:
                    // Should never happen!
                    Debug.Assert(false);
                    break;
            }

            return ret;
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Draw border on the inside edge of the specified rectangle.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        /// <param name="rect">Target rectangle.</param>
        /// <param name="palette">Palette used for drawing.</param>
        /// <param name="orientation">Visual orientation of the border.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="tabBorderStyle">Style of tab border.</param>
        public override void DrawTabBorder(RenderContext context,
                                           Rectangle rect,
                                           IPaletteBorder palette,
                                           VisualOrientation orientation,
                                           PaletteState state,
                                           TabBorderStyle tabBorderStyle)
        {
            Debug.Assert(context != null);
            Debug.Assert(palette != null);

            // Validate parameter references
            if (context == null) throw new ArgumentNullException("context");
            if (palette == null) throw new ArgumentNullException("palette");

            Debug.Assert(context.Control != null);
            Debug.Assert(!context.Control.IsDisposed);

            // Is there anything to actually draw?
            if ((rect.Width > 0) && (rect.Height > 0))
            {
                // Decide if we need to use anti aliasing for a smoother looking visual
                using (GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)))
                {
                    // Cache commonly used values
                    int borderWidth = palette.GetBorderWidth(state);

                    // Is there any border to actually draw?
                    if (borderWidth > 0)
                    {
                        // Create the path that represents the entire tab border
                        using (GraphicsPath borderPath = CreateTabBorderBackPath(context.Control.RightToLeft, state, true, rect,
                                                                                 borderWidth, tabBorderStyle, orientation,
                                                                                 (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias)))
                        {
                            // Get the rectangle to use when dealing with gradients
                            Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBorderColorAlign(state), rect);

                            // Use standard helper routine to create appropriate color brush
                            using(Brush borderBrush = CreateColorBrush(gradientRect,
                                                                       palette.GetBorderColor1(state),
                                                                       palette.GetBorderColor2(state),
                                                                       palette.GetBorderColorStyle(state),
                                                                       palette.GetBorderColorAngle(state),
                                                                       orientation))
                            {
                                using (Pen borderPen = new Pen(borderBrush, borderWidth))
                                    context.Graphics.DrawPath(borderPen, borderPath);
                            }

                            Image borderImage = palette.GetBorderImage(state);

                            // Do we need to draw the image?
                            if (ShouldDrawImage(borderImage))
                            {
                                // Get the rectangle to use when dealing with gradients
                                Rectangle imageRect = context.GetAlignedRectangle(palette.GetBorderImageAlign(state), rect);

                                // Get the image style to use for the image brush
                                PaletteImageStyle borderImageStyle = palette.GetBorderImageStyle(state);

                                // Use standard helper routine to create appropriate image brush
                                using (Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), borderWidth))
                                {
                                    context.Graphics.DrawPath(borderPen, borderPath);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Initialize a new instance of the NavigatorBar class.
        /// </summary>
        /// <param name="navigator">Reference to owning navigator instance.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public NavigatorBar(KryptonNavigator navigator,
                            NeedPaintHandler needPaint)
        {
            Debug.Assert(navigator != null);

            // Remember back reference
            _navigator = navigator;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default values
            _barAnimation = true;
            _barFirstItemInset = 0;
            _barLastItemInset = 0;
            _barOrientation = VisualOrientation.Top;
            _barMinimumHeight = _defaultBarMinimumHeight;
            _barMultiline = BarMultiline.Singleline;
            _checkButtonStyle = ButtonStyle.Standalone;
            _tabStyle = TabStyle.HighProfile;
            _tabBorderStyle = TabBorderStyle.RoundedOutsizeMedium;
            _itemAlignment = RelativePositionAlign.Near;
            _itemMinimumSize = _defaultItemMinimumSize;
            _itemMaximumSize = _defaultItemMaximumSize;
            _itemOrientation = ButtonOrientation.Auto;
            _itemSizing = BarItemSizing.SameHeight;
            _barMapImage = MapKryptonPageImage.Small;
            _barMapText = MapKryptonPageText.TextTitle;
            _barMapExtraText = MapKryptonPageText.None;
        }
Ejemplo n.º 17
0
 /// <summary>
 /// Draw border on the inside edge of the specified rectangle.
 /// </summary>
 /// <param name="context">Rendering context.</param>
 /// <param name="rect">Target rectangle.</param>
 /// <param name="palette">Palette used for drawing.</param>
 /// <param name="orientation">Visual orientation of the border.</param>
 /// <param name="state">State associated with rendering.</param>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 public abstract void DrawTabBorder(RenderContext context,
                                    Rectangle rect,
                                    IPaletteBorder palette,
                                    VisualOrientation orientation,
                                    PaletteState state,
                                    TabBorderStyle tabBorderStyle);
Ejemplo n.º 18
0
        private static GraphicsPath CreateTabBorderBackPath(RightToLeft rtl,
                                                            PaletteState state,
                                                            bool forBorder,
                                                            Rectangle rect,
                                                            int borderWidth,
                                                            TabBorderStyle tabBorderStyle,
                                                            VisualOrientation orientation,
                                                            bool smoothing)
        {
            GraphicsPath borderPath = new GraphicsPath();

            // A zero size rectangle cannot be drawn, so return a null path
            if ((rect.Width > 0) && (rect.Height > 0))
            {
                // Shrink the rect by half the width of the pen, because the pen will
                // draw half the distance overlapping each side of the centre anyway.
                int halfBorderWidth = borderWidth / 2;

                // Adjust rectangle for all except the bottom edges
                rect.Width -= (halfBorderWidth * 2);
                rect.Height -= halfBorderWidth;
                rect.X += halfBorderWidth;
                rect.Y += halfBorderWidth;

                // Populate the graphics path for the border style
                CreateTabBorderPath((rtl == RightToLeft.Yes), state, forBorder,
                                    borderPath, rect, tabBorderStyle, orientation);
            }

            return borderPath;
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Gets if the tabs should be drawn from left to right for z-ordering.
 /// </summary>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>True for left to right, otherwise draw right to left.</returns>
 public abstract bool GetTabBorderLeftDrawing(TabBorderStyle tabBorderStyle);
Ejemplo n.º 20
0
        private static void CreateTabBorderPath(bool rtl,
                                                PaletteState state,
                                                bool forBorder,
                                                GraphicsPath borderPath,
                                                Rectangle rect,
                                                TabBorderStyle tabBorderStyle,
                                                VisualOrientation orientation)
        {
            // Correct drawing by reducing drawing rectangle
            switch (orientation)
            {
                case VisualOrientation.Top:
                    rect.Width--;
                    break;
                case VisualOrientation.Bottom:
                    rect.Y--;
                    rect.Width--;
                    break;
                case VisualOrientation.Left:
                    rect.Height--;
                    break;
                case VisualOrientation.Right:
                    rect.X--;
                    rect.Height--;
                    break;
            }

            // Add only the border for drawing
            switch (tabBorderStyle)
            {
                case TabBorderStyle.DockEqual:
                case TabBorderStyle.SquareEqualSmall:
                case TabBorderStyle.SquareEqualMedium:
                case TabBorderStyle.SquareEqualLarge:
                    AddSquarePath(borderPath, orientation, rect, forBorder);
                    break;
                case TabBorderStyle.DockOutsize:
                case TabBorderStyle.SquareOutsizeSmall:
                case TabBorderStyle.SquareOutsizeMedium:
                case TabBorderStyle.SquareOutsizeLarge:
                    rect = AdjustOutsizeTab(state, rect, orientation);
                    AddSquarePath(borderPath, orientation, rect, forBorder);
                    break;
                case TabBorderStyle.RoundedEqualSmall:
                case TabBorderStyle.RoundedEqualMedium:
                case TabBorderStyle.RoundedEqualLarge:
                    AddRoundedPath(borderPath, orientation, rect, forBorder);
                    break;
                case TabBorderStyle.RoundedOutsizeSmall:
                case TabBorderStyle.RoundedOutsizeMedium:
                case TabBorderStyle.RoundedOutsizeLarge:
                    rect = AdjustOutsizeTab(state, rect, orientation);
                    AddRoundedPath(borderPath, orientation, rect, forBorder);
                    break;
                case TabBorderStyle.SlantEqualNear:
                case TabBorderStyle.SlantOutsizeNear:
                    if (tabBorderStyle == TabBorderStyle.SlantOutsizeNear)
                        rect = AdjustOutsizeTab(state, rect, orientation);

                    if (rtl && ((orientation == VisualOrientation.Top) || (orientation == VisualOrientation.Bottom)))
                        AddSlantFarPath(borderPath, orientation, rect, forBorder);
                    else
                        AddSlantNearPath(borderPath, orientation, rect, forBorder);
                    break;
                case TabBorderStyle.SlantEqualFar:
                case TabBorderStyle.SlantOutsizeFar:
                    if (tabBorderStyle == TabBorderStyle.SlantOutsizeFar)
                        rect = AdjustOutsizeTab(state, rect, orientation);

                    if (rtl && ((orientation == VisualOrientation.Top) || (orientation == VisualOrientation.Bottom)))
                        AddSlantNearPath(borderPath, orientation, rect, forBorder);
                    else
                        AddSlantFarPath(borderPath, orientation, rect, forBorder);
                    break;
                case TabBorderStyle.SlantEqualBoth:
                case TabBorderStyle.SlantOutsizeBoth:
                    if (tabBorderStyle == TabBorderStyle.SlantOutsizeBoth)
                        rect = AdjustOutsizeTab(state, rect, orientation);

                    AddSlantBothPath(borderPath, orientation, rect, forBorder);
                    break;
                case TabBorderStyle.OneNote:
                    // Is the current tab selected?
                    bool selected = (state == PaletteState.CheckedNormal) ||
                                    (state == PaletteState.CheckedPressed) ||
                                    (state == PaletteState.CheckedTracking);

                    // The right padding depends on the selected state
                    int rp = (selected ? _spacingTabOneNoteRPS : _spacingTabOneNoteRPI);

                    // If not selected then need to make the tab shorter
                    if (!selected)
                        rect = AdjustOneNoteTab(rect, orientation);

                    if (rtl && ((orientation == VisualOrientation.Top) || (orientation == VisualOrientation.Bottom)))
                        AddOneNoteReversePath(borderPath, orientation, rect, forBorder, rp);
                    else
                        AddOneNotePath(borderPath, orientation, rect, forBorder, rp);
                    break;
                case TabBorderStyle.SmoothEqual:
                case TabBorderStyle.SmoothOutsize:
                    // Adjust the outsize tab variant
                    if (tabBorderStyle == TabBorderStyle.SmoothOutsize)
                        rect = AdjustSmoothTab(state, rect, orientation);

                    AddSmoothPath(borderPath, orientation, rect, forBorder);
                    break;
                default:
                    // Should never happen!
                    Debug.Assert(false);
                    break;
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Gets the spacing used to separate each tab border instance.
 /// </summary>
 /// <param name="tabBorderStyle">Style of tab border.</param>
 /// <returns>Number of pixels to space instances.</returns>
 public abstract int GetTabBorderSpacingGap(TabBorderStyle tabBorderStyle);
Ejemplo n.º 22
0
        /// <summary>
        /// Initialize a new instance of the ViewLayoutBar class.
        /// </summary>
        /// <param name="paletteMetric">Palette source for metric values.</param>
        /// <param name="metricGap">Metric for gap between each child item.</param>
        /// <param name="itemSizing">Method used to calculate item size.</param>
        /// <param name="itemAlignment">Method used to align items within lines.</param>
        /// <param name="barMultiline">Multline showing of items.</param>
        /// <param name="itemMinimumSize">Maximum allowed item size.</param>
        /// <param name="itemMaximumSize">Minimum allowed item size.</param>
        /// <param name="barMinimumHeight">Minimum height of the bar.</param>
        /// <param name="tabBorderStyle">Tab border style.</param>
        /// <param name="reorderSelectedLine">Should line with selection be reordered.</param>
        public ViewLayoutBar(IPaletteMetric paletteMetric,
                             PaletteMetricInt metricGap,
                             BarItemSizing itemSizing,
                             RelativePositionAlign itemAlignment,
                             BarMultiline barMultiline,
                             Size itemMinimumSize,
                             Size itemMaximumSize,
                             int barMinimumHeight,
                             TabBorderStyle tabBorderStyle,
                             bool reorderSelectedLine)
        {
            // Remember the source information
            _paletteMetric = paletteMetric;
            _metricGap = metricGap;
            _itemSizing = itemSizing;
            _itemAlignment = itemAlignment;
            _itemMinimumSize = itemMinimumSize;
            _itemMaximumSize = itemMaximumSize;
            _barMinimumHeight = barMinimumHeight;
            _tabBorderStyle = tabBorderStyle;
            _barMultiline = barMultiline;
            _reorderSelectedLine = reorderSelectedLine;

            // Default other state
            _orientation = VisualOrientation.Top;
            _itemOrientation = VisualOrientation.Top;
        }