- 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
-----------------------------------------
- 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:
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
//
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 );
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();
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();
,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();
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();
*/
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().
# 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 \
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;
#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
# 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 \