[NUI] CheckBox, RadioButton and Switch can place text without setting text size ...
[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                 IconPadding = 5,
58                 Icon = new ImageViewStyle()
59                 {
60                     Size = new Size(30, 30),
61                     Opacity = new Selector<float?>()
62                     {
63                         Normal = 1.0f,
64                         Disabled = 0.4f,
65                         Selected = 1.0f,
66                     },
67                     BackgroundImage = new Selector<string>()
68                     {
69                         Pressed = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_bg_p.png",
70                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_bg_p.png",
71                         Other = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_bg_n.png",
72                     },
73                     ResourceUrl = new Selector<string>()
74                     {
75                         Pressed = "",
76                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_checkbox_s.png",
77                         Other = "",
78                     },
79                 },
80                 Text = new TextLabelStyle()
81                 {
82                     PointSize = 12,
83                     TextColor = new Selector<Color>()
84                     {
85                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
86                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
87                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1),
88                     }
89                 }
90             });
91
92             theme.AddStyleWithoutClone("Tizen.NUI.Components.Popup", new PopupStyle()
93             {
94                 Size = new Size(500, 280),
95                 BackgroundColor = new Color(0.9f, 0.9f, 0.9f, 1),
96                 ImageShadow = new ImageShadow()
97                 {
98                     Url = FrameworkInformation.ResourcePath + "nui_component_default_popup_shadow.png",
99                     Border = new Rectangle(24, 24, 24, 24),
100                     Extents = new Vector2(48, 48)
101                 },
102                 Title = new TextLabelStyle()
103                 {
104                     PointSize = 16,
105                     Padding = new Extents(20, 20, 20, 20),
106                 },
107                 Buttons = new ButtonStyle()
108                 {
109                     Size = new Size(0, 80),
110                     BackgroundColor = new Selector<Color>()
111                     {
112                         Normal = new Color(1, 1, 1, 1),
113                         Pressed = new Color(1, 1, 1, 0.5f),
114                     },
115                     Overlay = new ImageViewStyle()
116                     {
117                         BackgroundColor = new Selector<Color>()
118                         {
119                             Pressed = new Color(0, 0, 0, 0.1f),
120                             Other = new Color(1, 1, 1, 0.1f),
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                 IconPadding = 5,
150                 Icon = new ImageViewStyle()
151                 {
152                     Size = new Size(30, 30),
153                     Opacity = new Selector<float?>()
154                     {
155                         Normal = 1.0f,
156                         Disabled = 0.4f,
157                         Selected = 1.0f,
158                     },
159                     BackgroundImage = new Selector<string>()
160                     {
161                         Pressed = FrameworkInformation.ResourcePath + "nui_component_default_radiobutton_p.png",
162                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_radiobutton_s.png",
163                         Other = FrameworkInformation.ResourcePath + "nui_component_default_radiobutton_n.png",
164                     }
165                 },
166                 Text = new TextLabelStyle()
167                 {
168                     PointSize = 12,
169                     TextColor = new Selector<Color>()
170                     {
171                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
172                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
173                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1),
174                     }
175                 }
176             });
177
178             theme.AddStyleWithoutClone("Tizen.NUI.Components.Slider", new SliderStyle()
179             {
180                 Size = new Size(200, 50),
181                 TrackThickness = 5,
182                 Track = new ImageViewStyle()
183                 {
184                     BackgroundColor = new Color(0, 0, 0, 0.1f),
185                 },
186                 Progress = new ImageViewStyle()
187                 {
188                     BackgroundColor = new Color(0.5f, 0.63f, 0.9f, 1),
189                 },
190                 Thumb = new ImageViewStyle()
191                 {
192                     Size = new Size(50, 50),
193                     ResourceUrl = FrameworkInformation.ResourcePath + "nui_component_default_slider_thumb_n.png",
194                     BackgroundImage = new Selector<string>()
195                     {
196                         Normal = FrameworkInformation.ResourcePath + "nui_component_default_slider_thumb_bg_p.png",
197                         Pressed = FrameworkInformation.ResourcePath + "nui_component_default_slider_thumb_bg_p.png",
198                     }
199                 },
200                 ValueIndicatorImage = new ImageViewStyle()
201                 {
202                     Size = new Size(83, 54),
203                     ResourceUrl = FrameworkInformation.ResourcePath + "nui_component_default_slider_value_indicator.png",
204                 },
205             });
206
207             theme.AddStyleWithoutClone("Tizen.NUI.Components.Switch", new SwitchStyle()
208             {
209                 IconPadding = 5,
210                 Track = new ImageViewStyle()
211                 {
212                     Size = new Size(96, 60),
213                     ResourceUrl = new Selector<string>()
214                     {
215                         Normal = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_n.png",
216                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_s.png",
217                         Disabled = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_d.png",
218                         DisabledSelected = FrameworkInformation.ResourcePath + "nui_component_default_switch_track_ds.png",
219                     }
220                 },
221                 Thumb = new ImageViewStyle()
222                 {
223                     Size = new Size(60, 60),
224                     ResourceUrl = new Selector<string>()
225                     {
226                         Normal = FrameworkInformation.ResourcePath + "nui_component_default_switch_thumb_n.png",
227                         Disabled = FrameworkInformation.ResourcePath + "nui_component_default_switch_thumb_d.png",
228                         Selected = FrameworkInformation.ResourcePath + "nui_component_default_switch_thumb_n.png",
229                     }
230                 },
231                 Text = new TextLabelStyle()
232                 {
233                     PointSize = 12,
234                     TextColor = new Selector<Color>()
235                     {
236                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
237                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
238                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1),
239                     }
240                 }
241             });
242
243             theme.AddStyleWithoutClone("Tizen.NUI.Components.Loading", new LoadingStyle()
244             {
245                 LoadingSize = new Size(100, 100),
246             });
247
248             theme.AddStyleWithoutClone("Tizen.NUI.Components.Pagination", new PaginationStyle()
249             {
250                 IndicatorImageUrl = new Selector<string>()
251                 {
252                     Normal = FrameworkInformation.ResourcePath + "nui_component_default_pagination_normal_dot.png",
253                     Selected = FrameworkInformation.ResourcePath + "nui_component_default_pagination_focus_dot.png",
254                 },
255                 IndicatorSize = new Size(10, 10),
256             });
257
258             theme.AddStyleWithoutClone("Tizen.NUI.Components.Scrollbar", new ScrollbarStyle()
259             {
260                 TrackThickness = 6,
261                 ThumbThickness = 6,
262                 TrackColor = new Color(1, 1, 1, 0.15f),
263                 ThumbColor = new Color(0.6f, 0.6f, 0.6f, 1.0f),
264                 TrackPadding = 4
265             });
266
267             theme.AddStyleWithoutClone("Tizen.NUI.Components.RecyclerViewItem", new RecyclerViewItemStyle()
268             {
269                 BackgroundColor = new Selector<Color>()
270                 {
271                     Normal = new Color(1, 1, 1, 1),
272                     Pressed = new Color(0.85f, 0.85f, 0.85f, 1),
273                     Disabled = new Color(0.70f, 0.70f, 0.70f, 1),
274                     Selected = new Color(0.701f, 0.898f, 0.937f, 1),
275                 },
276             });
277
278             theme.AddStyleWithoutClone("Tizen.NUI.Components.DefaultLinearItem", new DefaultLinearItemStyle()
279             {
280                 SizeHeight = 130,
281                 Padding = new Extents(20, 20, 5, 5),
282                 BackgroundColor = new Selector<Color>()
283                 {
284                     Normal = new Color(1, 1, 1, 1),
285                     Pressed = new Color(0.85f, 0.85f, 0.85f, 1),
286                     Disabled = new Color(0.70f, 0.70f, 0.70f, 1),
287                     Selected = new Color(0.701f, 0.898f, 0.937f, 1),
288                 },
289                 Label = new TextLabelStyle()
290                 {
291                     PointSize = 10,
292                     Ellipsis = true,
293                 },
294                 SubLabel = new TextLabelStyle()
295                 {
296                     PointSize = 6,
297                     Ellipsis = true,
298                 },
299                 Icon = new ViewStyle()
300                 {
301                     Margin = new Extents(0, 20, 0, 0)
302                 },
303                 Extra = new ViewStyle()
304                 {
305                     Margin = new Extents(20, 0, 0, 0)
306                 },
307                 Seperator = new ViewStyle()
308                 {
309                     Margin = new Extents(5, 5, 0, 0),
310                     BackgroundColor = new Color(0.78f, 0.78f, 0.78f, 1),
311                 },
312             });
313             theme.AddStyleWithoutClone("Tizen.NUI.Components.DefaultGridItem", new DefaultGridItemStyle()
314             {
315                 Padding = new Extents(5, 5, 5, 5),
316                 Caption = new TextLabelStyle()
317                 {
318                     PointSize = 9,
319                     Ellipsis = true,
320                 },
321                 Badge = new ViewStyle()
322                 {
323                     Margin = new Extents(5, 5, 5, 5),
324                 },
325             });
326
327             theme.AddStyleWithoutClone("Tizen.NUI.Components.DefaultTitleItem", new DefaultTitleItemStyle()
328             {
329                 SizeHeight = 90,
330                 Padding = new Extents(10, 10, 5, 5),
331                 BackgroundColor = new Selector<Color>()
332                 {
333                     Normal = new Color(0.78f, 0.78f, 0.78f, 1),
334                 },
335                 Label = new TextLabelStyle()
336                 {
337                     PointSize = 10,
338                     Ellipsis = true,
339                 },
340                 Icon = new ViewStyle()
341                 {
342                     Margin = new Extents(10, 0, 0, 0)
343                 },
344                 Seperator = new ViewStyle()
345                 {
346                     Margin = new Extents(0, 0, 0, 0),
347                     BackgroundColor = new Color(0.85f, 0.85f, 0.85f, 1),
348                 },
349             });
350
351             theme.AddStyleWithoutClone("Tizen.NUI.Components.AppBar", new AppBarStyle()
352             {
353                 Size = new Size(-1, 120),
354                 BackgroundColor = new Color("#EEEFF1FF"),
355                 BackButton = new ButtonStyle()
356                 {
357                     Size = new Size(48, 48),
358                     CornerRadius = 0,
359                     BackgroundColor = new Color(0, 0, 0, 0),
360                     Icon = new ImageViewStyle()
361                     {
362                         Size = new Size(48, 48),
363                         ResourceUrl = FrameworkInformation.ResourcePath + "nui_component_default_back_button.png",
364                         Color = new Selector<Color>()
365                         {
366                             Normal = new Color("#0A0E4AFF"),
367                             Focused = new Color("#00338BFF"),
368                             Pressed = new Color("#1B69CAFF"),
369                             Disabled = new Color("#C3CAD2FF"),
370                         },
371                     },
372                 },
373                 TitleTextLabel = new TextLabelStyle()
374                 {
375                     PixelSize = 40,
376                     VerticalAlignment = VerticalAlignment.Center,
377                     TextColor = new Selector<Color>()
378                     {
379                         Normal = new Color("#000C2BFF"),
380                     }
381                 },
382                 ActionView = new ViewStyle()
383                 {
384                     Size = new Size(-1, 48),
385                     CornerRadius = 0,
386                     BackgroundColor = new Color(0, 0, 0, 0),
387                 },
388                 ActionButton = new ButtonStyle()
389                 {
390                     Size = new Size(-1, 48),
391                     CornerRadius = 0,
392                     BackgroundColor = new Color(0, 0, 0, 0),
393                     Text = new TextLabelStyle()
394                     {
395                         PixelSize = 26,
396                         TextColor = new Selector<Color>()
397                         {
398                             Normal = new Color("#0A0E4AFF"),
399                             Focused = new Color("#00338BFF"),
400                             Pressed = new Color("#1B69CAFF"),
401                             Disabled = new Color("#C3CAD2FF"),
402                         },
403                     },
404                     Icon = new ImageViewStyle()
405                     {
406                         Size = new Size(-1, 48),
407                         Color = new Selector<Color>()
408                         {
409                             Normal = new Color("#0A0E4AFF"),
410                             Focused = new Color("#00338BFF"),
411                             Pressed = new Color("#1B69CAFF"),
412                             Disabled = new Color("#C3CAD2FF"),
413                         },
414                     },
415                 },
416                 Padding = new Extents(64, 64, 0, 0),
417                 NavigationPadding = new Extents(0, 24, 0, 0),
418                 ActionPadding = new Extents(40, 0, 0, 0),
419                 ActionCellPadding = new Size2D(40, 0),
420             });
421
422             return theme;
423         }
424     }
425 }
426
427 #endif