[NUI] Remove bindings between Style and View (#1788)
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Components / PreloadStyle / DefaultTheme.cs
1 /*
2  * Copyright(c) 2020 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 using System.ComponentModel;
18 using Tizen.NUI.BaseComponents;
19
20 namespace Tizen.NUI.Components
21 {
22     /// <summary>
23     /// Interface that includes styles for all components for a default theme
24     /// </summary>
25     [EditorBrowsable(EditorBrowsableState.Never)]
26     internal class DefaultTheme : Theme
27     {
28         internal static Theme Instance { get; } = new DefaultTheme();
29
30         protected DefaultTheme() : base()
31         {
32         }
33
34         protected override ButtonStyle GetButtonStyle()
35         {
36             return new ButtonStyle
37             {
38                 Size = new Size(100, 45),
39                 BackgroundColor = new Selector<Color>
40                 {
41                     Normal = new Color(0.88f, 0.88f, 0.88f, 1),
42                     Pressed = new Color(0.77f, 0.77f, 0.77f, 1),
43                     Disabled = new Color(0.88f, 0.88f, 0.88f, 1)
44                 },
45                 Text = new TextLabelStyle
46                 {
47                     PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
48                     WidthResizePolicy = ResizePolicyType.FillToParent,
49                     HeightResizePolicy = ResizePolicyType.FillToParent,
50                     HorizontalAlignment = HorizontalAlignment.Center,
51                     VerticalAlignment = VerticalAlignment.Center,
52                     TextColor = new Selector<Color>
53                     {
54                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
55                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
56                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
57                     },
58                     Text = "Button",
59                 }
60             };
61         }
62
63         protected override ButtonStyle GetCheckBoxStyle()
64         {
65             return new ButtonStyle
66             {
67                 Size = new Size(30, 30),
68                 Icon = new ImageViewStyle
69                 {
70                     WidthResizePolicy = ResizePolicyType.DimensionDependency,
71                     HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
72                     SizeModeFactor = new Vector3(1, 1, 1),
73                     Opacity = new Selector<float?>
74                     {
75                         Normal = 1.0f,
76                         Selected = 1.0f,
77                         Disabled = 0.4f,
78                         DisabledSelected = 0.4f
79                     },
80                     BackgroundImage = new Selector<string>
81                     {
82                         Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_n.png"),
83                         Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png"),
84                         Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png"),
85                         Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_n.png"),
86                         DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png"),
87                     },
88                     ResourceUrl = new Selector<string>
89                     {
90                         Normal = "",
91                         Pressed = "",
92                         Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_s.png"),
93                         Disabled = "",
94                         DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_s.png"),
95                     }
96                 },
97                 Text = new TextLabelStyle
98                 {
99                     PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
100                     WidthResizePolicy = ResizePolicyType.FillToParent,
101                     HeightResizePolicy = ResizePolicyType.FillToParent,
102                     HorizontalAlignment = HorizontalAlignment.Center,
103                     VerticalAlignment = VerticalAlignment.Center,
104                     TextColor = new Selector<Color>
105                     {
106                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
107                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
108                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
109                     }
110                 }
111             };
112         }
113
114         protected override DropDownStyle GetDropDownStyle()
115         {
116             return new DropDownStyle
117             {
118                 Position = new Position(50, 50),
119                 Button = new ButtonStyle
120                 {
121                     ParentOrigin = ParentOrigin.TopLeft,
122                     PivotPoint = PivotPoint.TopLeft,
123                     BackgroundImage = new Selector<string>
124                     {
125                         Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_n.png"),
126                         Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png")
127                     },
128                     BackgroundImageBorder = (Rectangle)6,
129                     Text = new TextLabelStyle
130                     {
131                         Text = "Select an item",
132                         PointSize = StyleManager.PointSizeNormal,
133                         TextColor = Color.Black,
134                     },
135                     Icon = new ImageViewStyle
136                     {
137                         Size = new Size(28, 28),
138                         ResourceUrl = StyleManager.GetFrameworkResourcePath("nui_component_default_dropdown_button_icon.png"),
139                     },
140                     IconRelativeOrientation = Button.IconOrientation.Right,
141                     IconPadding = 6,
142                 },
143                 ListBackgroundImage = new ImageViewStyle
144                 {
145                     ResourceUrl = StyleManager.GetFrameworkResourcePath("nui_component_default_dropdown_list_bg.png"),
146                     Border = (Rectangle)6,
147                     Size = new Size(280, 360),
148                 },
149                 SpaceBetweenButtonTextAndIcon = 10,
150                 ListPadding = 5,
151             };
152         }
153
154         protected override DropDownItemStyle GetDropDownItemStyle()
155         {
156             return new DropDownItemStyle
157             {
158                 Size = new Size(360, 50),
159                 BackgroundColor = new Selector<Color>
160                 {
161                     Pressed = new Color(0.05f, 0.63f, 0.9f, 1),
162                     Selected = new Color(0.8f, 0.8f, 0.8f, 1),
163                     Normal = new Color(1, 1, 1, 1),
164                 },
165                 Text = new TextLabelStyle
166                 {
167                     PointSize = StyleManager.PointSizeNormal,
168                     Position = new Position(28, 0),
169                     Text = "List item",
170                 },
171             };
172         }
173
174         protected override PopupStyle GetPopupStyle()
175         {
176             return new PopupStyle
177             {
178                 Size = new Size(500, 280),
179                 BackgroundColor = new Color(0.9f, 0.9f, 0.9f, 1),
180                 ImageShadow = new ImageShadow
181                 {
182                     Url = StyleManager.GetFrameworkResourcePath("nui_component_default_popup_shadow.png"),
183                     Border = new Rectangle(24, 24, 24, 24),
184                     Extents = new Vector2(48, 48),
185                 },
186                 Title = new TextLabelStyle
187                 {
188                     PointSize = 16,
189                     TextColor = Color.Black,
190                     PositionUsesPivotPoint = true,
191                     ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
192                     PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
193                     HorizontalAlignment = HorizontalAlignment.Begin,
194                     VerticalAlignment = VerticalAlignment.Bottom,
195                     Padding = 20,
196                     Text = "Title",
197                 },
198                 Buttons = new ButtonStyle
199                 {
200                     Size = new Size(0, 80),
201                     PositionUsesPivotPoint = true,
202                     ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
203                     PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
204                     BackgroundColor = new Selector<Color>
205                     {
206                         Normal = new Color(1, 1, 1, 1),
207                         Pressed = new Color(1, 1, 1, 0.5f),
208                     },
209                     Overlay = new ImageViewStyle
210                     {
211                         PositionUsesPivotPoint = true,
212                         ParentOrigin = Tizen.NUI.ParentOrigin.Center,
213                         PivotPoint = Tizen.NUI.PivotPoint.Center,
214                         WidthResizePolicy = ResizePolicyType.FillToParent,
215                         HeightResizePolicy = ResizePolicyType.FillToParent,
216                         BackgroundColor = new Selector<Color>
217                         {
218                             Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f),
219                             Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f),
220                             Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
221                         }
222                     },
223                     Text = new TextLabelStyle
224                     {
225                         PositionUsesPivotPoint = true,
226                         ParentOrigin = Tizen.NUI.ParentOrigin.Center,
227                         PivotPoint = Tizen.NUI.PivotPoint.Center,
228                         HorizontalAlignment = HorizontalAlignment.Center,
229                         VerticalAlignment = VerticalAlignment.Center,
230                         TextColor = new Color(0.05f, 0.63f, 0.9f, 1)
231                     },
232                 },
233             };
234         }
235
236         protected override ProgressStyle GetProgressStyle()
237         {
238             return new ProgressStyle
239             {
240                 Size = new Size(200, 5),
241                 Track = new ImageViewStyle
242                 {
243                     BackgroundColor = new Color(0, 0, 0, 0.1f),
244                 },
245                 Buffer = new ImageViewStyle
246                 {
247                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 0.3f)
248                 },
249                 Progress = new ImageViewStyle
250                 {
251                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1)
252                 },
253             };
254         }
255
256         protected override ButtonStyle GetRadioButtonStyle()
257         {
258             return new ButtonStyle
259             {
260                 Size = new Size(30, 30),
261                 Icon = new ImageViewStyle
262                 {
263                     WidthResizePolicy = ResizePolicyType.DimensionDependency,
264                     HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
265                     SizeModeFactor = new Vector3(1, 1, 1),
266                     Opacity = new Selector<float?>
267                     {
268                         Normal = 1.0f,
269                         Selected = 1.0f,
270                         Disabled = 0.4f,
271                         DisabledSelected = 0.4f
272                     },
273                     BackgroundImage = new Selector<string>
274                     {
275                         Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_n.png"),
276                         Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_p.png"),
277                         Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_s.png"),
278                         Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_n.png"),
279                         DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_s.png"),
280                     }
281                 },
282                 Text = new TextLabelStyle
283                 {
284                     PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
285                     WidthResizePolicy = ResizePolicyType.FillToParent,
286                     HeightResizePolicy = ResizePolicyType.FillToParent,
287                     HorizontalAlignment = HorizontalAlignment.Center,
288                     VerticalAlignment = VerticalAlignment.Center,
289                     TextColor = new Selector<Color>
290                     {
291                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
292                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
293                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
294                     }
295                 }
296             };
297         }
298
299         protected override SliderStyle GetSliderStyle()
300         {
301             return new SliderStyle
302             {
303                 Size = new Size(200, 50),
304                 TrackThickness = 5,
305                 Track = new ImageViewStyle
306                 {
307                     BackgroundColor = new Color(0, 0, 0, 0.1f),
308                 },
309
310                 Progress = new ImageViewStyle
311                 {
312                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
313                 },
314
315                 Thumb = new ImageViewStyle
316                 {
317                     Size = new Size(50, 50),
318                     ResourceUrl = StyleManager.GetFrameworkResourcePath("nui_component_default_slider_thumb_n.png"),
319                     BackgroundImage = new Selector<string>
320                     {
321                         Normal = "",
322                         Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_slider_thumb_bg_p.png"),
323                     }
324                 },
325
326             };
327         }
328
329         protected override SwitchStyle GetSwitchStyle()
330         {
331             return new SwitchStyle
332             {
333                 Size = new Size(96, 60),
334                 Track = new ImageViewStyle
335                 {
336                     Size = new Size(96, 60),
337                     WidthResizePolicy = ResizePolicyType.Fixed,
338                     HeightResizePolicy = ResizePolicyType.Fixed,
339                     ResourceUrl = new Selector<string>
340                     {
341                         Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_n.png"),
342                         Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_s.png"),
343                         Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_d.png"),
344                         DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_ds.png"),
345                     },
346                     Border = new Rectangle(30, 30, 30, 30),
347                 },
348                 Thumb = new ImageViewStyle
349                 {
350                     Size = new Size(60, 60),
351                     ResourceUrl = new Selector<string>
352                     {
353                         Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_n.png"),
354                         Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_n.png"),
355                         Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_d.png"),
356                         DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_d.png"),
357                     },
358                 },
359                 Text = new TextLabelStyle
360                 {
361                     PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
362                     WidthResizePolicy = ResizePolicyType.FillToParent,
363                     HeightResizePolicy = ResizePolicyType.FillToParent,
364                     HorizontalAlignment = HorizontalAlignment.Center,
365                     VerticalAlignment = VerticalAlignment.Center,
366                     TextColor = new Selector<Color>
367                     {
368                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
369                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
370                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
371                     }
372                 },
373             };
374         }
375
376         protected override TabStyle GetTabStyle()
377         {
378             return new TabStyle
379             {
380                 BackgroundColor = Color.Yellow,
381                 Size = new Size(480, 80),
382                 UnderLine = new ViewStyle
383                 {
384                     Size = new Size(0, 6),
385                     PositionUsesPivotPoint = true,
386                     ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
387                     PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
388                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
389                 },
390                 Text = new TextLabelStyle
391                 {
392                     PointSize = StyleManager.PointSizeTitle,
393                     TextColor = new Selector<Color>
394                     {
395                         Normal = Color.Black,
396                         Selected = new Color(0.05f, 0.63f, 0.9f, 1),
397                     },
398                 },
399             };
400         }
401
402         protected override ToastStyle GetToastStyle()
403         {
404             return new ToastStyle
405             {
406                 WidthResizePolicy = ResizePolicyType.FitToChildren,
407                 HeightResizePolicy = ResizePolicyType.FitToChildren,
408                 BackgroundColor = new Color(0, 0, 0, 0.8f),
409                 Text = new TextLabelStyle()
410                 {
411                     PositionUsesPivotPoint = true,
412                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
413                     PivotPoint = Tizen.NUI.PivotPoint.Center,
414                     WidthResizePolicy = ResizePolicyType.UseNaturalSize,
415                     HeightResizePolicy = ResizePolicyType.UseNaturalSize,
416                     HorizontalAlignment = HorizontalAlignment.Center,
417                     VerticalAlignment = VerticalAlignment.Center,
418                     TextColor = Color.White,
419                     Padding = new Extents(12, 12, 8, 8),
420                 }
421             };
422         }
423
424         protected override LoadingStyle GetLoadingStyle()
425         {
426             return new LoadingStyle
427             {
428                 LoadingSize = new Size(100, 100)
429             };
430         }
431
432         protected override PaginationStyle GetPaginationStyle()
433         {
434             return new PaginationStyle
435             {
436                 IndicatorImageUrl = new Selector<string>()
437                 {
438                     Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_pagination_normal_dot.png"),
439                     Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_pagination_focus_dot.png"),
440                 },
441             };
442         }
443     }
444 }