wxPropertyGrid
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
wxMultiChoiceProperty Class Reference

Property that manages a value resulting from wxMultiChoiceDialog. More...

#include <advprops.h>

Inheritance diagram for wxMultiChoiceProperty:
wxPGProperty

Public Member Functions

virtual int GetChoiceInfo (wxPGChoiceInfo *choiceinfo)
 Returns current value's index to the choice control. More...
 
wxArrayInt GetValueAsArrayInt () const
 
virtual wxString GetValueAsString (int flags=0) const
 Returns text representation of property's value. More...
 
virtual bool OnEvent (wxPropertyGrid *propgrid, wxWindow *primary, wxEvent &event)
 Events received by editor widgets are processed here. More...
 
virtual void OnSetValue ()
 This virtual function is called after m_value has been set. More...
 
virtual bool StringToValue (wxVariant &variant, const wxString &text, int argFlags=0) const
 Converts 'text' into proper value 'variant'. More...
 
 wxMultiChoiceProperty (const wxString &label, const wxString &name, const wxArrayString &strings, const wxArrayString &value)
 
 wxMultiChoiceProperty (const wxString &label, const wxString &name, const wxPGChoices &choices, const wxArrayString &value=wxArrayString())
 
 wxMultiChoiceProperty (const wxString &label=wxPG_LABEL, const wxString &name=wxPG_LABEL, const wxArrayString &value=wxArrayString())
 
- Public Member Functions inherited from wxPGProperty
wxPGCellAcquireCell (unsigned int column)
 Returns wxPGCell of given column, NULL if none. More...
 
void ActualChildChanged (wxVariant &thisValue, int childIndex, wxVariant &childValue) const
 
bool ActualIntToValue (wxVariant &variant, int number, int argFlags=0) const
 
bool ActualStringToValue (wxVariant &variant, const wxString &text, int argFlags=0) const
 
bool ActualValidateValue (wxVariant &value, wxPGValidationInfo &validationInfo) const
 
void AdaptListToValue (wxVariant &list, wxVariant *value) const
 Adapts list variant into proper value using consequtive ChildChanged-calls.
 
void AddPrivateChild (wxPGProperty *prop)
 Call this to add sub-properties which will become private, fixed children. More...
 
wxPGPropertyAppendChild (wxPGProperty *prop)
 Appends a new child property. More...
 
int AppendChoice (const wxString &label, int value=INT_MAX)
 Adds entry to property's wxPGChoices and editor control (if it is active). More...
 
bool AreAllChildrenSpecified (wxVariant *pendingList=NULL) const
 Determines, recursively, if all children are not unspecified. More...
 
bool AreChildrenComponents () const
 Returns true if children of this property are component values (for instance, points size, face name, and is_underlined are component values of a font).
 
