2 * Copyright(c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19 using Tizen.NUI.Binding;
21 namespace Tizen.NUI.Components
24 /// PopupStyle is a class which saves Popup's ux data.
26 [EditorBrowsable(EditorBrowsableState.Never)]
27 public class PopupStyle : ControlStyle
29 static PopupStyle() { }
32 /// Creates a new instance of a PopupStyle.
34 [EditorBrowsable(EditorBrowsableState.Never)]
35 public PopupStyle() : base()
41 /// Creates a new instance of a PopupStyle with style.
43 /// <param name="style">Create PopupStyle by style customized by user.</param>
44 [EditorBrowsable(EditorBrowsableState.Never)]
45 public PopupStyle(PopupStyle style) : base(style)
47 Title = new TextLabelStyle();
48 Buttons = new ButtonStyle();
53 /// Title Text's style.
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public TextLabelStyle Title { get; set; }
59 /// Popup button's style.
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 public ButtonStyle Buttons { get; set; }
65 /// Style's clone function.
67 /// <param name="bindableObject">The style that need to copy.</param>
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public override void CopyFrom(BindableObject bindableObject)
71 base.CopyFrom(bindableObject);
73 PopupStyle popupStyle = bindableObject as PopupStyle;
74 if (popupStyle != null)
76 if (popupStyle.Title != null)
78 Title?.CopyFrom(popupStyle.Title);
81 if (popupStyle.Buttons != null)
83 Buttons?.CopyFrom(popupStyle.Buttons);
88 private void InitSubStyle()
90 // TODO Apply proper shadow as a default for a Popup
91 BoxShadow = new Shadow()
94 Offset = new Vector2(5, 5),
97 Title = new TextLabelStyle()
99 PositionUsesPivotPoint = true,
100 ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
101 PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
102 HorizontalAlignment = HorizontalAlignment.Begin,
103 VerticalAlignment = VerticalAlignment.Bottom
106 Buttons = new ButtonStyle()
108 Size = new Size(0, 0),
109 PositionUsesPivotPoint = true,
110 ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
111 PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
112 Overlay = new ImageViewStyle()
114 PositionUsesPivotPoint = true,
115 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
116 PivotPoint = Tizen.NUI.PivotPoint.Center,
117 WidthResizePolicy = ResizePolicyType.FillToParent,
118 HeightResizePolicy = ResizePolicyType.FillToParent
121 Text = new TextLabelStyle()
123 PositionUsesPivotPoint = true,
124 ParentOrigin = Tizen.NUI.ParentOrigin.Center,
125 PivotPoint = Tizen.NUI.PivotPoint.Center,
126 WidthResizePolicy = ResizePolicyType.FillToParent,
127 HeightResizePolicy = ResizePolicyType.FillToParent,
128 HorizontalAlignment = HorizontalAlignment.Center,
129 VerticalAlignment = VerticalAlignment.Center