Class IShowPropertyImpl
- Namespace
- CADability.UserInterface
- Assembly
- CADability.dll
Deprecated: for new objects use IPropertyEntry instead. Deprecated standard implementation of IShowProperty. Implements many interface methods in a standard way as a virtual method to give derived classes the possibility to override these implementations.
public class IShowPropertyImpl : IShowProperty, IPropertyEntry
- Inheritance
-
IShowPropertyImpl
- Implements
- Derived
- Inherited Members
Constructors
IShowPropertyImpl()
Creates the entry without a frame; Frame then returns the frame of the property page the entry is shown in, or the main frame (MainFrame).
protected IShowPropertyImpl()
IShowPropertyImpl(IFrame)
Creates the entry with the frame it belongs to, which Frame returns as long as the entry is not shown in a property page.
protected IShowPropertyImpl(IFrame frame)
Parameters
frameIFramethe frame, may be null
Fields
flagsToSuppress
The label flags passed to SuppressFlags(ShowPropertyLabelFlags). The base class only stores them; none of the entries shipped with CADability evaluates them.
protected ShowPropertyLabelFlags flagsToSuppress
Field Value
labelTextInternal
Overrides the label text, which is normally retrieved from the StringTable with the resourceIdInternal
protected string labelTextInternal
Field Value
propertyPage
The property page this entry is currently shown in, set by Added(IPropertyPage) and cleared by Removed(IPropertyPage). Null while the entry is not shown.
protected IPropertyPage propertyPage
Field Value
resourceIdInternal
The resourceId specifies both the label text and the tooltip text. The label text is loaded from the StringTable with the ID resourceId+".Label" the tooltip text is loaded with the id resourceId+".ShortInfo" or resourceId+".DetailedInfo". You may extend the StringTable and ues your own resourceId values according to this scheme. (see AddStrings(XmlDocument))
protected string resourceIdInternal
Field Value
Properties
ContextMenu
Implementation of ContextMenu: the default returns null. An entry whose LabelType contains ContextMenu must override it.
public virtual MenuWithHandler[] ContextMenu { get; }
Property Value
DeferUpdate
Only meaningful when ValueEditable is set. In this case the changes by typing do not notify the system until the text-box is closed (i.e. the focus leaves the text box)
public bool DeferUpdate { get; set; }
Property Value
EntryType
The kind of entry (see ShowPropertyEntryType): a simple entry, a group title, an editable value... It decides how the property page displays the entry. The default implementation returns SimpleEntry.
public virtual ShowPropertyEntryType EntryType { get; }
Property Value
Flags
Implementation of Flags for the current property page, derived from the older properties of this class: the LabelType flags (which have the same values), GroupTitle or Seperator from EntryType, DropDown from HasDropDownButton, ValueEditable from ValueIsEditable and HasSubEntries when SubEntriesCount is greater than 0.
public virtual PropertyEntryType Flags { get; }
Property Value
Frame
Returns a IFrame when this IShowProperty has been added to a IPropertyTreeView, returns null otherwise.
public virtual IFrame Frame { get; set; }
Property Value
HasDropDownButton
Whether the entry offers a drop down list of choices for its value, which adds DropDown to Flags. The default is false, and no entry derived from this class returns true at present: drop down lists are provided by MultipleChoiceProperty, which derives from PropertyEntryImpl.
protected virtual bool HasDropDownButton { get; }
Property Value
HelpLink
Implementation of HelpLink, returns resourceIdInternal.
public virtual string HelpLink { get; }
Property Value
Hidden
If an IShowProperty object is hidden, it will not appear in the TreeView of the control center. Most Properties are not hidden by default.
public virtual bool Hidden { get; set; }
Property Value
InfoText
Implementation of InfoText, returns GetString(string)(resourceId+".DetailedInfo") or GetString(string)(resourceId+".ShortInfo")
public virtual string InfoText { get; }
Property Value
IsSelected
Implementation of IsSelected: asks the property page for its current selection; setting it selects or unselects this entry in the property page. May only be used while the entry is shown in a property page.
public virtual bool IsSelected { get; set; }
Property Value
Label
public virtual string Label { get; }
Property Value
LabelText
Implementation of LabelText, returns either labelTextInternal (if not null) or GetString(string)(resourceId+".Label") Whe set, labelTextInternal is set.
public virtual string LabelText { get; set; }
Property Value
LabelType
How the label of this entry behaves (see ShowPropertyLabelFlags): whether it can be selected or edited, is bold or has a context menu. The default implementation returns Selectable.
public virtual ShowPropertyLabelFlags LabelType { get; }
Property Value
OwnerDrawHeight
Implementation of OwnerDrawHeight. Returns 0.
public virtual int OwnerDrawHeight { get; }
Property Value
Parent
Gets or sets the parent. The implementer must simply keep this reference, it is either a IPropertyEntry or a IPropertyPage for the root objects
public object Parent { get; set; }
Property Value
ReadOnly
If an IShowProperty object is read only, its value should be fixed. The subProperties should also be read only.
public virtual bool ReadOnly { get; set; }
Property Value
ResourceId
Implementation of ResourceId: returns HelpLink, i.e. the resource id of the entry, which the property page uses for the tool tip and which FindSubItem(string) and FindFromHelpLink(string, bool) use to identify the entry.
public string ResourceId { get; }
Property Value
SelectedBckgColor
The background color of the selected entry (the system highlight color). A remnant of the old control center; the current property page uses the system colors directly.
public static Color SelectedBckgColor { get; }
Property Value
SelectedTextColor
The text color of the selected entry (the system highlight text color). A remnant of the old control center; the current property page uses the system colors directly.
public static Color SelectedTextColor { get; }
Property Value
SubEntries
The sub entries shown below this entry when it is opened in the property page. The default implementation has none and returns an empty array.
public virtual IShowProperty[] SubEntries { get; }
Property Value
SubEntriesCount
The number of SubEntries, 0 for an entry that cannot be opened. The default implementation returns 0.
public virtual int SubEntriesCount { get; }
Property Value
SubItems
Implementation of SubItems: those of the SubEntries that implement IPropertyEntry; entries that only implement IShowProperty are left out.
public virtual IPropertyEntry[] SubItems { get; }
Property Value
UnselectedBckgColor
The background color of an unselected entry (the system window color). A remnant of the old control center; the current property page uses the system colors directly.
public static Color UnselectedBckgColor { get; }
Property Value
UnselectedTextColor
The text color of an unselected entry (the system window text color). A remnant of the old control center; the current property page uses the system colors directly.
public static Color UnselectedTextColor { get; }
Property Value
Value
Implementation of Value: the text shown in the value column. The default is null, which means the entry has no value column; entries that show a value override it.
public virtual string Value { get; }
Property Value
ValueIsEditable
Whether the value of the entry may be edited in the text box of the property page: by default true unless ReadOnly is set. Together with a non-null Value it yields ValueEditable in Flags.
protected virtual bool ValueIsEditable { get; }
Property Value
propertyTreeView
The property page this entry is currently shown in, or null. The older name of propertyPage, kept for the derived classes that still use it.
protected IPropertyPage propertyTreeView { get; }
Property Value
Methods
Added(IPropertyPage)
Implementation of Added(IPropertyPage): memorizes the property page in propertyPage. Unlike Added(IPropertyTreeView) it does not raise the state changed event. Override it to subscribe to events while the entry is displayed, and call the base implementation.
public virtual void Added(IPropertyPage pp)
Parameters
ppIPropertyPagethe property page the entry was added to
Added(IPropertyTreeView)
Implementation of Added(IPropertyTreeView). Momorizes the given IPropertyTreeView, raises the StateChangedEvent
public virtual void Added(IPropertyTreeView propertyTreeView)
Parameters
propertyTreeViewIPropertyTreeView
ButtonClicked(PropertyEntryButton)
Implementation of ButtonClicked(PropertyEntryButton). The base implementation throws a NotImplementedException; an entry whose Flags announce a button (OK, cancel, check box, lock symbol, direct menu, value as button) must override it.
public virtual void ButtonClicked(PropertyEntryButton button)
Parameters
buttonPropertyEntryButtonthe button that was clicked
ChildSelected(IShowProperty)
Implementation of ChildSelected(IShowProperty), raises the StateChangedEvent
public virtual void ChildSelected(IShowProperty theSelectedChild)
Parameters
theSelectedChildIShowPropertythe now selected child property
Concat(IShowProperty[], IShowProperty[])
Static helper method to concatenate two arrays of IShowProperty.
public static IShowProperty[] Concat(IShowProperty[] left, IShowProperty[] right)
Parameters
leftIShowProperty[]rightIShowProperty[]
Returns
EditTextChanged(string)
Implementation of EditTextChanged(string): accepts every text and returns true. Override it to check the text while it is typed and to apply it immediately.
public virtual bool EditTextChanged(string newValue)
Parameters
newValuestringthe current text of the text box
Returns
- bool
true when the text is acceptable, false to show the error symbol with the text of GetErrorText()
EndEdit(bool, bool, string)
Implementation of EndEdit(bool, bool, string): does nothing. An entry with an editable value or label overrides it to take over (or, when aborted, discard) the text that was entered.
public virtual void EndEdit(bool aborted, bool modified, string newValue)
Parameters
abortedbooltrue: the edit was aborted (Escape), false: it ended normally
modifiedbooltrue: the text was changed while editing
newValuestringthe text as it was when editing ended
FindSubItem(string)
Implementation of FindSubItem(string): returns this entry when its ResourceId
(or, when it has none, its label text) equals helpResourceID, otherwise searches the
SubItems recursively, whether they are open or not.
public virtual IPropertyEntry FindSubItem(string helpResourceID)
Parameters
helpResourceIDstringthe resource id (or label text) to look for
Returns
- IPropertyEntry
the entry found, or null
GetDropDownList()
Implementation of GetDropDownList(). Entries derived from this class have no drop down list (see HasDropDownButton), the method throws a NotImplementedException.
public string[] GetDropDownList()
Returns
- string[]
the list of choices; this implementation never returns
GetErrorText()
Implementation of GetErrorText(): returns an empty string. Override it together with EditTextChanged(string) to explain why a text was rejected.
public virtual string GetErrorText()
Returns
- string
the error text, empty by default
LabelChanged(string)
Implementation of LabelChanged(string). Override if LabelType is Editable.
public virtual void LabelChanged(string NewText)
Parameters
NewTextstringthe new text
ListBoxSelected(int)
Implementation of ListBoxSelected(int): does nothing, since entries derived from this class have no drop down list.
public virtual void ListBoxSelected(int selectedIndex)
Parameters
selectedIndexintthe index of the chosen item in the list of GetDropDownList()
OnEnterPressed()
Alt+Enter was pressed in the controlcenter while this entry was selected
public virtual void OnEnterPressed()
OnVisibilityChanged(bool)
Implementation of OnVisibilityChanged(bool). Does nothing, override when needed.
public virtual void OnVisibilityChanged(bool isVisible)
Parameters
isVisiblebooltrue: the entry is now visible, false: it is now hidden
OpenOrCloseSubEntries()
Implementation of OpenOrCloseSubEntries(): toggles IsOpen, which notifies the entry via Opened(bool).
public int OpenOrCloseSubEntries()
Returns
- int
the number of sub items that became visible, or the negative number of sub items that were hidden
Opened(bool)
Implementation of Opened(bool), raises the StateChangedEvent
public virtual void Opened(bool IsOpen)
Parameters
IsOpenbooltrue: now open, false: now closed
PropertyEntryChangedState(StateChangedArgs)
Raises PropertyEntryChangedStateEvent with the given arguments. The standard implementations of Added(IPropertyTreeView), Selected(), UnSelected(), ChildSelected(IShowProperty) and Opened(bool) use it; a derived class may report further changes.
protected void PropertyEntryChangedState(StateChangedArgs args)
Parameters
argsStateChangedArgsthe change to report
Refresh()
Forces the entry to refresh its contents
public virtual void Refresh()
Removed(IPropertyPage)
Implementation of Removed(IPropertyPage): forgets the property page. Override it to unsubscribe from events, and call the base implementation.
public virtual void Removed(IPropertyPage pp)
Parameters
ppIPropertyPagethe property page the entry was removed from
Removed(IPropertyTreeView)
Implementation of Removed(IPropertyTreeView), raises the StateChangedEvent
public virtual void Removed(IPropertyTreeView propertyTreeView)
Parameters
propertyTreeViewIPropertyTreeViewremoved from this IPropertyTreeView
Select()
Implementation of Select(), selects this entry if it is currently contained in a IPropertyTreeView
public virtual void Select()
Selected()
Implementation of Selected(), raises the StateChangedEvent
public virtual void Selected()
Selected(IPropertyEntry)
Implementation of Selected(IPropertyEntry): forwards to the parameterless Selected() of the older interface, which raises the state changed event.
public virtual void Selected(IPropertyEntry previousSelected)
Parameters
previousSelectedIPropertyEntrythe entry that was selected before, may be null
SetFocus()
Implementation of SetFocus(). Does nothing, override when needed.
public virtual void SetFocus()
ShowOpen(bool)
Implementation of ShowOpen(bool), opens or closes this entry if it is currently contained in a IPropertyTreeView
public virtual void ShowOpen(bool open)
Parameters
openbooltrue: open, false: close
StartEdit(bool)
Implementation of StartEdit(bool): does nothing. Override it when the entry has to prepare for an edit, e.g. remember the value before the edit.
public virtual void StartEdit(bool editValue)
Parameters
editValuebooltrue: the value is edited, false: the label is edited
SuppressFlags(ShowPropertyLabelFlags)
Asks the entry not to show the given label flags (e.g. no context menu). The flags are only stored in flagsToSuppress; a derived class would have to remove them from its LabelType, which none of the entries shipped with CADability does.
public void SuppressFlags(ShowPropertyLabelFlags flagsToSuppress)
Parameters
flagsToSuppressShowPropertyLabelFlagsthe flags that should not appear in LabelType
UnSelected()
Implementation of UnSelected(), raises the StateChangedEvent
public virtual void UnSelected()
UnSelected(IPropertyEntry)
Implementation of UnSelected(IPropertyEntry): forwards to the parameterless UnSelected() of the older interface, which raises the state changed event.
public virtual void UnSelected(IPropertyEntry nowSelected)
Parameters
nowSelectedIPropertyEntrythe entry that is selected instead, may be null
Update(IShowProperty)
Calls the Refresh method of several standard implementations of IShowProperty.
public static void Update(IShowProperty sp)
Parameters
Events
PropertyEntryChangedStateEvent
public event PropertyEntryChangedStateDelegate PropertyEntryChangedStateEvent
Event Type
StateChangedEvent
Event that is fired when the state of this entry changed, e.g. the entry was selected.
public event StateChangedDelegate StateChangedEvent