res/maps_marker_pin_72.png #mobile #mobile-emul #tv #wearable
res/maps_marker_sticker_48.png #mobile #mobile-emul #tv #wearable
res/maps_marker_sticker_72.png #mobile #mobile-emul #tv #wearable
+res/nui_component_default_checkbox_bg_n.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_checkbox_bg_p.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_checkbox_s.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_switch_thumb_d.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_switch_thumb_n.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_switch_track_d.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_switch_track_ds.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_switch_track_n.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_switch_track_s.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_radiobutton_n.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_radiobutton_p.png #common #mobile #mobile-emul #tv #wearable
+res/nui_component_default_radiobutton_s.png #common #mobile #mobile-emul #tv #wearable
Tizen.Account.AccountManager.dll #mobile #mobile-emul #tv #wearable
Tizen.Account.FidoClient.dll #mobile #mobile-emul #wearable
Tizen.Account.OAuth2.dll #mobile #mobile-emul #wearable
[EditorBrowsable(EditorBrowsableState.Never)]
public Control() : base()
{
+ ViewStyle viewStyle = StyleManager.Instance.GetComponentStyle(this.GetType());
+
+ if (viewStyle != null)
+ {
+ ApplyStyle(viewStyle);
+ }
+
Initialize(null);
}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default Button style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultButtonStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default Button style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ ButtonStyle style = new ButtonStyle
+ {
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(0.88f, 0.88f, 0.88f, 1),
+ Pressed = new Color(0.77f, 0.77f, 0.77f, 1),
+ Disabled = new Color(0.88f, 0.88f, 0.88f, 1)
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ },
+ Text = "Button",
+ }
+ };
+ return style;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default CheckBox style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultCheckBoxStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default CheckBox style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ ButtonStyle style = new ButtonStyle
+ {
+ Size = new Size(30, 30),
+ Icon = new ImageViewStyle
+ {
+ WidthResizePolicy = ResizePolicyType.DimensionDependency,
+ HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
+ SizeModeFactor = new Vector3(1, 1, 1),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ BackgroundImage = new Selector<string>
+ {
+ Normal = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_n.png"),
+ Pressed = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png"),
+ Selected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png"),
+ Disabled = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_n.png"),
+ DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png"),
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = "",
+ Pressed = "",
+ Selected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_s.png"),
+ Disabled = "",
+ DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_s.png"),
+ }
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ }
+ }
+ };
+ return style;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default RadioButton style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultRadioButtonStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default RadioButton style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ ButtonStyle style = new ButtonStyle
+ {
+ Size = new Size(30, 30),
+ Icon = new ImageViewStyle
+ {
+ WidthResizePolicy = ResizePolicyType.DimensionDependency,
+ HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
+ SizeModeFactor = new Vector3(1, 1, 1),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ BackgroundImage = new Selector<string>
+ {
+ Normal = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_n.png"),
+ Pressed = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_p.png"),
+ Selected = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_s.png"),
+ Disabled = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_n.png"),
+ DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_s.png"),
+ }
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ }
+ }
+ };
+ return style;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+using System.ComponentModel;
+
+namespace Tizen.NUI.Components
+{
+ internal static class DefaultStyle
+ {
+ internal const float PointSizeNormal = 12;
+
+ static internal string GetResourcePath(string filename)
+ {
+ return "/usr/share/dotnet.tizen/framework/res/" + filename;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// The default Switch style
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class DefaultSwitchStyle : StyleBase
+ {
+ /// <summary>
+ /// Return default Switch style
+ /// </summary>
+ internal protected override ViewStyle GetAttributes()
+ {
+ SwitchStyle style = new SwitchStyle
+ {
+ Size = new Size(96, 60),
+ Track = new ImageViewStyle
+ {
+ ResourceUrl = new Selector<string>
+ {
+ Normal = DefaultStyle.GetResourcePath("nui_component_default_switch_track_n.png"),
+ Selected = DefaultStyle.GetResourcePath("nui_component_default_switch_track_s.png"),
+ Disabled = DefaultStyle.GetResourcePath("nui_component_default_switch_track_d.png"),
+ DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_track_ds.png"),
+ }
+ },
+ Thumb = new ImageViewStyle
+ {
+ WidthResizePolicy = ResizePolicyType.DimensionDependency,
+ HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
+ SizeModeFactor = new Vector3(1, 1, 1),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"),
+ Selected = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"),
+ Disabled = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"),
+ DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"),
+ },
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ }
+ },
+ };
+ return style;
+ }
+ }
+}
<ProjectReference Include="..\Tizen.NUI\Tizen.NUI.csproj" />
</ItemGroup>
+ <ItemGroup>
+ <None Update="res\*.png">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
+
<!-- Include Nuget Package for Tizen Project building -->
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed class StyleManager
{
- private string theme = "default";
+ private static readonly string defaultThemeName = "default";
+ private string theme = defaultThemeName;
private Dictionary<string, Dictionary<string, StyleBase>> themeStyleSet = new Dictionary<string, Dictionary<string, StyleBase>>();
private Dictionary<string, StyleBase> defaultStyleSet = new Dictionary<string, StyleBase>();
+ private Dictionary<string, Dictionary<Type, StyleBase>> componentStyleByTheme = new Dictionary<string, Dictionary<Type, StyleBase>>();
private EventHandler<ThemeChangeEventArgs> themeChangeHander;
/// <summary>
private StyleManager()
{
}
+
/// <summary>
/// An event for the theme changed signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
/// </summary>
}
/// <summary>
+ /// Register a style for a component to theme.
+ /// </summary>
+ /// <param name="targetTheme">Theme</param>
+ /// <param name="component">The type of ComponentStyle</param>
+ /// <param name="style">The type of style</param>
+ /// <since_tizen> 6 </since_tizen>
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RegisterComponentStyle(string targetTheme, Type component, Type style)
+ {
+ if (targetTheme == null)
+ {
+ throw new ArgumentException("The argument targetTheme must be specified");
+ }
+
+ if (!componentStyleByTheme.ContainsKey(targetTheme))
+ {
+ componentStyleByTheme.Add(targetTheme, new Dictionary<Type, StyleBase>());
+ }
+
+ if (componentStyleByTheme[targetTheme].ContainsKey(component))
+ {
+ componentStyleByTheme[targetTheme][component] = Activator.CreateInstance(style) as StyleBase;
+ }
+ else
+ {
+ componentStyleByTheme[targetTheme].Add(component, Activator.CreateInstance(style) as StyleBase);
+ }
+ }
+
+ /// <summary>
+ /// Get components style in the current theme.
+ /// </summary>
+ /// <param name="component">The type of component</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ViewStyle GetComponentStyle(Type component)
+ {
+ var currentTheme = theme;
+
+ if (!componentStyleByTheme.ContainsKey(theme))
+ {
+ currentTheme = defaultThemeName;
+ }
+
+ if (defaultThemeName.Equals(currentTheme) && !componentStyleByTheme.ContainsKey(defaultThemeName))
+ {
+ LoadDefaultComponentStyle();
+ }
+
+ if (!componentStyleByTheme[currentTheme].ContainsKey(component))
+ {
+ return null;
+ }
+
+ return (componentStyleByTheme[currentTheme][component])?.GetAttributes();
+ }
+
+ /// <summary>
/// ThemeChangeEventArgs is a class to record theme change event arguments which will sent to user.
/// </summary>
/// <since_tizen> 6 </since_tizen>
[EditorBrowsable(EditorBrowsableState.Never)]
public string CurrentTheme;
}
+
+ private void LoadDefaultComponentStyle()
+ {
+ componentStyleByTheme.Add(defaultThemeName, new Dictionary<Type, StyleBase>());
+
+ var defaultComponentsStyle = componentStyleByTheme[defaultThemeName];
+ defaultComponentsStyle.Add(typeof(Button), new DefaultButtonStyle());
+ defaultComponentsStyle.Add(typeof(CheckBox), new DefaultCheckBoxStyle());
+ defaultComponentsStyle.Add(typeof(RadioButton), new DefaultRadioButtonStyle());
+ defaultComponentsStyle.Add(typeof(Switch), new DefaultSwitchStyle());
+ }
}
}