[NUI] Revert patch about StyleManager (#1970)
[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                     Color = new Color("0ea1e6"),
319                     ResourceUrl = StyleManager.GetFrameworkResourcePath("nui_component_default_slider_thumb_n.png"),
320                     BackgroundImage = new Selector<string>
321                     {
322                         Normal = "",
323                         Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_slider_thumb_bg_p.png"),
324                     }
325                 },
326
327             };
328         }
329
330         protected override SwitchStyle GetSwitchStyle()
331         {
332             return new SwitchStyle
333             {
334                 Size = new Size(96, 60),
335                 Track = new ImageViewStyle
336                 {
337                     Size = new Size(96, 60),
338                     WidthResizePolicy = ResizePolicyType.Fixed,
339                     HeightResizePolicy = ResizePolicyType.Fixed,
340                     ResourceUrl = new Selector<string>
341                     {
342                         Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_n.png"),
343                         Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_s.png"),
344                         Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_d.png"),
345                         DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_ds.png"),
346                     },
347                     Border = new Rectangle(30, 30, 30, 30),
348                 },
349                 Thumb = new ImageViewStyle
350                 {
351                     Size = new Size(60, 60),
352                     ResourceUrl = new Selector<string>
353                     {
354                         Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_n.png"),
355                         Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_n.png"),
356                         Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_d.png"),
357                         DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_d.png"),
358                     },
359                 },
360                 Text = new TextLabelStyle
361                 {
362                     PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
363                     WidthResizePolicy = ResizePolicyType.FillToParent,
364                     HeightResizePolicy = ResizePolicyType.FillToParent,
365                     HorizontalAlignment = HorizontalAlignment.Center,
366                     VerticalAlignment = VerticalAlignment.Center,
367                     TextColor = new Selector<Color>
368                     {
369                         Normal = new Color(0.22f, 0.22f, 0.22f, 1),
370                         Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
371                         Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
372                     }
373                 },
374             };
375         }
376
377         protected override TabStyle GetTabStyle()
378         {
379             return new TabStyle
380             {
381                 BackgroundColor = Color.Yellow,
382                 Size = new Size(480, 80),
383                 UnderLine = new ViewStyle
384                 {
385                     Size = new Size(0, 6),
386                     PositionUsesPivotPoint = true,
387                     ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
388                     PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
389                     BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
390                 },
391                 Text = new TextLabelStyle
392                 {
393                     PointSize = StyleManager.PointSizeTitle,
394                     TextColor = new Selector<Color>
395                     {
396                         Normal = Color.Black,
397                         Selected = new Color(0.05f, 0.63f, 0.9f, 1),
398                     },
399                 },
400             };
401         }
402
403         protected override ToastStyle GetToastStyle()
404         {
405             return new ToastStyle
406             {
407                 WidthResizePolicy = ResizePolicyType.FitToChildren,
408                 HeightResizePolicy = ResizePolicyType.FitToChildren,
409                 BackgroundColor = new Color(0, 0, 0, 0.8f),
410                 Text = new TextLabelStyle()
411                 {
412                     PositionUsesPivotPoint = true,
413                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
414                     PivotPoint = Tizen.NUI.PivotPoint.Center,
415                     WidthResizePolicy = ResizePolicyType.UseNaturalSize,
416                     HeightResizePolicy = ResizePolicyType.UseNaturalSize,
417                     HorizontalAlignment = HorizontalAlignment.Center,
418                     VerticalAlignment = VerticalAlignment.Center,
419                     TextColor = Color.White,
420                     Padding = new Extents(12, 12, 8, 8),
421                 }
422             };
423         }
424
425         protected override LoadingStyle GetLoadingStyle()
426         {
427             return new LoadingStyle
428             {
429                 LoadingSize = new Size(100, 100)
430             };
431         }
432
433         protected override PaginationStyle GetPaginationStyle()
434         {
435             return new PaginationStyle
436             {
437                 IndicatorImageUrl = new Selector<string>()
438                 {
439                     Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_pagination_normal_dot.png"),
440                     Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_pagination_focus_dot.png"),
441                 },
442             };
443         }
444     }
445 }