public TypeFilterButtonGroup() { _ClassFilter = CreateButton(KnownImageIds.Class, "Classes"); _InterfaceFilter = CreateButton(KnownImageIds.Interface, "Interfaces"); _DelegateFilter = CreateButton(KnownImageIds.Delegate, "Delegates"); _StructFilter = CreateButton(KnownImageIds.Structure, "Structures"); _EnumFilter = CreateButton(KnownImageIds.Enumeration, "Enumerations"); _NamespaceFilter = CreateButton(KnownImageIds.Namespace, "Namespaces"); _PublicFilter = CreateButton(KnownImageIds.ModulePublic, "Public and protected types"); _PrivateFilter = CreateButton(KnownImageIds.ModulePrivate, "Internal and private types"); _Filters = TypeFilterTypes.All; Margin = WpfHelper.SmallHorizontalMargin; Content = new Border { BorderThickness = WpfHelper.TinyMargin, CornerRadius = new CornerRadius(3), Child = new StackPanel { Children = { _PublicFilter, _PrivateFilter, new Border { Width = 1, BorderThickness = WpfHelper.TinyMargin }.ReferenceProperty(BorderBrushProperty, CommonControlsColors.TextBoxBorderBrushKey), _ClassFilter, _InterfaceFilter, _DelegateFilter, _StructFilter, _EnumFilter, _NamespaceFilter, new Border { Width = 1, BorderThickness = WpfHelper.TinyMargin }.ReferenceProperty(BorderBrushProperty, CommonControlsColors.TextBoxBorderBrushKey), new ThemedButton(KnownImageIds.StopFilter, "Clear filter", ClearFilter).ClearBorder(), }, Orientation = Orientation.Horizontal } }.ReferenceProperty(BorderBrushProperty, CommonControlsColors.TextBoxBorderBrushKey); }
protected override void UpdateFilterValue() { if (_uiLock) { return; } var f = TypeFilterTypes.None; if (_ClassFilter.IsChecked == true) { f |= TypeFilterTypes.Class; } if (_StructFilter.IsChecked == true) { f |= TypeFilterTypes.Struct; } if (_EnumFilter.IsChecked == true) { f |= TypeFilterTypes.Enum; } if (_DelegateFilter.IsChecked == true) { f |= TypeFilterTypes.Delegate; } if (_InterfaceFilter.IsChecked == true) { f |= TypeFilterTypes.Interface; } if (_NamespaceFilter.IsChecked == true) { f |= TypeFilterTypes.Namespace; } if (f.HasAnyFlag(TypeFilterTypes.AllTypes) == false) { f |= TypeFilterTypes.AllTypes; } if (_PublicFilter.IsChecked == true) { f |= TypeFilterTypes.Public | TypeFilterTypes.Protected; } if (_PrivateFilter.IsChecked == true) { f |= TypeFilterTypes.Internal | TypeFilterTypes.Private; } if (f.HasAnyFlag(TypeFilterTypes.AllAccessibility) == false) { f |= TypeFilterTypes.AllAccessibility; } if (_Filters != f) { _Filters = f; OnFilterChanged(); } }
public override void ClearFilter() { _uiLock = true; _ClassFilter.IsChecked = _InterfaceFilter.IsChecked = _DelegateFilter.IsChecked = _StructFilter.IsChecked = _EnumFilter.IsChecked = _NamespaceFilter.IsChecked = _PublicFilter.IsChecked = _PrivateFilter.IsChecked = false; _uiLock = false; if (_Filters != TypeFilterTypes.All) { _Filters = TypeFilterTypes.All; } OnFilterCleared(); }
internal static bool FilterBySymbol(TypeFilterTypes filterTypes, ISymbol symbol) { TypeFilterTypes symbolFlags; if (symbol.Kind == SymbolKind.Alias) { symbol = ((IAliasSymbol)symbol).Target; } switch (symbol.DeclaredAccessibility) { case Accessibility.Private: symbolFlags = TypeFilterTypes.Private; break; case Accessibility.Protected: symbolFlags = TypeFilterTypes.Protected; break; case Accessibility.Internal: symbolFlags = TypeFilterTypes.Internal; break; case Accessibility.ProtectedAndInternal: case Accessibility.ProtectedOrInternal: symbolFlags = TypeFilterTypes.Internal | TypeFilterTypes.Protected; break; case Accessibility.Public: symbolFlags = TypeFilterTypes.Public; break; default: symbolFlags = TypeFilterTypes.None; break; } if (symbol.Kind == SymbolKind.NamedType) { switch (((INamedTypeSymbol)symbol).TypeKind) { case TypeKind.Class: symbolFlags |= TypeFilterTypes.Class; break; case TypeKind.Struct: symbolFlags |= TypeFilterTypes.Struct; break; case TypeKind.Interface: symbolFlags |= TypeFilterTypes.Interface; break; case TypeKind.Delegate: symbolFlags |= TypeFilterTypes.Delegate; break; case TypeKind.Enum: symbolFlags |= TypeFilterTypes.Enum; break; } } else if (symbol.Kind == SymbolKind.Namespace) { symbolFlags |= TypeFilterTypes.Namespace; } return(filterTypes.MatchFlags(symbolFlags)); }