Class ColorSelectionProperty
- Namespace
- CADability.UserInterface
- Assembly
- CADability.dll
Property page entry to choose a ColorDef from a ColorList in a drop down list which shows a color box next to each name. It either controls the color of an IColorDef object (the object is updated when the selection changes and the entry follows changes of the object), accesses a ColorDef property of an arbitrary object via reflection, or only reports the selection via ColorDefChangedEvent. The ColorList.StaticFlags decide whether an "undefined" entry and the colors "from parent" and "from style" are offered.
public class ColorSelectionProperty : MultipleChoiceProperty, IPropertyEntry, IShowProperty
- Inheritance
-
ColorSelectionProperty
- Implements
- Inherited Members
Constructors
ColorSelectionProperty(IColorDef, string, ColorList, StaticFlags)
Creates an entry which controls the color of iColorDef. The current color of the object is
preselected; if the object is an IGeoObject, the entry follows changes of its color.
public ColorSelectionProperty(IColorDef iColorDef, string resourceId, ColorList clrTable, ColorList.StaticFlags flags)
Parameters
iColorDefIColorDefThe object whose color is edited
resourceIdstringResource id of the label text
clrTableColorListThe list providing the choices
flagsColorList.StaticFlagsWhich special colors are offered, see ColorList.StaticFlags
ColorSelectionProperty(object, string, string, ColorList, StaticFlags)
Creates an entry which edits a property of type ColorDef of an arbitrary object via reflection. The current value of the property is preselected; if the object is an IGeoObject, the entry follows changes of its color.
public ColorSelectionProperty(object go, string propertyName, string resourceId, ColorList clrTable, ColorList.StaticFlags flags)
Parameters
goobjectThe object holding the property
propertyNamestringName of the ColorDef property of that object
resourceIdstringResource id of the label text
clrTableColorListThe list providing the choices
flagsColorList.StaticFlagsWhich special colors are offered, see ColorList.StaticFlags
ColorSelectionProperty(string, ColorList, ColorDef, StaticFlags)
Creates an entry which is not connected to an object: the selection is reported via ColorDefChangedEvent.
public ColorSelectionProperty(string resourceId, ColorList clrTable, ColorDef select, ColorList.StaticFlags flags)
Parameters
resourceIdstringResource id of the label text
clrTableColorListThe list providing the choices
selectColorDefThe initially selected color, or null for "undefined"
flagsColorList.StaticFlagsWhich special colors are offered, see ColorList.StaticFlags
Properties
Connected
The IGeoObject whose color is controlled by this entry. Setting it connects the entry to the new object (which must implement IColorDef): its color is changed when the user selects an entry, and the entry is refreshed when the color of the object changes.
public IGeoObject Connected { get; set; }
Property Value
ShowAllowUndefinedGray
Whether the "undefined" entry should be displayed in gray. The value is only stored; the current implementation does not evaluate it.
public bool ShowAllowUndefinedGray { get; set; }
Property Value
Value
Must be overridden, when Flags contains PropertyEntryType.ValueEditable
public override string Value { get; }
Property Value
Methods
Added(IPropertyPage)
Implementation of Added(IPropertyPage): memorizes the page in propertyPage and reports Added. Override it to subscribe to events while the entry is displayed, and call the base implementation.
public override void Added(IPropertyPage pp)
Parameters
ppIPropertyPagethe property page the entry was added to
GetDropDownList()
Must be overridden when Flags contains PropertyEntryType.DropDown, See GetDropDownList()
public override string[] GetDropDownList()
Returns
- string[]
ListBoxSelected(int)
Must be overridden when Flags contains PropertyEntryType.DropDown
public override void ListBoxSelected(int selectedIndex)
Parameters
selectedIndexint
OnSelectionChanged(string)
Called when the user has picked a choice. Raises SelectionChangedEvent, stores the text in SelectedText and raises ValueChangedEvent. Derived classes override it to pass the selection on to the object they represent.
protected override void OnSelectionChanged(string selected)
Parameters
selectedstringThe selected text
Removed(IPropertyPage)
Implementation of Removed(IPropertyPage): closes the undo context of the project (an edit may have been interrupted by removing the entry), reports Removed and forgets the page. Override it to unsubscribe from events, and call the base implementation.
public override void Removed(IPropertyPage propertyTreeView)
Parameters
propertyTreeViewIPropertyPage
SetSelection(int)
Sets the current selection by index without raising the events. Used to synchronize the entry with the object it represents.
public override void SetSelection(int toSelect)
Parameters
Events
ColorDefChangedEvent
Raised when the user selects a color and the entry is neither connected to an IColorDef object nor to a property via reflection.
public event ColorSelectionProperty.ColorDefChangedDelegate ColorDefChangedEvent