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
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.
Returns pointer to created 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.
*/
int AddPage( const wxString& label = wxEmptyString,
const wxBitmap& bmp = wxPG_NULL_BITMAP,
wxPropertyGridPage* pageObj = (wxPropertyGridPage*) NULL )
wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
const wxBitmap& bmp = wxPG_NULL_BITMAP,
wxPropertyGridPage* pageObj = NULL )
{
return InsertPage(-1,label,bmp,pageObj);
return InsertPage(-1, label, bmp, pageObj);
}
void ClearModifiedStatus ( wxPGPropArg id );
@ -445,13 +447,6 @@ public:
return GetPage(m_selPage);
}
/** 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
@ -519,13 +514,14 @@ public:
@param pageObj
wxPropertyGridPage instance. Manager will take ownership of this object.
If NULL, default page object is constructed.
@return
Returns index to the page created.
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.

View File

@ -171,8 +171,7 @@ public:
wxPropertyGridPage* page;
pgMan->AddPage(wxT("First Page"));
page = pgMan->GetLastPage();
page = pgMan->AddPage(wxT("First Page"));
page->Append( new wxPropertyCategory(wxT("Category A1")) );
@ -180,8 +179,7 @@ public:
page->Append( new wxColourProperty(wxT("Colour"),wxPG_LABEL,*wxWHITE) );
pgMan->AddPage(wxT("Second Page"));
page = pgMan->GetLastPage();
page = pgMan->AddPage(wxT("Second Page"));
page->Append( wxT("Text"),wxPG_LABEL,wxT("(no text)") );
@ -220,18 +218,15 @@ public:
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);
}
wxPropertyGridPage* AddPage( const wxString& label = wxEmptyString,
const wxBitmap& bmp = wxPG_NULL_BITMAP,
wxPropertyGridPage* pageObj = NULL );
void ClearModifiedStatus( wxPGPropArg id );
@ -350,14 +345,6 @@ public:
*/
wxPropertyGridPage* GetCurrentPage() const;
/**
Returns last page.
*/
wxPropertyGridPage* GetLastPage() const
{
return GetPage(m_arrPages.size()-1);
}
/**
Returns page object for given page index.
*/
@ -429,11 +416,11 @@ public:
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.

View File

@ -705,13 +705,15 @@ size_t wxPropertyGridManager::GetPageCount() const
// -----------------------------------------------------------------------
int wxPropertyGridManager::InsertPage( int index, const wxString& label,
const wxBitmap& bmp, wxPropertyGridPage* pageObj )
wxPropertyGridPage* wxPropertyGridManager::InsertPage( int index,
const wxString& label,
const wxBitmap& bmp,
wxPropertyGridPage* pageObj )
{
if ( index < 0 )
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)."));
bool needInit = true;
@ -826,7 +828,7 @@ int wxPropertyGridManager::InsertPage( int index, const wxString& label,
wxASSERT( pageObj->GetGrid() );
return index;
return pageObj;
}
// -----------------------------------------------------------------------