Replace wxComboBox::IsEmpty() with Is{List,Text}Empty().
IsEmpty() didn't exist in all ports (notably not wxMSW) and its meaning was unclear anyhow, so remove it even from the ports where it did exist and add clear Is{List,Text}Empty() replacements instead. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -333,6 +333,9 @@ Changes in behaviour which may result in compilation errors
|
||||
|
||||
- wxST_MARKUP doesn't exist any more, use wxControl::SetLabelMarkup() instead.
|
||||
|
||||
- wxComboBox::IsEmpty(), which was previously available in some ports (but not
|
||||
wxMSW), doesn't exist any more, use either IsListEmpty() or IsTextEmpty().
|
||||
|
||||
|
||||
Deprecated methods and their replacements
|
||||
-----------------------------------------
|
||||
@@ -453,6 +456,7 @@ All (GUI):
|
||||
- Allow marking wxTreeBook nodes to expand initially in XRC (RedTide).
|
||||
- Added customizable wxDocManager::OnMRUFileNotExist() virtual method.
|
||||
- Fix stock labels when not using mnemonics for Chinese (cw.ahbong).
|
||||
- Added wxComboBox::IsListEmpty() and IsTextEmpty().
|
||||
|
||||
OSX:
|
||||
|
||||
|
@@ -36,7 +36,13 @@ public:
|
||||
wxItemContainer::Clear();
|
||||
}
|
||||
|
||||
bool IsEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
// IsEmpty() is ambiguous because we inherit it from both wxItemContainer
|
||||
// and wxTextEntry, and even if defined it here to help the compiler with
|
||||
// choosing one of them, it would still be confusing for the human users of
|
||||
// this class. So instead define the clearly named methods below and leave
|
||||
// IsEmpty() ambiguous to trigger a compilation error if it's used.
|
||||
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
||||
|
||||
// also bring in GetSelection() versions of both base classes in scope
|
||||
//
|
||||
|
@@ -97,7 +97,9 @@ public:
|
||||
wxItemContainer::Clear();
|
||||
}
|
||||
|
||||
bool IsEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
// See wxComboBoxBase discussion of IsEmpty().
|
||||
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
||||
|
||||
void OnChar( wxKeyEvent &event );
|
||||
|
||||
|
@@ -69,6 +69,10 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr);
|
||||
|
||||
// See wxComboBoxBase discussion of IsEmpty().
|
||||
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
||||
|
||||
// resolve ambiguities among virtual functions inherited from both base
|
||||
// classes
|
||||
virtual void Clear();
|
||||
|
@@ -75,6 +75,10 @@ public:
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxComboBoxNameStr);
|
||||
|
||||
// See wxComboBoxBase discussion of IsEmpty().
|
||||
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
||||
|
||||
// resolve ambiguities among virtual functions inherited from both base
|
||||
// classes
|
||||
virtual void Clear();
|
||||
|
@@ -96,6 +96,10 @@ class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
|
||||
,const wxString& rsName = wxComboBoxNameStr
|
||||
);
|
||||
|
||||
// See wxComboBoxBase discussion of IsEmpty().
|
||||
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
||||
|
||||
// resolve ambiguities among virtual functions inherited from both base
|
||||
// classes
|
||||
virtual void Clear();
|
||||
|
@@ -129,7 +129,9 @@ public:
|
||||
wxItemContainer::Clear();
|
||||
}
|
||||
|
||||
bool IsEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
// See wxComboBoxBase discussion of IsEmpty().
|
||||
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
|
||||
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
|
||||
|
||||
// wxControlWithItems methods
|
||||
virtual void DoClear();
|
||||
|
@@ -224,6 +224,39 @@ public:
|
||||
*/
|
||||
virtual long GetInsertionPoint() const;
|
||||
|
||||
/**
|
||||
IsEmpty() is not available in this class.
|
||||
|
||||
This method is documented here only to notice that it can't be used
|
||||
with this class because of the ambiguity between the methods with the
|
||||
same name inherited from wxItemContainer and wxTextEntry base classes.
|
||||
|
||||
Because of this, any attempt to call it results in a compilation error
|
||||
and you should use either IsListEmpty() or IsTextEmpty() depending on
|
||||
what exactly do you want to test.
|
||||
*/
|
||||
bool IsEmpty() const;
|
||||
|
||||
/**
|
||||
Returns true if the list of combobox choices is empty.
|
||||
|
||||
Use this method instead of (not available in this class) IsEmpty() to
|
||||
test if the list of items is empty.
|
||||
|
||||
@since 2.9.3
|
||||
*/
|
||||
bool IsListEmpty() const;
|
||||
|
||||
/**
|
||||
Returns true if the text of the combobox is empty.
|
||||
|
||||
Use this method instead of (not available in this class) IsEmpty() to
|
||||
test if the text currently entered into the combobox is empty.
|
||||
|
||||
@since 2.9.3
|
||||
*/
|
||||
bool IsTextEmpty() const;
|
||||
|
||||
/**
|
||||
Same as wxTextEntry::SetSelection().
|
||||
|
||||
|
@@ -922,7 +922,17 @@ test_gui_xrctest.o: $(srcdir)/xml/xrctest.cpp $(TEST_GUI_ODEP)
|
||||
# warnings don't matter when we expect compilation to fail anyhow so we can
|
||||
# use this variable to enable the compilation of code which is supposed to
|
||||
# fail
|
||||
failtest:
|
||||
failtest: failtest_combobox failtest_evthandler
|
||||
|
||||
failtest_combobox:
|
||||
@$(RM) test_gui_comboboxtest.o
|
||||
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_COMBOBOX_ISEMPTY test_gui_comboboxtest.o 2>/dev/null; then \
|
||||
echo "*** Compilation with TEST_INVALID_COMBOBOX_ISEMPTY unexpectedly succeeded.">&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
exit 0
|
||||
|
||||
failtest_evthandler:
|
||||
@$(RM) test_evthandler.o
|
||||
@for d in GLOBAL STATIC METHOD FUNCTOR NO_HANDLER DERIVED WRONG_CLASS; do \
|
||||
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_BIND_$$d test_evthandler.o 2>/dev/null; then \
|
||||
|
@@ -62,12 +62,14 @@ private:
|
||||
CPPUNIT_TEST( PopDismiss );
|
||||
CPPUNIT_TEST( Sort );
|
||||
CPPUNIT_TEST( ReadOnly );
|
||||
CPPUNIT_TEST( IsEmpty );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
void Size();
|
||||
void PopDismiss();
|
||||
void Sort();
|
||||
void ReadOnly();
|
||||
void IsEmpty();
|
||||
|
||||
wxComboBox *m_combo;
|
||||
|
||||
@@ -194,4 +196,27 @@ void ComboBoxTestCase::ReadOnly()
|
||||
#endif
|
||||
}
|
||||
|
||||
void ComboBoxTestCase::IsEmpty()
|
||||
{
|
||||
CPPUNIT_ASSERT( m_combo->IsListEmpty() );
|
||||
CPPUNIT_ASSERT( m_combo->IsTextEmpty() );
|
||||
|
||||
m_combo->Append("foo");
|
||||
CPPUNIT_ASSERT( !m_combo->IsListEmpty() );
|
||||
CPPUNIT_ASSERT( m_combo->IsTextEmpty() );
|
||||
|
||||
m_combo->SetValue("bar");
|
||||
CPPUNIT_ASSERT( !m_combo->IsListEmpty() );
|
||||
CPPUNIT_ASSERT( !m_combo->IsTextEmpty() );
|
||||
|
||||
m_combo->Clear();
|
||||
CPPUNIT_ASSERT( m_combo->IsListEmpty() );
|
||||
CPPUNIT_ASSERT( m_combo->IsTextEmpty() );
|
||||
|
||||
#ifdef TEST_INVALID_COMBOBOX_ISEMPTY
|
||||
// Compiling this should fail, see failtest target definition in test.bkl.
|
||||
m_combo->IsEmpty();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //wxUSE_COMBOBOX
|
||||
|
@@ -253,7 +253,17 @@
|
||||
# warnings don't matter when we expect compilation to fail anyhow so we can
|
||||
# use this variable to enable the compilation of code which is supposed to
|
||||
# fail
|
||||
failtest:
|
||||
failtest: failtest_combobox failtest_evthandler
|
||||
|
||||
failtest_combobox:
|
||||
@$(RM) test_gui_comboboxtest.o
|
||||
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_COMBOBOX_ISEMPTY test_gui_comboboxtest.o 2>/dev/null; then \
|
||||
echo "*** Compilation with TEST_INVALID_COMBOBOX_ISEMPTY unexpectedly succeeded.">&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
exit 0
|
||||
|
||||
failtest_evthandler:
|
||||
@$(RM) test_evthandler.o
|
||||
@for d in GLOBAL STATIC METHOD FUNCTOR NO_HANDLER DERIVED WRONG_CLASS; do \
|
||||
if $(MAKE) CXXWARNINGS=-DTEST_INVALID_BIND_$$d test_evthandler.o 2>/dev/null; then \
|
||||
|
Reference in New Issue
Block a user