Пример #1
0
 public override View DoLayout(Size displaySize, ViewDefaults viewDefaults)
 {
     if (displaySize.Width != this.textItem.Width)
     {
         this.textItem.Width = displaySize.Width;
     }
     if (displaySize.Height != this.textItem.Height)
     {
         this.textItem.Height = displaySize.Height;
     }
     if (this.fontSize != this.textItem.FontSize)
     {
         this.textItem.FontSize = this.fontSize;
     }
     if (this.textItem.DisplayText != this.DisplayText)
     {
         this.textItem.DisplayText = this.DisplayText;
     }
     this.textItem.ApplyDefaults(viewDefaults);
     if (this.textItem.FontName != this.FontName)
     {
         this.textItem.FontName = this.FontName;
     }
     return(this.textItem.View);
 }
Пример #2
0
 public void ApplyDefaults(ViewDefaults layoutDefaults)
 {
     if (this.TextColor != null)
     {
         this.button.TextColor = this.TextColor.Value;
     }
     else
     {
         if (this.IncludeBevel)
         {
             this.button.TextColor = layoutDefaults.ButtonWithBevel_Defaults.TextColor;
         }
         else
         {
             this.button.TextColor = layoutDefaults.ButtonWithoutBevel_Defaults.TextColor;
         }
     }
     if (this.IncludeBevel)
     {
         this.buttonBackground.BackgroundColor = layoutDefaults.ButtonWithBevel_Defaults.BackgroundColor;
     }
     else
     {
         this.buttonBackground.BackgroundColor = layoutDefaults.ButtonWithoutBevel_Defaults.BackgroundColor;
     }
     if (this.InnerBevel != null)
     {
         this.InnerBevel.BackgroundColor = layoutDefaults.ButtonWithBevel_Defaults.InnerBevelColor;
     }
     if (this.OuterBevel != null)
     {
         this.OuterBevel.BackgroundColor = layoutDefaults.ButtonWithBevel_Defaults.OuterBevelColor;
     }
 }
        public override View DoLayout(Size displaySize, ViewDefaults layoutDefaults)
        {
            if (this.subLayout != null)
            {
                double outerWidth = displaySize.Width;
                if (this.Size.Width < outerWidth && !this.ChildFillsAvailableSpace)
                {
                    outerWidth = this.Size.Width;
                }
                double outerHeight = displaySize.Height;
                if (this.Size.Height < outerHeight && !this.ChildFillsAvailableSpace)
                {
                    outerHeight = this.Size.Height;
                }

                Size childSize = this.chooseSize(new Size(outerWidth, outerHeight));

                View childContent = this.subLayout.DoLayout(childSize, layoutDefaults);
                if (this.View != null)
                {
                    this.View.WidthRequest  = displaySize.Width;
                    this.View.HeightRequest = displaySize.Height;
                    this.PutContentInView(this.View, childContent);
                    return(this.View);
                }
                return(childContent);
            }
            return(this.View);
        }
Пример #4
0
 public override View DoLayout(Size bounds, ViewDefaults layoutDefaults)
 {
     if (this.view != null)
     {
         this.view.WidthRequest  = bounds.Width;
         this.view.HeightRequest = bounds.Height;
     }
     return(this.view);
 }
Пример #5
0
 public void ApplyDefaults(ViewDefaults layoutDefaults)
 {
     // apply defaults if colors weren't already set
     if (this.assignedTextColor.A <= 0)
     {
         this.Label.TextColor = layoutDefaults.TextBlock_Defaults.TextColor;
     }
     if (this.assignedBackgroundColor.A <= 0)
     {
         this.Label.BackgroundColor = layoutDefaults.TextBlock_Defaults.BackgroundColor;
     }
 }
Пример #6
0
 public abstract View DoLayout(Size bounds, ViewDefaults layoutDefaults);
Пример #7
0
 public override View DoLayout(Size displaySize, ViewDefaults layoutDefaults)
 {
     return(this.SubLayout.DoLayout(displaySize, this.defaultsOverride));
 }
