diff --git a/include/wx/generic/bmpcbox.h b/include/wx/generic/bmpcbox.h index 90a6ba4351..058a389ad9 100644 --- a/include/wx/generic/bmpcbox.h +++ b/include/wx/generic/bmpcbox.h @@ -84,6 +84,8 @@ public: virtual ~wxBitmapComboBox(); + virtual wxString GetStringSelection() const wxOVERRIDE; + // Adds item with image to the end of the combo box. int Append(const wxString& item, const wxBitmap& bitmap = wxNullBitmap); int Append(const wxString& item, const wxBitmap& bitmap, void *clientData); diff --git a/src/generic/bmpcboxg.cpp b/src/generic/bmpcboxg.cpp index 6432bccaf0..1e3bfff452 100644 --- a/src/generic/bmpcboxg.cpp +++ b/src/generic/bmpcboxg.cpp @@ -135,6 +135,11 @@ wxBitmapComboBox::~wxBitmapComboBox() DoClear(); } +wxString wxBitmapComboBox::GetStringSelection() const +{ + return wxItemContainer::GetStringSelection(); +} + // ---------------------------------------------------------------------------- // Item manipulation // ---------------------------------------------------------------------------- diff --git a/tests/controls/bitmapcomboboxtest.cpp b/tests/controls/bitmapcomboboxtest.cpp index 2a011b3869..904eb6079f 100644 --- a/tests/controls/bitmapcomboboxtest.cpp +++ b/tests/controls/bitmapcomboboxtest.cpp @@ -24,9 +24,6 @@ #include "itemcontainertest.h" #include "asserthelper.h" -//Test only if we are based off of wxComboBox -#ifndef wxGENERIC_BITMAPCOMBOBOX - class BitmapComboBoxTestCase : public TextEntryTestCase, public ItemContainerTestCase, public CppUnit::TestCase @@ -82,9 +79,9 @@ void BitmapComboBoxTestCase::Bitmap() wxArrayString items; items.push_back("item 0"); items.push_back("item 1"); - - //We need this otherwise MSVC complains as it cannot find a suitable append - static_cast(m_combo)->Append(items); + // TODO: Add wxBitmapComboBoxBase::Append(wxArrayString ) + for( unsigned int i = 0; i < items.size(); ++i ) + m_combo->Append(items[i]); CPPUNIT_ASSERT(!m_combo->GetItemBitmap(0).IsOk()); @@ -104,8 +101,10 @@ void BitmapComboBoxTestCase::Bitmap() CPPUNIT_ASSERT(m_combo->GetItemBitmap(0).IsOk()); CPPUNIT_ASSERT_EQUAL(wxSize(16, 16), m_combo->GetBitmapSize()); + + m_combo->SetSelection( 1 ); + + CPPUNIT_ASSERT_EQUAL( m_combo->GetStringSelection(), "item with bitmap" ); } -#endif //wxGENERIC_BITMAPCOMBOBOX - #endif //wxUSE_BITMAPCOMBOBOX