Class HatchStyleList
- Namespace
- CADability.Attribute
- Assembly
- CADability.dll
List of HatchStyle derived objects. Typically a Project or the Settings maintain such a list. The list is serializable and can be shown and modified in the ControlCenter. There can not be two hatch-styles with the same name.
public class HatchStyleList : PropertyEntryImpl, IPropertyEntry, IShowProperty, ISerializable, ICommandHandler, IAttributeList, IDeserializationCallback
- Inheritance
-
HatchStyleList
- Implements
- Inherited Members
Constructors
HatchStyleList()
Creates an empty hatch style list that is not owned by a project or the settings.
public HatchStyleList()
HatchStyleList(SerializationInfo, StreamingContext)
Constructor required by deserialization
protected HatchStyleList(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoSerializationInfo
contextStreamingContextStreamingContext
Properties
ContextMenu
Must be overridden, when Flags contains PropertyEntryType.ContextMenu. See ContextMenu
public override MenuWithHandler[] ContextMenu { get; }
Property Value
Count
Gets the number of hatchstyles in the list.
public int Count { get; }
Property Value
Current
The current hatch style of the list: the style that SetDefaults(IGeoObject) gives to a new Hatch, shown in bold in the control center. When nothing has been set, it is the first entry, or null for an empty list. Setting a style that is not yet in the list adds it; setting null is ignored.
public HatchStyle Current { get; set; }
Property Value
Flags
Implementation of Flags: the derived class states what the entry is and what the user can do with it. The flags must match the overridden members, e.g. HasSubEntries requires SubItems, ValueEditable requires Value and EndEdit(bool, bool, string), DropDown requires GetDropDownList() and ListBoxSelected(int).
public override PropertyEntryType Flags { get; }
Property Value
this[int]
Returns the hatch style at the given index. The entries are ordered alphabetically by name, so the index of a style changes when styles are added, removed or renamed.
public HatchStyle this[int Index] { get; }
Parameters
Property Value
- HatchStyle
the hatch style, or null when the index is out of range
Owner
The Project or Settings that holds this list, or null. The container sets it when the list is added to it. The list uses the owner to resolve the colours, line widths and line patterns its styles refer to and asks it before an entry is removed (RemovingItem(IAttributeList, INamedAttribute, string)).
public IAttributeListContainer Owner { get; set; }
Property Value
SubItems
Must be overridden, when Flags contains PropertyEntryType.HasSubEntries. See SubItems
public override IPropertyEntry[] SubItems { get; }
Property Value
Methods
Add(HatchStyle)
Adds an HatchStyle to the list. If there is already an hatchstyle with that name, an NameAlreadyExistsException exception will be thrown.
public void Add(HatchStyle ToAdd)
Parameters
ToAddHatchStyleThe hatchstyle to add
Clone()
Creates a copy of this list in which every hatch style is cloned (see Clone()). The Current entry of the copy corresponds to the current entry of this list. The copy has no Owner.
public HatchStyleList Clone()
Returns
- HatchStyleList
the copied list
CreateHatchStyleList()
Creates an empty hatch style list, either through the CreateHatchStyleListEvent when a handler is attached or as a plain HatchStyleList. CADability itself creates its lists with the constructor; this factory is provided for applications that want to use a derived list.
public static HatchStyleList CreateHatchStyleList()
Returns
- HatchStyleList
the new, empty list
Find(string)
Returns the hatchstyle with the given name from the list. If there is no such hatchstyle null will be returned.
public HatchStyle Find(string Name)
Parameters
NamestringName of the hatchstyle
Returns
- HatchStyle
The hatchstyle found or null
GetDefault(IAttributeListContainer)
Creates a hatch style list with two default entries: a solid fill (HatchStyleSolid) in the current color of the container and a line hatch (HatchStyleLines) with 45° lines at a distance of 10 that uses the current color, line width and line pattern of the container. Used when neither the project nor the global settings provide a hatch style list.
public static HatchStyleList GetDefault(IAttributeListContainer container)
Parameters
containerIAttributeListContainerprovides the color, line width and line pattern lists
Returns
- HatchStyleList
the default hatch style list
Refresh()
Asks the property page to redisplay this entry (see Refresh(IPropertyEntry)); call it after the label, the value or the sub entries changed. Does nothing while the entry is not shown.
public override void Refresh()
Remove(HatchStyle)
Removes the given HatchStyle from the list. No action is taken if the hatchstyle is not in the list.
public void Remove(HatchStyle ToRemove)
Parameters
ToRemoveHatchStyleThe hatchstyle to remove
UnSelected(IPropertyEntry)
Implementation of UnSelected(IPropertyEntry): reports UnSelected.
public override void UnSelected(IPropertyEntry nowSelected)
Parameters
nowSelectedIPropertyEntrythe entry that is selected instead, may be null
Events
CreateHatchStyleListEvent
Lets an application substitute its own class derived from HatchStyleList: when a handler is attached, CreateHatchStyleList() returns the list the handler creates instead of a plain HatchStyleList.
public static event HatchStyleList.CreateHatchStyleListDelegate CreateHatchStyleListEvent
Event Type
DidModifyEvent
Raised after a hatch style has been added to or removed from the list. The handler receives this list as sender and null as arguments. Property pages that offer the entries of the list for selection use it to rebuild their choices.
public event DidModifyDelegate DidModifyEvent