//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); }
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; }
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)); }
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); } } }
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); } } }