// Name: manager.h
// Purpose: interface of wxPropertyGridManager
// Author: wxWidgets team
-// RCS-ID: $Id:
-// Licence: wxWindows license
+// RCS-ID: $Id$
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-/** @class wxPropertyGridPage
+/**
+ @class wxPropertyGridPage
Holder of property grid page information. You can subclass this and
give instance in wxPropertyGridManager::AddPage. It inherits from
wxEvtHandler and can be used to process events specific to this
page (id of events will still be same as manager's). If you don't
want to use it to process all events of the page, you need to
- return false in the derived wxPropertyGridPage::IsHandlingAllEvents.
+ return @false in the derived wxPropertyGridPage::IsHandlingAllEvents.
Please note that wxPropertyGridPage lacks many non-const property
- manipulation functions found in wxPropertyGridManager. Please use
- parent manager (m_manager member variable) when needed.
+ manipulation functions found in wxPropertyGridManager.
+ Please use parent manager (m_manager member variable) when needed.
Please note that most member functions are inherited and as such not
documented on this page. This means you will probably also want to read
public wxPropertyGridInterface
{
friend class wxPropertyGridManager;
-public:
+public:
wxPropertyGridPage();
virtual ~wxPropertyGridPage();
Returns id of the tool bar item that represents this page on
wxPropertyGridManager's wxToolBar.
*/
- int GetToolId() const
- {
- return m_id;
- }
+ int GetToolId() const;
/**
Do any member initialization in this method.
@remarks - Called every time the page is added into a manager.
- You can add properties to the page here.
*/
- virtual void Init() {}
+ virtual void Init();
/**
Return false here to indicate unhandled events should be
propagated to manager's parent, as normal.
*/
- virtual bool IsHandlingAllEvents() const { return true; }
+ virtual bool IsHandlingAllEvents() const;
/**
Called every time page is about to be shown.
*/
virtual void RefreshProperty( wxPGProperty* p );
- /** Sets splitter position on page.
+ /**
+ Sets splitter position on page.
+
@remarks
Splitter position cannot exceed grid size, and therefore setting it
during form creation may fail as initial grid size is often smaller than
void SetSplitterPosition( int splitterPos, int col = 0 );
};
-// -----------------------------------------------------------------------
-/** @class wxPropertyGridManager
+/**
+ @class wxPropertyGridManager
wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid,
- which can optionally have toolbar for mode and page selection, and a help text
- box.
+ 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
Here's some example code for creating and populating a wxPropertyGridManager:
@code
-
wxPropertyGridManager* pgMan = new wxPropertyGridManager(this, PGID,
wxDefaultPosition, wxDefaultSize,
// These and other similar styles are automatically
wxPropertyGridPage* page;
- pgMan->AddPage(wxT("First Page"));
- page = pgMan->GetLastPage();
+ page = pgMan->AddPage("First Page");
- page->Append( new wxPropertyCategory(wxT("Category A1")) );
+ page->Append( new wxPropertyCategory("Category A1") );
- page->Append( new wxIntProperty(wxT("Number"),wxPG_LABEL,1) );
+ page->Append( new wxIntProperty("Number",wxPG_LABEL,1) );
- page->Append( new wxColourProperty(wxT("Colour"),wxPG_LABEL,*wxWHITE) );
+ page->Append( new wxColourProperty("Colour",wxPG_LABEL,*wxWHITE) );
- pgMan->AddPage(wxT("Second Page"));
- page = pgMan->GetLastPage();
+ page = pgMan->AddPage("Second Page");
- page->Append( wxT("Text"),wxPG_LABEL,wxT("(no text)") );
+ page->Append( "Text",wxPG_LABEL,"(no text)" );
- page->Append( new wxFontProperty(wxT("Font"),wxPG_LABEL) );
+ page->Append( new wxFontProperty("Font",wxPG_LABEL) );
+ // Display a header above the grid
+ pgMan->ShowHeader();
@endcode
-
@section propgridmanager_window_styles_ Window Styles
See @ref propgrid_window_styles.
wxPropertyGridPage instance. Manager will take ownership of this
object. NULL indicates that a default page instance should be created.
- @return Returns index to the page created.
+ @return Returns pointer to created property grid page.
@remarks 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.
*/
- int AddPage( const wxString& label = wxEmptyString,
- const wxBitmap& bmp = wxPG_NULL_BITMAP,
- wxPropertyGridPage* pageObj = (wxPropertyGridPage*) NULL )
- {
- return InsertPage(-1,label,bmp,pageObj);
- }
-
- void ClearModifiedStatus( wxPGPropArg id );
-
- void ClearModifiedStatus()
- {
- m_pPropGrid->ClearModifiedStatus();
- }
+ wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
+ const wxBitmap& bmp = wxPG_NULL_BITMAP,
+ wxPropertyGridPage* pageObj = NULL );
/**
Deletes all properties and all pages.
@return Returns @true if value was actually updated.
*/
- bool CommitChangesFromEditor( wxUint32 flags = 0 )
- {
- return m_pPropGrid->CommitChangesFromEditor(flags);
- }
+ bool CommitChangesFromEditor( wxUint32 flags = 0 );
/**
Two step creation. Whenever the control is created without any parameters,
@remarks
Calling his may not properly update toolbar buttons.
*/
- bool EnableCategories( bool enable )
- {
- long fl = m_windowStyle | wxPG_HIDE_CATEGORIES;
- if ( enable ) fl = m_windowStyle & ~(wxPG_HIDE_CATEGORIES);
- SetWindowStyleFlag(fl);
- return true;
- }
+ bool EnableCategories( bool enable );
/**
Selects page, scrolls and/or expands items to ensure that the
*/
bool EnsureVisible( wxPGPropArg id );
- /**
- Returns number of children of the root property of the selected page.
- */
- size_t GetChildrenCount()
- {
- return GetChildrenCount( m_pPropGrid->m_pState->m_properties );
- }
-
- /**
- Returns number of children of the root property of given page.
- */
- size_t GetChildrenCount( int pageIndex );
-
- /**
- Returns number of children for the property.
-
- NB: Cannot be in container methods class due to name hiding.
- */
- size_t GetChildrenCount( wxPGPropArg id ) const
- {
- wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
- return p->GetChildCount();
- }
-
/**
Returns number of columns on given page. By the default,
returns number of columns on current page.
*/
wxPropertyGridPage* GetCurrentPage() const;
- /**
- Returns last page.
- */
- wxPropertyGridPage* GetLastPage() const
- {
- return GetPage(m_arrPages.size()-1);
- }
-
/**
Returns page object for given page index.
*/
- wxPropertyGridPage* GetPage( unsigned int ind ) const
- {
- return (wxPropertyGridPage*)m_arrPages.Item(ind);
- }
+ wxPropertyGridPage* GetPage( unsigned int ind ) const;
/**
Returns page object for given page name.
*/
- wxPropertyGridPage* GetPage( const wxString& name ) const
- {
- return GetPage(GetPageByName(name));
- }
+ wxPropertyGridPage* GetPage( const wxString& name ) const;
/**
Returns index for a page name. If no match is found, wxNOT_FOUND is
*/
size_t GetPageCount() const;
- /** Returns name of given page. */
+ /**
+ Returns name of given page.
+ */
const wxString& GetPageName( int index ) const;
/**
wxPGProperty* GetPageRoot( int index ) const;
/** Returns index to currently selected page. */
- int GetSelectedPage() const { return m_selPage; }
+ int GetSelectedPage() const;
/** Shortcut for GetGrid()->GetSelection(). */
- wxPGProperty* GetSelectedProperty() const
- {
- return m_pPropGrid->GetSelection();
- }
+ wxPGProperty* GetSelectedProperty() const;
/** Synonyme for GetSelectedPage. */
- int GetSelection() const { return m_selPage; }
+ int GetSelection() const;
/**
Returns a pointer to the toolbar currently associated with the
wxPropertyGridManager (if any).
*/
- wxToolBar* GetToolBar() const { return m_pToolbar; }
+ wxToolBar* GetToolBar() const;
- /** Creates new property page. Note that the first page is not created
+ /**
+ Creates new property page. Note that the first page is not created
automatically.
@param index
wxPropertyGridPage instance. Manager will take ownership of this
object. If NULL, default page object is constructed.
- @return Returns index to the page created.
+ @return Returns pointer to created page.
*/
- virtual int InsertPage( int index, const wxString& label,
- const wxBitmap& bmp = wxNullBitmap,
- wxPropertyGridPage* pageObj = NULL );
+ virtual wxPropertyGridPage* InsertPage( int index, const wxString& label,
+ const wxBitmap& bmp = wxNullBitmap,
+ wxPropertyGridPage* pageObj = NULL );
/**
Returns @true if any property on any page has been modified by the user.
bool IsAnyModified() const;
/**
- Returns @true if updating is frozen (ie. Freeze() called but not yet
- Thaw() ).
+ Returns @true if updating is frozen (ie. Freeze() called but not yet Thaw() ).
*/
bool IsFrozen() const;
*/
bool IsPageModified( size_t index ) const;
- /** Removes a page.
+ /**
+ 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.
@return Returns @false if it was not possible to remove page in question.
*/
virtual bool RemovePage( int page );
- /** Select and displays a given page.
+ /**
+ Select and displays a given page.
@param index
Index of page being seleced. Can be -1 to select nothing.
/** Select and displays a given page. */
void SelectPage( wxPropertyGridPage* page );
- /** Select a property. */
+ /**
+ Select a property.
+
+ @see wxPropertyGrid::SelectProperty(),
+ wxPropertyGridInterface::ClearSelection()
+ */
bool SelectProperty( wxPGPropArg id, bool focus = false );
/**
Sets number of columns on given page (default is current page).
+
+ @remarks 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 SetColumnCount( int colCount, int page = -1 );
- /** Sets label and text in description box.
+ /**
+ Sets a column title. Default title for column 0 is "Property",
+ and "Value" for column 1.
+
+ @remarks If header is not shown yet, then calling this
+ member function will make it visible.
+ */
+ void SetColumnTitle( int idx, const wxString& title );
+
+ /**
+ Sets label and text in description box.
*/
void SetDescription( const wxString& label, const wxString& content );
/** Sets y coordinate of the description box splitter. */
void SetDescBoxHeight( int ht, bool refresh = true );
- /** Moves splitter as left as possible, while still allowing all
+ /**
+ Moves splitter as left as possible, while still allowing all
labels to be shown in full.
@param subProps
*/
void SetSplitterLeft( bool subProps = false, bool allPages = true );
- /** Sets splitter position on individual page. */
- void SetPageSplitterPosition( int page, int pos, int column = 0 )
- {
- GetPage(page)->DoSetSplitterPosition( pos, column );
- }
+ /**
+ Sets splitter position on individual page.
+
+ @remarks 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 SetPageSplitterPosition( int page, int pos, int column = 0 );
/**
Sets splitter position for all pages.
- @remarks 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.
+ @remarks 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 SetSplitterPosition( int pos, int column = 0 );
/** Synonyme for SelectPage(name). */
- void SetStringSelection( const wxChar* name )
- {
- SelectPage( GetPageByName(name) );
- }
+ void SetStringSelection( const wxChar* name );
+
+ /**
+ Show or hide the property grid header control. It is hidden
+ by the default.
+
+ @remarks Grid may look better if you use wxPG_NO_INTERNAL_BORDER
+ window style when showing a header.
+ */
+ void ShowHeader(bool show = true);
protected:
//
/**
- Creates property grid for the manager. Override to use subclassed
- wxPropertyGrid.
+ 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.
*/
virtual wxPropertyGrid* CreatePropertyGrid() const;
};
-
-// -----------------------------------------------------------------------