]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/propgrid/property.h
rebaked makefiles with 0.2.4
[wxWidgets.git] / include / wx / propgrid / property.h
index 3bb7756faf68e0fc278d6a707c3a49403a4450a4..ece85011db7cedabbb6560f2b91801153088a9ca 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Jaakko Salli
 // Modified by:
 // Created:     2008-08-23
 // Author:      Jaakko Salli
 // Modified by:
 // Created:     2008-08-23
-// RCS-ID:      $Id:
+// RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) Jaakko Salli
 // Licence:     wxWindows license
 /////////////////////////////////////////////////////////////////////////////
@@ -47,13 +47,6 @@ struct wxPGPaintData
 };
 
 
 };
 
 
-// Structure for relaying choice/list info.
-struct wxPGChoiceInfo
-{
-    wxPGChoices*    m_choices;
-};
-
-
 #ifndef SWIG
 
 
 #ifndef SWIG
 
 
@@ -412,7 +405,7 @@ wxPG_PROP_CLASS_SPECIFIC_2          = 0x00100000
     Identifiers.
 
     wxPGProperty::SetAttribute() and
     Identifiers.
 
     wxPGProperty::SetAttribute() and
-    wxPropertyGridInterfaces::SetPropertyAttribute() accept one of these as
+    wxPropertyGridInterface::SetPropertyAttribute() accept one of these as
     attribute name argument.
 
     You can use strings instead of constants. However, some of these
     attribute name argument.
 
     You can use strings instead of constants. However, some of these
@@ -550,11 +543,6 @@ wxPG_PROP_CLASS_SPECIFIC_2          = 0x00100000
 */
 #define wxPG_COLOUR_ALLOW_CUSTOM            wxS("AllowCustom")
 
 */
 #define wxPG_COLOUR_ALLOW_CUSTOM            wxS("AllowCustom")
 
-/** First attribute id that is guaranteed not to be used built-in
-    properties.
-*/
-//#define wxPG_USER_ATTRIBUTE                 192
-
 /** @}
 */
 
 /** @}
 */
 
@@ -572,276 +560,396 @@ wxPG_PROP_CLASS_SPECIFIC_2          = 0x00100000
 
 // -----------------------------------------------------------------------
 
 
 // -----------------------------------------------------------------------
 
