X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ba9ed9d0c6148134808e8d63b9f4bf45995a5cd9..50d4763f1710f6e45ac6af7112d1ce9effe93bc4:/interface/wx/propgrid/propgridiface.h
diff --git a/interface/wx/propgrid/propgridiface.h b/interface/wx/propgrid/propgridiface.h
index cf253098b3..dba072c5e5 100644
--- a/interface/wx/propgrid/propgridiface.h
+++ b/interface/wx/propgrid/propgridiface.h
@@ -2,8 +2,8 @@
// Name: property.h
// Purpose: interface of wxPGProperty
// Author: wxWidgets team
-// RCS-ID: $Id:
-// Licence: wxWindows license
+// RCS-ID: $Id$
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------
@@ -46,6 +46,9 @@ public:
- Does not automatically redraw the control, so you may need to call
Refresh() when calling this function after control has been shown for
the first time.
+ - This functions deselects selected property, if any. Validation
+ failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
+ selection is cleared even if editor had invalid value.
*/
wxPGProperty* Append( wxPGProperty* property );
@@ -62,8 +65,8 @@ public:
/**
In order to add new items into a property with private children (for
- instance, wxFlagsProperty), you need to call this method. After
- populating has been finished, you need to call EndAddChildren().
+ instance, wxFlagsProperty), you need to call this method.
+ After populating has been finished, you need to call EndAddChildren().
@see EndAddChildren()
*/
@@ -71,15 +74,31 @@ public:
/**
Deletes all properties.
+
+ @remarks This functions deselects selected property, if any. Validation
+ failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
+ selection is cleared even if editor had invalid value.
*/
virtual void Clear() = 0;
/**
- Deselect current selection, if any.
+ Clears current selection, if any.
+
+ @param validation
+ If set to @false, deselecting the property will always work,
+ even if its editor had invalid value in it.
+
+ @return Returns @true if successful or if there was no selection. May
+ fail if validation was enabled and active editor had invalid
+ value.
- @return Returns @true if success (ie. validator did not intercept).
+ @remarks In wxPropertyGrid 1.4, this member function used to send
+ wxPG_EVT_SELECTED. In wxWidgets 2.9 and later, it no longer
+ does that.
+
+ @see wxPropertyGrid::SelectProperty()
*/
- bool ClearSelection();
+ bool ClearSelection( bool validation = false);
/**
Resets modified status of all properties.
@@ -90,14 +109,19 @@ public:
Collapses given category or property with children.
@return Returns @true if actually collapsed.
+
+ @remarks This function may deselect selected property, if any. Validation
+ failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
+ selection is cleared even if editor had invalid value.
*/
bool Collapse( wxPGPropArg id );
/**
Collapses all items that can be collapsed.
- @return Returns @false if failed (may fail if value in active
- editor cannot be validated).
+ @remarks This functions clears selection. Validation failure option
+ wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. selection
+ is cleared even if editor had invalid value.
*/
bool CollapseAll();
@@ -111,30 +135,46 @@ public:
bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
/**
- Deletes a property.
+ Removes and deletes a property and any children.
+
+ @param id
+ Pointer or name of a property.
+
+ @remarks If you delete a property in a wxPropertyGrid event
+ handler, the actual deletion is postponed until the next
+ idle event.
+
+ This functions deselects selected property, if any.
+ Validation failure option wxPG_VFB_STAY_IN_PROPERTY is not
+ respected, ie. selection is cleared even if editor had
+ invalid value.
*/
void DeleteProperty( wxPGPropArg id );
/**
Disables a property.
+
+ @see EnableProperty(), wxPGProperty::Enable()
*/
bool DisableProperty( wxPGPropArg id );
/**
- Returns true if all property grid data changes have been committed. Usually
- only returns false if value in active editor has been invalidated by a
+ Returns @true if all property grid data changes have been committed. Usually
+ only returns @false if value in active editor has been invalidated by a
wxValidator.
*/
bool EditorValidate();
/**
- Enables or disables property.
+ Enables or disables property. Disabled property usually appears as
+ having grey text.
@param id
Name or pointer to a property.
-
@param enable
If @false, property is disabled instead.
+
+ @see wxPGProperty::Enable()
*/
bool EnableProperty( wxPGPropArg id, bool enable = true );
@@ -149,18 +189,28 @@ public:
Expands given category or property with children.
@return Returns @true if actually expanded.
+
+ @remarks This function may deselect selected property, if any. Validation
+ failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
+ selection is cleared even if editor had invalid value.
*/
bool Expand( wxPGPropArg id );
/**
Expands all items that can be expanded.
+
+ @remarks This functions clears selection. Validation failure option
+ wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. selection
+ is cleared even if editor had invalid value.
*/
bool ExpandAll( bool expand = true );
/**
- Returns list of expanded properties.
+ Returns auto-resize proportion of the given column.
+
+ @see SetColumnProportion()
*/
- wxArrayPGProperty GetExpandedProperties() const;
+ int GetColumnProportion( unsigned int column ) const;
/**
Returns id of first child of given property.
@@ -170,28 +220,52 @@ public:
wxPGProperty* GetFirstChild( wxPGPropArg id );
//@{
- /** Returns iterator class instance.
+ /**
+ Returns iterator class instance.
@param flags
See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes
iteration over everything except private child properties.
-
@param firstProp
- Property to start iteration from. If NULL, then first child of root
+ Property to start iteration from. If @NULL, then first child of root
is used.
+ @beginWxPythonOnly
+ Instead of ++ operator, use Next() method, and instead of * operator,
+ use GetProperty() method. There is also GetPyIterator() method (which
+ takes the same arguments but instead returns a pythonic iterator),
+ @c Properties attribute which is an iterator over all non-category,
+ non-private properties, and finally @c Items attribute which is an
+ iterator over all items except private child properties.
+ @endWxPythonOnly
+ */
+ wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
+ wxPGProperty* firstProp = NULL );
+ wxPropertyGridConstIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
+ wxPGProperty* firstProp = NULL ) const;
+ //@}
+
+ //@{
+ /**
+ Returns iterator class instance.
+
+ @param flags
+ See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes
+ iteration over everything except private child properties.
@param startPos
Either wxTOP or wxBOTTOM. wxTOP will indicate that iterations start
from the first property from the top, and wxBOTTOM means that the
iteration will instead begin from bottommost valid item.
- wxPython Note: Instead of ++ operator, use Next() method, and
- instead of * operator, use GetProperty() method.
+ @beginWxPythonOnly
+ Instead of ++ operator, use Next() method, and instead of * operator,
+ use GetProperty() method. There is also GetPyIterator() method (which
+ takes the same arguments but instead returns a pythonic iterator),
+ @c Properties attribute which is an iterator over all non-category,
+ non-private properties, and finally @c Items attribute which is an
+ iterator over all items except private child properties.
+ @endWxPythonOnly
*/
- wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
- wxPGProperty* firstProp = NULL );
- wxPropertyGridConstIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
- wxPGProperty* firstProp = NULL ) const;
wxPropertyGridIterator GetIterator( int flags, int startPos );
wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const;
//@}
@@ -205,21 +279,26 @@ public:
wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL );
/**
- Returns id of property with given name (case-sensitive).
+ Returns pointer to a property with given name (case-sensitive).
+ If there is no property with such name, @NULL pointer is returned.
+
+ @remarks Properties which have non-category, non-root parent
+ cannot be accessed globally by their name. Instead, use
+ "." instead of "".
*/
- wxPGProperty* GetProperty( const wxString& name ) const
- {
- return GetPropertyByName(name);
- }
+ wxPGProperty* GetProperty( const wxString& name ) const;
/**
- Adds to 'targetArr' pointers to properties that have given
- flags 'flags' set. However, if 'inverse' is set to true, then
- only properties without given flags are stored.
+ Adds to 'targetArr' pointers to properties that have given flags 'flags' set.
+ However, if @a 'inverse' is set to @true, then only properties without
+ given flags are stored.
+ @param targetArr
+ @todo docme
@param flags
Property flags to use.
-
+ @param inverse
+ @todo docme
@param iterFlags
Iterator flags to use. Default is everything expect private children.
See @ref propgrid_iterator_flags.
@@ -234,9 +313,14 @@ public:
*/
wxVariant GetPropertyAttribute( wxPGPropArg id, const wxString& attrName ) const;
+ /**
+ Returns background colour of first cell of a property.
+ */
+ wxColour GetPropertyBackgroundColour( wxPGPropArg id ) const;
+
/**
Returns pointer of property's nearest parent category. If no category
- found, returns NULL.
+ found, returns @NULL.
*/
wxPropertyCategory* GetPropertyCategory( wxPGPropArg id ) const;
@@ -244,14 +328,19 @@ public:
void* GetPropertyClientData( wxPGPropArg id ) const;
/**
- Returns first property which label matches given string. NULL if none
+ Returns first property which label matches given string. @NULL if none
found. Note that this operation is very slow when compared to
GetPropertyByName().
*/
wxPGProperty* GetPropertyByLabel( const wxString& label ) const;
/**
- Returns property with given name. NULL if none found.
+ Returns pointer to a property with given name (case-sensitive).
+ If there is no property with such name, @NULL pointer is returned.
+
+ @remarks Properties which have non-category, non-root parent
+ cannot be accessed globally by their name. Instead, use
+ "." instead of "".
*/
wxPGProperty* GetPropertyByName( const wxString& name ) const;
@@ -273,7 +362,7 @@ public:
wxString GetPropertyHelpString( wxPGPropArg id ) const;
/**
- Returns property's custom value image (NULL of none).
+ Returns property's custom value image (@NULL of none).
*/
wxBitmap* GetPropertyImage( wxPGPropArg id ) const;
@@ -283,6 +372,11 @@ public:
/** Returns property's name, by which it is globally accessible. */
wxString GetPropertyName( wxPGProperty* property );
+ /**
+ Returns text colour of first cell of a property.
+ */
+ wxColour GetPropertyTextColour( wxPGPropArg id ) const;
+
/**
Returns validator of a property as a reference, which you
can pass to any number of SetPropertyValidator.
@@ -337,6 +431,10 @@ public:
Returns a wxVariant list containing wxVariant versions of all
property values. Order is not guaranteed.
+ @param listname
+ @todo docme
+ @param baseparent
+ @todo docme
@param flags
Use wxPG_KEEP_STRUCTURE to retain category structure; each sub
category will be its own wxVariantList of wxVariant.
@@ -346,9 +444,22 @@ public:
"@@@@attr."
*/
wxVariant GetPropertyValues( const wxString& listname = wxEmptyString,
- wxPGProperty* baseparent = NULL, long flags = 0 ) const;
+ wxPGProperty* baseparent = NULL, long flags = 0 ) const;
+
+ /**
+ Returns list of currently selected properties.
- /** Returns currently selected property. */
+ @remarks wxArrayPGProperty should be compatible with std::vector API.
+ */
+ const wxArrayPGProperty& GetSelectedProperties() const;
+
+ /**
+ Returns currently selected property. NULL if none.
+
+ @remarks When wxPG_EX_MULTIPLE_SELECTION extra style is used, this
+ member function returns the focused property, that is the
+ one which can have active editor.
+ */
wxPGProperty* GetSelection() const;
/**
@@ -359,17 +470,24 @@ public:
@param flags
See @ref propgrid_iterator_flags.
- wxPython Note: Instead of ++ operator, use Next() method, and
- instead of * operator, use GetProperty() method.
+ @beginWxPythonOnly
+ Instead of ++ operator, use Next() method, and instead of * operator,
+ use GetProperty() method. There is also GetPyVIterator() method (which
+ takes the same arguments but instead returns a pythonic iterator),
+ @c Properties attribute which is an iterator over all non-category,
+ non-private properties, and finally @c Items attribute which is an
+ iterator over all items except private child properties.
+ @endWxPythonOnly
*/
virtual wxPGVIterator GetVIterator( int flags ) const;
/**
Hides or reveals a property.
+ @param id
+ @todo docme
@param hide
If @true, hides property, otherwise reveals it.
-
@param flags
By default changes are applied recursively. Set this parameter
wxPG_DONT_RECURSE to prevent this.
@@ -383,29 +501,18 @@ public:
*/
static void InitAllTypeHandlers();
- //@{
- /** Inserts property to the property container.
+ /**
+ Inserts property to the property container.
@param priorThis
New property is inserted just prior to this. Available only
in the first variant. There are two versions of this function
to allow this parameter to be either an id or name to
a property.
-
@param newProperty
Pointer to the inserted property. wxPropertyGrid will take
ownership of this object.
- @param parent
- New property is inserted under this category. Available only
- in the second variant. There are two versions of this function
- to allow this parameter to be either an id or name to
- a property.
-
- @param index
- Index under category. Available only in the second variant.
- If index is < 0, property is appended in category.
-
@return Returns newProperty.
@remarks
@@ -417,6 +524,10 @@ public:
non-categoric) are active, Insert becomes even more slow. This is
especially true if current mode is non-categoric.
+ - This functions deselects selected property, if any. Validation
+ failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
+ selection is cleared even if editor had invalid value.
+
Example of use:
@code
@@ -433,11 +544,28 @@ public:
wxPGProperty* my_item_id_2 = propertygrid->Insert( my_item_id, new wxStringProperty("My String 2") );
@endcode
-
*/
wxPGProperty* Insert( wxPGPropArg priorThis, wxPGProperty* newProperty );
+
+ /**
+ Inserts property to the property container.
+ See the other overload for more details.
+
+ @param parent
+ New property is inserted under this category. Available only
+ in the second variant. There are two versions of this function
+ to allow this parameter to be either an id or name to
+ a property.
+ @param index
+ Index under category. Available only in the second variant.
+ If index is < 0, property is appended in category.
+ @param newProperty
+ Pointer to the inserted property. wxPropertyGrid will take
+ ownership of this object.
+
+ @return Returns newProperty.
+ */
wxPGProperty* Insert( wxPGPropArg parent, int index, wxPGProperty* newProperty );
- //@}
/** Returns @true if property is a category. */
bool IsPropertyCategory( wxPGPropArg id ) const;
@@ -446,7 +574,7 @@ public:
bool IsPropertyEnabled( wxPGPropArg id ) const;
/**
- Returns true if given property is expanded. Naturally, always returns
+ Returns @true if given property is expanded. Naturally, always returns
@false for properties that cannot be expanded.
*/
bool IsPropertyExpanded( wxPGPropArg id ) const;
@@ -458,13 +586,18 @@ public:
bool IsPropertyModified( wxPGPropArg id ) const;
/**
- Returns true if property is shown (ie. HideProperty() with @true not
+ Returns true if property is selected.
+ */
+ virtual bool IsPropertySelected( wxPGPropArg id ) const;
+
+ /**
+ Returns @true if property is shown (ie. HideProperty() with @true not
called for it).
*/
bool IsPropertyShown( wxPGPropArg id ) const;
/**
- Returns true if property value is set to unspecified.
+ Returns @true if property value is set to unspecified.
*/
bool IsPropertyValueUnspecified( wxPGPropArg id ) const;
@@ -482,6 +615,21 @@ public:
*/
static void RegisterAdditionalEditors();
+ /**
+ Removes a property. Does not delete the property object, but
+ instead returns it.
+
+ @param id
+ Pointer or name of a property.
+
+ @remarks Removed property cannot have any children.
+
+ Also, if you remove property in a wxPropertyGrid event
+ handler, the actual removal is postponed until the next
+ idle event.
+ */
+ wxPGProperty* RemoveProperty( wxPGPropArg id );
+
/**
Replaces property with id with newly created one. For example,
this code replaces existing property named "Flags" with one that
@@ -570,32 +718,34 @@ public:
const wxString& falseChoice );
/**
- Sets or clears flag(s) of all properties in given array.
+ Set proportion of a auto-stretchable column. wxPG_SPLITTER_AUTO_CENTER
+ window style needs to be used to indicate that columns are auto-
+ resizable.
- @param flags
- Property flags to set or clear.
+ @returns Returns @false on failure.
- @param inverse
- Set to true if you want to clear flag instead of setting them.
+ @remarks You should call this for individual pages of
+ wxPropertyGridManager (if used).
+
+ @see GetColumnProportion()
*/
- void SetPropertiesFlag( const wxArrayPGProperty& srcArr, wxPGProperty::FlagType flags,
- bool inverse = false );
+ bool SetColumnProportion( unsigned int column, int proportion );
/**
Sets an attribute for this property.
- @param name
+ @param id
+ @todo docme
+ @param attrName
Text identifier of attribute. See @ref propgrid_property_attributes.
-
@param value
Value of attribute.
-
@param argFlags
- Optional. Use wxPG_RECURSE to set the attribute to child properties
- recursively.
+ Optional.
+ Use wxPG_RECURSE to set the attribute to child properties recursively.
@remarks Setting attribute's value to Null variant will simply remove it
- from property's set of attributes.
+ from property's set of attributes.
*/
void SetPropertyAttribute( wxPGPropArg id, const wxString& attrName,
wxVariant value, long argFlags = 0 );
@@ -607,6 +757,24 @@ public:
*/
void SetPropertyAttributeAll( const wxString& attrName, wxVariant value );
+ /**
+ Sets background colour of a property.
+
+ @param id
+ Property name or pointer.
+
+ @param colour
+ New background colour.
+
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
+ */
+ void SetPropertyBackgroundColour( wxPGPropArg id,
+ const wxColour& colour,
+ int flags = wxPG_RECURSE );
+
/**
Sets text, bitmap, and colours for given column's cell.
@@ -629,9 +797,16 @@ public:
*/
void SetPropertyClientData( wxPGPropArg id, void* clientData );
+ /**
+ Resets text and background colours of given property.
+ */
+ void SetPropertyColoursToDefault( wxPGPropArg id );
+
/**
Sets editor for a property.
+ @param id
+ @todo docme
@param editor
For builtin editors, use wxPGEditor_X, where X is builtin editor's
name (TextCtrl, Choice, etc. see wxPGEditor documentation for full
@@ -672,9 +847,6 @@ public:
In other words, user cannot change the value in the editor, but they can
still copy it.
- @remarks This is mainly for use with textctrl editor. Only some other
- editors fully support it.
-
@param id
Property name or pointer.
@@ -684,6 +856,9 @@ public:
@param flags
By default changes are applied recursively. Set this parameter
wxPG_DONT_RECURSE to prevent this.
+
+ @remarks This is mainly for use with textctrl editor. Only some other
+ editors fully support it.
*/
void SetPropertyReadOnly( wxPGPropArg id, bool set = true,
int flags = wxPG_RECURSE );
@@ -695,13 +870,14 @@ public:
void SetPropertyValueUnspecified( wxPGPropArg id );
/**
- Sets various property values from a list of wxVariants. If property with
- name is missing from the grid, new property is created under given
- default category (or root if omitted).
+ Sets property values from a list of wxVariants.
*/
void SetPropertyValues( const wxVariantList& list,
wxPGPropArg defaultCategory = wxNullProperty );
+ /**
+ Sets property values from a list of wxVariants.
+ */
void SetPropertyValues( const wxVariant& list,
wxPGPropArg defaultCategory = wxNullProperty );
@@ -728,6 +904,25 @@ public:
*/
bool SetPropertyMaxLength( wxPGPropArg id, int maxLen );
+
+ /**
+ Sets text colour of a property.
+
+ @param id
+ Property name or pointer.
+
+ @param colour
+ New background colour.
+
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
+ */
+ void SetPropertyTextColour( wxPGPropArg id,
+ const wxColour& colour,
+ int flags = wxPG_RECURSE );
+
/**
Sets validator of a property.
*/
@@ -796,6 +991,33 @@ public:
*/
void SetValidationFailureBehavior( int vfbFlags );
+ /**
+ Sorts all properties recursively.
+
+ @param flags
+ This can contain any of the following options:
+ wxPG_SORT_TOP_LEVEL_ONLY: Only sort categories and their
+ immediate children. Sorting done by wxPG_AUTO_SORT option
+ uses this.
+
+ @see SortChildren, wxPropertyGrid::SetSortFunction
+ */
+ void Sort( int flags = 0 );
+
+ /**
+ Sorts children of a property.
+
+ @param id
+ Name or pointer to a property.
+
+ @param flags
+ This can contain any of the following options:
+ wxPG_RECURSE: Sorts recursively.
+
+ @see Sort, wxPropertyGrid::SetSortFunction
+ */
+ void SortChildren( wxPGPropArg id, int flags = 0 );
+
/**
Returns editor pointer of editor with given name;
*/