wxCustomProperty Class Reference

This is a somewhat inefficient but versatile property class. More...

#include <props.h>

Inheritance diagram for wxCustomProperty:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void ChildChanged (wxVariant &a1, int a2, wxVariant &a3) const
virtual int GetChoiceInfo (wxPGChoiceInfo *choiceinfo)
virtual wxString GetValueAsString (int argFlags) const
virtual bool IntToValue (wxVariant &variant, int number, int argFlags) const
virtual bool StringToValue (wxVariant &variant, const wxString &text, int argFlags=0) const
 wxCustomProperty (const wxString &label=wxPG_LABEL, const wxString &name=wxPG_LABEL)
virtual ~wxCustomProperty ()

Protected Attributes

wxPGChoices m_choices
wxPGPaintCallback m_paintCallback

Detailed Description

This is a somewhat inefficient but versatile property class.

Base class offers the following:

Definition at line 1156 of file props.h.


Constructor & Destructor Documentation

wxCustomProperty::wxCustomProperty ( const wxString &  label = wxPG_LABEL,
const wxString &  name = wxPG_LABEL 
)
virtual wxCustomProperty::~wxCustomProperty (  )  [virtual]

Member Function Documentation

virtual void wxCustomProperty::ChildChanged ( wxVariant &  thisValue,
int  childIndex,
wxVariant &  childValue 
) const [inline, virtual]

Called after value of a child property has been altered. Note that this function is usually called at the time that value of this property, or given child property, is still pending for change.

Sample pseudo-code implementation:

        void MyProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
        {
            // Acquire reference to actual type of data stored in variant
            // (TFromVariant only exists if wxPropertyGrid's wxVariant-macros were used to create
            // the variant class).
            T& data = TFromVariant(thisValue);

            // Copy childValue into data.
            switch ( childIndex )
            {
                case 0:
                    data.SetSubProp1( childvalue.GetLong() );
                    break;
                case 1:
                    data.SetSubProp2( childvalue.GetString() );
                    break;
                ...
            }
        }
Parameters:
thisValue Value of this property, that should be altered.
childIndex Index of child changed (you can use Item(childIndex) to get).
childValue Value of the child property.

Reimplemented from wxPGProperty.

Definition at line 1177 of file props.h.

virtual int wxCustomProperty::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.

virtual wxString wxCustomProperty::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.

virtual bool wxCustomProperty::IntToValue ( wxVariant &  value,
int  number,
int  argFlags 
) 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.

virtual bool wxCustomProperty::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.


Member Data Documentation

Definition at line 1187 of file props.h.

Definition at line 1191 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:06 2013