/// <summary> /// Applies the values from the adapter to a component /// </summary> /// <param name="component"></param> public override void Apply(Component component) { // Component ID used by developer for locating the component via ComponentManager<br/> // Must be unique in the application component.Id = Id; component.Depth = Depth; component.Tooltip = Tooltip; component.Visible = Visible; component.IncludeInLayout = IncludeInLayout; component.Enabled = Enabled; component.MouseEnabled = MouseEnabled; component.MouseChildren = MouseChildren; component.FocusEnabled = FocusEnabled; component.HighlightOnFocus = HighlightOnFocus; component.NavigatorDescriptor = NavigatorDescriptor; #region Position and sizing component.X = UseX ? X : 0; component.Y = UseY ? Y : 0; if (UseWidth) { if (UsePercentWidth) { component.PercentWidth = Width; } else { component.Width = Width; } } else { /* 2 times - by purpose */ component.ExplicitWidth = null; component.PercentWidth = null; component.InvalidateParentSizeAndDisplayList(); } if (UseHeight) { if (UsePercentHeight) { component.PercentHeight = Height; } else { component.Height = Height; } } else { /* 2 times - by purpose */ component.ExplicitHeight = null; component.PercentHeight = null; component.InvalidateParentSizeAndDisplayList(); } component.MinWidth = MinWidth; component.MinHeight = MinHeight; component.MaxWidth = MaxWidth; component.MaxHeight = MaxHeight; #endregion #region StyleName if (StyleName != (string)component.StyleName) { component.StyleName = !string.IsNullOrEmpty(StyleName) ? StyleName : null; } #endregion #region Constrains if (UseLeft) { component.Left = Left; } else { component.Left = null; } if (UseRight) { component.Right = Right; } else { component.Right = null; } if (UseTop) { component.Top = Top; } else { component.Top = null; } if (UseBottom) { component.Bottom = Bottom; } else { component.Bottom = null; } if (UseHorizontalCenter) { component.HorizontalCenter = HorizontalCenter; } else { component.HorizontalCenter = null; } if (UseVerticalCenter) { component.VerticalCenter = VerticalCenter; } else { component.VerticalCenter = null; } #endregion #region Color & alpha if (UseColor) { component.Color = Color; component.ContentColor = ContentColor; component.BackgroundColor = BackgroundColor; } else { component.Color = Color.white; component.ContentColor = Color.white; component.BackgroundColor = Color.white; } component.Alpha = Alpha; #endregion #region Rotation & scale component.Rotation = Rotation; component.RotationPivot = RotationPivot; component.Scale = Scale; #endregion }
/// <summary> /// Applies the values from the adapter to a component /// </summary> /// <param name="component"></param> public override void Apply(Component component) { // Component ID used by developer for locating the component via ComponentManager<br/> // Must be unique in the application component.Id = Id; component.Depth = Depth; component.Tooltip = Tooltip; component.Visible = Visible; component.IncludeInLayout = IncludeInLayout; component.Enabled = Enabled; component.MouseEnabled = MouseEnabled; component.MouseChildren = MouseChildren; component.FocusEnabled = FocusEnabled; component.HighlightOnFocus = HighlightOnFocus; component.NavigatorDescriptor = NavigatorDescriptor; #region Position and sizing component.X = UseX ? X : 0; component.Y = UseY ? Y : 0; if (UseWidth) { if (UsePercentWidth) component.PercentWidth = Width; else component.Width = Width; } else { /* 2 times - by purpose */ component.ExplicitWidth = null; component.PercentWidth = null; component.InvalidateParentSizeAndDisplayList(); } if (UseHeight) { if (UsePercentHeight) component.PercentHeight = Height; else component.Height = Height; } else { /* 2 times - by purpose */ component.ExplicitHeight = null; component.PercentHeight = null; component.InvalidateParentSizeAndDisplayList(); } component.MinWidth = MinWidth; component.MinHeight = MinHeight; component.MaxWidth = MaxWidth; component.MaxHeight = MaxHeight; #endregion #region StyleName if (StyleName != (string)component.StyleName) { component.StyleName = !string.IsNullOrEmpty(StyleName) ? StyleName : null; } #endregion #region Constrains if (UseLeft) { component.Left = Left; } else { component.Left = null; } if (UseRight) { component.Right = Right; } else { component.Right = null; } if (UseTop) { component.Top = Top; } else { component.Top = null; } if (UseBottom) { component.Bottom = Bottom; } else { component.Bottom = null; } if (UseHorizontalCenter) { component.HorizontalCenter = HorizontalCenter; } else { component.HorizontalCenter = null; } if (UseVerticalCenter) { component.VerticalCenter = VerticalCenter; } else { component.VerticalCenter = null; } #endregion #region Color & alpha if (UseColor) { component.Color = Color; component.ContentColor = ContentColor; component.BackgroundColor = BackgroundColor; } else { component.Color = Color.white; component.ContentColor = Color.white; component.BackgroundColor = Color.white; } component.Alpha = Alpha; #endregion #region Rotation & scale component.Rotation = Rotation; component.RotationPivot = RotationPivot; component.Scale = Scale; #endregion }