2 * Copyright(c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
21 namespace Tizen.NUI.Components
24 /// PaginationStyle used to config the pagination represent.
26 /// <since_tizen> 8 </since_tizen>
27 public class PaginationStyle : ControlStyle
29 /// <summary>The IndicatorSize bindable property.</summary>
30 [EditorBrowsable(EditorBrowsableState.Never)]
31 public static readonly BindableProperty IndicatorSizeProperty = BindableProperty.Create(nameof(IndicatorSize), typeof(Size), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
33 ((PaginationStyle)bindable).indicatorSize = newValue == null ? null : new Size((Size)newValue);
35 defaultValueCreator: (bindable) =>
37 return ((PaginationStyle)bindable).indicatorSize;
40 /// <summary>The IndicatorImageUrlSelector bindable property.</summary>
41 [EditorBrowsable(EditorBrowsableState.Never)]
42 public static readonly BindableProperty IndicatorImageUrlSelectorProperty = BindableProperty.Create("IndicatorImageUrl", typeof(Selector<string>), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
44 ((PaginationStyle)bindable).indicatorImageUrl = (Selector<string>)newValue;
46 defaultValueCreator: (bindable) =>
48 return ((PaginationStyle)bindable).indicatorImageUrl;
51 /// <summary>The IndicatorSpacing bindable property.</summary>
52 [EditorBrowsable(EditorBrowsableState.Never)]
53 public static readonly BindableProperty IndicatorSpacingProperty = BindableProperty.Create(nameof(IndicatorSpacing), typeof(int?), typeof(PaginationStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
55 ((PaginationStyle)bindable).indicatorSpacing = (int?)newValue;
57 defaultValueCreator: (bindable) =>
59 return ((PaginationStyle)bindable).indicatorSpacing;
62 private Size indicatorSize;
63 private Selector<string> indicatorImageUrl;
64 private int? indicatorSpacing;
66 static PaginationStyle() { }
69 /// Creates a new instance of a PaginationStyle.
71 /// <since_tizen> 8 </since_tizen>
72 public PaginationStyle() : base() { }
75 /// Creates a new instance of a PaginationStyle using style.
77 /// <param name="style">Create PaginationStyle by style customized by user.</param>
78 /// <since_tizen> 8 </since_tizen>
79 public PaginationStyle(PaginationStyle style) : base(style)
84 /// Gets or sets the size of the indicator.
86 /// <since_tizen> 8 </since_tizen>
87 public Size IndicatorSize
89 get => (Size)GetValue(IndicatorSizeProperty);
90 set => SetValue(IndicatorSizeProperty, value);
94 /// Gets or sets the resource of indicator.
96 /// <since_tizen> 8 </since_tizen>
97 public Selector<string> IndicatorImageUrl
99 get => (Selector<string>)GetValue(IndicatorImageUrlSelectorProperty);
100 set => SetValue(IndicatorImageUrlSelectorProperty, value);
104 /// Gets or sets the space of the indicator.
106 /// <since_tizen> 8 </since_tizen>
107 public int IndicatorSpacing
109 get => ((int?)GetValue(IndicatorSpacingProperty)) ?? 0;
110 set => SetValue(IndicatorSpacingProperty, value);
114 /// Retrieves a copy of PaginationStyle.
116 /// <param name="bindableObject">The style that need to copy.</param>
117 /// <since_tizen> 8 </since_tizen>
118 public override void CopyFrom(BindableObject bindableObject)
120 base.CopyFrom(bindableObject);