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.
18 using System.Collections.Generic;
19 using System.ComponentModel;
20 using Tizen.NUI.Binding;
22 namespace Tizen.NUI.BaseComponents
25 /// The base class for Children attributes in Components.
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
31 private bool disposed = false;
32 private string styleName;
33 private View.States? state;
34 private View.States? subState;
36 private int? alignSelf;
37 private Vector4 flexMargin;
38 private Vector2 cellIndex;
39 private float? rowSpan;
40 private float? columnSpan;
41 private HorizontalAlignmentType? cellHorizontalAlignment;
42 private VerticalAlignmentType? cellVerticalAlignment;
43 private View leftFocusableView;
44 private View rightFocusableView;
45 private View upFocusableView;
46 private View downFocusableView;
47 private bool? focusable;
48 private bool? positionUsesPivotPoint;
49 private int? siblingOrder;
50 private Position parentOrigin;
51 private Position pivotPoint;
52 private Position position;
53 private Rotation orientation;
54 private Vector3 scale;
56 private bool? sensitive;
57 private bool? leaveRequired;
58 private bool? inheritOrientation;
59 private bool? inheritScale;
60 private DrawModeType? drawMode;
61 private Vector3 sizeModeFactor;
62 private ResizePolicyType? widthResizePolicy;
63 private ResizePolicyType? heightResizePolicy;
64 private SizeScalePolicyType? sizeScalePolicy;
65 private bool? widthForHeight;
66 private bool? heightForWidth;
67 private Extents padding;
68 private Size2D minimumSize;
69 private Size2D maximumSize;
70 private bool? inheritPosition;
71 private ClippingModeType? clippingMode;
73 private bool? inheritLayoutDirection;
74 private ViewLayoutDirectionType? layoutDirection;
75 private Extents margin;
76 private float? weight;
77 private bool? enableControlState;
78 private bool? themeChangeSensitive;
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 private VisualTransformPolicyType? cornerRadiusPolicy;
90 static ViewStyle() { }
92 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
93 [EditorBrowsable(EditorBrowsableState.Never)]
94 public ViewStyle() { }
96 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
97 [EditorBrowsable(EditorBrowsableState.Never)]
98 public ViewStyle(ViewStyle viewAttributes)
100 CopyFrom(viewAttributes);
103 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
104 [EditorBrowsable(EditorBrowsableState.Never)]
105 public string StyleName
107 get => (string)GetValue(StyleNameProperty);
108 set => SetValue(StyleNameProperty, value);
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 Selector<string> BackgroundImage
117 Selector<string> image = (Selector<string>)GetValue(BackgroundImageSelectorProperty);
118 return (null != image) ? image : backgroundImageSelector = new Selector<string>();
120 set => SetValue(BackgroundImageSelectorProperty, value);
123 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
124 [EditorBrowsable(EditorBrowsableState.Never)]
125 public View.States? State
127 get => (View.States?)GetValue(StateProperty);
128 set => SetValue(StateProperty, value);
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? SubState
135 get => (View.States?)GetValue(SubStateProperty);
136 set => SetValue(SubStateProperty, value);
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)]
143 get => (float?)GetValue(FlexProperty);
144 set => SetValue(FlexProperty, value);
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 int? AlignSelf
151 get => (int?)GetValue(AlignSelfProperty);
152 set => SetValue(AlignSelfProperty, value);
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 Vector4 FlexMargin
159 get => (Vector4)GetValue(FlexMarginProperty);
160 set => SetValue(FlexMarginProperty, value);
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 Vector2 CellIndex
167 get => (Vector2)GetValue(CellIndexProperty);
168 set => SetValue(CellIndexProperty, value);
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 float? RowSpan
175 get => (float?)GetValue(RowSpanProperty);
176 set => SetValue(RowSpanProperty, value);
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? ColumnSpan
183 get => (float?)GetValue(ColumnSpanProperty);
184 set => SetValue(ColumnSpanProperty, value);
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 HorizontalAlignmentType? CellHorizontalAlignment
191 get => (HorizontalAlignmentType?)GetValue(CellHorizontalAlignmentProperty);
192 set => SetValue(CellHorizontalAlignmentProperty, value);
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 VerticalAlignmentType? CellVerticalAlignment
199 get => (VerticalAlignmentType?)GetValue(CellVerticalAlignmentProperty);
200 set => SetValue(CellVerticalAlignmentProperty, value);
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 View LeftFocusableView
207 get => (View)GetValue(LeftFocusableViewProperty);
208 set => SetValue(LeftFocusableViewProperty, value);
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 RightFocusableView
215 get => (View)GetValue(RightFocusableViewProperty);
216 set => SetValue(RightFocusableViewProperty, value);
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 UpFocusableView
223 get => (View)GetValue(UpFocusableViewProperty);
224 set => SetValue(UpFocusableViewProperty, value);
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 DownFocusableView
231 get => (View)GetValue(DownFocusableViewProperty);
232 set => SetValue(DownFocusableViewProperty, value);
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 bool? Focusable
239 get => (bool?)GetValue(FocusableProperty);
240 set => SetValue(FocusableProperty, value);
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)]
247 get => (Size2D)GetValue(Size2DProperty);
248 set => SetValue(Size2DProperty, value);
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 Selector<float?> Opacity
257 Selector<float?> opacity = (Selector<float?>)GetValue(OpacitySelectorProperty);
258 return (null != opacity) ? opacity : opacitySelector = new Selector<float?>();
260 set => SetValue(OpacitySelectorProperty, value);
263 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
264 [EditorBrowsable(EditorBrowsableState.Never)]
265 public Position2D Position2D
267 get => (Position2D)GetValue(Position2DProperty);
268 set => SetValue(Position2DProperty, value);
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 bool? PositionUsesPivotPoint
275 get => (bool?)GetValue(PositionUsesPivotPointProperty);
276 set => SetValue(PositionUsesPivotPointProperty, value);
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 int? SiblingOrder
283 get => (int?)GetValue(SiblingOrderProperty);
284 set => SetValue(SiblingOrderProperty, value);
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 Position ParentOrigin
291 get => (Position)GetValue(ParentOriginProperty);
292 set => SetValue(ParentOriginProperty, value);
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 PivotPoint
299 get => (Position)GetValue(PivotPointProperty);
300 set => SetValue(PivotPointProperty, value);
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 float? SizeWidth
307 get => (float?)GetValue(SizeWidthProperty);
308 set => SetValue(SizeWidthProperty, value);
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? SizeHeight
315 get => (float?)GetValue(SizeHeightProperty);
316 set => SetValue(SizeHeightProperty, value);
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 Position Position
323 get => (Position)GetValue(PositionProperty);
324 set => SetValue(PositionProperty, value);
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 float? PositionX
331 get => (float?)GetValue(PositionXProperty);
332 set => SetValue(PositionXProperty, value);
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? PositionY
339 get => (float?)GetValue(PositionYProperty);
340 set => SetValue(PositionYProperty, value);
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? PositionZ
347 get => (float?)GetValue(PositionZProperty);
348 set => SetValue(PositionZProperty, value);
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 Rotation Orientation
355 get => (Rotation)GetValue(OrientationProperty);
356 set => SetValue(OrientationProperty, value);
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)]
363 get => (Vector3)GetValue(ScaleProperty);
364 set => SetValue(ScaleProperty, value);
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)]
371 get => (float?)GetValue(ScaleXProperty);
372 set => SetValue(ScaleXProperty, value);
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)]
379 get => (float?)GetValue(ScaleYProperty);
380 set => SetValue(ScaleYProperty, value);
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)]
387 get => (float?)GetValue(ScaleZProperty);
388 set => SetValue(ScaleZProperty, value);
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)]
395 get => (string)GetValue(NameProperty);
396 set => SetValue(NameProperty, value);
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 bool? Sensitive
403 get => (bool?)GetValue(SensitiveProperty);
404 set => SetValue(SensitiveProperty, value);
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? LeaveRequired
411 get => (bool?)GetValue(LeaveRequiredProperty);
412 set => SetValue(LeaveRequiredProperty, value);
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? InheritOrientation
419 get => (bool?)GetValue(InheritOrientationProperty);
420 set => SetValue(InheritOrientationProperty, value);
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? InheritScale
427 get => (bool?)GetValue(InheritScaleProperty);
428 set => SetValue(InheritScaleProperty, value);
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 DrawModeType? DrawMode
435 get => (DrawModeType?)GetValue(DrawModeProperty);
436 set => SetValue(DrawModeProperty, value);
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 Vector3 SizeModeFactor
443 get => (Vector3)GetValue(SizeModeFactorProperty);
444 set => SetValue(SizeModeFactorProperty, value);
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 ResizePolicyType? WidthResizePolicy
451 get => (ResizePolicyType?)GetValue(WidthResizePolicyProperty);
452 set => SetValue(WidthResizePolicyProperty, value);
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? HeightResizePolicy
459 get => (ResizePolicyType?)GetValue(HeightResizePolicyProperty);
460 set => SetValue(HeightResizePolicyProperty, value);
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 SizeScalePolicyType? SizeScalePolicy
467 get => (SizeScalePolicyType?)GetValue(SizeScalePolicyProperty);
468 set => SetValue(SizeScalePolicyProperty, value);
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 bool? WidthForHeight
475 get => (bool?)GetValue(WidthForHeightProperty);
476 set => SetValue(WidthForHeightProperty, value);
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? HeightForWidth
483 get => (bool?)GetValue(HeightForWidthProperty);
484 set => SetValue(HeightForWidthProperty, value);
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 Extents Padding
493 Extents tmp = (Extents)GetValue(PaddingProperty);
494 return (null != tmp) ? tmp : padding = new Extents(OnPaddingChanged, 0, 0, 0, 0);
496 set => SetValue(PaddingProperty, value);
499 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
500 [EditorBrowsable(EditorBrowsableState.Never)]
501 public Size2D MinimumSize
503 get => (Size2D)GetValue(MinimumSizeProperty);
504 set => SetValue(MinimumSizeProperty, value);
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 MaximumSize
511 get => (Size2D)GetValue(MaximumSizeProperty);
512 set => SetValue(MaximumSizeProperty, value);
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 bool? InheritPosition
519 get => (bool?)GetValue(InheritPositionProperty);
520 set => SetValue(InheritPositionProperty, value);
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 ClippingModeType? ClippingMode
527 get => (ClippingModeType?)GetValue(ClippingModeProperty);
528 set => SetValue(ClippingModeProperty, value);
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)]
537 Size tmp = (Size)GetValue(SizeProperty);
538 return (null != tmp) ? tmp : size = new Size((float? width, float? height, float? depth) =>
540 float targetWidth = 0;
541 float targetHeight = 0;
542 float targetDepth = 0;
546 targetWidth = size.Width;
547 targetHeight = size.Height;
548 targetDepth = size.Depth;
550 if (width != null) { targetWidth = (float)width; }
551 if (height != null) { targetHeight = (float)height; }
552 if (depth != null) { targetDepth = (float)depth; }
554 Size = new Size(targetWidth, targetHeight, targetDepth);
557 set => SetValue(SizeProperty, value);
560 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
561 [EditorBrowsable(EditorBrowsableState.Never)]
562 public bool? InheritLayoutDirection
564 get => (bool?)GetValue(InheritLayoutDirectionProperty);
565 set => SetValue(InheritLayoutDirectionProperty, value);
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 ViewLayoutDirectionType? LayoutDirection
572 get => (ViewLayoutDirectionType?)GetValue(LayoutDirectionProperty);
573 set => SetValue(LayoutDirectionProperty, value);
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 Extents Margin
582 Extents tmp = (Extents)GetValue(MarginProperty);
583 return (null != tmp) ? tmp : margin = new Extents(OnMarginChanged, 0, 0, 0, 0);
585 set => SetValue(MarginProperty, value);
588 /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
589 [EditorBrowsable(EditorBrowsableState.Never)]
592 get => (float?)GetValue(WeightProperty);
593 set => SetValue(WeightProperty, value);
596 /// <summary> View BackgroundColor </summary>
597 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
598 [EditorBrowsable(EditorBrowsableState.Never)]
599 public Selector<Color> BackgroundColor
603 Selector<Color> color = (Selector<Color>)GetValue(BackgroundColorSelectorProperty);
604 return (null != color) ? color : backgroundColorSelector = new Selector<Color>();
606 set => SetValue(BackgroundColorSelectorProperty, value);
612 [EditorBrowsable(EditorBrowsableState.Never)]
613 public Selector<Color> Color
617 Selector<Color> color = (Selector<Color>)GetValue(ColorSelectorProperty);
618 return (null != color) ? color : colorSelector = new Selector<Color>();
620 set => SetValue(ColorSelectorProperty, value);
623 /// <summary>View BackgroundBorder</summary>
624 /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
625 [EditorBrowsable(EditorBrowsableState.Never)]
626 public Selector<Rectangle> BackgroundImageBorder
630 Selector<Rectangle> border = (Selector<Rectangle>)GetValue(BackgroundImageBorderSelectorProperty);
631 return (null != border) ? border : backgroundImageBorderSelector = new Selector<Rectangle>();
633 set => SetValue(BackgroundImageBorderSelectorProperty, value);
637 /// Describes a shadow as an image for a View.
638 /// It is null by default.
641 /// If BoxShadow is not null, the ImageShadow value will be ignored.
643 [EditorBrowsable(EditorBrowsableState.Never)]
644 public Selector<ImageShadow> ImageShadow
646 get => (Selector<ImageShadow>)GetValue(ImageShadowSelectorProperty);
647 set => SetValue(ImageShadowSelectorProperty, value);
651 /// Describes a box shaped shadow drawing for a View.
652 /// It is null by default.
654 [EditorBrowsable(EditorBrowsableState.Never)]
655 public Selector<Shadow> BoxShadow
657 get => (Selector<Shadow>)GetValue(BoxShadowSelectorProperty);
658 set => SetValue(BoxShadowSelectorProperty, value);
662 /// The radius for the rounded corners of the View
664 [EditorBrowsable(EditorBrowsableState.Never)]
665 public Selector<float?> CornerRadius
667 get => (Selector<float?>)GetValue(CornerRadiusProperty);
668 set => SetValue(CornerRadiusProperty, value);
672 /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units).
673 /// It is absolute by default.
674 /// When the policy is relative, the corner radius is relative to the smaller of the view's width and height.
676 [EditorBrowsable(EditorBrowsableState.Never)]
677 public VisualTransformPolicyType? CornerRadiusPolicy
679 get => (VisualTransformPolicyType?)GetValue(CornerRadiusPolicyProperty);
680 set => SetValue(CornerRadiusPolicyProperty, value);
684 /// The EnableControlState value of the View.
686 [EditorBrowsable(EditorBrowsableState.Never)]
687 public bool? EnableControlState
689 get => (bool?)GetValue(EnableControlStateProperty);
690 set => SetValue(EnableControlStateProperty, value);
694 /// The ThemeChangeSensitive value of the View.
696 [EditorBrowsable(EditorBrowsableState.Never)]
697 public bool? ThemeChangeSensitive
699 get => (bool?)GetValue(ThemeChangeSensitiveProperty);
700 set => SetValue(ThemeChangeSensitiveProperty, value);
705 /// Allow null properties when merging it into other Theme.
706 /// If the value is true, the null properties reset target properties of the other ViewStyle with same key when merge.
707 /// It is used in <seealso cref="Theme.Merge(string)"/>, <seealso cref="Theme.Merge(Theme)"/>.
708 /// It is also used in <seealso cref="Theme.GetStyle(string)"/> when the Theme has a parent and needs to merge.
709 /// Please note that it is false by default.
711 [EditorBrowsable(EditorBrowsableState.Never)]
712 public bool SolidNull { get; set; } = false;
715 /// Set style's bindable properties from the view.
717 /// <param name="view">The view that includes property data.</param>
718 [EditorBrowsable(EditorBrowsableState.Never)]
719 public virtual void CopyPropertiesFromView(View view)
721 if (view == null) return;
723 BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);
724 BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
727 if (styleProperties == null || viewProperties == null) return;
729 foreach (var stylePropertyItem in styleProperties)
731 viewProperties.TryGetValue(stylePropertyItem.Key, out var viewProperty);
733 if (viewProperty == null) continue;
735 SetValue(stylePropertyItem.Value, view.GetValue(viewProperty));
739 /// <summary>Create a cloned ViewStyle.</summary>
740 [EditorBrowsable(EditorBrowsableState.Never)]
741 public ViewStyle Clone()
743 var cloned = CreateInstance();
744 cloned.CopyFrom(this);
749 /// <summary>Create a cloned ViewStyle.</summary>
750 [EditorBrowsable(EditorBrowsableState.Never)]
751 public void Merge(ViewStyle other)
753 AllowNullCopy = other?.SolidNull ?? false;
755 AllowNullCopy = false;
758 internal ViewStyle CreateInstance()
760 return (ViewStyle)Activator.CreateInstance(GetType());
763 private void OnPaddingChanged(ushort start, ushort end, ushort top, ushort bottom)
765 Padding = new Extents(start, end, top, bottom);
768 private void OnMarginChanged(ushort start, ushort end, ushort top, ushort bottom)
770 Margin = new Extents(start, end, top, bottom);
773 [EditorBrowsable(EditorBrowsableState.Never)]
774 protected virtual void Dispose(bool disposing)
783 // Dispose managed state (managed objects).
784 cellIndex?.Dispose();
785 downFocusableView?.Dispose();
786 flexMargin?.Dispose();
787 leftFocusableView?.Dispose();
789 maximumSize?.Dispose();
790 minimumSize?.Dispose();
791 orientation?.Dispose();
793 parentOrigin?.Dispose();
794 pivotPoint?.Dispose();
796 rightFocusableView?.Dispose();
799 sizeModeFactor?.Dispose();
800 upFocusableView?.Dispose();
806 [EditorBrowsable(EditorBrowsableState.Never)]
807 public void Dispose()
810 global::System.GC.SuppressFinalize(this);