-/** @class wxPGProperty
-
-    wxPGProperty is base class for all wxPropertyGrid properties. In
-    sections below we cover few related topics.
-
-    @li @ref pgproperty_properties
-    @li @ref pgproperty_creating
+#ifndef SWIG
 
 
-    @section pgproperty_properties Supplied Ready-to-use Property Classes
+/** @class wxPGChoiceEntry
+    Data of a single wxPGChoices choice.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGChoiceEntry : public wxPGCell
+{
+public:
+    wxPGChoiceEntry();
+    wxPGChoiceEntry( const wxPGChoiceEntry& entry );
+    wxPGChoiceEntry( const wxString& label,
+                     int value = wxPG_INVALID_VALUE )
+        : wxPGCell(), m_value(value)
+    {
+        m_text = label;
+    }
 
 
-    Here is a list and short description of supplied fully-functional
-    property classes. They are located in either props.h or advprops.h.
+    wxPGChoiceEntry( const wxString& label,
+                     int value,
+                     const wxBitmap& bitmap,
+                     const wxColour& fgCol = wxNullColour,
+                     const wxColour& bgCol = wxNullColour )
+        : wxPGCell(label, bitmap, fgCol, bgCol), m_value(value)
+    {
+    }
 
 
-    @li @ref wxArrayStringProperty
-    @li @ref wxBoolProperty
-    @li @ref wxColourProperty
-    @li @ref wxCursorProperty
-    @li @ref wxDateProperty
-    @li @ref wxDirProperty
-    @li @ref wxEditEnumProperty
-    @li @ref wxEnumProperty
-    @li @ref wxFileProperty
-    @li @ref wxFlagsProperty
-    @li @ref wxFloatProperty
-    @li @ref wxFontProperty
-    @li @ref wxImageFileProperty
-    @li @ref wxIntProperty
-    @li @ref wxLongStringProperty
-    @li @ref wxMultiChoiceProperty
-    @li @ref wxPropertyCategory
-    @li @ref wxStringProperty
-    @li @ref wxSystemColourProperty
-    @li @ref wxUIntProperty
+    virtual ~wxPGChoiceEntry()
+    {
+    }
 
 
-    @subsection wxPropertyCategory
+    void SetValue( int value ) { m_value = value; }
 
 
-    Not an actual property per se, but a header for a group of properties.
-    Regardless inherits from wxPGProperty.
+    int GetValue() const { return m_value; }
 
 
-    @subsection wxStringProperty
+    bool HasValue() const { return (m_value != wxPG_INVALID_VALUE); }
 
 
-    Simple string property. wxPG_STRING_PASSWORD attribute may be used
-    to echo value as asterisks and use wxTE_PASSWORD for wxTextCtrl.
+protected:
+    int m_value;
+};
 
 
-    @remarks
-    * wxStringProperty has a special trait: if it has value of "<composed>",
-      and also has child properties, then its displayed value becomes
-      composition of child property values, similar as with wxFontProperty,
-      for instance.
 
 
-    @subsection wxIntProperty
+typedef void* wxPGChoicesId;
 
 
-    Like wxStringProperty, but converts text to a signed long integer.
-    wxIntProperty seamlessly supports 64-bit integers (ie. wxLongLong).
+class WXDLLIMPEXP_PROPGRID wxPGChoicesData
+{
+    friend class wxPGChoices;
+public:
+    // Constructor sets m_refCount to 1.
+    wxPGChoicesData();
 
 
-    @subsection wxUIntProperty
+    void CopyDataFrom( wxPGChoicesData* data );
 
 
-    Like wxIntProperty, but displays value as unsigned int. To set
-    the prefix used globally, manipulate wxPG_UINT_PREFIX string attribute.
-    To set the globally used base, manipulate wxPG_UINT_BASE int
-    attribute. Regardless of current prefix, understands (hex) values starting
-    with both "0x" and "$".
-    wxUIntProperty seamlessly supports 64-bit unsigned integers (ie.
-    wxULongLong).
+    // Takes ownership of 'item'
+    void Insert( int index, wxPGChoiceEntry* item )
+    {
+        wxVector<wxPGChoiceEntry*>::iterator it;
+        if ( index == -1 )
+        {
+            it = m_items.end();
+            index = m_items.size();
+        }
+        else
+        {
+            it = m_items.begin() + index;
+        }
 
 
-    @subsection wxFloatProperty
+        // Need to fix value?
+        if ( item->GetValue() == wxPG_INVALID_VALUE )
+            item->SetValue(index);
 
 
-    Like wxStringProperty, but converts text to a double-precision floating
-    point. Default float-to-text precision is 6 decimals, but this can be
-    changed by modifying wxPG_FLOAT_PRECISION attribute.
+        m_items.insert(it, item);
+    }
 
 
-    @subsection wxBoolProperty
+    // Delete all entries
+    void Clear();
 
 
-    Represents a boolean value. wxChoice is used as editor control, by the
-    default. wxPG_BOOL_USE_CHECKBOX attribute can be set to true inorder to use
-    check box instead.
+    size_t GetCount() const { return m_items.size(); }
 
 
-    @subsection wxLongStringProperty
+    wxPGChoiceEntry* Item( unsigned int i ) const
+    {
+        wxCHECK_MSG( i < GetCount(), NULL, "invalid index" );
 
 
-    Like wxStringProperty, but has a button that triggers a small text editor
-    dialog. Note that in long string values, tabs are represented by "\t" and
-    line break by "\n".
+        return m_items[i];
+    }
 
 
-    @subsection wxDirProperty
+    void DecRef()
+    {
+        m_refCount--;
+        wxASSERT( m_refCount >= 0 );
+        if ( m_refCount == 0 )
+            delete this;
+    }
 
 
-    Like wxLongStringProperty, but the button triggers dir selector instead.
-    Supported properties (all with string value): wxPG_DIR_DIALOG_MESSAGE.
+private:
+    wxVector<wxPGChoiceEntry*>  m_items;
 
 
-    @subsection wxFileProperty
+    // So that multiple properties can use the same set
+    int             m_refCount;
 
 
-    Like wxLongStringProperty, but the button triggers file selector instead.
-    Default wildcard is "All files..." but this can be changed by setting
-    wxPG_FILE_WILDCARD attribute (see wxFileDialog for format details).
-    Attribute wxPG_FILE_SHOW_FULL_PATH can be set to false inorder to show
-    only the filename, not the entire path.
+    virtual ~wxPGChoicesData();
+};
 
 
-    @subsection wxEnumProperty
+#define wxPGChoicesEmptyData    ((wxPGChoicesData*)NULL)
 
 
-    Represents a single selection from a list of choices -
-    wxOwnerDrawnComboBox is used to edit the value.
+#endif // SWIG
 
 
-    @subsection wxFlagsProperty
+/** @class wxPGChoices
 
 
-    Represents a bit set that fits in a long integer. wxBoolProperty
-    sub-properties are created for editing individual bits. Textctrl is created
-    to manually edit the flags as a text; a continous sequence of spaces,
-    commas and semicolons is considered as a flag id separator.
-    <b>Note: </b> When changing "choices" (ie. flag labels) of wxFlagsProperty,
-    you will need to use SetPropertyChoices - otherwise they will not get
-    updated properly.
+    Helper class for managing choices of wxPropertyGrid properties.
+    Each entry can have label, value, bitmap, text colour, and background
+    colour.
 
 
-    @subsection wxArrayStringProperty
+    @library{wxpropgrid}
+    @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPGChoices
+{
+public:
+    typedef long ValArrItem;
 
 
-    Allows editing of a list of strings in wxTextCtrl and in a separate dialog.
+    /** Default constructor. */
+    wxPGChoices()
+    {
+        Init();
+    }
 
 
-    @subsection wxDateProperty
+    /** Copy constructor. */
+    wxPGChoices( const wxPGChoices& a )
+    {
+        if ( a.m_data != wxPGChoicesEmptyData )
+        {
+            m_data = a.m_data;
+            m_data->m_refCount++;
+        }
+    }
 
 
-    wxDateTime property. Default editor is DatePickerCtrl, altough TextCtrl
-    should work as well. wxPG_DATE_FORMAT attribute can be used to change
-    string wxDateTime::Format uses (altough default is recommended as it is
-    locale-dependant), and wxPG_DATE_PICKER_STYLE allows changing window
-    style given to DatePickerCtrl (default is wxDP_DEFAULT|wxDP_SHOWCENTURY).
+    /** Constructor. */
+    wxPGChoices( const wxChar** labels, const long* values = NULL )
+    {
+        Init();
+        Set(labels,values);
+    }
 
 
-    @subsection wxEditEnumProperty
+    /** Constructor. */
+    wxPGChoices( const wxArrayString& labels,
+                 const wxArrayInt& values = wxArrayInt() )
+    {
+        Init();
+        Set(labels,values);
+    }
 
 
-    Represents a string that can be freely edited or selected from list of
-    choices - custom combobox control is used to edit the value.
+    /** Simple interface constructor. */
+    wxPGChoices( wxPGChoicesData* data )
+    {
+        wxASSERT(data);
+        m_data = data;
+        data->m_refCount++;
+    }
 
 
-    @subsection wxMultiChoiceProperty
+    /** Destructor. */
+    ~wxPGChoices()
+    {
+        Free();
+    }
 
 
-    Allows editing a multiple selection from a list of strings. This is
-    property is pretty much built around concept of wxMultiChoiceDialog.
-    It uses wxArrayString value.
+    /**
+        Adds to current.
 
 
-    @subsection wxImageFileProperty
+        If did not have own copies, creates them now. If was empty, identical
+        to set except that creates copies.
+    */
+    void Add( const wxChar** labels, const ValArrItem* values = NULL );
 
 
-    Like wxFileProperty, but has thumbnail of the image in front of
-    the filename and autogenerates wildcard from available image handlers.
+    /** Version that works with wxArrayString. */
+    void Add( const wxArrayString& arr, const ValArrItem* values = NULL );
 
 
-    @subsection wxColourProperty
+    /** Version that works with wxArrayString and wxArrayInt. */
+    void Add( const wxArrayString& arr, const wxArrayInt& arrint );
 
 
-    <b>Useful alternate editor:</b> Choice.
+    /** Adds single item. */
+    wxPGChoiceEntry& Add( const wxString& label,
+                          int value = wxPG_INVALID_VALUE );
 
 
-    Represents wxColour. wxButton is used to trigger a colour picker dialog.
+    /** Adds a single item, with bitmap. */
+    wxPGChoiceEntry& Add( const wxString& label,
+                          const wxBitmap& bitmap,
+                          int value = wxPG_INVALID_VALUE );
 
 
-    @subsection wxFontProperty
+    /** Adds a single item with full entry information. */
+    wxPGChoiceEntry& Add( const wxPGChoiceEntry& entry )
+    {
+        return Insert(entry, -1);
+    }
 
 
-    Represents wxFont. Various sub-properties are used to edit individual
-    subvalues.
+    /** Adds single item. */
+    wxPGChoiceEntry& AddAsSorted( const wxString& label,
+                                  int value = wxPG_INVALID_VALUE );
 
 
-    @subsection wxSystemColourProperty
+    void Assign( const wxPGChoices& a )
+    {
+        AssignData(a.m_data);
+    }
 
 
-    Represents wxColour and a system colour index. wxChoice is used to edit
-    the value. Drop-down list has color images. Note that value type
-    is wxColourPropertyValue instead of wxColour.
-    @code
-        class wxColourPropertyValue : public wxObject
-        {
-        public:
-            //  An integer value relating to the colour, and which exact
-            //  meaning depends on the property with which it is used.
-            //
-            //  For wxSystemColourProperty:
-            //  Any of wxSYS_COLOUR_XXX, or any web-colour (use
-            //  wxPG_TO_WEB_COLOUR macro - (currently unsupported) ),
-            //  or wxPG_COLOUR_CUSTOM.
-            wxUint32    m_type;
+    void AssignData( wxPGChoicesData* data );
 
 
-            // Resulting colour. Should be correct regardless of type.
-            wxColour    m_colour;
-        };
-    @endcode
+    /** Delete all choices. */
+    void Clear()
+    {
+        if ( m_data != wxPGChoicesEmptyData )
+            m_data->Clear();
+    }
 
 
-    @subsection wxCursorProperty
+    void EnsureData()
+    {
+        if ( m_data == wxPGChoicesEmptyData )
+            m_data = new wxPGChoicesData();
+    }
 
 
-    Represents a wxCursor. wxChoice is used to edit the value.
-    Drop-down list has cursor images under some (wxMSW) platforms.
+    /** Gets a unsigned number identifying this list. */
+    wxPGChoicesId GetId() const { return (wxPGChoicesId) m_data; };
 
 
+    const wxString& GetLabel( size_t ind ) const
+    {
+        return Item(ind).GetText();
+    }
 
 
-    @section pgproperty_creating Creating Custom Properties
+    size_t GetCount () const
+    {
+        if ( !m_data )
+            return 0;
 
 
-    New properties can be created by subclassing wxPGProperty or one
-    of the provided property classes, and (re)implementing necessary
-    member functions. Below, each virtual member function has ample
-    documentation about its purpose and any odd details which to keep
-    in mind.
+        return m_data->GetCount();
+    }
 
 
-    Here is a very simple 'template' code:
+    int GetValue( size_t ind ) const { return Item(ind).GetValue(); }
 
 
-    @code
-        class MyProperty : public wxPGProperty
-        {
-        public:
-            // All arguments of ctor must have a default value -
-            // use wxPG_LABEL for label and name
-            MyProperty( const wxString& label = wxPG_LABEL,
-                        const wxString& name = wxPG_LABEL,
-                        const wxString& value = wxEmptyString )
-            {
-                // m_value is wxVariant
-                m_value = value;
-            }
+    /** Returns array of values matching the given strings. Unmatching strings
+        result in wxPG_INVALID_VALUE entry in array.
+    */
+    wxArrayInt GetValuesForStrings( const wxArrayString& strings ) const;
 
 
-            virtual ~MyProperty() { }
+    /** Returns array of indices matching given strings. Unmatching strings
+        are added to 'unmatched', if not NULL.
+    */
+    wxArrayInt GetIndicesForStrings( const wxArrayString& strings,
+                                     wxArrayString* unmatched = NULL ) const;
 
 
-            const wxPGEditor* DoGetEditorClass() const
-            {
-                // Determines editor used by property.
-                // You can replace 'TextCtrl' below with any of these
-                // builtin-in property editor identifiers: Choice, ComboBox,
-                // TextCtrlAndButton, ChoiceAndButton, CheckBox, SpinCtrl,
-                // DatePickerCtrl.
-                return wxPGEditor_TextCtrl;
-            }
+    /** Returns true if choices in general are likely to have values
+        (depens on that all entries have values or none has)
+    */
+    bool HasValues() const;
 
 
-            virtual wxString GetValueAsString( int argFlags ) const
-            {
-                // TODO: Return property value in string format
-            }
+    bool HasValue( unsigned int i ) const
+        { return (i < m_data->GetCount()) && m_data->Item(i)->HasValue(); }
 
 
-            virtual bool StringToValue( wxVariant& variant,
-                                        const wxString& text,
-                                        int argFlags )
-            {
-                // TODO: Adapt string to property value.
-            }
+    int Index( const wxString& str ) const;
+    int Index( int val ) const;
 
 
-        protected:
-        };
-    @endcode
+    /** Inserts single item. */
+    wxPGChoiceEntry& Insert( const wxString& label,
+                             int index,
+                             int value = wxPG_INVALID_VALUE );
 
 
-    Since wxPGProperty derives from wxObject, you can use standard
-    DECLARE_DYNAMIC_CLASS and IMPLEMENT_DYNAMIC_CLASS macros. From the
-    above example they were omitted for sake of simplicity, and besides,
-    they are only really needed if you need to use wxRTTI with your
-    property class.
+    /** Inserts a single item with full entry information. */
+    wxPGChoiceEntry& Insert( const wxPGChoiceEntry& entry, int index );
 
 
-    You can change the 'value type' of a property by simply assigning different
-    type of variant with SetValue. <b>It is mandatory to implement
-    wxVariantData class for all data types used as property values.</b>
-    You can use macros declared in wxPropertyGrid headers. For instance:
+    /** Returns false if this is a constant empty set of choices,
+        which should not be modified.
+    */
+    bool IsOk() const
+    {
+        return ( m_data != wxPGChoicesEmptyData );
+    }
 
 
-    @code
-        // In header file:
-        // (If you need to have export declaration, use version of macros
-        // with _EXPORTED postfix)
-        WX_PG_DECLARE_VARIANT_DATA(MyDataClass)
+    const wxPGChoiceEntry& Item( unsigned int i ) const
+    {
+        wxASSERT( IsOk() );
+        return *m_data->Item(i);
+    }
 
 
-        // In sources file:
-        WX_PG_IMPLEMENT_VARIANT_DATA(MyDataClass)
+    wxPGChoiceEntry& Item( unsigned int i )
+    {
+        wxASSERT( IsOk() );
+        return *m_data->Item(i);
+    }
 
 
-        // Or, if you don't have valid == operator:
-        WX_PG_IMPLEMENT_VARIANT_DATA_DUMMY_EQ(MyDataClass)
-    @endcode
+    /** Removes count items starting at position nIndex. */
+    void RemoveAt(size_t nIndex, size_t count = 1);
 
 
-    @library{wxpropgrid}
-    @category{propgrid}
-*/
-class WXDLLIMPEXP_PROPGRID wxPGProperty : public wxObject
-{
-    friend class wxPropertyGrid;
-    friend class wxPropertyGridInterface;
-    friend class wxPropertyGridPageState;
-    friend class wxPropertyGridPopulator;
-    friend class wxStringProperty;  // Proper "<composed>" support requires this
 #ifndef SWIG
 #ifndef SWIG
-    DECLARE_ABSTRACT_CLASS(wxPGProperty)
-#endif
-public:
-    typedef wxUint32 FlagType;
+    /** Does not create copies for itself. */
+    void Set( const wxChar** labels, const long* values = NULL )
+    {
+        Free();
+        Add(labels,values);
+    }
+#endif // SWIG
+
+    /** Version that works with wxArrayString and wxArrayInt. */
+    void Set( const wxArrayString& labels,
+              const wxArrayInt& values = wxArrayInt() )
+    {
+        Free();
+        if ( &values )
+            Add(labels,values);
+        else
+            Add(labels);
+    }
+
+    // Creates exclusive copy of current choices
+    void SetExclusive()
+    {
+        if ( m_data->m_refCount != 1 )
+        {
+            wxPGChoicesData* data = new wxPGChoicesData();
+            data->CopyDataFrom(m_data);
+            Free();
+            m_data = data;
+        }
+    }
+
+    // Returns data, increases refcount.
+    wxPGChoicesData* GetData()
+    {
+        wxASSERT( m_data->m_refCount != 0xFFFFFFF );
+        m_data->m_refCount++;
+        return m_data;
+    }
+
+    // Returns plain data ptr - no refcounting stuff is done.
+    wxPGChoicesData* GetDataPtr() const { return m_data; }
+
+    // Changes ownership of data to you.
+    wxPGChoicesData* ExtractData()
+    {
+        wxPGChoicesData* data = m_data;
+        m_data = wxPGChoicesEmptyData;
+        return data;
+    }
+
+    wxArrayString GetLabels() const;
+
+#ifndef SWIG
+    void operator= (const wxPGChoices& a)
+    {
+        AssignData(a.m_data);
+    }
+
+    wxPGChoiceEntry& operator[](unsigned int i)
+    {
+        return Item(i);
+    }
+
+    const wxPGChoiceEntry& operator[](unsigned int i) const
+    {
+        return Item(i);
+    }
+
+protected:
+    wxPGChoicesData*    m_data;
+
+    void Init();
+    void Free();
+#endif  // !SWIG
+};
+
+// -----------------------------------------------------------------------
+
+/** @class wxPGProperty
+
+    wxPGProperty is base class for all wxPropertyGrid properties.
+
+    NB: Full class overview is now only present in
+        interface/wx/propgrid/property.h.
+
+    @library{wxpropgrid}
+    @category{propgrid}
+*/
+class WXDLLIMPEXP_PROPGRID wxPGProperty : public wxObject
+{
+    friend class wxPropertyGrid;
+    friend class wxPropertyGridInterface;
+    friend class wxPropertyGridPageState;
+    friend class wxPropertyGridPopulator;
+    friend class wxStringProperty;  // Proper "<composed>" support requires this
+#ifndef SWIG
+    DECLARE_ABSTRACT_CLASS(wxPGProperty)
+#endif
+public:
+    typedef wxUint32 FlagType;
 
     /** Basic constructor.
     */
 
     /** Basic constructor.
     */
@@ -908,9 +1016,15 @@ public:
                                 wxPGValidationInfo& validationInfo ) const;
 
     /**
                                 wxPGValidationInfo& validationInfo ) const;
 
     /**
-        Converts 'text' into proper value 'variant'.
-        Returns true if new (different than m_value) value could be interpreted
-        from the text.
+        Converts text into wxVariant value appropriate for this property.
+
+        @param variant
+            On function entry this is the old value (should not be wxNullVariant
+            in normal cases). Translated value must be assigned back to it.
+
+        @param text
+            Text to be translated into variant.
+
         @param argFlags
             If wxPG_FULL_VALUE is set, returns complete, storable value instead
             of displayable one (they may be different).
         @param argFlags
             If wxPG_FULL_VALUE is set, returns complete, storable value instead
             of displayable one (they may be different).
@@ -918,25 +1032,36 @@ public:
             composite property string value (as generated by GetValueAsString()
             called with this same flag).
 
             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.
+        @return Returns @true if resulting wxVariant value was different.
+
+        @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).
     */
     virtual bool StringToValue( wxVariant& variant,
                                 const wxString& text,
                                 int argFlags = 0 ) const;
 
     /**
     */
     virtual bool StringToValue( wxVariant& variant,
                                 const wxString& text,
                                 int argFlags = 0 ) const;
 
     /**
-        Converts 'number' (including choice selection) into proper value
-        'variant'.
+        Converts integer (possibly a choice selection) into wxVariant value
+        appropriate for this property.
 
 
-        Returns true if new (different than m_value) value could be interpreted
-        from the integer.
+        @param variant
+            On function entry this is the old value (should not be wxNullVariant
+            in normal cases). Translated value must be assigned back to it.
+
+        @param number
+            Integer to be translated into variant.
 
         @param argFlags
             If wxPG_FULL_VALUE is set, returns complete, storable value instead
             of displayable one.
 
 
         @param argFlags
             If wxPG_FULL_VALUE is set, returns complete, storable value instead
             of displayable one.
 
+        @return Returns @true if resulting wxVariant value was different.
+
         @remarks
         - 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.
         @remarks
         - 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.
@@ -944,6 +1069,9 @@ public:
         - 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.
         - 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).
     */
     virtual bool IntToValue( wxVariant& value,
                              int number,
     */
     virtual bool IntToValue( wxVariant& value,
                              int number,
@@ -1106,21 +1234,6 @@ public:
     */
     virtual wxValidator* DoGetValidator () const;
 
     */
     virtual wxValidator* DoGetValidator () const;
 
-    /**
-        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
-        wxPGEditor_Choice or similar.
-
-        @remarks
-        - If returns NULL in choiceinfo.m_choices, then this class must be
-          derived from wxBaseEnumProperty.
-        - Must be able to cope situation where property's set of choices is
-          uninitialized.
-    */
-    virtual int GetChoiceInfo( wxPGChoiceInfo* choiceinfo );
-
     /**
         Override to paint an image in front of the property value text or
         drop-down list item (but only if wxPGProperty::OnMeasureImage is
     /**
         Override to paint an image in front of the property value text or
         drop-down list item (but only if wxPGProperty::OnMeasureImage is
@@ -1176,6 +1289,14 @@ public:
     */
     virtual wxPGCellRenderer* GetCellRenderer( int column ) const;
 
     */
     virtual wxPGCellRenderer* GetCellRenderer( int column ) const;
 
+    /** Returns which choice is currently selected. Only applies to properties
+        which have choices.
+
+        Needs to reimplemented in derived class if property value does not
+        map directly to a choice. Integer as index, bool, and string usually do.
+    */
+    virtual int GetChoiceSelection() const;
+
     /**
         Refresh values of child properties.
 
     /**
         Refresh values of child properties.
 
@@ -1208,17 +1329,6 @@ public:
     */
     virtual wxPGEditorDialogAdapter* GetEditorDialog() const;
 
     */
     virtual wxPGEditorDialogAdapter* GetEditorDialog() const;
 
-    /**
-        Adds entry to property's wxPGChoices and editor control (if it is
-        active).
-
-        Returns index of item added.
-    */
-    int AppendChoice( const wxString& label, int value = wxPG_INVALID_VALUE )
-    {
-        return InsertChoice(label,-1,value);
-    }
-
     /** Returns wxPGCell of given column, NULL if none. If valid
         object is returned, caller will gain its ownership.
     */
     /** Returns wxPGCell of given column, NULL if none. If valid
         object is returned, caller will gain its ownership.
     */
@@ -1232,6 +1342,13 @@ public:
         return cell;
     }
 
         return cell;
     }
 
