Table of Contents

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

frame IFrame

the 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

ShowPropertyLabelFlags

labelTextInternal

Overrides the label text, which is normally retrieved from the StringTable with the resourceIdInternal

protected string labelTextInternal

Field Value

string

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

IPropertyPage

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

string

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

MenuWithHandler[]

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

bool

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

ShowPropertyEntryType

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

PropertyEntryType

Frame

Returns a IFrame when this IShowProperty has been added to a IPropertyTreeView, returns null otherwise.

public virtual IFrame Frame { get; set; }

Property Value

IFrame

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

bool

Implementation of HelpLink, returns resourceIdInternal.

public virtual string HelpLink { get; }

Property Value

string

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

bool

InfoText

Implementation of InfoText, returns GetString(string)(resourceId+".DetailedInfo") or GetString(string)(resourceId+".ShortInfo")

public virtual string InfoText { get; }

Property Value

string

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

bool

Label

Implementation of Label: returns LabelText.

public virtual string Label { get; }

Property Value

string

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

string

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

ShowPropertyLabelFlags

OwnerDrawHeight

Implementation of OwnerDrawHeight. Returns 0.

public virtual int OwnerDrawHeight { get; }

Property Value

int

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

object

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

bool

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

string

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

Color

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

Color

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

IShowProperty[]

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

int

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

IPropertyEntry[]

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

Color

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

Color

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

string

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

bool

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

IPropertyPage

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

pp IPropertyPage

the 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

propertyTreeView IPropertyTreeView

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

button PropertyEntryButton

the button that was clicked

ChildSelected(IShowProperty)

Implementation of ChildSelected(IShowProperty), raises the StateChangedEvent

public virtual void ChildSelected(IShowProperty theSelectedChild)

Parameters

theSelectedChild IShowProperty

the 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

left IShowProperty[]
right IShowProperty[]

Returns

IShowProperty[]

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

newValue string

the 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

aborted bool

true: the edit was aborted (Escape), false: it ended normally

modified bool

true: the text was changed while editing

newValue string

the 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

helpResourceID string

the 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

NewText string

the 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

selectedIndex int

the 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

isVisible bool

true: 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

IsOpen bool

true: 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

args StateChangedArgs

the 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

pp IPropertyPage

the property page the entry was removed from

Removed(IPropertyTreeView)

Implementation of Removed(IPropertyTreeView), raises the StateChangedEvent

public virtual void Removed(IPropertyTreeView propertyTreeView)

Parameters

propertyTreeView IPropertyTreeView

removed 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

previousSelected IPropertyEntry

the 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

open bool

true: 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

editValue bool

true: 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

flagsToSuppress ShowPropertyLabelFlags

the 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

nowSelected IPropertyEntry

the 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

sp IShowProperty

Events

PropertyEntryChangedStateEvent

public event PropertyEntryChangedStateDelegate PropertyEntryChangedStateEvent

Event Type

PropertyEntryChangedStateDelegate

StateChangedEvent

Event that is fired when the state of this entry changed, e.g. the entry was selected.

public event StateChangedDelegate StateChangedEvent

Event Type

StateChangedDelegate