Пример #1
0
        public Theme Create()
        {
            Theme theme = new Theme()
            {
                Id      = DefaultId,
                Version = DefaultVersion,
            };

            // TextLabel style.
            theme.AddStyleWithoutClone("Tizen.NUI.BaseComponents.TextLabel", new TextLabelStyle()
            {
                FontFamily = "TizenSans",
                PixelSize  = 24,
                TextColor  = new Color(0.04f, 0.05f, 0.13f, 1),
                FontStyle  = new PropertyMap().Add("weight", new PropertyValue("regular")),
            });

            // TextField style.
            theme.AddStyleWithoutClone("Tizen.NUI.BaseComponents.TextField", new TextFieldStyle()
            {
                FontFamily                = "TizenSans",
                PixelSize                 = 24,
                TextColor                 = new Color(0.04f, 0.05f, 0.13f, 1),
                PlaceholderTextColor      = new Vector4(0.79f, 0.79f, 0.79f, 1),
                FontStyle                 = new PropertyMap().Add("weight", new PropertyValue("regular")),
                PrimaryCursorColor        = new Vector4(0.04f, 0.05f, 0.13f, 1),
                SecondaryCursorColor      = new Vector4(0.04f, 0.05f, 0.13f, 1),
                CursorWidth               = 2,
                SelectionHighlightColor   = new Vector4(1.00f, 0.38f, 0.00f, 0.30f),
                GrabHandleColor           = new Color(1.00f, 1.00f, 1.00f, 1),
                GrabHandleImage           = FrameworkInformation.ResourcePath + "IoT_handler_center_downW.png",
                SelectionHandleImageLeft  = new PropertyMap().Add("filename", new PropertyValue(FrameworkInformation.ResourcePath + "IoT_handler_downleftW.png")),
                SelectionHandleImageRight = new PropertyMap().Add("filename", new PropertyValue(FrameworkInformation.ResourcePath + "IoT_handler_downrightW.png")),
            });

            // TextEditor style.
            theme.AddStyleWithoutClone("Tizen.NUI.BaseComponents.TextEditor", new TextEditorStyle()
            {
                FontFamily                = "TizenSans",
                PixelSize                 = 24,
                TextColor                 = new Color(0.04f, 0.05f, 0.13f, 1),
                PlaceholderTextColor      = new Color(0.79f, 0.79f, 0.79f, 1),
                FontStyle                 = new PropertyMap().Add("weight", new PropertyValue("regular")),
                PrimaryCursorColor        = new Vector4(0.04f, 0.05f, 0.13f, 1),
                SecondaryCursorColor      = new Vector4(0.04f, 0.05f, 0.13f, 1),
                CursorWidth               = 2,
                SelectionHighlightColor   = new Vector4(1.00f, 0.38f, 0.00f, 0.30f),
                GrabHandleColor           = new Color(1.00f, 1.00f, 1.00f, 1),
                GrabHandleImage           = FrameworkInformation.ResourcePath + "IoT_handler_center_downW.png",
                SelectionHandleImageLeft  = new PropertyMap().Add("filename", new PropertyValue(FrameworkInformation.ResourcePath + "IoT_handler_downleftW.png")),
                SelectionHandleImageRight = new PropertyMap().Add("filename", new PropertyValue(FrameworkInformation.ResourcePath + "IoT_handler_downrightW.png")),
            });

            return(theme);
        }
Пример #2
0
        internal void ApplyKeyActions(IExternalTheme externalTheme, Theme theme)
        {
            var style = theme.GetStyle(componentType.FullName);

            foreach (var item in list)
            {
                if (item.IsFinalizer)
                {
                    item.Action(style, null);
                    continue;
                }

                string newValue = externalTheme.GetValue(item.Key);
                if (newValue != null)
                {
                    if (style == null || style.GetType() != styleType)
                    {
                        style = Activator.CreateInstance(styleType) as ViewStyle;
                        theme.AddStyleWithoutClone(componentType.FullName, style);
                    }

                    // Invoke action with the existing style to overwrite properties of it.
                    item.Action(style, newValue);
                }
            }
        }