Version: 2.9.4
Public Member Functions | Protected Member Functions
wxPropertyGridManager Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/propgrid/manager.h>

Inheritance diagram for wxPropertyGridManager:

Detailed Description

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.

Library:  wxPropertyGrid
Category:  wxPropertyGrid

Public Member Functions

wxPropertyGridPageAddPage (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.
wxPropertyGridGetGrid ()
 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.
wxPropertyGridPageGetCurrentPage () const
 Returns currently selected page.
wxPropertyGridPageGetPage (unsigned int ind) const
 Returns page object for given page index.
wxPropertyGridPageGetPage (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 wxStringGetPageName (int index) const
 Returns name of given page.
wxPGPropertyGetPageRoot (int index) const
 Returns "root property" of the given page.
int GetSelectedPage () const
 Returns index to currently selected page.
wxPGPropertyGetSelectedProperty () const
 Alias for GetSelection().
wxPGPropertyGetSelection () const
 Shortcut for GetGrid()->GetSelection().
wxToolBarGetToolBar () const
 Returns a pointer to the toolbar currently associated with the wxPropertyGridManager (if any).
virtual wxPropertyGridPageInsertPage (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 wxPropertyGridCreatePropertyGrid () const
 Creates property grid for the manager.

List of all members.


Member Function Documentation

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.

Parameters:
labelA label for the page. This may be shown as a toolbar tooltip etc.
bmpBitmap image for toolbar. If wxNullBitmap is used, then a built-in default image is used.
pageObjwxPropertyGridPage instance. Manager will take ownership of this object. NULL indicates that a default page instance should be created.
Returns:
Returns pointer to created property grid page.
注意:
If toolbar is used, it is highly recommended that the pages are added when the toolbar is not turned off using window style flag switching. Otherwise toolbar buttons might not be added properly.
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.

Returns:
Returns true if value was actually updated.
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.

参照:
wxPropertyGrid Window Styles

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.

注意:
Calling his may not properly update toolbar buttons.
bool wxPropertyGridManager::EnsureVisible ( wxPGPropArg  id)

Selects page, scrolls and/or expands items to ensure that the given item is visible.

Returns:
Returns true if something was actually done.
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.

Parameters:
indexAdd to this position. -1 will add as the last item.
labelA label for the page. This may be shown as a toolbar tooltip etc.
bmpBitmap image for toolbar. If wxNullBitmap is used, then a built-in default image is used.
pageObjwxPropertyGridPage instance. Manager will take ownership of this object. If NULL, default page object is constructed.
Returns:
Returns pointer to created page.
bool wxPropertyGridManager::IsAnyModified ( ) const

Returns true if any property on any page has been modified by the user.

bool wxPropertyGridManager::IsFrozen ( ) const

Returns true if updating is frozen (ie.

Freeze() called but not yet Thaw() ).

Reimplemented from wxWindow.

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.

Returns:
Returns false if it was not possible to remove page in question.
void wxPropertyGridManager::SelectPage ( wxPropertyGridPage page)

Select and displays a given page.

void wxPropertyGridManager::SelectPage ( int  index)

Select and displays a given page.

Parameters:
indexIndex 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 
)
void wxPropertyGridManager::SetColumnCount ( int  colCount,
int  page = -1 
)

Sets number of columns on given page (default is current page).

注意:
If you use header, then you should always use this member function to set the column count, instead of ones present in wxPropertyGrid or wxPropertyGridPage.
void wxPropertyGridManager::SetColumnTitle ( int  idx,
const wxString title 
)

Sets a column title.

Default title for column 0 is "Property", and "Value" for column 1.

注意:
If header is not shown yet, then calling this member function will make it visible.
void wxPropertyGridManager::SetDescBoxHeight ( int  ht,
bool  refresh = true 
)

Sets y coordinate of the description box splitter.

void wxPropertyGridManager::SetDescription ( const wxString label,
const wxString content 
)

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.

注意:
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::SetSplitterLeft ( bool  subProps = false,
bool  allPages = true 
)

Moves splitter as left as possible, while still allowing all labels to be shown in full.

Parameters:
subPropsIf false, will still allow sub-properties (ie. properties which parent is not root or category) to be cropped.
allPagesIf true, takes labels on all pages into account.
void wxPropertyGridManager::SetSplitterPosition ( int  pos,
int  column = 0 
)

Sets splitter position for all pages.

注意:
Splitter position cannot exceed grid size, and therefore setting it during form creation may fail as initial grid size is often smaller than desired splitter position, especially when sizers are being used.

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.

注意:
Grid may look better if you use wxPG_NO_INTERNAL_BORDER window style when showing a header.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines