wxBaseEnumProperty Class Reference

Derive dynamic custom properties with choices from this class. More...

#include <props.h>

Inheritance diagram for wxBaseEnumProperty:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual const wxString * GetEntry (size_t index, int *pvalue) const =0
virtual int GetIndexForValue (int value) const
virtual wxString GetValueAsString (int argFlags) const
int GetValueForIndex (size_t index) const
virtual bool IntToValue (wxVariant &variant, int number, int argFlags=0) const
virtual void OnSetValue ()
virtual void OnValidationFailure (wxVariant &pendingValue)
virtual bool StringToValue (wxVariant &variant, const wxString &text, int argFlags=0) const
virtual bool ValidateValue (wxVariant &value, wxPGValidationInfo &validationInfo) const
 wxBaseEnumProperty (const wxString &label=wxPG_LABEL, const wxString &name=wxPG_LABEL)

Protected Member Functions

int GetIndex () const
void SetIndex (int index)
bool ValueFromInt_ (wxVariant &value, int intVal, int argFlags) const
bool ValueFromString_ (wxVariant &value, const wxString &text, int argFlags) const

Static Protected Member Functions

static void ResetNextIndex ()

Private Attributes

int m_index

Static Private Attributes

static int ms_nextIndex

Detailed Description

Derive dynamic custom properties with choices from this class.

Remarks:
  • Updating private index is important. You can do this either by calling SetIndex() in IntToValue, and then letting wxBaseEnumProperty::OnSetValue be called (by not implementing it, or by calling super class function in it) -OR- you can just call SetIndex in OnSetValue.

Definition at line 529 of file props.h.


Constructor & Destructor Documentation

wxBaseEnumProperty::wxBaseEnumProperty ( const wxString &  label = wxPG_LABEL,
const wxString &  name = wxPG_LABEL 
)

Member Function Documentation

virtual const wxString* wxBaseEnumProperty::GetEntry ( size_t  index,
int *  pvalue 
) const [pure virtual]

Implemented in wxEnumProperty.

int wxBaseEnumProperty::GetIndex (  )  const [protected]
virtual int wxBaseEnumProperty::GetIndexForValue ( int  value  )  const [virtual]

Reimplemented in wxEnumProperty.

virtual wxString wxBaseEnumProperty::GetValueAsString ( int  argFlags  )  const [virtual]

Returns text representation of property's value. Generally this function should not be called from the application code. Instead, call GetValueString().

Parameters:
argFlags If 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.

int wxBaseEnumProperty::GetValueForIndex ( size_t  index  )  const [inline]

Definition at line 554 of file props.h.

virtual bool wxBaseEnumProperty::IntToValue ( wxVariant &  value,
int  number,
int  argFlags = 0 
) const [virtual]

Converts 'number' (including choice selection) into proper value 'variant'. Returns true if new (different than m_value) value could be interpreted from the integer.

Parameters:
argFlags If wxPG_FULL_VALUE is set, returns complete, storable value instead of displayable
Remarks:
  • Default implementation may work correctly if used value type is int.
  • If property is not supposed to use choice or spinctrl or other editor with int-based value, it is not necessary to implement this method.
  • 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.
  • 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.

Reimplemented in wxSystemColourProperty.

virtual void wxBaseEnumProperty::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.

Reimplemented in wxSystemColourProperty.

virtual void wxBaseEnumProperty::OnValidationFailure ( wxVariant &  pendingValue  )  [virtual]

Called whenever validation has failed with given pending value.

Remarks:
If you implement this in your custom property class, please remember to call the baser implementation as well as they may use it to revert property into pre-change state.

Reimplemented from wxPGProperty.

static void wxBaseEnumProperty::ResetNextIndex (  )  [inline, static, protected]

Definition at line 571 of file props.h.

void wxBaseEnumProperty::SetIndex ( int  index  )  [protected]
virtual bool wxBaseEnumProperty::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:
argFlags If 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.

virtual bool wxBaseEnumProperty::ValidateValue ( wxVariant &  value,
wxPGValidationInfo validationInfo 
) const [virtual]

Implement this function in derived class to check the value. Return true if it is ok. Returning false prevents property change events from occurring.

Remarks:
  • Default implementation always returns true.

Reimplemented from wxPGProperty.

bool wxBaseEnumProperty::ValueFromInt_ ( wxVariant &  value,
int  intVal,
int  argFlags 
) const [protected]
bool wxBaseEnumProperty::ValueFromString_ ( wxVariant &  value,
const wxString &  text,
int  argFlags 
) const [protected]

Member Data Documentation

Definition at line 576 of file props.h.

int wxBaseEnumProperty::ms_nextIndex [static, private]

Definition at line 579 of file props.h.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


wxpropgrid
Author(s): Jaakko Salli
autogenerated on Fri Jan 11 09:34:05 2013