Пример #8
0
 public OverrideLayoutDefaults_SpecificLayout(SpecificLayout sublayout, ViewDefaults defaultsOverride)
     : base(null, sublayout.Size, LayoutScore.Zero, sublayout, new Thickness(0))
 {
     this.defaultsOverride = defaultsOverride;
 }
Пример #9
0
 public void ApplyDefaults(ViewDefaults layoutDefaults)
 {
     this.TextBox.TextColor = layoutDefaults.TextBox_Defaults.TextColor;
     this.defaultBackground = layoutDefaults.TextBox_Defaults.BackgroundColor;
     this.updateBackgroundWithDefaults();
 }
Пример #10
0
 public void ApplyDefaults(ViewDefaults layoutDefaults)
 {
     // TODO: should a Picker change colors based on LayoutDefaults?
 }
Пример #11
0
 public void ApplyDefaults(ViewDefaults layoutDefaults)
 {
     this.TextBox.TextColor       = layoutDefaults.TextBox_Defaults.TextColor;
     this.TextBox.BackgroundColor = layoutDefaults.TextBox_Defaults.BackgroundColor;
 }
Пример #12
0
        public VisualDefaults Build()
        {
            ViewDefaults viewDefaults = new ViewDefaults();

            viewDefaults.ApplicationBackground = this.applicationBackground;

            TextBlock_ViewDefaults textblockDefaults = new TextBlock_ViewDefaults();

            textblockDefaults.TextColor       = this.uneditableTextColor;
            textblockDefaults.BackgroundColor = this.uneditableTextBackgroundColor;
            viewDefaults.TextBlock_Defaults   = textblockDefaults;

            TextBox_ViewDefaults textboxDefaults = new TextBox_ViewDefaults();

            textboxDefaults.TextColor       = this.uneditableTextBackgroundColor;
            textboxDefaults.BackgroundColor = this.uneditableTextColor;
            viewDefaults.TextBox_Defaults   = textboxDefaults;

            ButtonViewDefaults buttonDefaults = new ButtonViewDefaults();

            buttonDefaults.TextColor       = this.uneditableTextColor;
            buttonDefaults.BackgroundColor = this.uneditableTextBackgroundColor;
            if (this.buttonInnerBevelColor != null)
            {
                buttonDefaults.InnerBevelColor = this.buttonInnerBevelColor.Value;
            }
            else
            {
                buttonDefaults.InnerBevelColor = Color.DarkGray;
            }
            if (this.buttonOuterBevelColor != null)
            {
                buttonDefaults.OuterBevelColor = this.buttonOuterBevelColor.Value;
            }
            else
            {
                buttonDefaults.OuterBevelColor = Color.LightGray;
            }
            viewDefaults.ButtonWithBevel_Defaults = buttonDefaults;

            ButtonViewDefaults buttonWithoutBevelDefaults = new ButtonViewDefaults();

            buttonWithoutBevelDefaults.TextColor       = this.uneditableTextBackgroundColor;
            buttonWithoutBevelDefaults.BackgroundColor = this.uneditableTextColor;
            viewDefaults.ButtonWithoutBevel_Defaults   = buttonWithoutBevelDefaults;

            LayoutDefaults layoutDefaults = new LayoutDefaults();

            TextBox_LayoutDefaults textbox_layoutDefaults = new TextBox_LayoutDefaults();

            textbox_layoutDefaults.Font                = new ScaledFont();
            textbox_layoutDefaults.Font.Name           = this.fontName;
            textbox_layoutDefaults.Font.SizeMultiplier = this.fontSizeMultiplier;
            layoutDefaults.TextBox_Defaults            = textbox_layoutDefaults;

            VisualDefaults visualDefaults = new VisualDefaults();

            visualDefaults.LayoutDefaults = layoutDefaults;
            visualDefaults.ViewDefaults   = viewDefaults;

            visualDefaults.PersistedName = this.displayName;
            visualDefaults.DisplayName   = this.displayName;

            return(visualDefaults);
        }