+    /** Append a new choice to property's list of choices.
+    */
+    int AddChoice( const wxString& label, int value = wxPG_INVALID_VALUE )
+    {
+        return InsertChoice(label, wxNOT_FOUND, value);
+    }
+
     /**
         Returns true if children of this property are component values (for
         instance, points size, face name, and is_underlined are component
     /**
         Returns true if children of this property are component values (for
         instance, points size, face name, and is_underlined are component
@@ -1281,11 +1398,12 @@ public:
      */
     const wxString& GetBaseName() const { return m_name; }
 
      */
     const wxString& GetBaseName() const { return m_name; }
 
-    wxPGChoices& GetChoices();
-
-    const wxPGChoices& GetChoices() const;
-
-    const wxPGChoiceEntry* GetCurrentChoice() const;
+    /** Returns read-only reference to property's list of choices.
+    */
+    const wxPGChoices& GetChoices() const
+    {
+        return m_choices;
+    }
 
     /** Returns coordinate to the top y of the property. Note that the
         position of scrollbars is not taken into account.
 
     /** Returns coordinate to the top y of the property. Note that the
         position of scrollbars is not taken into account.
@@ -1313,7 +1431,9 @@ public:
     }
 #endif
 
     }
 #endif
 
-    /** Same as GetValueAsString, except takes common value into account.
+    /** To acquire property's value as string, you should use this
+         function (instead of GetValueAsString()), as it may produce
+         more accurate value in future versions.
     */
     wxString GetValueString( int argFlags = 0 ) const;
 
     */
     wxString GetValueString( int argFlags = 0 ) const;
 
