예제 #1
0
        public override void CopyFrom(Style s)
        {
            if (s == null || s.IsEmpty)
            {
                return;
            }

            base.CopyFrom(s);
            SubMenuStyle from = s as SubMenuStyle;

            if (from == null)
            {
                return;
            }

            if (from.IsSet(HORZ_PADD))
            {
                HorizontalPadding = from.HorizontalPadding;
            }

            if (from.IsSet(VERT_PADD))
            {
                VerticalPadding = from.VerticalPadding;
            }
        }
예제 #2
0
        public override void MergeWith(Style s)
        {
            if (s != null && !s.IsEmpty)
            {
                if (IsEmpty)
                {
                    CopyFrom(s);
                    return;
                }
                base.MergeWith(s);

                SubMenuStyle with = s as SubMenuStyle;
                if (with == null)
                {
                    return;
                }

                if (with.IsSet(HORZ_PADD) && !IsSet(HORZ_PADD))
                {
                    HorizontalPadding = with.HorizontalPadding;
                }
                if (with.IsSet(VERT_PADD) && !IsSet(VERT_PADD))
                {
                    VerticalPadding = with.VerticalPadding;
                }
            }
        }
        /// <devdoc>
        ///    Copies non-blank elements from the specified style, but will not overwrite
        ///    any existing style elements.
        /// </devdoc>
        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);

                SubMenuStyle sms = s as SubMenuStyle;
                // 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 (sms != null && !sms.IsEmpty && s.RegisteredCssClass.Length == 0)
                {
                    if (sms.IsSet(PROP_VPADDING) && !this.IsSet(PROP_VPADDING))
                    {
                        this.VerticalPadding = sms.VerticalPadding;
                    }

                    if (sms.IsSet(PROP_HPADDING) && !this.IsSet(PROP_HPADDING))
                    {
                        this.HorizontalPadding = sms.HorizontalPadding;
                    }
                }
            }
        }
예제 #4
0
 public override void CopyFrom(Style s)
 {
     if (s != null)
     {
         base.CopyFrom(s);
         SubMenuStyle style = s as SubMenuStyle;
         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;
                 }
             }
         }
     }
 }
예제 #5
0
 public override void MergeWith(Style s)
 {
     if (s != null)
     {
         if (this.IsEmpty)
         {
             this.CopyFrom(s);
         }
         else
         {
             base.MergeWith(s);
             SubMenuStyle style = s as SubMenuStyle;
             if (((style != null) && !style.IsEmpty) && (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;
                 }
             }
         }
     }
 }
        /// <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);

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

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

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