Exemplo n.º 1
0
        /// <summary>
        /// Theme change callback when theme is changed, this callback will be trigger.
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event data</param>
        /// <since_tizen> 8 </since_tizen>
        protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
        {
            SwitchStyle switchStyle = StyleManager.Instance.GetViewStyle(style) as SwitchStyle;

            if (null != switchStyle)
            {
                Style.CopyFrom(switchStyle);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of a SwitchStyle with style.
        /// </summary>
        /// <param name="style">Create SwitchStyle by style customized by user.</param>
        /// <since_tizen> 8 </since_tizen>
        public SwitchStyle(SwitchStyle style) : base(style)
        {
            if(null == style)
            {
                return;
            }

            InitSubStyle();

            this.CopyFrom(style);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new instance of a SwitchStyle with style.
        /// </summary>
        /// <param name="style">Create SwitchStyle by style customized by user.</param>
        /// <since_tizen> 8 </since_tizen>
        public SwitchStyle(SwitchStyle style) : base(style)
        {
            if (null == style)
            {
                return;
            }

            IsSelectable = true;
            Track        = new ImageViewStyle();
            Thumb        = new ImageViewStyle();

            this.CopyFrom(style);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Return default Switch style
        /// </summary>
        internal protected override ViewStyle GetViewStyle()
        {
            SwitchStyle style = new SwitchStyle
            {
                Size  = new Size(96, 60),
                Track = new ImageViewStyle
                {
                    ResourceUrl = new Selector <string>
                    {
                        Normal           = DefaultStyle.GetResourcePath("nui_component_default_switch_track_n.png"),
                        Selected         = DefaultStyle.GetResourcePath("nui_component_default_switch_track_s.png"),
                        Disabled         = DefaultStyle.GetResourcePath("nui_component_default_switch_track_d.png"),
                        DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_track_ds.png"),
                    }
                },
                Thumb = new ImageViewStyle
                {
                    WidthResizePolicy  = ResizePolicyType.DimensionDependency,
                    HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
                    SizeModeFactor     = new Vector3(1, 1, 1),
                    ResourceUrl        = new Selector <string>
                    {
                        Normal           = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"),
                        Selected         = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"),
                        Disabled         = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"),
                        DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"),
                    },
                },
                Text = new TextLabelStyle
                {
                    PointSize = new Selector <float?> {
                        All = DefaultStyle.PointSizeNormal
                    },
                    WidthResizePolicy   = ResizePolicyType.FillToParent,
                    HeightResizePolicy  = ResizePolicyType.FillToParent,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    TextColor           = new Selector <Color>
                    {
                        Normal   = new Color(0.22f, 0.22f, 0.22f, 1),
                        Pressed  = new Color(0.11f, 0.11f, 0.11f, 1),
                        Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
                    }
                },
            };

            return(style);
        }
Exemplo n.º 5
0
        public override void ApplyStyle(ViewStyle viewStyle)
        {
            base.ApplyStyle(viewStyle);

            SwitchStyle swStyle = viewStyle as SwitchStyle;

            if (null != swStyle)
            {
                if (swStyle.Track != null)
                {
                    Track.ApplyStyle(swStyle.Track);
                }

                if (swStyle.Thumb != null)
                {
                    Thumb.ApplyStyle(swStyle.Thumb);
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Style's clone function.
        /// </summary>
        /// <param name="bindableObject">The style that need to copy.</param>
        /// <since_tizen> 8 </since_tizen>
        public override void CopyFrom(BindableObject bindableObject)
        {
            base.CopyFrom(bindableObject);

            SwitchStyle switchStyle = bindableObject as SwitchStyle;

            if (null != switchStyle)
            {
                if (null != switchStyle.Track)
                {
                    Track?.CopyFrom(switchStyle.Track);
                }

                if (null != switchStyle.Thumb)
                {
                    Thumb?.CopyFrom(switchStyle.Thumb);
                }
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new instance of a Switch with style.
 /// </summary>
 /// <param name="switchStyle">Create Switch by style customized by user.</param>
 /// <since_tizen> 8 </since_tizen>
 public Switch(SwitchStyle switchStyle) : base(switchStyle)
 {
     Initialize();
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a new instance of a Switch with style.
 /// </summary>
 /// <param name="switchStyle">Create Switch by style customized by user.</param>
 /// <since_tizen> 8 </since_tizen>
 public Switch(SwitchStyle switchStyle) : base(switchStyle)
 {
 }
Exemplo n.º 9
0
 /// <summary>
 /// Creates a new instance of a SwitchStyle with style.
 /// </summary>
 /// <param name="style">Create SwitchStyle by style customized by user.</param>
 /// <since_tizen> 8 </since_tizen>
 public SwitchStyle(SwitchStyle style) : base(style)
 {
 }