@@ -1330,10 +1450,6 @@ public:
         return (wxPGCell*) m_cells[column];
     }
 
         return (wxPGCell*) m_cells[column];
     }
 
-    unsigned int GetChoiceCount() const;
-
-    wxString GetChoiceString( unsigned int index );
-
     /** Return number of displayed common values for this property.
     */
     int GetDisplayedCommonValueCount() const;
     /** Return number of displayed common values for this property.
     */
     int GetDisplayedCommonValueCount() const;
@@ -1424,15 +1540,9 @@ public:
     */
     bool HasVisibleChildren() const;
 
     */
     bool HasVisibleChildren() const;
 
-    /**
-        Adds entry to property's wxPGChoices and editor control (if it is
-        active).
-
-        Returns index of item added.
+    /** Inserts a new choice to property's list of choices.
     */
     */
-    int InsertChoice( const wxString& label,
-                      int index,
-                      int value = wxPG_INVALID_VALUE );
+    int InsertChoice( const wxString& label, int index, int value = wxPG_INVALID_VALUE );
 
     /**
         Returns true if this property is actually a wxPropertyCategory.
 
     /**
         Returns true if this property is actually a wxPropertyCategory.
@@ -1466,7 +1576,9 @@ public:
     /**
         Determines, recursively, if all children are not unspecified.
 
     /**
         Determines, recursively, if all children are not unspecified.
 
-        Takes values in given list into account.
+        @param pendingList
+            Assumes members in this wxVariant list as pending
+            replacement values.
     */
     bool AreAllChildrenSpecified( wxVariant* pendingList = NULL ) const;
 
     */
     bool AreAllChildrenSpecified( wxVariant* pendingList = NULL ) const;
 
