AddPage(), InsertPage() now return page ptr instead of index

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55882 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Jaakko Salli
2008-09-25 17:19:49 +00:00
parent 0f457f4de2
commit 9288df3401
3 changed files with 29 additions and 44 deletions

View File

@@ -277,18 +277,20 @@ public:
@param pageObj @param pageObj
wxPropertyGridPage instance. Manager will take ownership of this object. wxPropertyGridPage instance. Manager will take ownership of this object.
NULL indicates that a default page instance should be created. NULL indicates that a default page instance should be created.
@return @return
Returns index to the page created. Returns pointer to created page.
@remarks @remarks
If toolbar is used, it is highly recommended that the pages are If toolbar is used, it is highly recommended that the pages are
added when the toolbar is not turned off using window style flag added when the toolbar is not turned off using window style flag
switching. switching.
*/ */
int AddPage( const wxString& label = wxEmptyString, wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
const wxBitmap& bmp = wxPG_NULL_BITMAP, const wxBitmap& bmp = wxPG_NULL_BITMAP,
wxPropertyGridPage* pageObj = (wxPropertyGridPage*) NULL ) wxPropertyGridPage* pageObj = NULL )
{ {
return InsertPage(-1,label,bmp,pageObj); return InsertPage(-1, label, bmp, pageObj);
} }
void ClearModifiedStatus ( wxPGPropArg id ); void ClearModifiedStatus ( wxPGPropArg id );
@@ -445,13 +447,6 @@ public:
return GetPage(m_selPage); return GetPage(m_selPage);
} }
/** Returns last page.
*/
wxPropertyGridPage* GetLastPage() const
{
return GetPage(m_arrPages.size()-1);
}
/** Returns page object for given page index. /** Returns page object for given page index.
*/ */
wxPropertyGridPage* GetPage( unsigned int ind ) const wxPropertyGridPage* GetPage( unsigned int ind ) const
@@ -519,13 +514,14 @@ public:
@param pageObj @param pageObj
wxPropertyGridPage instance. Manager will take ownership of this object. wxPropertyGridPage instance. Manager will take ownership of this object.
If NULL, default page object is constructed. If NULL, default page object is constructed.
@return @return
Returns index to the page created. Returns pointer to created page.
*/ */
virtual int InsertPage( int index, virtual wxPropertyGridPage* InsertPage( int index,
const wxString& label, const wxString& label,
const wxBitmap& bmp = wxNullBitmap, const wxBitmap& bmp = wxNullBitmap,
wxPropertyGridPage* pageObj = NULL ); wxPropertyGridPage* pageObj = NULL );
/** /**
Returns true if any property on any page has been modified by the user. Returns true if any property on any page has been modified by the user.

View File

@@ -171,8 +171,7 @@ public:
wxPropertyGridPage* page; wxPropertyGridPage* page;
pgMan->AddPage(wxT("First Page")); page = pgMan->AddPage(wxT("First Page"));
page = pgMan->GetLastPage();
page->Append( new wxPropertyCategory(wxT("Category A1")) ); page->Append( new wxPropertyCategory(wxT("Category A1")) );
@@ -180,8 +179,7 @@ public:
page->Append( new wxColourProperty(wxT("Colour"),wxPG_LABEL,*wxWHITE) ); page->Append( new wxColourProperty(wxT("Colour"),wxPG_LABEL,*wxWHITE) );
pgMan->AddPage(wxT("Second Page")); page = pgMan->AddPage(wxT("Second Page"));
page = pgMan->GetLastPage();
page->Append( wxT("Text"),wxPG_LABEL,wxT("(no text)") ); page->Append( wxT("Text"),wxPG_LABEL,wxT("(no text)") );
@@ -220,18 +218,15 @@ public:
wxPropertyGridPage instance. Manager will take ownership of this wxPropertyGridPage instance. Manager will take ownership of this
object. NULL indicates that a default page instance should be created. 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 @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 added when the toolbar is not turned off using window style flag
switching. Otherwise toolbar buttons might not be added properly. switching. Otherwise toolbar buttons might not be added properly.
*/ */
int AddPage( const wxString& label = wxEmptyString, wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
const wxBitmap& bmp = wxPG_NULL_BITMAP, const wxBitmap& bmp = wxPG_NULL_BITMAP,
wxPropertyGridPage* pageObj = (wxPropertyGridPage*) NULL ) wxPropertyGridPage* pageObj = NULL );
{
return InsertPage(-1,label,bmp,pageObj);
}
void ClearModifiedStatus( wxPGPropArg id ); void ClearModifiedStatus( wxPGPropArg id );
@@ -350,14 +345,6 @@ public:
*/ */
wxPropertyGridPage* GetCurrentPage() const; wxPropertyGridPage* GetCurrentPage() const;
/**
Returns last page.
*/
wxPropertyGridPage* GetLastPage() const
{
return GetPage(m_arrPages.size()-1);
}
/** /**
Returns page object for given page index. Returns page object for given page index.
*/ */
@@ -429,11 +416,11 @@ public:
wxPropertyGridPage instance. Manager will take ownership of this wxPropertyGridPage instance. Manager will take ownership of this
object. If NULL, default page object is constructed. 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, virtual wxPropertyGridPage* InsertPage( int index, const wxString& label,
const wxBitmap& bmp = wxNullBitmap, const wxBitmap& bmp = wxNullBitmap,
wxPropertyGridPage* pageObj = NULL ); wxPropertyGridPage* pageObj = NULL );
/** /**
Returns @true if any property on any page has been modified by the user. Returns @true if any property on any page has been modified by the user.

View File

@@ -705,13 +705,15 @@ size_t wxPropertyGridManager::GetPageCount() const
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
int wxPropertyGridManager::InsertPage( int index, const wxString& label, wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
const wxBitmap& bmp, wxPropertyGridPage* pageObj ) const wxString& label,
const wxBitmap& bmp,
wxPropertyGridPage* pageObj )
{ {
if ( index < 0 ) if ( index < 0 )
index = GetPageCount(); index = GetPageCount();
wxCHECK_MSG( (size_t)index == GetPageCount(), -1, wxCHECK_MSG( (size_t)index == GetPageCount(), NULL,
wxT("wxPropertyGridManager currently only supports appending pages (due to wxToolBar limitation).")); wxT("wxPropertyGridManager currently only supports appending pages (due to wxToolBar limitation)."));
bool needInit = true; bool needInit = true;
@@ -826,7 +828,7 @@ int wxPropertyGridManager::InsertPage( int index, const wxString& label,
wxASSERT( pageObj->GetGrid() ); wxASSERT( pageObj->GetGrid() );
return index; return pageObj;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------