bool CanHaveExtraChildren () const
 Returns true if extra children can be added for this property (i.e. More...
 
void ChangeFlag (FlagType flag, bool set)
 Sets or clears given property flag(s). More...
 
virtual void ChildChanged (wxVariant &thisValue, int childIndex, wxVariant &childValue) const
 Called after value of a child property has been altered. More...
 
void ClearFlag (FlagType flag)
 
void DeleteChildren ()
 Deletes children of the property.
 
void DeleteChoice (int index)
 Removes entry from property's wxPGChoices and editor control (if it is active). More...
 
virtual wxVariant DoGetAttribute (const wxString &name) const
 Returns value of an attribute. More...
 
virtual const wxPGEditorDoGetEditorClass () const
 Returns pointer to an instance of editor class.
 
virtual wxValidator * DoGetValidator () const
 Returns pointer to the wxValidator that should be used with the editor of this property (NULL for no validator). More...
 
virtual wxVariant DoGetValue () const
 Override this to return something else than m_value as the value.
 
virtual bool DoSetAttribute (const wxString &name, wxVariant &value)
 Special handling for attributes of this property. More...
 
void Empty ()
 Deletes children of the property.
 
void EnableCommonValue (bool enable=true)
 Call to enable or disable usage of common value (integer value that can be selected for properties instead of their normal values) for this property. More...
 
void FixIndexesOfChildren (unsigned int starthere=0)
 
void GenerateComposedValue (wxString &text, int argFlags=0) const
 Composes text from values of child properties. More...
 
unsigned int GetArrIndex () const
 
wxVariant GetAttribute (const wxString &name) const
 
wxString GetAttribute (const wxString &name, const wxString &defVal) const
 Returns named attribute, as string, if found. More...
 
double GetAttributeAsDouble (const wxString &name, double defVal) const
 Returns named attribute, as double, if found. More...
 
long GetAttributeAsLong (const wxString &name, long defVal) const
 Returns named attribute, as long, if found. More...
 
const wxPGAttributeStorageGetAttributes () const
 Returns comma-delimited string of property attributes.
 
wxVariant GetAttributesAsList () const
 Returns m_attributes as list wxVariant.
 
const wxString & GetBaseName () const
 Returns property's base name (ie. More...
 
wxPGCellGetCell (unsigned int column) const
 Returns wxPGCell of given column, NULL if none. More...
 
virtual wxPGCellRendererGetCellRenderer (int column) const
 Returns used wxPGCellRenderer instance for given property column (label=0, value=1). More...
 
unsigned int GetChildCount () const
 Returns number of child properties.
 
int GetChildrenHeight (int lh, int iMax=-1) const
 Returns height of children, recursively, and by taking expanded/collapsed status into account. More...
 
unsigned int GetChoiceCount () const
 
wxPGChoicesGetChoices ()
 
const wxPGChoicesGetChoices () const
 
wxString GetChoiceString (unsigned int index)
 
const wxChar * GetClassName () const
 
ClientDataType GetClientData () const
 
const wxPGEditorGetColumnEditor (int column) const
 Returns editor used for given column. More...
 
int GetCommonValue () const
 Returns common value selected for this property. More...
 
unsigned int GetCount () const
 Returns number of child properties.
 
const wxPGChoiceEntryGetCurrentChoice () const
 
wxVariant GetDefaultValue () const
 
unsigned int GetDepth () const
 
int GetDisplayedCommonValueCount () const
 Return number of displayed common values for this property.
 
wxString GetDisplayedString () const
 
const wxPGEditorGetEditorClass () const
 
virtual wxPGEditorDialogAdapterGetEditorDialog () const
 Returns instance of a new wxPGEditorDialogAdapter instance, which is used when user presses the (optional) button next to the editor control;. More...
 
FlagType GetFlags () const
 
wxString GetFlagsAsString (FlagType flagsMask) const
 Gets flags as a'|' delimited string. More...
 
wxPropertyGridGetGrid () const
 Returns property grid where property lies. More...
 
wxPropertyGridGetGridIfDisplayed () const
 Returns owner wxPropertyGrid, but only if one is currently on a page displaying this property. More...
 
const wxString & GetHelpString () const
 
wxPGId GetId ()
 Returns property id. More...
 
int GetImageOffset (int imageWidth) const
 Converts image width into full image offset, with margins.
 
virtual wxSize GetImageSize () const
 
unsigned int GetIndexInParent () const
 Returns position in parent's array. More...
 
wxPGPropertyGetItemAtY (unsigned int y, unsigned int lh, unsigned int *nextItemY) const
 
const wxString & GetLabel () const
 Returns property's label. More...
 
const wxPGPropertyGetLastVisibleSubItem () const
 Returns last visible sub-property, recursively.
 
wxPGPropertyGetMainParent () const
 Returns highest level non-category, non-root parent. More...
 
int GetMaxLength () const
 
wxString GetName () const
 Returns property's name with all (non-category, non-root) parents. More...
 
wxPGCellGetOrCreateCell (unsigned int column)
 Returns wxPGCell of given column, creating one if necesasry. More...
 
wxPGPropertyGetParent () const
 Return parent of property.
 
wxPropertyGridStateGetParentState () const
 
wxPGPropertyGetPropertyByName (const wxString &name) const
 Returns (direct) child property with given name (or NULL if not found).
 
wxString GetType () const
 Returns type name of property that is compatible with CreatePropertyByType. More...
 
wxValidator * GetValidator () const
 Gets assignable version of property's validator. More...
 
wxVariant GetValue () const
 
wxVariant GetValueAsVariant () const
 Returns value as wxVariant. More...
 
wxBitmap * GetValueImage () const
 
wxVariant & GetValueRef ()
 Returns reference to the internal stored value. More...
 
const wxVariant & GetValueRef () const
 
wxString GetValueString (int argFlags=0) const
 Same as GetValueAsString, except takes common value into account.
 
wxString GetValueType () const
 
int GetY () const
 Returns coordinate to the top y of the property. More...
 
FlagType HasFlag (FlagType flag) const
 Returns non-zero if given property flag is set. More...
 
bool HasVisibleChildren () const
 Returns true if property has even one visible child.
 
bool Hide (bool hide, int flags=wxPG_RECURSE)
 Hides or reveals the property. More...
 
int Index (const wxPGProperty *p) const
 Returns index of given sub-property. More...
 
wxPGPropertyInsertChild (int index, wxPGProperty *childProperty)
 Use this member function to add independent (ie. More...
 
int InsertChoice (const wxString &label, int index, int value=INT_MAX)
 Adds entry to property's wxPGChoices and editor control (if it is active). More...
 
virtual bool IntToValue (wxVariant &value, int number, int argFlags=0) const
 Converts 'number' (including choice selection) into proper value 'variant'. More...
 
bool IsCategory () const
 Returns true if this property is actually a wxPropertyCategory.
 
bool IsEnabled () const
 
bool IsExpanded () const
 
bool IsFlagSet (FlagType flag) const
 
bool IsRoot () const
 Returns true if this property is actually a wxRootProperty.
 
bool IsSomeParent (wxPGProperty *candidate_parent) const
 
bool IsSubProperty () const
 Returns true if this is a sub-property. More...
 
bool IsTextEditable () const
 Returns true if property has editable wxTextCtrl when selected. More...
 
bool IsValueUnspecified () const
 Returns if property value is unspecified.
 
bool IsVisible () const
 Returns true if all parents expanded.
 
wxPGPropertyItem (unsigned int i) const
 Returns sub-property at index i. More...
 
wxPGPropertyLast () const
 Returns last sub-property.
 
virtual void OnCustomPaint (wxDC &dc, const wxRect &rect, wxPGPaintData &paintdata)
 Override to paint an image in front of the property value text or drop-down list item (but only if wxPGProperty::OnMeasureImage is overridden as well). More...
 
virtual wxSize OnMeasureImage (int item=-1) const
 Returns size of the custom painted image in front of property. More...
 
virtual void OnValidationFailure (wxVariant &pendingValue)
 Called whenever validation has failed with given pending value. More...
 
bool PrepareValueForDialogEditing (wxPropertyGrid *propgrid)
 Updates property value in case there were last minute changes. More...
 
bool RecreateEditor ()
 If property's editor is created this forces its recreation. More...
 
virtual void RefreshChildren ()
 Refresh values of child properties. More...
 
void RefreshEditor ()
 If property's editor is active, then update it's value.
 
void SetAttribute (const wxString &name, wxVariant value)
 Sets an attribute for this property. More...
 
void SetAttributes (const wxPGAttributeStorage &attributes)
 Sets attributes from a comma-delimited string.
 
void SetCell (int column, wxPGCell *cellObj)
 Sets cell information for given column. More...
 
bool SetChoices (wxPGChoices &choices)
 Set choices of a property to specified set of labels and values. More...
 
bool SetChoices (const wxArrayString &labels, const wxArrayInt &values=wxArrayInt())
 Sets new set of choices for property.
 
void SetChoiceSelection (int newValue, const wxPGChoiceInfo &choiceInfo)
 Changes value of a property with choices, but only works if the value type is long or string. More...
 
void SetChoicesExclusive ()
 If property has choices and they are not yet exclusive, new such copy of them will be created.
 
void SetClientData (ClientDataType clientData)
 Sets client data (void*) of a property. More...
 
void SetCommonValue (int commonValue)
 Sets common value selected for this property. More...
 
void SetDefaultValue (wxVariant &value)
 Set default value of a property. More...
 
void SetEditor (const wxPGEditor *editor)
 Sets editor for a property. More...
 
void SetEditor (const wxString &editorName)
 Sets editor for a property. More...
 
void SetExpanded (bool expanded)
 
void SetFlag (FlagType flag)
 Sets given property flag(s). More...
 
void SetFlagRecursively (FlagType flag, bool set)
 Sets or clears given property flag(s), recursively in child properties (if any). More...
 
void SetFlagsFromString (const wxString &str)
 Sets flags from a '|' delimited string. More...
 
void SetHelpString (const wxString &helpString)
 
void SetLabel (const wxString &label)
 Sets property's label. More...
 
bool SetMaxLength (int maxLen)
 Set max length of text editor.
 
void SetName (const wxString &newName)
 
void SetValidator (const wxValidator &validator)
 Sets wxValidator for a property.
 
void SetValue (wxVariant value, wxVariant *pList=NULL, int flags=wxPG_SETVAL_REFRESH_EDITOR)
 Call this to set value of the property. More...
 
virtual bool SetValueFromInt (long value, int flags=0)
 Converts integer to a value, and if succesfull, calls SetValue() on it. More...
 
virtual bool SetValueFromString (const wxString &text, int flags=wxPG_PROGRAMMATIC_VALUE)
 Converts string to a value, and if succesfull, calls SetValue() on it. More...
 
void SetValueImage (wxBitmap &bmp)
 Set wxBitmap in front of the value. More...
 
void SetValueInEvent (wxVariant value) const
 Call in OnEvent(), OnButtonClick() etc. More...
 
void SetValueToUnspecified ()
 Sets property value to unspecified.
 
void SetWasModified (bool set=true)
 Call with 'false' in OnSetValue to cancel value changes after all (ie. More...
 
wxPGPropertyUpdateParentValues ()
 Updates composed values of parent non-category properties, recursively. More...
 
FlagType UsesAutoUnspecified () const
 Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES.
 
virtual bool ValidateValue (wxVariant &value, wxPGValidationInfo &validationInfo) const
 Implement this function in derived class to check the value. More...
 
 wxPGProperty ()
 Basic constructor. More...
 
 wxPGProperty (const wxString &label, const wxString &name)
 Constructor. More...
 
virtual ~wxPGProperty ()
 Virtual destructor. More...
 

Protected Member Functions

void GenerateValueAsString ()
 
wxArrayInt GetValueAsIndices () const
 
- Protected Member Functions inherited from wxPGProperty
void AddChild (wxPGProperty *prop)
 Call this to add sub-properties which will become private, fixed children. More...
 
void AddChild2 (wxPGProperty *prop, int index=-1, bool correct_mode=true)
 This is used by Insert etc. More...
 
void DoEmpty ()
 Deletes all sub-properties. More...
 
bool DoHide (bool hide, int flags)
 
void DoSetName (const wxString &str)
 
wxString GetColumnText (unsigned int col) const
 Returns text for given column.
 
wxPGPropertyGetPropertyByNameWH (const wxString &name, unsigned int hintIndex) const
 Returns (direct) child property with given name (or NULL if not found), with hint index. More...
 
int GetY2 (int lh) const
 
void PrepareSubProperties ()
 
void SetParentalType (int flag)
 
void SetParentState (wxPropertyGridState *pstate)
 
void SubPropsChanged (int oldSelInd=-1)
 

Protected Attributes

wxPGChoices m_choices
 
wxString m_display
 
wxArrayString m_valueAsStrings
 
- Protected Attributes inherited from wxPGProperty
unsigned int m_arrIndex
 
wxPGAttributeStorage m_attributes
 
unsigned char m_bgColIndex
 
wxArrayPtrVoid m_cells
 
wxArrayPtrVoid m_children
 
ClientDataType m_clientData
 
int m_commonValue
 
const wxPGEditorm_customEditor
 
unsigned char m_depth
 
unsigned char m_depthBgCol
 
unsigned char m_fgColIndex
 
FlagType m_flags
 
wxString m_helpString
 
wxString m_label
 
short m_maxLen
 
wxString m_name
 
wxPGPropertym_parent
 
wxPropertyGridStatem_parentState
 
wxValidator * m_validator
 
wxVariant m_value
 
wxBitmap * m_valueBitmap
 

Additional Inherited Members

- Public Types inherited from wxPGProperty
typedef void * ClientDataType
 
typedef wxUint32 FlagType
 

Detailed Description

Property that manages a value resulting from wxMultiChoiceDialog.

Value is array of strings. You can get value as array of choice values/indices by calling wxMultiChoiceProperty::GetValueAsArrayInt().

Supported special attributes:

Member Function Documentation

◆ GetChoiceInfo()

virtual int wxMultiChoiceProperty::GetChoiceInfo ( wxPGChoiceInfo choiceinfo)
virtual

Returns current value's index to the choice control.

May also return, through pointer arguments, strings that should be inserted to that control. Irrelevant to classes which do not employ wxPG_EDITOR(Choice) or similar.

Remarks
  • If returns NULL in choices, then this class must be derived from wxBaseEnumProperty.
  • Must not crash even if property's set of choices is uninitialized (i.e. it points to wxPGGlobalVars->m_emptyConstants).

Reimplemented from wxPGProperty.

◆ GetValueAsString()

virtual wxString wxMultiChoiceProperty::GetValueAsString ( int  argFlags = 0) const
virtual

Returns text representation of property's value.

Generally this function should not be called from the application code. Instead, call GetValueString().

Parameters
argFlagsIf wxPG_FULL_VALUE is set, returns complete, storable string value instead of displayable. If wxPG_EDITABLE_VALUE is set, returns string value that must be editable in textctrl. If wxPG_COMPOSITE_FRAGMENT is set, returns text that is appropriate to display as a part of composite property string value.
Remarks
  • Default implementation returns string composed from text representations of child properties.
  • Implementations are never called with m_value being null variant (ie. unspecified value), so you don't need to check for that. Naturally this means that unspecified value is always displayed as an empty string.
See also
GetValueString()

Reimplemented from wxPGProperty.

◆ OnEvent()

virtual bool wxMultiChoiceProperty::OnEvent ( wxPropertyGrid propgrid,
wxWindow *  wnd_primary,
wxEvent &  event 
)
virtual

Events received by editor widgets are processed here.

Note that editor class usually processes most events. Some, such as button press events of TextCtrlAndButton class, should be handled here. Also, if custom handling for regular events is desired, then that can also be done (for example, wxSystemColourProperty custom handles wxEVT_COMMAND_CHOICE_SELECTED).

If the event causes value to be changed, wxPropertyGrid::ValueChangeInEvent(value) should be used.

Parameters
eventAssociated wxEvent.
Return values
Shouldreturn true if any changes in value should be reported.
Remarks
  • If property uses choice control, and displays a dialog on some choice items, then it is preferred to display that dialog in IntToValue instead of OnEvent.

Reimplemented from wxPGProperty.

◆ OnSetValue()

virtual void wxMultiChoiceProperty::OnSetValue ( )
virtual

This virtual function is called after m_value has been set.

Remarks
  • If m_value was set to Null variant (ie. unspecified value), OnSetValue() will not be called.
  • m_value may be of any variant type. Typically properties internally support only one variant type, and as such OnSetValue() provides a good opportunity to convert supported values into internal type.
  • Default implementation does nothing.

Reimplemented from wxPGProperty.

◆ StringToValue()

virtual bool wxMultiChoiceProperty::StringToValue ( wxVariant &  variant,
const wxString &  text,
int  argFlags = 0 
) const
virtual

Converts 'text' into proper value 'variant'.

Returns true if new (different than m_value) value could be interpreted from the text.

Parameters
argFlagsIf wxPG_FULL_VALUE is set, returns complete, storable value instead of displayable one (they may be different). If wxPG_COMPOSITE_FRAGMENT is set, text is interpreted as a part of composite property string value (as generated by GetValueAsString() called with this same flag).
Remarks
  • Default implementation converts semicolon delimited tokens into child values. Only works for properties with children.
  • You might want to take into account that m_value is Null variant if property value is unspecified (which is usually only case if you explicitly enabled that sort behavior).

Reimplemented from wxPGProperty.


The documentation for this class was generated from the following file: