[NUI] Format all files
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / Theme / DefaultThemeCommon.cs
1 /*
2  * Copyright(c) 2021 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 #if !PROFILE_WEARABLE
18
19 using System.Diagnostics.CodeAnalysis;
20 using Tizen.NUI.BaseComponents;
21
22 namespace Tizen.NUI.Components
23 {
24     // It is a C# version of res/Tizen.NUI.Components_Tizen.NUI.Theme.Common.xaml
25     internal partial class DefaultThemeCreator : IThemeCreator
26     {
27         [SuppressMessage("Microsoft.Reliability", "CA2000: Dispose objects before losing scope", Justification = "The responsibility to dispose the object is transferred to the theme object.")]
28         public Theme Create()
29         {
30             var theme = new Theme()
31             {
32                 Id = Tizen.NUI.DefaultThemeCreator.DefaultId,
33                 Version = Tizen.NUI.DefaultThemeCreator.DefaultVersion
34             };
35
36             theme.AddStyleWithoutClone("Tizen.NUI.Components.Button", new ButtonStyle()
37             {
38                 Size = new Size(339, 96),
39                 CornerRadiusPolicy = VisualTransformPolicyType.Relative,
40                 CornerRadius = 0.2916f,
41                 BackgroundColor = new Selector<Color>()
42                 {
43                     Normal = new Color(0.039f, 0.055f, 0.29f, 1),
44                     Focused = new Color(0, 0.2f, 0.545f, 1),
45                     Pressed = new Color(0.106f, 0.412f, 0.792f, 1),
46                     Disabled = new Color(0.765f, 0.792f, 0.824f, 1),
47                 },
48                 Text = new TextLabelStyle()
49                 {
50                     PixelSize = 32,
51                     TextColor = Color.White,
52                 }
53             });
54
55             theme.AddStyleWithoutClone("Tizen.NUI.Components.CheckBox", new ButtonStyle()
56             {
57                 Size = new Size(30, 30),
58                 Icon = new ImageViewStyle()
59                 {
60                     Opacity = new Selector<float?>()
61                     {
62                         Normal = 1.0f,
63                         Disabled = 0.4f,
64                         Selected = 1.0f,
65                     },
66                     BackgroundImage = new Selector<string>()
67                     {
68                         Pressed = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_bg_p.png",
69                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_bg_p.png",
70                         Other = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_bg_n.png",
71                     },
72                     ResourceUrl = new Selector<string>()
73                     {
74                         Pressed = "",
75                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_s.png",
76                         Other = "",
77                     },
78                 },
79                 Text = new TextLabelStyle()
80                 {
81                     PointSize = 12,
82                     TextColor = new Selector<Color>()
83                     {
84                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
85                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
86                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1),
87                     }
88                 }
89             });
90
91             theme.AddStyleWithoutClone("Tizen.NUI.Components.Popup", new PopupStyle()
92             {
93                 Size = new Size(500, 280),
94                 BackgroundColor = new Color(0.9f, 0.9f, 0.9f, 1),
95                 ImageShadow = new ImageShadow()
96                 {
97                     Url = FrameworkInformation.ResourcePath + "nui_component_default_popup_shadow.png",
98                     Border = new Rectangle(24, 24, 24, 24),
99                     Extents = new Vector2(48, 48)
100                 },
101                 Title = new TextLabelStyle()
102                 {
103                     PointSize = 16,
104                     Padding = new Extents(20, 20, 20, 20),
105                 },
106                 Buttons = new ButtonStyle()
107                 {
108                     Size = new Size(0, 80),
109                     BackgroundColor = new Selector<Color>()
110                     {
111                         Normal = new Color(1, 1, 1, 1),
112                         Pressed = new Color(1, 1, 1, 0.5f),
113                     },
114                     Overlay = new ImageViewStyle()
115                     {
116                         BackgroundColor = new Selector<Color>()
117                         {
118                             Normal = new Color(1, 1, 1, 1),
119                             Pressed = new Color(0, 0, 0, 0.1f),
120                             Other = new Color(1, 1, 1, 1),
121                         },
122                     },
123                     Text = new TextLabelStyle()
124                     {
125                         TextColor = new Color(0.05f, 0.63f, 0.9f, 1),
126                     }
127                 }
128             });
129
130             theme.AddStyleWithoutClone("Tizen.NUI.Components.Progress", new ProgressStyle()
131             {
132                 Size = new Size(200, 5),
133                 Track = new ImageViewStyle()
134                 {
135                     BackgroundColor = new Color(0, 0, 0, 0.1f),
136                 },
137                 Buffer = new ImageViewStyle()
138                 {
139                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 0.3f),
140                 },
141                 Progress = new ImageViewStyle()
142                 {
143                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
144                 },
145             });
146
147             theme.AddStyleWithoutClone("Tizen.NUI.Components.RadioButton", new ButtonStyle()
148             {
149                 Size = new Size(30, 30),
150                 Icon = new ImageViewStyle()
151                 {
152                     Opacity = new Selector<float?>()
153                     {
154                         Normal = 1.0f,
155                         Disabled = 0.4f,
156                         Selected = 1.0f,
157                     },
158                     BackgroundImage = new Selector<string>()
159                     {
160                         Pressed = FrameworkInformation.ResourcePath + "nui_component_default_radiobutton_p.png",
161                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_radiobutton_s.png",
162                         Other = FrameworkInformation.ResourcePath + "nui_component_default_radiobutton_n.png",
163                     }
164                 },
165                 Text = new TextLabelStyle()
166                 {
167                     PointSize = 12,
168                     TextColor = new Selector<Color>()
169                     {
170                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
171                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
172                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1),
173                     }
174                 }
175             });
176
177             theme.AddStyleWithoutClone("Tizen.NUI.Components.Slider", new SliderStyle()
178             {
179                 Size = new Size(200, 50),
180                 TrackThickness = 5,
181                 Track = new ImageViewStyle()
182                 {
183                     BackgroundColor = new Color(0, 0, 0, 0.1f),
184                 },
185                 Progress = new ImageViewStyle()
186                 {
187                     BackgroundColor = new Color(0.5f, 0.63f, 0.9f, 1),
188                 },
189                 Thumb = new ImageViewStyle()
190                 {
191                     Size = new Size(50, 50),
192                     ResourceUrl = FrameworkInformation.ResourcePath + "nui_component_default_slider_thumb_n.png",
193                     BackgroundImage = new Selector<string>()
194                     {
195                         Normal = FrameworkInformation.ResourcePath + "nui_component_default_slider_thumb_bg_p.png",
196                         Pressed = FrameworkInformation.ResourcePath + "nui_component_default_slider_thumb_bg_p.png",
197                     }
198                 },
199                 ValueIndicatorImage = new ImageViewStyle()
200                 {
201                     Size = new Size(83, 54),
202                     ResourceUrl = FrameworkInformation.ResourcePath + "nui_component_default_slider_value_indicator.png",
203                 },
204             });
205
206             theme.AddStyleWithoutClone("Tizen.NUI.Components.Switch", new SwitchStyle()
207             {
208                 Size = new Size(96, 60),
209                 Track = new ImageViewStyle()
210                 {
211                     Size = new Size(96, 60),
212                     ResourceUrl = new Selector<string>()
213                     {
214                         Normal = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_n.png",
215                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_s.png",
216                         Disabled = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_d.png",
217                         DisabledSelected = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_ds.png",
218                     }
219                 },
220                 Thumb = new ImageViewStyle()
221                 {
222                     Size = new Size(60, 60),
223                     ResourceUrl = new Selector<string>()
224                     {
225                         Normal = FrameworkInformation.ResourcePath + "nui_component_default_switch_thumb_n.png",
226                         Disabled = FrameworkInformation.ResourcePath + "nui_component_default_switch_thumb_d.png",
227                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_switch_thumb_n.png",
228                     }
229                 },
230                 Text = new TextLabelStyle()
231                 {
232                     PointSize = 12,
233                     TextColor = new Selector<Color>()
234                     {
235                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
236                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
237                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1),
238                     }
239                 }
240             });
241
242             theme.AddStyleWithoutClone("Tizen.NUI.Components.Loading", new LoadingStyle()
243             {
244                 LoadingSize = new Size(100, 100),
245             });
246
247             theme.AddStyleWithoutClone("Tizen.NUI.Components.Pagination", new PaginationStyle()
248             {
249                 IndicatorImageUrl = new Selector<string>()
250                 {
251                     Normal = FrameworkInformation.ResourcePath + "nui_component_default_pagination_normal_dot.png",
252                     Selected = FrameworkInformation.ResourcePath + "nui_component_default_pagination_focus_dot.png",
253                 }
254             });
255
256             theme.AddStyleWithoutClone("Tizen.NUI.Components.Scrollbar", new ScrollbarStyle()
257             {
258                 TrackThickness = 6,
259                 ThumbThickness = 6,
260                 TrackColor = new Color(1, 1, 1, 0.15f),
261                 ThumbColor = new Color(0.6f, 0.6f, 0.6f, 1.0f),
262                 TrackPadding = 4
263             });
264
265             theme.AddStyleWithoutClone("Tizen.NUI.Components.RecyclerViewItem", new RecyclerViewItemStyle()
266             {
267                 BackgroundColor = new Selector<Color>()
268                 {
269                     Normal = new Color(1, 1, 1, 1),
270                     Pressed = new Color(0.85f, 0.85f, 0.85f, 1),
271                     Disabled = new Color(0.70f, 0.70f, 0.70f, 1),
272                     Selected = new Color(0.701f, 0.898f, 0.937f, 1),
273                 },
274             });
275
276             theme.AddStyleWithoutClone("Tizen.NUI.Components.DefaultLinearItem", new DefaultLinearItemStyle()
277             {
278                 SizeHeight = 130,
279                 Padding = new Extents(20, 20, 5, 5),
280                 BackgroundColor = new Selector<Color>()
281                 {
282                     Normal = new Color(1, 1, 1, 1),
283                     Pressed = new Color(0.85f, 0.85f, 0.85f, 1),
284                     Disabled = new Color(0.70f, 0.70f, 0.70f, 1),
285                     Selected = new Color(0.701f, 0.898f, 0.937f, 1),
286                 },
287                 Label = new TextLabelStyle()
288                 {
289                     PointSize = 10,
290                     Ellipsis = true,
291                 },
292                 SubLabel = new TextLabelStyle()
293                 {
294                     PointSize = 6,
295                     Ellipsis = true,
296                 },
297                 Icon = new ViewStyle()
298                 {
299                     Margin = new Extents(0, 20, 0, 0)
300                 },
301                 Extra = new ViewStyle()
302                 {
303                     Margin = new Extents(20, 0, 0, 0)
304                 },
305                 Seperator = new ViewStyle()
306                 {
307                     Margin = new Extents(5, 5, 0, 0),
308                     BackgroundColor = new Color(0.78f, 0.78f, 0.78f, 1),
309                 },
310             });
311             theme.AddStyleWithoutClone("Tizen.NUI.Components.DefaultGridItem", new DefaultGridItemStyle()
312             {
313                 Padding = new Extents(5, 5, 5, 5),
314                 Caption = new TextLabelStyle()
315                 {
316                     PointSize = 9,
317                     Ellipsis = true,
318                 },
319                 Badge = new ViewStyle()
320                 {
321                     Margin = new Extents(5, 5, 5, 5),
322                 },
323             });
324
325             theme.AddStyleWithoutClone("Tizen.NUI.Components.DefaultTitleItem", new DefaultTitleItemStyle()
326             {
327                 SizeHeight = 90,
328                 Padding = new Extents(10, 10, 5, 5),
329                 BackgroundColor = new Selector<Color>()
330                 {
331                     Normal = new Color(0.78f, 0.78f, 0.78f, 1),
332                 },
333                 Label = new TextLabelStyle()
334                 {
335                     PointSize = 10,
336                     Ellipsis = true,
337                 },
338                 Icon = new ViewStyle()
339                 {
340                     Margin = new Extents(10, 0, 0, 0)
341                 },
342                 Seperator = new ViewStyle()
343                 {
344                     Margin = new Extents(0, 0, 0, 0),
345                     BackgroundColor = new Color(0.85f, 0.85f, 0.85f, 1),
346                 },
347             });
348
349             return theme;
350         }
351     }
352 }
353
354 #endif