@@ -1480,9 +1592,9 @@ public:
 
     /** Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES.
     */
 
     /** Returns true if containing grid uses wxPG_EX_AUTO_UNSPECIFIED_VALUES.
     */
-    FlagType UsesAutoUnspecified() const
+    bool UsesAutoUnspecified() const
     {
     {
-        return HasFlag(wxPG_PROP_AUTO_UNSPECIFIED);
+        return HasFlag(wxPG_PROP_AUTO_UNSPECIFIED)?true:false;
     }
 
     wxBitmap* GetValueImage() const
     }
 
     wxBitmap* GetValueImage() const
@@ -1513,8 +1625,6 @@ public:
     */
     double GetAttributeAsDouble( const wxString& name, double defVal ) const;
 
     */
     double GetAttributeAsDouble( const wxString& name, double defVal ) const;
 
-    unsigned int GetArrIndex() const { return m_arrIndex; }
-
     unsigned int GetDepth() const { return (unsigned int)m_depth; }
 
     /** Gets flags as a'|' delimited string. Note that flag names are not
     unsigned int GetDepth() const { return (unsigned int)m_depth; }
 
     /** Gets flags as a'|' delimited string. Note that flag names are not
@@ -1594,10 +1704,6 @@ public:
     */
     void SetCell( int column, wxPGCell* cellObj );
 
     */
     void SetCell( int column, wxPGCell* cellObj );
 
