public override void MergeWith(Style s)
 {
     if (s != null)
     {
         if (this.IsEmpty)
         {
             this.CopyFrom(s);
         }
         else
         {
             base.MergeWith(s);
             MenuItemStyle style = s as MenuItemStyle;
             if ((style != null) && !style.IsEmpty)
             {
                 if (s.RegisteredCssClass.Length == 0)
                 {
                     if (style.IsSet(0x10000) && !base.IsSet(0x10000))
                     {
                         this.VerticalPadding = style.VerticalPadding;
                     }
                     if (style.IsSet(0x20000) && !base.IsSet(0x20000))
                     {
                         this.HorizontalPadding = style.HorizontalPadding;
                     }
                 }
                 if (style.IsSet(0x40000) && !base.IsSet(0x40000))
                 {
                     this.ItemSpacing = style.ItemSpacing;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <devdoc>
        ///    Copies non-blank elements from the specified style, overwriting existing
        ///    style elements if necessary.
        /// </devdoc>
        public override void CopyFrom(Style s)
        {
            if (s != null)
            {
                base.CopyFrom(s);

                MenuItemStyle mis = s as MenuItemStyle;
                if (mis != null && !mis.IsEmpty)
                {
                    // Only copy the Css attributes if they aren't included in the source Style's registered CSS class
                    if (s.RegisteredCssClass.Length != 0)
                    {
                        if (mis.IsSet(PROP_VPADDING))
                        {
                            ViewState.Remove("VerticalPadding");
                            ClearBit(PROP_VPADDING);
                        }

                        if (mis.IsSet(PROP_HPADDING))
                        {
                            ViewState.Remove("HorizontalPadding");
                            ClearBit(PROP_HPADDING);
                        }
                    }
                    else
                    {
                        if (mis.IsSet(PROP_VPADDING))
                        {
                            this.VerticalPadding = mis.VerticalPadding;
                        }

                        if (mis.IsSet(PROP_HPADDING))
                        {
                            this.HorizontalPadding = mis.HorizontalPadding;
                        }
                    }

                    // Item spacing is not rendered in the registered css, so we always copy it
                    if (mis.IsSet(PROP_ITEMSPACING))
                    {
                        this.ItemSpacing = mis.ItemSpacing;
                    }
                }
            }
        }
 public override void CopyFrom(Style s)
 {
     if (s != null)
     {
         base.CopyFrom(s);
         MenuItemStyle style = s as MenuItemStyle;
         if ((style != null) && !style.IsEmpty)
         {
             if (s.RegisteredCssClass.Length != 0)
             {
                 if (style.IsSet(0x10000))
                 {
                     base.ViewState.Remove("VerticalPadding");
                     base.ClearBit(0x10000);
                 }
                 if (style.IsSet(0x20000))
                 {
                     base.ViewState.Remove("HorizontalPadding");
                     base.ClearBit(0x20000);
                 }
             }
             else
             {
                 if (style.IsSet(0x10000))
                 {
                     this.VerticalPadding = style.VerticalPadding;
                 }
                 if (style.IsSet(0x20000))
                 {
                     this.HorizontalPadding = style.HorizontalPadding;
                 }
             }
             if (style.IsSet(0x40000))
             {
                 this.ItemSpacing = style.ItemSpacing;
             }
         }
     }
 }
Ejemplo n.º 4
0
        public override void MergeWith(Style s)
        {
            if (s != null)
            {
                if (IsEmpty)
                {
                    // Merging with an empty style is equivalent to copying,
                    // which is more efficient.
                    CopyFrom(s);
                    return;
                }

                base.MergeWith(s);

                MenuItemStyle mis = s as MenuItemStyle;
                if (mis != null && !mis.IsEmpty)
                {
                    // Since we're already copying the registered CSS class in base.MergeWith, we don't
                    // need to any attributes that would be included in that class.
                    if (s.RegisteredCssClass.Length == 0)
                    {
                        if (mis.IsSet(PROP_VPADDING) && !this.IsSet(PROP_VPADDING))
                        {
                            this.VerticalPadding = mis.VerticalPadding;
                        }

                        if (mis.IsSet(PROP_HPADDING) && !this.IsSet(PROP_HPADDING))
                        {
                            this.HorizontalPadding = mis.HorizontalPadding;
                        }
                    }

                    if (mis.IsSet(PROP_ITEMSPACING) && !this.IsSet(PROP_ITEMSPACING))
                    {
                        this.ItemSpacing = mis.ItemSpacing;
                    }
                }
            }
        }