Ejemplo n.º 1
0
 //style number is used to prioritize shared styles, higher numbers are less important
 public StyleEntry(UIStyleGroup sourceGroup, UIStyleRunCommand styleRunCommand, StyleType type, StyleState state, int styleNumber, int attributeCount)
 {
     this.sourceGroup     = sourceGroup;
     this.styleRunCommand = styleRunCommand;
     this.type            = type;
     this.state           = state;
     this.priority        = (int)BitUtil.SetBytes(styleNumber, attributeCount, (int)type, (int)state);
 }
Ejemplo n.º 2
0
 public void Initialize(UIElement element)
 {
     this.element            = element;
     this.currentState       = StyleState.Normal;
     this.containedStates    = StyleState.Normal;
     this.hasAttributeStyles = false;
     this.instanceStyle      = null;
     this.availableStyles.Clear();
     this.styleGroupContainers.Clear();
     this.propertyMap.Clear();
     this.isInheritedMap = 0;
 }
Ejemplo n.º 3
0
        private void CreateStyleEntry(LightList <StylePropertyId> toUpdate, UIStyleGroup group, UIStyleRunCommand styleRunCommand, StyleType styleType, StyleState styleState, int ruleCount)
        {
            if (styleRunCommand.style == null)
            {
                return;
            }

            containedStates |= styleState;

            if ((currentState & styleState) != 0)
            {
                AddMissingProperties(toUpdate, styleRunCommand.style);
                RunCommands(styleRunCommand.runCommands);
            }

            availableStyles.Add(new StyleEntry(group, styleRunCommand, styleType, styleState, availableStyles.Count, ruleCount));
        }
Ejemplo n.º 4
0
        private void CreateStyleGroups(UIStyleGroupContainer groupContainer, LightList <StylePropertyId> toUpdate)
        {
            for (int i = 0; i < groupContainer.groups.Length; i++)
            {
                UIStyleGroup group = groupContainer.groups[i];

                if (group.HasAttributeRule)
                {
                    hasAttributeStyles = true;
                }

                if (group.rule == null || group.rule != null && group.rule.IsApplicableTo(element))
                {
                    int ruleCount = group.CountRules();
                    CreateStyleEntry(toUpdate, group, group.normal, groupContainer.styleType, StyleState.Normal, ruleCount);
                    CreateStyleEntry(toUpdate, group, group.hover, groupContainer.styleType, StyleState.Hover, ruleCount);
                    CreateStyleEntry(toUpdate, group, group.focused, groupContainer.styleType, StyleState.Focused, ruleCount);
                    CreateStyleEntry(toUpdate, group, group.active, groupContainer.styleType, StyleState.Active, ruleCount);
                }
            }
        }
Ejemplo n.º 5
0
        private void AddStyleGroups(LightList <StylePropertyId> toUpdate, UIStyleGroupContainer container)
        {
            styleGroupContainers.Add(container);

            if (container.hasAttributeStyles)
            {
                hasAttributeStyles = true;
            }

            for (int j = 0; j < container.groups.Length; j++)
            {
                UIStyleGroup group = container.groups[j];

                if (group.rule == null || group.rule != null && group.rule.IsApplicableTo(element))
                {
                    int ruleCount = group.CountRules();
                    CreateStyleEntry(toUpdate, group, group.normal, container.styleType, StyleState.Normal, ruleCount);
                    CreateStyleEntry(toUpdate, group, group.hover, container.styleType, StyleState.Hover, ruleCount);
                    CreateStyleEntry(toUpdate, group, group.focused, container.styleType, StyleState.Focused, ruleCount);
                    CreateStyleEntry(toUpdate, group, group.active, container.styleType, StyleState.Active, ruleCount);
                }
            }
        }