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