X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1169a91932273bc84c23ed9dbd0a2da064d59d66..69120ee48a66faa743b6e7c85a745806f53228ac:/src/common/ctrlsub.cpp diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index c4debc5e7c..36bf79cec9 100644 --- a/src/common/ctrlsub.cpp +++ b/src/common/ctrlsub.cpp @@ -5,7 +5,7 @@ // Modified by: // Created: 22.10.99 // RCS-ID: $Id$ -// Copyright: (c) wxWindows team +// Copyright: (c) wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -36,15 +36,10 @@ #endif // ============================================================================ -// implementation +// wxItemContainerImmutable implementation // ============================================================================ -wxItemContainer::wxItemContainer() -{ - m_clientDataItemsType = wxClientData_None; -} - -wxItemContainer::~wxItemContainer() +wxItemContainerImmutable::~wxItemContainerImmutable() { // this destructor is required for Darwin } @@ -53,7 +48,7 @@ wxItemContainer::~wxItemContainer() // selection // ---------------------------------------------------------------------------- -wxString wxItemContainer::GetStringSelection() const +wxString wxItemContainerImmutable::GetStringSelection() const { wxString s; int sel = GetSelection(); @@ -63,13 +58,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,10 +174,6 @@ void *wxItemContainer::GetClientData(int n) const return DoGetItemClientData(n); } -wxControlWithItems::wxControlWithItems() -{ -} - wxControlWithItems::~wxControlWithItems() { // this destructor is required for Darwin