2 * Copyright(c) 2021 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 /// AppBarStyle is a class which saves AppBar's ux data.
26 /// <since_tizen> 9 </since_tizen>
27 public class AppBarStyle : ControlStyle
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 static AppBarStyle() { }
33 /// Creates a new instance of an AppBarStyle.
35 /// <since_tizen> 9 </since_tizen>
36 public AppBarStyle() : base()
41 /// Creates a new instance of an AppBarStyle with style.
42 /// The given style is copied to the new instance.
44 /// <param name="style">Creates AppBarStyle by style customized by user.</param>
45 /// <since_tizen> 9 </since_tizen>
46 public AppBarStyle(AppBarStyle style) : base(style)
51 /// Gets or sets the AppBar Back Button style.
53 /// <since_tizen> 9 </since_tizen>
54 public ButtonStyle BackButton { get; set; } = new ButtonStyle();
57 /// Gets or sets the AppBar Title TextLabel style.
58 /// This style is applied if AppBar Title is a TextLabel.
60 /// <since_tizen> 9 </since_tizen>
61 public TextLabelStyle TitleTextLabel { get; set; } = new TextLabelStyle();
64 /// Gets or sets the AppBar Action View style.
65 /// This style is applied if AppBar ActionContent's child is a View.
67 /// <since_tizen> 9 </since_tizen>
68 public ViewStyle ActionView { get; set; } = new ViewStyle();
71 /// Gets or sets the AppBar Action Button style.
72 /// This style is applied if AppBar ActionContent's child is a Button.
74 /// <since_tizen> 9 </since_tizen>
75 public ButtonStyle ActionButton { get; set; } = new ButtonStyle();
78 /// Navigation padding in AppBar.
79 /// This works only when NavigationContent is visible.
81 [EditorBrowsable(EditorBrowsableState.Never)]
82 public Extents NavigationPadding { get; set; } = new Extents();
85 /// Action padding in AppBar.
86 /// This works only when ActionContent is visible.
88 [EditorBrowsable(EditorBrowsableState.Never)]
89 public Extents ActionPadding { get; set; } = new Extents();
92 /// Cell padding among Actions in AppBar.
93 /// This works only when ActionContent is visible.
95 [EditorBrowsable(EditorBrowsableState.Never)]
96 public Size2D ActionCellPadding { get; set; } = new Size2D();
99 /// <since_tizen> 9 </since_tizen>
100 public override void CopyFrom(BindableObject bindableObject)
102 base.CopyFrom(bindableObject);
104 if (bindableObject is AppBarStyle appBarStyle)
106 BackButton.CopyFrom(appBarStyle.BackButton);
107 TitleTextLabel.CopyFrom(appBarStyle.TitleTextLabel);
108 ActionView.CopyFrom(appBarStyle.ActionView);
109 ActionButton.CopyFrom(appBarStyle.ActionButton);
110 NavigationPadding = (appBarStyle.NavigationPadding == null) ? new Extents() : new Extents(appBarStyle.NavigationPadding);
111 ActionPadding = (appBarStyle.ActionPadding == null) ? new Extents() : new Extents(appBarStyle.ActionPadding);
112 ActionCellPadding = (appBarStyle.ActionCellPadding == null) ? new Size2D() : new Size2D(appBarStyle.ActionCellPadding.Width, appBarStyle.ActionCellPadding.Height);