public StyleValueRule(IStyleSelector selector, IEnumerable <IStyleDeclaration> declarations) { Selector = selector; _hashCode = selector.GetHashCode(); Declarations = declarations.ToArray(); }
public DependencyPropertyValueRule(IStyleSelector selector, ValueDeclaration <TValue> declaration) { Selector = selector; _hashCode = selector.GetHashCode() & declaration.GetHashCode(); Declaration = declaration; }
public ComplexStyleSelector(IStyleSelector left, IStyleSelector right, StyleOperator op) { Left = left; Right = right; Operator = op; Specificity = left.Specificity + right.Specificity; }
public void AddMapGrid() { m_styleSelector = new MapGridSelectorClass(); //Create a style selector and grab holf of the IMapGridSelector interface m_Ok = m_styleSelector.DoModal(m_pagelayoutControl.hWnd); //Display the style selector to the user IGraphicsContainer graphicsContainer = m_pagelayoutControl.GraphicsContainer; //Get the MapFrame IMapFrame mapFrame = (IMapFrame)graphicsContainer.FindFrame(m_pagelayoutControl.ActiveView.FocusMap); if (mapFrame == null) { return; } if (m_Ok == true) { IMapGrid m_mapGrid; m_mapGrid = (IMapGrid )m_styleSelector.GetStyle(0);//获得所选的MapGrid的类型; IMapGrids m_mapGrids = mapFrame as IMapGrids; m_mapGrids.ClearMapGrids();//删除原有的地图格网 if (m_mapGrid != null) { m_mapGrids.AddMapGrid(m_mapGrid); //添加地图格网到地图上 } m_pagelayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null); //刷新 } }
public VisualStateSelector(IStyleSelector selector, VisualStateType stateType) : base((selector.GetHashCode() * 397) ^ (Int32)stateType) { BaseSelector = selector; StateType = stateType; }
void ReadStyleRule(XElement reader, IStylePropertyContext context, List <IStyleRule> rules, IStyleSelector parent = null, bool directChild = false) { var element = reader.AttributeLocal("element")?.Value; var selector = CreateSelector(reader, parent, directChild, element, context); var style = new PredefinedStyle(StyleSystem); var hasStyle = false; foreach (var propertyNode in reader.Elements().Where(pn => pn.Name.LocalName == "property")) { var p = ReadProperty(propertyNode, context); style.SetValue(p.Key, p.Value); hasStyle = true; } if (hasStyle) { var rule = new StyleRule(selector, style); rules.Add(rule); } foreach (var propertyNode in reader.Elements().Where(pn => pn.Name.LocalName == "style")) { var attr = propertyNode.AttributeLocal("direct-child"); ReadStyleRule(propertyNode, context, rules, selector, attr?.Value == "true"); } }
public sealed override Boolean Equals(IStyleSelector other) { return(other is DependencyPropertySelector depSel && depSel.Property.Name == Property.Name && depSel.Property.VisualType == Property.VisualType && depSel.Property.PropertyType == Property.PropertyType); }
public ChildSelector(IStyleSelector parentSelector, IStyleSelector selectorForChild) : base(parentSelector.GetHashCode() & selectorForChild.GetHashCode()) { Parent = parentSelector; Child = selectorForChild; }
IStyleSelector CreateSelector(XElement style, IStyleSelector parent, bool directChild, string element, IStylePropertyContext context) { if (string.IsNullOrWhiteSpace(element) || "*".Equals(element)) { element = null; } ISimpleSelector es = new ElementSelector(element); var c = style.ElementLocal("conditions"); if (c != null) { var cond = ParseAndCondition(c, context); es = new ConditionalSelector(es, cond); } if (parent != null) { return(new DescendantSelector(es, parent, directChild)); } return(es); }
public AdjacentSiblingSelector(IStyleSelector firstElementSelector, IStyleSelector secondElementSelector) : base(firstElementSelector.GetHashCode() & secondElementSelector.GetHashCode()) { FirstElementSelector = firstElementSelector; SecondElementSelector = secondElementSelector; }
private static IStyleSelector GetContentAppender(IStyleSelector typeSelector, String appendTypeName) { if (!Enum.TryParse <ContentAppendType>(appendTypeName, true, out var appendType)) { throw new InvalidOperationException(); } return(new ContentAppenderSelector(typeSelector, appendType)); }
private static Boolean IsVisualSelectable(IVisualElement visual, IStyleSelector selector, IVisualLineage visualLineage) { switch (selector) { case AndStyleSelector andy: foreach (var sel in andy.Selectors) { if (!IsVisualSelectable(visual, sel, visualLineage)) { return(false); } } return(true); case VisualTypeStyleSelector typeSelector: var res = typeSelector.VisualType.IsInstanceOfType(visual); return(res); case DependencyPropertySelector _: return(false); case ClassStyleSelector classSelector: var className = GetClassName(visual, visualLineage); return(className == classSelector.ClassName); case ContentAppenderSelector contentAppender: var res2 = IsVisualSelectable(visual, contentAppender.TypeSelector, visualLineage); if (res2) { } return(res2); case VisualStateSelector stateSelector: // the state selector isn't tied to a specific type and is combined // with a type selector (presumably...) return(IsVisualSelectable(visual, stateSelector.BaseSelector, visualLineage)); default: throw new NotImplementedException(); } }
public Boolean Equals(IStyleSelector other) { if (!(other is AndStyleSelector andy)) { return(false); } if (andy._selectors.Count != _selectors.Count) { return(false); } for (var c = 0; c < _selectors.Count; c++) { if (!_selectors[c].Equals(andy._selectors[c])) { return(false); } } return(true); }
XElement ProcessSelector(XElement style, IStyleSelector selector) { if (selector is DescendantSelector) { var ds = (DescendantSelector)selector; var extractSelectors = ExtractSelectors(ds); extractSelectors.Reverse(); var first = true; foreach (var tuple in extractSelectors) { if (!first) { var inner = new XElement("style"); style.Add(inner); style = inner; style.Add(new XAttribute("direct-child", tuple.Item1)); } else { first = false; } ProcessSimpleSelector(style, tuple.Item2); } return(style); } if (selector is ISimpleSelector) { ProcessSimpleSelector(style, (ISimpleSelector)selector); return(style); } throw new StyleWriterException(); }
/// <summary> /// Returns the root visual and/or any child visuals that meet the /// requirements of the selector /// </summary> public static IEnumerable <IVisualElement> GetSelectableVisuals(IVisualElement rootVisual, IStyleSelector selector, IVisualLineage visualLineage) { switch (selector) { case AndStyleSelector andy: var selectables = GetSelectableVisualsImpl(rootVisual, andy, visualLineage, 0); foreach (var selectable in selectables) { yield return(selectable); } break; default: if (IsVisualSelectable(rootVisual, selector, visualLineage)) { yield return(rootVisual); } break; } }
public override Boolean Equals(IStyleSelector other) { return(other is CombinatorSelector combinator && combinator.Combinator == Combinator); }
public sealed override Boolean Equals(IStyleSelector other) { return(other is VisualStateSelector stateSelector && Equals(stateSelector.BaseSelector, BaseSelector) && stateSelector.StateType == StateType); }
public sealed override Boolean Equals(IStyleSelector other) { return(other is ClassStyleSelector classy && String.Equals(classy.ClassName, ClassName)); }
public StyleRule(IStyleSelector selector, IPredefinedStyle style) { Selector = selector; Style = style; Weight = Selector.Weight; }
public StyleContainer(IStyleSelector selectors) { Selector = selectors; }
public StyleContainer(string selectorText) { Selector = StyleSelectorParser.Parse(selectorText); }
public override Boolean Equals(IStyleSelector other) { throw new NotImplementedException(); }
public override Boolean Equals(IStyleSelector other) { return(other is ChildCombinator); }
public override Boolean Equals(IStyleSelector other) { return(other is ChildSelector childSelector && Equals(childSelector.Parent, Parent) && Equals(childSelector.Child, Child)); }
public void AddMapGrid() { m_styleSelector = new MapGridSelectorClass();//Create a style selector and grab holf of the IMapGridSelector interface m_Ok = m_styleSelector.DoModal(m_pagelayoutControl.hWnd);//Display the style selector to the user IGraphicsContainer graphicsContainer = m_pagelayoutControl.GraphicsContainer; //Get the MapFrame IMapFrame mapFrame = (IMapFrame)graphicsContainer.FindFrame(m_pagelayoutControl.ActiveView.FocusMap); if (mapFrame == null) return; if (m_Ok == true) { IMapGrid m_mapGrid; m_mapGrid =(IMapGrid ) m_styleSelector.GetStyle(0);//�����ѡ��MapGrid�����ͣ� IMapGrids m_mapGrids = mapFrame as IMapGrids ; m_mapGrids.ClearMapGrids();//ɾ��ԭ�еĵ�ͼ���� if (m_mapGrid != null) { m_mapGrids.AddMapGrid(m_mapGrid);//��ӵ�ͼ��������ͼ�� } m_pagelayoutControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);//ˢ�� } }
public static DescendantSelector WithDirectChild(this IStyleSelector parentElement, ISimpleSelector innerChild) { return(new DescendantSelector(innerChild, parentElement, true)); }
public NotPseudoClass(IStyleSelector selector) { Selector = selector ?? throw new ArgumentNullException(nameof(selector)); }
public sealed override Boolean Equals(IStyleSelector other) { return(other is AllStyleSelector); }
public override Boolean Equals(IStyleSelector other) { return(other.GetType() == GetType()); }
public IStyleRule CreateRule(IStyleSelector selector, IPredefinedStyleBuilder style) { return(new StyleRule(selector, style.Style)); }
public ContentAppenderSelector(IStyleSelector typeSelector, ContentAppendType appendType) { AppendType = appendType; TypeSelector = typeSelector; }