Add wxSelectionStore::IsEmpty() helper.
Just a simple and potentially (although not right now) more efficient equivalent to GetSelectedCount() == 0. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -71,6 +71,13 @@ public:
|
|||||||
// return true if the given item is selected
|
// return true if the given item is selected
|
||||||
bool IsSelected(unsigned item) const;
|
bool IsSelected(unsigned item) const;
|
||||||
|
|
||||||
|
// return true if no items are currently selected
|
||||||
|
bool IsEmpty() const
|
||||||
|
{
|
||||||
|
return m_defaultState ? m_itemsSel.size() == m_count
|
||||||
|
: m_itemsSel.empty();
|
||||||
|
}
|
||||||
|
|
||||||
// return the total number of selected items
|
// return the total number of selected items
|
||||||
unsigned GetSelectedCount() const
|
unsigned GetSelectedCount() const
|
||||||
{
|
{
|
||||||
|
@@ -125,11 +125,16 @@ void SelStoreTestCase::SetItemCount()
|
|||||||
|
|
||||||
void SelStoreTestCase::Clear()
|
void SelStoreTestCase::Clear()
|
||||||
{
|
{
|
||||||
|
CPPUNIT_ASSERT(m_store->IsEmpty());
|
||||||
CPPUNIT_ASSERT_EQUAL( 0u, m_store->GetSelectedCount() );
|
CPPUNIT_ASSERT_EQUAL( 0u, m_store->GetSelectedCount() );
|
||||||
|
|
||||||
m_store->SelectItem(0);
|
m_store->SelectItem(0);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(!m_store->IsEmpty());
|
||||||
|
|
||||||
m_store->Clear();
|
m_store->Clear();
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT(m_store->IsEmpty());
|
||||||
CPPUNIT_ASSERT_EQUAL( 0u, m_store->GetSelectedCount() );
|
CPPUNIT_ASSERT_EQUAL( 0u, m_store->GetSelectedCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user