#include </home/zeitlin/src/wx/github/interface/wx/propgrid/manager.h>
wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid, which can optionally have toolbar for mode and page selection, a help text box, and a header.
wxPropertyGridManager inherits from wxPropertyGridInterface, and as such it has most property manipulation functions. However, only some of them affect properties on all pages (eg. GetPropertyByName() and ExpandAll()), while some (eg. Append()) only apply to the currently selected page.
To operate explicitly on properties on specific page, use wxPropertyGridManager::GetPage() to obtain pointer to page's wxPropertyGridPage object.
Visual methods, such as SetCellBackgroundColour() are only available in wxPropertyGrid. Use wxPropertyGridManager::GetGrid() to obtain pointer to it.
Non-virtual iterators will not work in wxPropertyGridManager. Instead, you must acquire the internal grid (GetGrid()) or wxPropertyGridPage object (GetPage()).
wxPropertyGridManager constructor has exact same format as wxPropertyGrid constructor, and basically accepts same extra window style flags (albeit also has some extra ones).
Here's some example code for creating and populating a wxPropertyGridManager:
wxPropertyGridManager* pgMan = new wxPropertyGridManager(this, PGID, wxDefaultPosition, wxDefaultSize, // These and other similar styles are automatically // passed to the embedded wxPropertyGrid. wxPG_BOLD_MODIFIED|wxPG_SPLITTER_AUTO_CENTER| // Include toolbar. wxPG_TOOLBAR | // Include description box. wxPG_DESCRIPTION | // Include compactor. wxPG_COMPACTOR | // Plus defaults. wxPGMAN_DEFAULT_STYLE ); wxPropertyGridPage* page; page = pgMan->AddPage("First Page"); page->Append( new wxPropertyCategory("Category A1") ); page->Append( new wxIntProperty("Number",wxPG_LABEL,1) ); page->Append( new wxColourProperty("Colour",wxPG_LABEL,*wxWHITE) ); page = pgMan->AddPage("Second Page"); page->Append( "Text",wxPG_LABEL,"(no text)" ); page->Append( new wxFontProperty("Font",wxPG_LABEL) ); // Display a header above the grid pgMan->ShowHeader();
See wxPropertyGrid Window Styles.
See wxPropertyGrid Event Handling for more information.
Public Member Functions | |
wxPropertyGridPage * | AddPage (const wxString &label=wxEmptyString, const wxBitmap &bmp=wxPG_NULL_BITMAP, wxPropertyGridPage *pageObj=NULL) |
Creates new property page. | |
virtual void | Clear () |
Deletes all properties and all pages. | |
void | ClearPage (int page) |
Deletes all properties on given page. | |
bool | CommitChangesFromEditor (wxUint32 flags=0) |
Forces updating the value of property from the editor control. | |
bool | Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxPGMAN_DEFAULT_STYLE, const wxString &name=wxPropertyGridManagerNameStr) |
Two step creation. | |
bool | EnableCategories (bool enable) |
Enables or disables (shows/hides) categories according to parameter enable. | |
bool | EnsureVisible (wxPGPropArg id) |
Selects page, scrolls and/or expands items to ensure that the given item is visible. | |
int | GetColumnCount (int page=-1) const |
Returns number of columns on given page. | |
int | GetDescBoxHeight () const |
Returns height of the description text box. | |
wxPropertyGrid * | GetGrid () |
Returns pointer to the contained wxPropertyGrid. | |
virtual wxPGVIterator | GetVIterator (int flags) const |
Similar to GetIterator, but instead returns wxPGVIterator instance, which can be useful for forward-iterating through arbitrary property containers. | |
wxPropertyGridPage * | GetCurrentPage () const |
Returns currently selected page. | |
wxPropertyGridPage * | GetPage (unsigned int ind) const |
Returns page object for given page index. | |
wxPropertyGridPage * | GetPage (const wxString &name) const |
Returns page object for given page name. | |
int | GetPageByName (const wxString &name) const |
Returns index for a page name. | |
size_t | GetPageCount () const |
Returns number of managed pages. | |
const wxString & | GetPageName (int index) const |
Returns name of given page. | |
wxPGProperty * | GetPageRoot (int index) const |
Returns "root property" of the given page. | |
int | GetSelectedPage () const |
Returns index to currently selected page. | |
wxPGProperty * | GetSelectedProperty () const |
Alias for GetSelection(). | |
wxPGProperty * | GetSelection () const |
Shortcut for GetGrid()->GetSelection(). | |
wxToolBar * | GetToolBar () const |
Returns a pointer to the toolbar currently associated with the wxPropertyGridManager (if any). | |
virtual wxPropertyGridPage * | InsertPage (int index, const wxString &label, const wxBitmap &bmp=wxNullBitmap, wxPropertyGridPage *pageObj=NULL) |
Creates new property page. | |
bool | IsAnyModified () const |
Returns true if any property on any page has been modified by the user. | |
bool | IsFrozen () const |
Returns true if updating is frozen (ie. | |
bool | IsPageModified (size_t index) const |
Returns true if any property on given page has been modified by the user. | |
virtual bool | IsPropertySelected (wxPGPropArg id) const |
Returns true if property is selected. | |
virtual bool | RemovePage (int page) |
Removes a page. | |
void | SelectPage (int index) |
Select and displays a given page. | |
void | SelectPage (const wxString &label) |
Select and displays a given page (by label). | |
void | SelectPage (wxPropertyGridPage *page) |
Select and displays a given page. | |
bool | SelectProperty (wxPGPropArg id, bool focus=false) |
Select a property. | |
void | SetColumnCount (int colCount, int page=-1) |
Sets number of columns on given page (default is current page). | |
void | SetColumnTitle (int idx, const wxString &title) |
Sets a column title. | |
void | SetDescription (const wxString &label, const wxString &content) |
Sets label and text in description box. | |
void | SetDescBoxHeight (int ht, bool refresh=true) |
Sets y coordinate of the description box splitter. | |
void | SetSplitterLeft (bool subProps=false, bool allPages=true) |
Moves splitter as left as possible, while still allowing all labels to be shown in full. | |
void | SetPageSplitterLeft (int page, bool subProps=false) |
Moves splitter as left as possible on an individual page, while still allowing all labels to be shown in full. | |
void | SetPageSplitterPosition (int page, int pos, int column=0) |
Sets splitter position on individual page. | |
void | SetSplitterPosition (int pos, int column=0) |
Sets splitter position for all pages. | |
void | ShowHeader (bool show=true) |
Show or hide the property grid header control. | |
Protected Member Functions | |
virtual wxPropertyGrid * | CreatePropertyGrid () const |
Creates property grid for the manager. |
wxPropertyGridPage* wxPropertyGridManager::AddPage | ( | const wxString & | label = wxEmptyString , |
const wxBitmap & | bmp = wxPG_NULL_BITMAP , |
||
wxPropertyGridPage * | pageObj = NULL |
||
) |
Creates new property page.
Note that the first page is not created automatically.
label | A label for the page. This may be shown as a toolbar tooltip etc. |
bmp | Bitmap image for toolbar. If wxNullBitmap is used, then a built-in default image is used. |
pageObj | wxPropertyGridPage instance. Manager will take ownership of this object. NULL indicates that a default page instance should be created. |
virtual void wxPropertyGridManager::Clear | ( | ) | [virtual] |
Deletes all properties and all pages.
Implements wxPropertyGridInterface.
void wxPropertyGridManager::ClearPage | ( | int | page | ) |
Deletes all properties on given page.
bool wxPropertyGridManager::CommitChangesFromEditor | ( | wxUint32 | flags = 0 | ) |
Forces updating the value of property from the editor control.
bool wxPropertyGridManager::Create | ( | wxWindow * | parent, |
wxWindowID | id = wxID_ANY , |
||
const wxPoint & | pos = wxDefaultPosition , |
||
const wxSize & | size = wxDefaultSize , |
||
long | style = wxPGMAN_DEFAULT_STYLE , |
||
const wxString & | name = wxPropertyGridManagerNameStr |
||
) |
Two step creation.
Whenever the control is created without any parameters, use Create to actually create it. Don't access the control's public methods before this is called.
Reimplemented from wxPanel.
virtual wxPropertyGrid* wxPropertyGridManager::CreatePropertyGrid | ( | ) | const [protected, virtual] |
Creates property grid for the manager.
Reimplement in derived class to use subclassed wxPropertyGrid. However, if you do this then you must also use the two-step construction (ie. default constructor and Create() instead of constructor with arguments) when creating the manager.
bool wxPropertyGridManager::EnableCategories | ( | bool | enable | ) |
Enables or disables (shows/hides) categories according to parameter enable.
bool wxPropertyGridManager::EnsureVisible | ( | wxPGPropArg | id | ) |
Selects page, scrolls and/or expands items to ensure that the given item is visible.
int wxPropertyGridManager::GetColumnCount | ( | int | page = -1 | ) | const |
Returns number of columns on given page.
By the default, returns number of columns on current page.
wxPropertyGridPage* wxPropertyGridManager::GetCurrentPage | ( | ) | const |
Returns currently selected page.
int wxPropertyGridManager::GetDescBoxHeight | ( | ) | const |
Returns height of the description text box.
wxPropertyGrid* wxPropertyGridManager::GetGrid | ( | ) |
Returns pointer to the contained wxPropertyGrid.
This does not change after wxPropertyGridManager has been created, so you can safely obtain pointer once and use it for the entire lifetime of the manager instance.
wxPropertyGridPage* wxPropertyGridManager::GetPage | ( | unsigned int | ind | ) | const |
Returns page object for given page index.
wxPropertyGridPage* wxPropertyGridManager::GetPage | ( | const wxString & | name | ) | const |
Returns page object for given page name.
int wxPropertyGridManager::GetPageByName | ( | const wxString & | name | ) | const |
Returns index for a page name.
If no match is found, wxNOT_FOUND is returned.
size_t wxPropertyGridManager::GetPageCount | ( | ) | const |
Returns number of managed pages.
const wxString& wxPropertyGridManager::GetPageName | ( | int | index | ) | const |
Returns name of given page.
wxPGProperty* wxPropertyGridManager::GetPageRoot | ( | int | index | ) | const |
Returns "root property" of the given page.
It does not have name, etc. and it is not visible. It is only useful for accessing its children.
int wxPropertyGridManager::GetSelectedPage | ( | ) | const |
Returns index to currently selected page.
wxPGProperty* wxPropertyGridManager::GetSelectedProperty | ( | ) | const |
Alias for GetSelection().
wxPGProperty* wxPropertyGridManager::GetSelection | ( | ) | const |
Shortcut for GetGrid()->GetSelection().
Reimplemented from wxPropertyGridInterface.
wxToolBar* wxPropertyGridManager::GetToolBar | ( | ) | const |
Returns a pointer to the toolbar currently associated with the wxPropertyGridManager (if any).
virtual wxPGVIterator wxPropertyGridManager::GetVIterator | ( | int | flags | ) | const [virtual] |
Similar to GetIterator, but instead returns wxPGVIterator instance, which can be useful for forward-iterating through arbitrary property containers.
Reimplemented from wxPropertyGridInterface.
virtual wxPropertyGridPage* wxPropertyGridManager::InsertPage | ( | int | index, |
const wxString & | label, | ||
const wxBitmap & | bmp = wxNullBitmap , |
||
wxPropertyGridPage * | pageObj = NULL |
||
) | [virtual] |
Creates new property page.
Note that the first page is not created automatically.
index | Add to this position. -1 will add as the last item. |
label | A label for the page. This may be shown as a toolbar tooltip etc. |
bmp | Bitmap image for toolbar. If wxNullBitmap is used, then a built-in default image is used. |
pageObj | wxPropertyGridPage instance. Manager will take ownership of this object. If NULL, default page object is constructed. |
bool wxPropertyGridManager::IsAnyModified | ( | ) | const |
Returns true if any property on any page has been modified by the user.
bool wxPropertyGridManager::IsFrozen | ( | ) | const |
bool wxPropertyGridManager::IsPageModified | ( | size_t | index | ) | const |
Returns true if any property on given page has been modified by the user.
virtual bool wxPropertyGridManager::IsPropertySelected | ( | wxPGPropArg | id | ) | const [virtual] |
Returns true if property is selected.
Since selection is page based, this function checks every page in the manager.
Reimplemented from wxPropertyGridInterface.
virtual bool wxPropertyGridManager::RemovePage | ( | int | page | ) | [virtual] |
Removes a page.
void wxPropertyGridManager::SelectPage | ( | wxPropertyGridPage * | page | ) |
Select and displays a given page.
void wxPropertyGridManager::SelectPage | ( | int | index | ) |
Select and displays a given page.
index | Index of page being seleced. Can be -1 to select nothing. |
void wxPropertyGridManager::SelectPage | ( | const wxString & | label | ) |
Select and displays a given page (by label).
bool wxPropertyGridManager::SelectProperty | ( | wxPGPropArg | id, |
bool | focus = false |
||
) |
Select a property.
void wxPropertyGridManager::SetColumnCount | ( | int | colCount, |
int | page = -1 |
||
) |
Sets number of columns on given page (default is current page).
void wxPropertyGridManager::SetColumnTitle | ( | int | idx, |
const wxString & | title | ||
) |
Sets a column title.
Default title for column 0 is "Property", and "Value" for column 1.
void wxPropertyGridManager::SetDescBoxHeight | ( | int | ht, |
bool | refresh = true |
||
) |
Sets y coordinate of the description box splitter.
Sets label and text in description box.
void wxPropertyGridManager::SetPageSplitterLeft | ( | int | page, |
bool | subProps = false |
||
) |
Moves splitter as left as possible on an individual page, while still allowing all labels to be shown in full.
void wxPropertyGridManager::SetPageSplitterPosition | ( | int | page, |
int | pos, | ||
int | column = 0 |
||
) |
Sets splitter position on individual page.
void wxPropertyGridManager::SetSplitterLeft | ( | bool | subProps = false , |
bool | allPages = true |
||
) |
Moves splitter as left as possible, while still allowing all labels to be shown in full.
subProps | If false, will still allow sub-properties (ie. properties which parent is not root or category) to be cropped. |
allPages | If true, takes labels on all pages into account. |
void wxPropertyGridManager::SetSplitterPosition | ( | int | pos, |
int | column = 0 |
||
) |
Sets splitter position for all pages.
If you use header, then you should always use this member function to set the splitter position, instead of ones present in wxPropertyGrid or wxPropertyGridPage.
void wxPropertyGridManager::ShowHeader | ( | bool | show = true | ) |
Show or hide the property grid header control.
It is hidden by the default.