Esempio n. 1
0
 private void AddClass(string c)
 {
     if (c != null)
     {
         parts.Add(StyleSelectorPart.CreateClass(c));
     }
 }
Esempio n. 2
0
        public static void AddSettings(StyleSheetBuilderHelper helper, GUISettings settings)
        {
            // Settings
            helper.BeginRule("GUISkin.settings - GUISettings");
            using (helper.builder.BeginComplexSelector(0))
            {
                helper.builder.AddSimpleSelector(new[] { StyleSelectorPart.CreateClass(ConverterUtils.k_GUISettingsSelector.Replace(".", "")) }, StyleSelectorRelationship.None);
            }

            helper.AddProperty(ConverterUtils.k_SelectionColor, settings.selectionColor, "GUISettings.selectionColor");
            helper.AddProperty(ConverterUtils.k_CursorColor, settings.cursorColor, "GUISettings.cursorColor");
            helper.AddProperty(ConverterUtils.k_CursorFlashSpeed, settings.cursorFlashSpeed, "GUISettings.cursorFlashSpeed");
            helper.AddProperty(ConverterUtils.k_DoubleClickSelectsWord, settings.doubleClickSelectsWord, "GUISettings.doubleClickSelectsWord");
            helper.AddProperty(ConverterUtils.k_TripleClickSelectsLine, settings.tripleClickSelectsLine, "GUISettings.tripleClickSelectsLine");

            helper.EndRule();
        }
Esempio n. 3
0
 public static StyleSelectorPart CreateSelectorPart(string selectorStr)
 {
     return(selectorStr[0] == '.' ? StyleSelectorPart.CreateClass(selectorStr.Substring(1)) : StyleSelectorPart.CreateType(selectorStr));
 }
Esempio n. 4
0
        public static StyleSelectorPart[] GetStateRuleSelectorParts(string baseSelectorStr, string id)
        {
            var baseSelector = baseSelectorStr[0] == '.' ? StyleSelectorPart.CreateClass(baseSelectorStr.Substring(1)) : StyleSelectorPart.CreateType(baseSelectorStr);

            switch (id)
            {
            case "active":
                return(new[]
                {
                    baseSelector,
                    StyleSelectorPart.CreatePseudoClass("hover"),
                    StyleSelectorPart.CreatePseudoClass("active")
                });

            case "focused":
                return(new[]
                {
                    baseSelector,
                    StyleSelectorPart.CreatePseudoClass("focus")
                });

            case "hover":
                return(new[]
                {
                    baseSelector,
                    StyleSelectorPart.CreatePseudoClass("hover")
                });

            case "onActive":
                return(new[]
                {
                    baseSelector,
                    StyleSelectorPart.CreatePseudoClass("hover"),
                    StyleSelectorPart.CreatePseudoClass("active"),
                    StyleSelectorPart.CreatePseudoClass("checked")
                });

            case "onFocused":
                return(new[]
                {
                    baseSelector,
                    StyleSelectorPart.CreatePseudoClass("hover"),
                    StyleSelectorPart.CreatePseudoClass("focus"),
                    StyleSelectorPart.CreatePseudoClass("checked")
                });

            case "onHover":
                return(new[]
                {
                    baseSelector,
                    StyleSelectorPart.CreatePseudoClass("hover"),
                    StyleSelectorPart.CreatePseudoClass("checked")
                });

            case "onNormal":
                return(new[]
                {
                    baseSelector,
                    StyleSelectorPart.CreatePseudoClass("checked")
                });

            default:
                throw new Exception("Unsupported GUIStyleStateId: " + id);
            }
        }