-    /** Changes value of a property with choices, but only
-        works if the value type is long or string. */
-    void SetChoiceSelection( int newValue, const wxPGChoiceInfo& choiceInfo );
-
     /** Sets common value selected for this property. -1 for none.
     */
     void SetCommonValue( int commonValue )
     /** Sets common value selected for this property. -1 for none.
     */
     void SetCommonValue( int commonValue )
@@ -1655,7 +1761,17 @@ public:
     /** If property has choices and they are not yet exclusive, new such copy
         of them will be created.
     */
     /** If property has choices and they are not yet exclusive, new such copy
         of them will be created.
     */
-    void SetChoicesExclusive();
+    void SetChoicesExclusive()
+    {
+        m_choices.SetExclusive();
+    }
+
+    /** Sets selected choice and changes property value.
+
+        Tries to retain value type, although currently if it is not string,
+        then it is forced to integer.
+    */
+    void SetChoiceSelection( int newValue );
 
     void SetExpanded( bool expanded )
     {
 
     void SetExpanded( bool expanded )
     {
@@ -1752,11 +1868,6 @@ public:
     */
     bool SetChoices( wxPGChoices& choices );
 
     */
     bool SetChoices( wxPGChoices& choices );
 
-    /** Sets new set of choices for property.
-    */
-    inline bool SetChoices( const wxArrayString& labels,
-                            const wxArrayInt& values = wxArrayInt() );
-
     /** Set max length of text in text editor.
     */
     inline bool SetMaxLength( int maxLen );
     /** Set max length of text in text editor.
     */
     inline bool SetMaxLength( int maxLen );
@@ -1797,19 +1908,18 @@ public:
     int GetChildrenHeight( int lh, int iMax = -1 ) const;
 
     /** Returns number of child properties */
     int GetChildrenHeight( int lh, int iMax = -1 ) const;
 
     /** Returns number of child properties */
-    unsigned int GetChildCount() const { return m_children.GetCount(); }
+    unsigned int GetChildCount() const { return m_children.size(); }
 
     /** Returns sub-property at index i. */
     wxPGProperty* Item( size_t i ) const
 
     /** Returns sub-property at index i. */
     wxPGProperty* Item( size_t i ) const
-        { return (wxPGProperty*)m_children.Item(i); }
+        { return m_children[i]; }
 
     /** Returns last sub-property.
     */
 
     /** Returns last sub-property.
     */
-    wxPGProperty* Last() const { return (wxPGProperty*)m_children.Last(); }
+    wxPGProperty* Last() const { return m_children.back(); }
 
 
-    /** Returns index of given sub-property. */
-    int Index( const wxPGProperty* p ) const
-        { return m_children.Index((wxPGProperty*)p); }
+    /** Returns index of given child property. */
+    int Index( const wxPGProperty* p ) const;
 
     /** Deletes all sub-properties. */
     void Empty();
 
     /** Deletes all sub-properties. */
     void Empty();
@@ -1894,6 +2004,9 @@ protected:
     // Call for after sub-properties added with AddChild
     void PrepareSubProperties();
 
     // Call for after sub-properties added with AddChild
     void PrepareSubProperties();
 
+    // Removes child property with given pointer. Does not delete it.
+    void RemoveChild( wxPGProperty* p );
+
     void SetParentalType( int flag )
     {
         m_flags &= ~(wxPG_PROP_PROPERTY|wxPG_PROP_PARENTAL_FLAGS);
     void SetParentalType( int flag )
     {
         m_flags &= ~(wxPG_PROP_PROPERTY|wxPG_PROP_PARENTAL_FLAGS);
@@ -1930,11 +2043,14 @@ protected:
 
     wxVariant                   m_value;
     wxPGAttributeStorage        m_attributes;
 
     wxVariant                   m_value;
     wxPGAttributeStorage        m_attributes;
-    wxArrayPtrVoid              m_children;
+    wxArrayPGProperty           m_children;
 
     // Extended cell information
     wxArrayPtrVoid              m_cells;
 
 
     // Extended cell information
     wxArrayPtrVoid              m_cells;
 
+    // Choices shown in drop-down list of editor control.
+    wxPGChoices                 m_choices;
+
     // Help shown in statusbar or help box.
     wxString                    m_helpString;
 
     // Help shown in statusbar or help box.
     wxString                    m_helpString;
 
@@ -2066,390 +2182,6 @@ private:
 
 // -----------------------------------------------------------------------
 
 
 // -----------------------------------------------------------------------
 
-#ifndef SWIG
-
-/** @class wxPGChoiceEntry
-    Data of a single wxPGChoices choice.
-*/
-class WXDLLIMPEXP_PROPGRID wxPGChoiceEntry : public wxPGCell
-{
-public:
-    wxPGChoiceEntry();
-    wxPGChoiceEntry( const wxPGChoiceEntry& entry );
-    wxPGChoiceEntry( const wxString& label,
-                     int value = wxPG_INVALID_VALUE )
-        : wxPGCell(), m_value(value)
-    {
-        m_text = label;
-    }
-
-    wxPGChoiceEntry( const wxString& label,
-                     int value,
-                     const wxBitmap& bitmap,
-                     const wxColour& fgCol = wxNullColour,
-                     const wxColour& bgCol = wxNullColour )
-        : wxPGCell(label, bitmap, fgCol, bgCol), m_value(value)
-    {
-    }
-
-    virtual ~wxPGChoiceEntry()
-    {
-    }
-
-    void SetValue( int value ) { m_value = value; }
-
-    int GetValue() const { return m_value; }
-
-    bool HasValue() const { return (m_value != wxPG_INVALID_VALUE); }
-
-protected:
-    int m_value;
-};
-
-
-typedef void* wxPGChoicesId;
-
-class WXDLLIMPEXP_PROPGRID wxPGChoicesData
-{
-    friend class wxPGChoices;
-public:
-    // Constructor sets m_refCount to 1.
-    wxPGChoicesData();
-
-    void CopyDataFrom( wxPGChoicesData* data );
-
-    // Takes ownership of 'item'
-    void Insert( int index, wxPGChoiceEntry* item )
-    {
-        wxArrayPtrVoid::iterator it;
-        if ( index == -1 )
-        {
-            it = m_items.end();
-            index = m_items.size();
-        }
-        else
-        {
-            it = m_items.begin() + index;
-        }
-
-        // Need to fix value?
-        if ( item->GetValue() == wxPG_INVALID_VALUE )
-            item->SetValue(index);
-
-        m_items.insert(it, item);
-    }
-
-    // Delete all entries
-    void Clear();
-
-    size_t GetCount() const { return m_items.size(); }
-
-    wxPGChoiceEntry* Item( unsigned int i ) const
-    {
-        wxCHECK_MSG( i < GetCount(), NULL, "invalid index" );
-
-        return (wxPGChoiceEntry*) m_items[i];
-    }
-
-    void DecRef()
-    {
-        m_refCount--;
-        wxASSERT( m_refCount >= 0 );
-        if ( m_refCount == 0 )
-            delete this;
-    }
-
-private:
-    wxArrayPtrVoid  m_items;
-
-    // So that multiple properties can use the same set
-    int             m_refCount;
-
-    virtual ~wxPGChoicesData();
-};
-
-#define wxPGChoicesEmptyData    ((wxPGChoicesData*)NULL)
-
-#endif // SWIG
-
-
-/** @class wxPGChoices
-
-    Helper class for managing choices of wxPropertyGrid properties.
-    Each entry can have label, value, bitmap, text colour, and background
-    colour.
-
-    @library{wxpropgrid}
-    @category{propgrid}
-*/
-class WXDLLIMPEXP_PROPGRID wxPGChoices
-{
-public:
-    typedef long ValArrItem;
-
-    /** Default constructor. */
-    wxPGChoices()
-    {
-        Init();
-    }
-
-    /** Copy constructor. */
-    wxPGChoices( const wxPGChoices& a )
-    {
-        if ( a.m_data != wxPGChoicesEmptyData )
-        {
-            m_data = a.m_data;
-            m_data->m_refCount++;
-        }
-    }
-
-    /** Constructor. */
-    wxPGChoices( const wxChar** labels, const long* values = NULL )
-    {
-        Init();
-        Set(labels,values);
-    }
-
-    /** Constructor. */
-    wxPGChoices( const wxArrayString& labels,
-                 const wxArrayInt& values = wxArrayInt() )
-    {
-        Init();
-        Set(labels,values);
-    }
-
-    /** Simple interface constructor. */
-    wxPGChoices( wxPGChoicesData* data )
-    {
-        wxASSERT(data);
-        m_data = data;
-        data->m_refCount++;
-    }
-
-    /** Destructor. */
-    ~wxPGChoices()
-    {
-        Free();
-    }
-
-    /**
-        Adds to current.
-
-        If did not have own copies, creates them now. If was empty, identical
-        to set except that creates copies.
-    */
-    void Add( const wxChar** labels, const ValArrItem* values = NULL );
-
-    /** Version that works with wxArrayString. */
-    void Add( const wxArrayString& arr, const ValArrItem* values = NULL );
-
-    /** Version that works with wxArrayString and wxArrayInt. */
-    void Add( const wxArrayString& arr, const wxArrayInt& arrint );
-
-    /** Adds single item. */
-    wxPGChoiceEntry& Add( const wxString& label,
-                          int value = wxPG_INVALID_VALUE );
-
-    /** Adds a single item, with bitmap. */
-    wxPGChoiceEntry& Add( const wxString& label,
-                          const wxBitmap& bitmap,
-                          int value = wxPG_INVALID_VALUE );
-
-    /** Adds a single item with full entry information. */
-    wxPGChoiceEntry& Add( const wxPGChoiceEntry& entry )
-    {
-        return Insert(entry, -1);
-    }
-
-    /** Adds single item. */
-    wxPGChoiceEntry& AddAsSorted( const wxString& label,
-                                  int value = wxPG_INVALID_VALUE );
-
-    void Assign( const wxPGChoices& a )
-    {
-        AssignData(a.m_data);
-    }
-
-    void AssignData( wxPGChoicesData* data );
-
-    /** Delete all choices. */
-    void Clear()
-    {
-        if ( m_data != wxPGChoicesEmptyData )
-            m_data->Clear();
-    }
-
-    void EnsureData()
-    {
-        if ( m_data == wxPGChoicesEmptyData )
-            m_data = new wxPGChoicesData();
-    }
-
-    /** Gets a unsigned number identifying this list. */
-    wxPGChoicesId GetId() const { return (wxPGChoicesId) m_data; };
-
-    const wxString& GetLabel( size_t ind ) const
-    {
-        return Item(ind).GetText();
-    }
-
-    size_t GetCount () const
-    {
-        wxASSERT_MSG( m_data, "When checking if wxPGChoices is valid, "
-                              "use IsOk() instead of GetCount()" );
-        return m_data->GetCount();
-    }
-
-    int GetValue( size_t ind ) const { return Item(ind).GetValue(); }
-
-    /** Returns array of values matching the given strings. Unmatching strings
-        result in wxPG_INVALID_VALUE entry in array.
-    */
-    wxArrayInt GetValuesForStrings( const wxArrayString& strings ) const;
-
-    /** Returns array of indices matching given strings. Unmatching strings
-        are added to 'unmatched', if not NULL.
-    */
-    wxArrayInt GetIndicesForStrings( const wxArrayString& strings,
-                                     wxArrayString* unmatched = NULL ) const;
-
-    /** Returns true if choices in general are likely to have values
-        (depens on that all entries have values or none has)
-    */
-    bool HasValues() const;
-
-    bool HasValue( unsigned int i ) const
-        { return (i < m_data->GetCount()) && m_data->Item(i)->HasValue(); }
-
-    int Index( const wxString& str ) const;
-    int Index( int val ) const;
-
-    /** Inserts single item. */
-    wxPGChoiceEntry& Insert( const wxString& label,
-                             int index,
-                             int value = wxPG_INVALID_VALUE );
-
-    /** Inserts a single item with full entry information. */
-    wxPGChoiceEntry& Insert( const wxPGChoiceEntry& entry, int index );
-
-    /** Returns false if this is a constant empty set of choices,
-        which should not be modified.
-    */
-    bool IsOk() const
-    {
-        return ( m_data != wxPGChoicesEmptyData );
-    }
-
-    const wxPGChoiceEntry& Item( unsigned int i ) const
-    {
-        wxASSERT( IsOk() );
-        return *m_data->Item(i);
-    }
-
-    wxPGChoiceEntry& Item( unsigned int i )
-    {
-        wxASSERT( IsOk() );
-        return *m_data->Item(i);
-    }
-
-    /** Removes count items starting at position nIndex. */
-    void RemoveAt(size_t nIndex, size_t count = 1);
-
-#ifndef SWIG
-    /** Does not create copies for itself. */
-    void Set( const wxChar** labels, const long* values = NULL )
-    {
-        Free();
-        Add(labels,values);
-    }
-
-    /** Version that works with wxArrayString.
-        TODO: Deprecate this.
-    */
-    void Set( wxArrayString& arr, const long* values = (const long*) NULL )
-    {
-        Free();
-        Add(arr,values);
-    }
-#endif // SWIG
-
-    /** Version that works with wxArrayString and wxArrayInt. */
-    void Set( const wxArrayString& labels,
-              const wxArrayInt& values = wxArrayInt() )
-    {
-        Free();
-        if ( &values )
-            Add(labels,values);
-        else
-            Add(labels);
-    }
-
-    // Creates exclusive copy of current choices
-    void SetExclusive()
-    {
-        if ( m_data->m_refCount != 1 )
-        {
-            wxPGChoicesData* data = new wxPGChoicesData();
-            data->CopyDataFrom(m_data);
-            Free();
-            m_data = data;
-        }
-    }
-
-    // Returns data, increases refcount.
-    wxPGChoicesData* GetData()
-    {
-        wxASSERT( m_data->m_refCount != 0xFFFFFFF );
-        m_data->m_refCount++;
-        return m_data;
-    }
-
-    // Returns plain data ptr - no refcounting stuff is done.
-    wxPGChoicesData* GetDataPtr() const { return m_data; }
-
-    // Changes ownership of data to you.
-    wxPGChoicesData* ExtractData()
-    {
-        wxPGChoicesData* data = m_data;
-        m_data = wxPGChoicesEmptyData;
-        return data;
-    }
-
-    wxArrayString GetLabels() const;
-
-#ifndef SWIG
-    void operator= (const wxPGChoices& a)
-    {
-        AssignData(a.m_data);
-    }
-
-    wxPGChoiceEntry& operator[](unsigned int i)
-    {
-        return Item(i);
-    }
-
-    const wxPGChoiceEntry& operator[](unsigned int i) const
-    {
-        return Item(i);
-    }
-
-protected:
-    wxPGChoicesData*    m_data;
-
-    void Init();
-    void Free();
-#endif  // !SWIG
-};
-
-inline bool wxPGProperty::SetChoices( const wxArrayString& labels,
-                                      const wxArrayInt& values )
-{
-    wxPGChoices chs(labels, values);
-    return SetChoices(chs);
-}
-
-// -----------------------------------------------------------------------
-
 #endif // wxUSE_PROPGRID
 
 #endif // _WX_PROPGRID_PROPERTY_H_
 #endif // wxUSE_PROPGRID
 
 #endif // _WX_PROPGRID_PROPERTY_H_