X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d67974d248156678a45aded725f5b92c69f502a..abb4f9c93715f5b00c526203af96ed2938a1a2c3:/src/common/ctrlsub.cpp diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index cf913548e0..7f294c3f5d 100644 --- a/src/common/ctrlsub.cpp +++ b/src/common/ctrlsub.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "controlwithitems.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -36,10 +32,10 @@ #endif // ============================================================================ -// implementation +// wxItemContainerImmutable implementation // ============================================================================ -wxItemContainer::~wxItemContainer() +wxItemContainerImmutable::~wxItemContainerImmutable() { // this destructor is required for Darwin } @@ -48,7 +44,7 @@ wxItemContainer::~wxItemContainer() // selection // ---------------------------------------------------------------------------- -wxString wxItemContainer::GetStringSelection() const +wxString wxItemContainerImmutable::GetStringSelection() const { wxString s; int sel = GetSelection(); @@ -58,13 +54,36 @@ wxString wxItemContainer::GetStringSelection() const return s; } -wxArrayString wxItemContainer::GetStrings() const +bool wxItemContainerImmutable::SetStringSelection(const wxString& s) +{ + const int sel = FindString(s); + if ( sel == wxNOT_FOUND ) + return false; + + SetSelection(sel); + + return true; +} + +wxArrayString wxItemContainerImmutable::GetStrings() const { - wxArrayString result ; - size_t count = GetCount() ; - for ( size_t n = 0 ; n < count ; n++ ) + wxArrayString result; + + const size_t count = GetCount(); + result.Alloc(count); + for ( size_t n = 0; n < count; n++ ) result.Add(GetString(n)); - return result ; + + return result; +} + +// ============================================================================ +// wxItemContainer implementation +// ============================================================================ + +wxItemContainer::~wxItemContainer() +{ + // this destructor is required for Darwin } // ---------------------------------------------------------------------------- @@ -156,13 +175,4 @@ wxControlWithItems::~wxControlWithItems() // this destructor is required for Darwin } -#if WXWIN_COMPATIBILITY_2_2 - -int wxItemContainer::Number() const -{ - return GetCount(); -} - -#endif // WXWIN_COMPATIBILITY_2_2 - #endif // wxUSE_CONTROLS