Added multiple selection feature to wxPropertyGrid (enabled by setting wxPG_EX_MULTIPLE_SELECTION style)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2009-08-17 18:36:00 +00:00
parent 17a5460272
commit fc72fab6c6
15 changed files with 663 additions and 197 deletions

View File

@@ -388,6 +388,12 @@ public:
*/
bool IsPageModified( size_t index ) const;
/**
Returns true if property is selected. Since selection is page
based, this function checks every page in the manager.
*/
virtual bool IsPropertySelected( wxPGPropArg id ) const;
/**
Removes a page.

View File

@@ -152,7 +152,20 @@ wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000,
/**
Hides page selection buttons from tool bar.
*/
wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000
wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000,
/** Allows multiple properties to be selected by user (by pressing SHIFT
when clicking on a property, or by dragging with left mouse button
down).
You can get array of selected properties with
wxPropertyGridInterface::GetSelectedProperties(). In multiple selection
mode wxPropertyGridInterface::GetSelection() returns
property which has editor active (usually the first one
selected). Other useful member functions are ClearSelection(),
AddToSelection() and RemoveFromSelection().
*/
wxPG_EX_MULTIPLE_SELECTION = 0x02000000
};
@@ -394,6 +407,20 @@ public:
*/
void AddActionTrigger( int action, int keycode, int modifiers = 0 );
/**
Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION
extra style is not used, then this has same effect as
calling SelectProperty().
@remarks Multiple selection is not supported for categories. This
means that if you have properties selected, you cannot
add category to selection, and also if you have category
selected, you cannot add other properties to selection.
This member function will fail silently in these cases,
even returning true.
*/
bool AddToSelection( wxPGPropArg id );
/**
This static function enables or disables automatic use of
wxGetTranslation() for following strings: wxEnumProperty list labels,
@@ -708,6 +735,12 @@ public:
*/
void ResetColours();
/**
Removes given property from selection. If property is not selected,
an assertion failure will occur.
*/
bool RemoveFromSelection( wxPGPropArg id );
/**
Selects a property. Editor widget is automatically created, but
not focused unless focus is true.
@@ -725,6 +758,8 @@ public:
wxEVT_PG_SELECTED. In wxWidgets 2.9 and later, it no longer
does that.
@remarks This clears any previous selection.
@see wxPropertyGridInterface::ClearSelection()
*/
bool SelectProperty( wxPGPropArg id, bool focus = false );
@@ -790,6 +825,11 @@ public:
*/
void SetMarginColour(const wxColour& col);
/**
Set entire new selection from given list of properties.
*/
void SetSelection( const wxArrayPGProperty& newSelection );
/**
Sets selection background colour - applies to selected property name
background.

View File

@@ -418,7 +418,20 @@ public:
wxVariant GetPropertyValues( const wxString& listname = wxEmptyString,
wxPGProperty* baseparent = NULL, long flags = 0 ) const;
/** Returns currently selected property. */
/**
Returns list of currently selected properties.
@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;
/**
@@ -538,6 +551,11 @@ public:
*/
bool IsPropertyModified( wxPGPropArg id ) const;
/**
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).