[NUI] Refactoring Theme and StyleManager (#1981)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI / src / public / BaseComponents / Style / ViewStyle.cs
1 /*
2  * Copyright(c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17 using System;
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
21
22 namespace Tizen.NUI.BaseComponents
23 {
24     /// <summary>
25     /// The base class for Children attributes in Components.
26     /// </summary>
27     /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
28     [EditorBrowsable(EditorBrowsableState.Never)]
29     public partial class ViewStyle : BindableObject
30     {
31         private string styleName;
32         private View.States? state;
33         private View.States? subState;
34         private float? flex;
35         private int? alignSelf;
36         private Vector4 flexMargin;
37         private Vector2 cellIndex;
38         private float? rowSpan;
39         private float? columnSpan;
40         private HorizontalAlignmentType? cellHorizontalAlignment;
41         private VerticalAlignmentType? cellVerticalAlignment;
42         private View leftFocusableView;
43         private View rightFocusableView;
44         private View upFocusableView;
45         private View downFocusableView;
46         private bool? focusable;
47         private bool? positionUsesPivotPoint;
48         private int? siblingOrder;
49         private Position parentOrigin;
50         private Position pivotPoint;
51         private Position position;
52         private Rotation orientation;
53         private Vector3 scale;
54         private string name;
55         private bool? sensitive;
56         private bool? leaveRequired;
57         private bool? inheritOrientation;
58         private bool? inheritScale;
59         private DrawModeType? drawMode;
60         private Vector3 sizeModeFactor;
61         private ResizePolicyType? widthResizePolicy;
62         private ResizePolicyType? heightResizePolicy;
63         private SizeScalePolicyType? sizeScalePolicy;
64         private bool? widthForHeight;
65         private bool? heightForWidth;
66         private Extents padding;
67         private Size2D minimumSize;
68         private Size2D maximumSize;
69         private bool? inheritPosition;
70         private ClippingModeType? clippingMode;
71         private Size size;
72         private bool? inheritLayoutDirection;
73         private ViewLayoutDirectionType? layoutDirection;
74         private Extents margin;
75         private float? weight;
76         private bool? enableControlState;
77         private bool? themeChangeSensitive;
78
79         private Selector<ImageShadow> imageShadow;
80         private Selector<Shadow> boxShadow;
81         private Selector<string> backgroundImageSelector;
82         private Selector<float?> cornerRadius;
83         private Selector<float?> opacitySelector;
84         private Selector<Color> backgroundColorSelector;
85         private Selector<Rectangle> backgroundImageBorderSelector;
86         private Selector<Color> colorSelector;
87
88         static ViewStyle() {}
89
90         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
91         [EditorBrowsable(EditorBrowsableState.Never)]
92         public ViewStyle() { }
93
94         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
95         [EditorBrowsable(EditorBrowsableState.Never)]
96         public ViewStyle(ViewStyle viewAttributes)
97         {
98             CopyFrom(viewAttributes);
99         }
100
101         /// <summary>
102         /// Create an instance and set properties from the given view.
103         /// </summary>
104         /// <param name="view">The View that includes property data.</param>
105         [EditorBrowsable(EditorBrowsableState.Never)]
106         public ViewStyle(View view)
107         {
108             CopyPropertiesFromView(view);
109         }
110
111         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
112         [EditorBrowsable(EditorBrowsableState.Never)]
113         public string StyleName
114         {
115             get => (string)GetValue(StyleNameProperty);
116             set => SetValue(StyleNameProperty, value);
117         }
118
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 Selector<string> BackgroundImage
122         {
123             get
124             {
125                 Selector<string> image = (Selector<string>)GetValue(BackgroundImageSelectorProperty);
126                 return (null != image) ? image : backgroundImageSelector = new Selector<string>();
127             }
128             set => SetValue(BackgroundImageSelectorProperty, value);
129         }
130
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 View.States? State
134         {
135             get => (View.States?)GetValue(StateProperty);
136             set => SetValue(StateProperty, value);
137         }
138
139         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
140         [EditorBrowsable(EditorBrowsableState.Never)]
141         public View.States? SubState
142         {
143             get => (View.States?)GetValue(SubStateProperty);
144             set => SetValue(SubStateProperty, value);
145         }
146
147         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
148         [EditorBrowsable(EditorBrowsableState.Never)]
149         public float? Flex
150         {
151             get => (float?)GetValue(FlexProperty);
152             set => SetValue(FlexProperty, value);
153         }
154
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 int? AlignSelf
158         {
159             get => (int?)GetValue(AlignSelfProperty);
160             set => SetValue(AlignSelfProperty, value);
161         }
162
163         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
164         [EditorBrowsable(EditorBrowsableState.Never)]
165         public Vector4 FlexMargin
166         {
167             get => (Vector4)GetValue(FlexMarginProperty);
168             set => SetValue(FlexMarginProperty, value);
169         }
170
171         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
172         [EditorBrowsable(EditorBrowsableState.Never)]
173         public Vector2 CellIndex
174         {
175             get => (Vector2)GetValue(CellIndexProperty);
176             set => SetValue(CellIndexProperty, value);
177         }
178
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 float? RowSpan
182         {
183             get => (float?)GetValue(RowSpanProperty);
184             set => SetValue(RowSpanProperty, value);
185         }
186
187         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
188         [EditorBrowsable(EditorBrowsableState.Never)]
189         public float? ColumnSpan
190         {
191             get => (float?)GetValue(ColumnSpanProperty);
192             set => SetValue(ColumnSpanProperty, value);
193         }
194
195         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
196         [EditorBrowsable(EditorBrowsableState.Never)]
197         public HorizontalAlignmentType? CellHorizontalAlignment
198         {
199             get => (HorizontalAlignmentType?)GetValue(CellHorizontalAlignmentProperty);
200             set => SetValue(CellHorizontalAlignmentProperty, value);
201         }
202
203         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
204         [EditorBrowsable(EditorBrowsableState.Never)]
205         public VerticalAlignmentType? CellVerticalAlignment
206         {
207             get => (VerticalAlignmentType?)GetValue(CellVerticalAlignmentProperty);
208             set => SetValue(CellVerticalAlignmentProperty, value);
209         }
210
211         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
212         [EditorBrowsable(EditorBrowsableState.Never)]
213         public View LeftFocusableView
214         {
215             get => (View)GetValue(LeftFocusableViewProperty);
216             set => SetValue(LeftFocusableViewProperty, value);
217         }
218
219         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
220         [EditorBrowsable(EditorBrowsableState.Never)]
221         public View RightFocusableView
222         {
223             get => (View)GetValue(RightFocusableViewProperty);
224             set => SetValue(RightFocusableViewProperty, value);
225         }
226
227         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
228         [EditorBrowsable(EditorBrowsableState.Never)]
229         public View UpFocusableView
230         {
231             get => (View)GetValue(UpFocusableViewProperty);
232             set => SetValue(UpFocusableViewProperty, value);
233         }
234
235         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
236         [EditorBrowsable(EditorBrowsableState.Never)]
237         public View DownFocusableView
238         {
239             get => (View)GetValue(DownFocusableViewProperty);
240             set => SetValue(DownFocusableViewProperty, value);
241         }
242
243         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
244         [EditorBrowsable(EditorBrowsableState.Never)]
245         public bool? Focusable
246         {
247             get => (bool?)GetValue(FocusableProperty);
248             set => SetValue(FocusableProperty, value);
249         }
250
251         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
252         [EditorBrowsable(EditorBrowsableState.Never)]
253         public Size2D Size2D
254         {
255             get => (Size2D)GetValue(Size2DProperty);
256             set => SetValue(Size2DProperty, value);
257         }
258
259         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
260         [EditorBrowsable(EditorBrowsableState.Never)]
261         public Selector<float?> Opacity
262         {
263             get
264             {
265                 Selector<float?> opacity = (Selector<float?>)GetValue(OpacitySelectorProperty);
266                 return (null != opacity) ? opacity : opacitySelector = new Selector<float?>();
267             }
268             set => SetValue(OpacitySelectorProperty, value);
269         }
270
271         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
272         [EditorBrowsable(EditorBrowsableState.Never)]
273         public Position2D Position2D
274         {
275             get => (Position2D)GetValue(Position2DProperty);
276             set => SetValue(Position2DProperty, value);
277         }
278
279         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
280         [EditorBrowsable(EditorBrowsableState.Never)]
281         public bool? PositionUsesPivotPoint
282         {
283             get => (bool?)GetValue(PositionUsesPivotPointProperty);
284             set => SetValue(PositionUsesPivotPointProperty, value);
285         }
286
287         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
288         [EditorBrowsable(EditorBrowsableState.Never)]
289         public int? SiblingOrder
290         {
291             get => (int?)GetValue(SiblingOrderProperty);
292             set => SetValue(SiblingOrderProperty, value);
293         }
294
295         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
296         [EditorBrowsable(EditorBrowsableState.Never)]
297         public Position ParentOrigin
298         {
299             get => (Position)GetValue(ParentOriginProperty);
300             set => SetValue(ParentOriginProperty, value);
301         }
302
303         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
304         [EditorBrowsable(EditorBrowsableState.Never)]
305         public Position PivotPoint
306         {
307             get => (Position)GetValue(PivotPointProperty);
308             set => SetValue(PivotPointProperty, value);
309         }
310
311         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
312         [EditorBrowsable(EditorBrowsableState.Never)]
313         public float? SizeWidth
314         {
315             get => (float?)GetValue(SizeWidthProperty);
316             set => SetValue(SizeWidthProperty, value);
317         }
318
319         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
320         [EditorBrowsable(EditorBrowsableState.Never)]
321         public float? SizeHeight
322         {
323             get => (float?)GetValue(SizeHeightProperty);
324             set => SetValue(SizeHeightProperty, value);
325         }
326
327         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
328         [EditorBrowsable(EditorBrowsableState.Never)]
329         public Position Position
330         {
331             get => (Position)GetValue(PositionProperty);
332             set => SetValue(PositionProperty, value);
333         }
334
335         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
336         [EditorBrowsable(EditorBrowsableState.Never)]
337         public float? PositionX
338         {
339             get => (float?)GetValue(PositionXProperty);
340             set => SetValue(PositionXProperty, value);
341         }
342
343         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
344         [EditorBrowsable(EditorBrowsableState.Never)]
345         public float? PositionY
346         {
347             get => (float?)GetValue(PositionYProperty);
348             set => SetValue(PositionYProperty, value);
349         }
350
351         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
352         [EditorBrowsable(EditorBrowsableState.Never)]
353         public float? PositionZ
354         {
355             get => (float?)GetValue(PositionZProperty);
356             set => SetValue(PositionZProperty, value);
357         }
358
359         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
360         [EditorBrowsable(EditorBrowsableState.Never)]
361         public Rotation Orientation
362         {
363             get => (Rotation)GetValue(OrientationProperty);
364             set => SetValue(OrientationProperty, value);
365         }
366
367         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
368         [EditorBrowsable(EditorBrowsableState.Never)]
369         public Vector3 Scale
370         {
371             get => (Vector3)GetValue(ScaleProperty);
372             set => SetValue(ScaleProperty, value);
373         }
374
375         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
376         [EditorBrowsable(EditorBrowsableState.Never)]
377         public float? ScaleX
378         {
379             get => (float?)GetValue(ScaleXProperty);
380             set => SetValue(ScaleXProperty, value);
381         }
382
383         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
384         [EditorBrowsable(EditorBrowsableState.Never)]
385         public float? ScaleY
386         {
387             get => (float?)GetValue(ScaleYProperty);
388             set => SetValue(ScaleYProperty, value);
389         }
390
391         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
392         [EditorBrowsable(EditorBrowsableState.Never)]
393         public float? ScaleZ
394         {
395             get => (float?)GetValue(ScaleZProperty);
396             set => SetValue(ScaleZProperty, value);
397         }
398
399         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
400         [EditorBrowsable(EditorBrowsableState.Never)]
401         public string Name
402         {
403             get => (string)GetValue(NameProperty);
404             set => SetValue(NameProperty, value);
405         }
406
407         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
408         [EditorBrowsable(EditorBrowsableState.Never)]
409         public bool? Sensitive
410         {
411             get => (bool?)GetValue(SensitiveProperty);
412             set => SetValue(SensitiveProperty, value);
413         }
414
415         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
416         [EditorBrowsable(EditorBrowsableState.Never)]
417         public bool? LeaveRequired
418         {
419             get => (bool?)GetValue(LeaveRequiredProperty);
420             set => SetValue(LeaveRequiredProperty, value);
421         }
422
423         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
424         [EditorBrowsable(EditorBrowsableState.Never)]
425         public bool? InheritOrientation
426         {
427             get => (bool?)GetValue(InheritOrientationProperty);
428             set => SetValue(InheritOrientationProperty, value);
429         }
430
431         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
432         [EditorBrowsable(EditorBrowsableState.Never)]
433         public bool? InheritScale
434         {
435             get => (bool?)GetValue(InheritScaleProperty);
436             set => SetValue(InheritScaleProperty, value);
437         }
438
439         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
440         [EditorBrowsable(EditorBrowsableState.Never)]
441         public DrawModeType? DrawMode
442         {
443             get => (DrawModeType?)GetValue(DrawModeProperty);
444             set => SetValue(DrawModeProperty, value);
445         }
446
447         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
448         [EditorBrowsable(EditorBrowsableState.Never)]
449         public Vector3 SizeModeFactor
450         {
451             get => (Vector3)GetValue(SizeModeFactorProperty);
452             set => SetValue(SizeModeFactorProperty, value);
453         }
454
455         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
456         [EditorBrowsable(EditorBrowsableState.Never)]
457         public ResizePolicyType? WidthResizePolicy
458         {
459             get => (ResizePolicyType?)GetValue(WidthResizePolicyProperty);
460             set => SetValue(WidthResizePolicyProperty, value);
461         }
462
463         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
464         [EditorBrowsable(EditorBrowsableState.Never)]
465         public ResizePolicyType? HeightResizePolicy
466         {
467             get => (ResizePolicyType?)GetValue(HeightResizePolicyProperty);
468             set => SetValue(HeightResizePolicyProperty, value);
469         }
470
471         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
472         [EditorBrowsable(EditorBrowsableState.Never)]
473         public SizeScalePolicyType? SizeScalePolicy
474         {
475             get => (SizeScalePolicyType?)GetValue(SizeScalePolicyProperty);
476             set => SetValue(SizeScalePolicyProperty, value);
477         }
478
479         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
480         [EditorBrowsable(EditorBrowsableState.Never)]
481         public bool? WidthForHeight
482         {
483             get => (bool?)GetValue(WidthForHeightProperty);
484             set => SetValue(WidthForHeightProperty, value);
485         }
486
487         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
488         [EditorBrowsable(EditorBrowsableState.Never)]
489         public bool? HeightForWidth
490         {
491             get => (bool?)GetValue(HeightForWidthProperty);
492             set => SetValue(HeightForWidthProperty, value);
493         }
494
495         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
496         [EditorBrowsable(EditorBrowsableState.Never)]
497         public Extents Padding
498         {
499             get
500             {
501                 Extents tmp = (Extents)GetValue(PaddingProperty);
502                 return (null != tmp) ? tmp : padding = new Extents(OnPaddingChanged, 0, 0, 0, 0);
503             }
504             set => SetValue(PaddingProperty, value);
505         }
506
507         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
508         [EditorBrowsable(EditorBrowsableState.Never)]
509         public Size2D MinimumSize
510         {
511             get => (Size2D)GetValue(MinimumSizeProperty);
512             set => SetValue(MinimumSizeProperty, value);
513         }
514
515         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
516         [EditorBrowsable(EditorBrowsableState.Never)]
517         public Size2D MaximumSize
518         {
519             get => (Size2D)GetValue(MaximumSizeProperty);
520             set => SetValue(MaximumSizeProperty, value);
521         }
522
523         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
524         [EditorBrowsable(EditorBrowsableState.Never)]
525         public bool? InheritPosition
526         {
527             get => (bool?)GetValue(InheritPositionProperty);
528             set => SetValue(InheritPositionProperty, value);
529         }
530
531         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
532         [EditorBrowsable(EditorBrowsableState.Never)]
533         public ClippingModeType? ClippingMode
534         {
535             get => (ClippingModeType?)GetValue(ClippingModeProperty);
536             set => SetValue(ClippingModeProperty, value);
537         }
538
539         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
540         [EditorBrowsable(EditorBrowsableState.Never)]
541         public Size Size
542         {
543             get
544             {
545                 Size tmp = (Size)GetValue(SizeProperty);
546                 return (null != tmp) ? tmp : size = new Size((float? width, float? height, float? depth) =>
547                     {
548                         float targetWidth = 0;
549                         float targetHeight = 0;
550                         float targetDepth = 0;
551
552                         if (size != null)
553                         {
554                             targetWidth = size.Width;
555                             targetHeight = size.Height;
556                             targetDepth = size.Depth;
557                         }
558                         if (width != null) { targetWidth = (float)width; }
559                         if (height != null) { targetHeight = (float)height; }
560                         if (depth != null) { targetDepth = (float)depth; }
561
562                         Size = new Size(targetWidth, targetHeight, targetDepth);
563                     }, 0, 0, 0);
564             }
565             set => SetValue(SizeProperty, value);
566         }
567
568         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
569         [EditorBrowsable(EditorBrowsableState.Never)]
570         public bool? InheritLayoutDirection
571         {
572             get => (bool?)GetValue(InheritLayoutDirectionProperty);
573             set => SetValue(InheritLayoutDirectionProperty, value);
574         }
575
576         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
577         [EditorBrowsable(EditorBrowsableState.Never)]
578         public ViewLayoutDirectionType? LayoutDirection
579         {
580             get => (ViewLayoutDirectionType?)GetValue(LayoutDirectionProperty);
581             set => SetValue(LayoutDirectionProperty, value);
582         }
583
584         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
585         [EditorBrowsable(EditorBrowsableState.Never)]
586         public Extents Margin
587         {
588             get
589             {
590                 Extents tmp = (Extents)GetValue(MarginProperty);
591                 return (null != tmp) ? tmp : margin = new Extents(OnMarginChanged, 0, 0, 0, 0);
592             }
593             set => SetValue(MarginProperty, value);
594         }
595
596         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
597         [EditorBrowsable(EditorBrowsableState.Never)]
598         public float? Weight
599         {
600             get => (float?)GetValue(WeightProperty);
601             set => SetValue(WeightProperty, value);
602         }
603
604         /// <summary> View BackgroundColor </summary>
605         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
606         [EditorBrowsable(EditorBrowsableState.Never)]
607         public Selector<Color> BackgroundColor
608         {
609             get
610             {
611                 Selector<Color> color = (Selector<Color>)GetValue(BackgroundColorSelectorProperty);
612                 return (null != color) ? color : backgroundColorSelector = new Selector<Color>();
613             }
614             set => SetValue(BackgroundColorSelectorProperty, value);
615         }
616
617         /// <summary>
618         /// Color
619         /// </summary>
620         [EditorBrowsable(EditorBrowsableState.Never)]
621         public Selector<Color> Color
622         {
623             get
624             {
625                 Selector<Color> color = (Selector<Color>)GetValue(ColorSelectorProperty);
626                 return (null != color) ? color : colorSelector = new Selector<Color>();
627             }
628             set => SetValue(ColorSelectorProperty, value);
629         }
630
631         /// <summary>View BackgroundBorder</summary>
632         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
633         [EditorBrowsable(EditorBrowsableState.Never)]
634         public Selector<Rectangle> BackgroundImageBorder
635         {
636             get
637             {
638                 Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BackgroundImageBorderSelectorProperty);
639                 return (null != border) ? border : backgroundImageBorderSelector = new Selector<Rectangle>();
640             }
641             set => SetValue(BackgroundImageBorderSelectorProperty, value);
642         }
643
644         /// <summary>
645         /// Describes a shadow as an image for a View.
646         /// It is null by default.
647         /// </summary>
648         /// <remarks>
649         /// If BoxShadow is not null, the ImageShadow value will be ignored.
650         /// </remarks>
651         [EditorBrowsable(EditorBrowsableState.Never)]
652         public Selector<ImageShadow> ImageShadow
653         {
654             get => (Selector<ImageShadow>)GetValue(ImageShadowSelectorProperty);
655             set => SetValue(ImageShadowSelectorProperty, value);
656         }
657
658         /// <summary>
659         /// Describes a box shaped shadow drawing for a View.
660         /// It is null by default.
661         /// </summary>
662         [EditorBrowsable(EditorBrowsableState.Never)]
663         public Selector<Shadow> BoxShadow
664         {
665             get => (Selector<Shadow>)GetValue(BoxShadowSelectorProperty);
666             set => SetValue(BoxShadowSelectorProperty, value);
667         }
668
669         /// <summary>
670         /// The radius for the rounded corners of the View
671         /// </summary>
672         [EditorBrowsable(EditorBrowsableState.Never)]
673         public Selector<float?> CornerRadius
674         {
675             get => (Selector<float?>)GetValue(CornerRadiusProperty);
676             set => SetValue(CornerRadiusProperty, value);
677         }
678
679         /// <summary>
680         /// The EnableControlState value of the View.
681         /// </summary>
682         [EditorBrowsable(EditorBrowsableState.Never)]
683         public bool? EnableControlState
684         {
685             get => (bool?)GetValue(EnableControlStateProperty);
686             set => SetValue(EnableControlStateProperty, value);
687         }
688
689         /// <summary>
690         /// The ThemeChangeSensitive value of the View.
691         /// </summary>
692         [EditorBrowsable(EditorBrowsableState.Never)]
693         public bool? ThemeChangeSensitive
694         {
695             get => (bool?)GetValue(ThemeChangeSensitiveProperty);
696             set => SetValue(ThemeChangeSensitiveProperty, value);
697         }
698
699
700         /// <summary>
701         /// Allow null properties when merging it into other Theme.
702         /// If the value is true, the null properties reset target properties of the other ViewStyle with same key when merge.
703         /// It is used in <seealso cref="Theme.Merge(string)"/>, <seealso cref="Theme.Merge(Theme)"/>.
704         /// It is also used in <seealso cref="Theme.GetStyle(string)"/> when the Theme has a parent and needs to merge.
705         /// Please note that it is false by default.
706         /// </summary>
707         [EditorBrowsable(EditorBrowsableState.Never)]
708         public bool SolidNull { get; set; } = false;
709
710         /// <summary>
711         /// Set style's bindable properties from the view.
712         /// </summary>
713         /// <param name="view">The view that includes property data.</param>
714         [EditorBrowsable(EditorBrowsableState.Never)]
715         public virtual void CopyPropertiesFromView(View view)
716         {
717             if (view == null) return;
718
719             BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);            
720             BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
721             
722
723             if (styleProperties == null || viewProperties == null) return;
724
725             foreach (var stylePropertyItem in styleProperties)
726             {
727                 viewProperties.TryGetValue(stylePropertyItem.Key, out var viewProperty);
728
729                 if (viewProperty == null) continue;
730
731                 SetValue(stylePropertyItem.Value, view.GetValue(viewProperty));
732             }
733         }
734
735         /// <summary>Create a cloned ViewStyle.</summary>
736         [EditorBrowsable(EditorBrowsableState.Never)]
737         public ViewStyle Clone()
738         {
739             var cloned = CreateInstance();
740             cloned.CopyFrom(this);
741
742             return cloned;
743         }
744
745         /// <summary>Create a cloned ViewStyle.</summary>
746         [EditorBrowsable(EditorBrowsableState.Never)]
747         public void Merge(ViewStyle other)
748         {
749             AllowNullCopy = other?.SolidNull ?? false;
750             CopyFrom(other);
751             AllowNullCopy = false;
752         }
753
754         internal ViewStyle CreateInstance()
755         {
756             return (ViewStyle)Activator.CreateInstance(GetType());
757         }
758
759         private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
760         {
761             Padding = new Extents(start, end, top, bottom);
762         }
763
764         private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
765         {
766             Margin = new Extents(start, end, top, bottom);
767         }
768     }
769 }