Fix wxPGVIterator used in wxPropertyGridManager
Empty wxPropertyGridPages should be skipped when iterator is incremented from the last wxPGProperty on one page to the first property on the next page. Empty pages should be skipped also when ierator is initially set to point the first property. Closes #23273.
This commit is contained in:
parent
f1273ce152
commit
c9934cbd83
3 changed files with 23 additions and 5 deletions
|
|
@ -391,6 +391,7 @@ class WXDLLIMPEXP_PROPGRID wxPGVIteratorBase : public wxObjectRefData
|
|||
public:
|
||||
wxPGVIteratorBase() = default;
|
||||
virtual void Next() = 0;
|
||||
virtual bool AtEnd() const = 0;
|
||||
protected:
|
||||
virtual ~wxPGVIteratorBase() = default;
|
||||
|
||||
|
|
@ -424,7 +425,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
void Next() { m_pIt->Next(); }
|
||||
bool AtEnd() const { return m_pIt->m_it.AtEnd(); }
|
||||
bool AtEnd() const { return m_pIt->AtEnd(); }
|
||||
wxPGProperty* GetProperty() const { return m_pIt->m_it.GetProperty(); }
|
||||
protected:
|
||||
wxPGVIteratorBase* m_pIt;
|
||||
|
|
|
|||
|
|
@ -2349,9 +2349,15 @@ class wxPGVIteratorBase_Manager : public wxPGVIteratorBase
|
|||
{
|
||||
public:
|
||||
wxPGVIteratorBase_Manager( wxPropertyGridManager* manager, int flags )
|
||||
: m_manager(manager), m_flags(flags), m_curPage(0)
|
||||
: m_manager(manager), m_flags(flags)
|
||||
{
|
||||
m_it.Init(manager->GetPage(0), flags);
|
||||
// Start with first non-empty page
|
||||
for ( m_curPage = 0; m_curPage < m_manager->GetPageCount(); m_curPage++ )
|
||||
{
|
||||
m_it.Init(m_manager->GetPage(m_curPage), m_flags);
|
||||
if ( !m_it.AtEnd() )
|
||||
break;
|
||||
}
|
||||
}
|
||||
virtual ~wxPGVIteratorBase_Manager() = default;
|
||||
virtual void Next() override
|
||||
|
|
@ -2361,11 +2367,21 @@ public:
|
|||
// Next page?
|
||||
if ( m_it.AtEnd() )
|
||||
{
|
||||
// Skip empty pages
|
||||
m_curPage++;
|
||||
if ( m_curPage < m_manager->GetPageCount() )
|
||||
m_it.Init( m_manager->GetPage(m_curPage), m_flags );
|
||||
for ( ; m_curPage < m_manager->GetPageCount(); m_curPage++ )
|
||||
{
|
||||
m_it.Init(m_manager->GetPage(m_curPage), m_flags);
|
||||
if ( !m_it.AtEnd() )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual bool AtEnd() const override
|
||||
{
|
||||
return m_it.AtEnd() && m_curPage == m_manager->GetPageCount();
|
||||
}
|
||||
|
||||
private:
|
||||
wxPropertyGridManager* m_manager;
|
||||
int m_flags;
|
||||
|
|
|
|||
|
|
@ -887,6 +887,7 @@ public:
|
|||
}
|
||||
virtual ~wxPGVIteratorBase_State() = default;
|
||||
virtual void Next() override { m_it.Next(); }
|
||||
virtual bool AtEnd() const override { return m_it.AtEnd(); }
|
||||
};
|
||||
|
||||
wxPGVIterator wxPropertyGridInterface::GetVIterator( int flags ) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue