2 * Copyright(c) 2019 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;
20 using static Tizen.NUI.Components.DropDown;
22 namespace Tizen.NUI.Components
25 /// DropDownStyle is a class which saves DropDown's ux data.
27 /// <since_tizen> 6 </since_tizen>
28 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class DropDownStyle : ControlStyle
32 private int spaceBetweenButtonTextAndIcon = 0;
34 private Extents _space;
41 _space = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
43 Extents extents = new Extents(start, end, top, bottom);
44 _space.CopyFrom(extents);
52 private ListOrientation? listRelativeOrientation = ListOrientation.Left;
54 private bool isListMarginSetted = false;
55 private Extents _listMargin;
56 private Extents listMargin
60 if (null == _listMargin)
62 _listMargin = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
64 Extents extents = new Extents(start, end, top, bottom);
65 _listMargin.CopyFrom(extents);
73 private int focusedItemIndex = 0;
74 private int selectedItemIndex = 0;
75 private Size listSize;
77 private Extents _listPadding;
78 private Extents listPadding
82 if (null == _listPadding)
84 _listPadding = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
86 Extents extents = new Extents(start, end, top, bottom);
87 _listPadding.CopyFrom(extents);
95 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
96 [EditorBrowsable(EditorBrowsableState.Never)]
97 public static readonly BindableProperty SpaceBetweenButtonTextAndIconProperty = BindableProperty.Create("SpaceBetweenButtonTextAndIcon", typeof(int), typeof(DropDownStyle), 0, propertyChanged: (bindable, oldValue, newValue) =>
99 var dropDownStyle = (DropDownStyle)bindable;
100 dropDownStyle.spaceBetweenButtonTextAndIcon = (int)newValue;
102 defaultValueCreator: (bindable) =>
104 var dropDownStyle = (DropDownStyle)bindable;
105 return dropDownStyle.spaceBetweenButtonTextAndIcon;
107 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public static readonly BindableProperty SpaceProperty = BindableProperty.Create("Space", typeof(Extents), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
111 var dropDownStyle = (DropDownStyle)bindable;
112 dropDownStyle.space.CopyFrom((Extents)newValue);
114 defaultValueCreator: (bindable) =>
116 var dropDownStyle = (DropDownStyle)bindable;
117 return dropDownStyle.space;
119 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
120 [EditorBrowsable(EditorBrowsableState.Never)]
121 public static readonly BindableProperty ListRelativeOrientationProperty = BindableProperty.Create("ListRelativeOrientation", typeof(ListOrientation?), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
123 var dropDownStyle = (DropDownStyle)bindable;
124 dropDownStyle.listRelativeOrientation = (ListOrientation?)newValue;
126 defaultValueCreator: (bindable) =>
128 var dropDownStyle = (DropDownStyle)bindable;
129 return dropDownStyle.listRelativeOrientation;
131 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
132 [EditorBrowsable(EditorBrowsableState.Never)]
133 public static readonly BindableProperty ListMarginProperty = BindableProperty.Create("ListMargin", typeof(Extents), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
135 var dropDownStyle = (DropDownStyle)bindable;
136 dropDownStyle.listMargin.CopyFrom((Extents)newValue);
138 defaultValueCreator: (bindable) =>
140 var dropDownStyle = (DropDownStyle)bindable;
141 return dropDownStyle.listMargin;
143 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public static readonly BindableProperty FocusedItemIndexProperty = BindableProperty.Create("FocusedItemIndex", typeof(int), typeof(DropDownStyle), 0, propertyChanged: (bindable, oldValue, newValue) =>
147 var dropDownStyle = (DropDownStyle)bindable;
148 dropDownStyle.focusedItemIndex = (int)newValue;
150 defaultValueCreator: (bindable) =>
152 var dropDownStyle = (DropDownStyle)bindable;
153 return dropDownStyle.focusedItemIndex;
155 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
156 [EditorBrowsable(EditorBrowsableState.Never)]
157 public static readonly BindableProperty SelectedItemIndexProperty = BindableProperty.Create("SelectedItemIndex", typeof(int), typeof(DropDownStyle), 0, propertyChanged: (bindable, oldValue, newValue) =>
159 var dropDownStyle = (DropDownStyle)bindable;
160 dropDownStyle.selectedItemIndex = (int)newValue;
162 defaultValueCreator: (bindable) =>
164 var dropDownStyle = (DropDownStyle)bindable;
165 return dropDownStyle.selectedItemIndex;
167 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
168 [EditorBrowsable(EditorBrowsableState.Never)]
169 public static readonly BindableProperty ListSizeProperty = BindableProperty.Create("ListSize", typeof(Size), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
171 var dropDownStyle = (DropDownStyle)bindable;
172 dropDownStyle.listSize = (Size)newValue;
174 defaultValueCreator: (bindable) =>
176 var dropDownStyle = (DropDownStyle)bindable;
177 return dropDownStyle.listSize;
179 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
180 [EditorBrowsable(EditorBrowsableState.Never)]
181 public static readonly BindableProperty ListPaddingProperty = BindableProperty.Create("ListPadding", typeof(Extents), typeof(DropDownStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
183 var dropDownStyle = (DropDownStyle)bindable;
184 dropDownStyle.listPadding.CopyFrom((Extents)newValue);
186 defaultValueCreator: (bindable) =>
188 var dropDownStyle = (DropDownStyle)bindable;
189 return dropDownStyle.listPadding;
193 /// Creates a new instance of a DropDownStyle.
195 /// <since_tizen> 6 </since_tizen>
196 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
197 [EditorBrowsable(EditorBrowsableState.Never)]
198 public DropDownStyle() : base()
200 Button = new ButtonStyle();
201 HeaderText = new TextLabelStyle();
202 ListBackgroundImage = new ImageViewStyle();
205 /// Creates a new instance of a DropDownStyle with style.
207 /// <param name="style">Create DropDownStyle by style customized by user.</param>
208 /// <since_tizen> 6 </since_tizen>
209 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
210 [EditorBrowsable(EditorBrowsableState.Never)]
211 public DropDownStyle(DropDownStyle style) : base(style)
218 Button = new ButtonStyle();
219 HeaderText = new TextLabelStyle();
220 ListBackgroundImage = new ImageViewStyle();
226 /// DropDown button's Style.
228 /// <since_tizen> 6 </since_tizen>
229 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
230 [EditorBrowsable(EditorBrowsableState.Never)]
231 public ButtonStyle Button
238 /// Header text's Style.
240 /// <since_tizen> 6 </since_tizen>
241 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
242 [EditorBrowsable(EditorBrowsableState.Never)]
243 public TextLabelStyle HeaderText
250 /// List background image's Style.
252 /// <since_tizen> 6 </since_tizen>
253 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
254 [EditorBrowsable(EditorBrowsableState.Never)]
255 public ImageViewStyle ListBackgroundImage
262 /// Space between button text and button icon.
264 /// <since_tizen> 6 </since_tizen>
265 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
266 [EditorBrowsable(EditorBrowsableState.Never)]
267 public int SpaceBetweenButtonTextAndIcon
271 int temp = (int)GetValue(SpaceBetweenButtonTextAndIconProperty);
276 SetValue(SpaceBetweenButtonTextAndIconProperty, value);
280 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
281 [EditorBrowsable(EditorBrowsableState.Never)]
286 Extents temp = (Extents)GetValue(SpaceProperty);
291 SetValue(SpaceProperty, value);
296 /// List relative orientation.
298 /// <since_tizen> 6 </since_tizen>
299 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
300 [EditorBrowsable(EditorBrowsableState.Never)]
301 public ListOrientation? ListRelativeOrientation
305 ListOrientation? temp = (ListOrientation?)GetValue(ListRelativeOrientationProperty);
310 SetValue(ListRelativeOrientationProperty, value);
317 /// <since_tizen> 6 </since_tizen>
318 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
319 [EditorBrowsable(EditorBrowsableState.Never)]
320 public Extents ListMargin
324 Extents temp = (Extents)GetValue(ListMarginProperty);
329 SetValue(ListMarginProperty, value);
334 /// Focused item index.
336 /// <since_tizen> 6 </since_tizen>
337 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
338 [EditorBrowsable(EditorBrowsableState.Never)]
339 public int FocusedItemIndex
343 int temp = (int)GetValue(FocusedItemIndexProperty);
348 SetValue(FocusedItemIndexProperty, value);
352 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
353 [EditorBrowsable(EditorBrowsableState.Never)]
354 public int SelectedItemIndex
358 int temp = (int)GetValue(SelectedItemIndexProperty);
363 SetValue(SelectedItemIndexProperty, value);
370 /// <since_tizen> 6 </since_tizen>
371 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
372 [EditorBrowsable(EditorBrowsableState.Never)]
377 Size temp = (Size)GetValue(ListSizeProperty);
382 SetValue(ListSizeProperty, value);
389 /// <since_tizen> 6 </since_tizen>
390 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
391 [EditorBrowsable(EditorBrowsableState.Never)]
392 public Extents ListPadding
396 Extents temp = (Extents)GetValue(ListPaddingProperty);
401 SetValue(ListPaddingProperty, value);
408 /// <since_tizen> 6 </since_tizen>
409 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
410 [EditorBrowsable(EditorBrowsableState.Never)]
411 public ImageViewStyle Icon
418 /// Check image's Style.
420 /// <since_tizen> 6 </since_tizen>
421 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
422 [EditorBrowsable(EditorBrowsableState.Never)]
423 public ImageViewStyle CheckImage
430 /// Gap of Check image to boundary.
432 /// <since_tizen> 6 </since_tizen>
433 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
434 [EditorBrowsable(EditorBrowsableState.Never)]
435 public int CheckImageGapToBoundary
442 /// Flag to decide item is selected or not.
444 /// <since_tizen> 6 </since_tizen>
445 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
446 [EditorBrowsable(EditorBrowsableState.Never)]
447 public bool IsSelected
453 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
454 [EditorBrowsable(EditorBrowsableState.Never)]
455 public override void CopyFrom(BindableObject bindableObject)
457 base.CopyFrom(bindableObject);
459 DropDownStyle dropDownStyle = bindableObject as DropDownStyle;
461 if (null != dropDownStyle)
463 Button.CopyFrom(dropDownStyle.Button);
464 HeaderText.CopyFrom(dropDownStyle.HeaderText);
465 ListBackgroundImage.CopyFrom(dropDownStyle.ListBackgroundImage);
471 /// DropDownItemStyle is a class which saves DropDownItem's ux data.
473 /// <since_tizen> 6 </since_tizen>
474 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
475 [EditorBrowsable(EditorBrowsableState.Never)]
476 public class DropDownItemStyle : ControlStyle
479 /// Creates a new instance of a DropDownItemStyle.
481 /// <since_tizen> 6 </since_tizen>
482 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
483 [EditorBrowsable(EditorBrowsableState.Never)]
484 public DropDownItemStyle() : base() { }
486 /// Creates a new instance of a DropDownItemStyle with style.
488 /// <param name="style">Create DropDownItemStyle by style customized by user.</param>
489 /// <since_tizen> 6 </since_tizen>
490 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
491 [EditorBrowsable(EditorBrowsableState.Never)]
492 public DropDownItemStyle(DropDownItemStyle style) : base(style)
494 if (style.Text!= null)
496 Text.CopyFrom(style.Text);
499 if (style.Icon!= null)
501 Icon.CopyFrom(style.Icon);
504 if (style.CheckImage!= null)
506 CheckImage.CopyFrom(style.CheckImage);
509 CheckImageGapToBoundary = style.CheckImageGapToBoundary;
510 IsSelected = style.IsSelected;
516 /// <since_tizen> 6 </since_tizen>
517 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
518 [EditorBrowsable(EditorBrowsableState.Never)]
519 public TextLabelStyle Text
528 /// <since_tizen> 6 </since_tizen>
529 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
530 [EditorBrowsable(EditorBrowsableState.Never)]
531 public ImageViewStyle Icon
538 /// Check image's Style.
540 /// <since_tizen> 6 </since_tizen>
541 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
542 [EditorBrowsable(EditorBrowsableState.Never)]
543 public ImageViewStyle CheckImage
550 /// Gap of Check image to boundary.
552 /// <since_tizen> 6 </since_tizen>
553 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
554 [EditorBrowsable(EditorBrowsableState.Never)]
555 public int CheckImageGapToBoundary
562 /// Flag to decide item is selected or not.
564 /// <since_tizen> 6 </since_tizen>
565 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
566 [EditorBrowsable(EditorBrowsableState.Never)]
567 public bool IsSelected