X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/14f355c2b5c71fc7c3d680aea366582d2ac60f7b..db6d3918916e601fe06b9fbffc2969d57e5e68f2:/src/common/ctrlsub.cpp diff --git a/src/common/ctrlsub.cpp b/src/common/ctrlsub.cpp index 9a7ec228e3..df087db268 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 /////////////////////////////////////////////////////////////////////////////// @@ -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" @@ -35,11 +31,13 @@ #include "wx/arrstr.h" #endif +IMPLEMENT_ABSTRACT_CLASS(wxControlWithItems, wxControl) + // ============================================================================ -// implementation +// wxItemContainerImmutable implementation // ============================================================================ -wxItemContainer::~wxItemContainer() +wxItemContainerImmutable::~wxItemContainerImmutable() { // this destructor is required for Darwin } @@ -48,7 +46,7 @@ wxItemContainer::~wxItemContainer() // selection // ---------------------------------------------------------------------------- -wxString wxItemContainer::GetStringSelection() const +wxString wxItemContainerImmutable::GetStringSelection() const { wxString s; int sel = GetSelection(); @@ -58,6 +56,38 @@ wxString wxItemContainer::GetStringSelection() const return s; } +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; + + const size_t count = GetCount(); + result.Alloc(count); + for ( size_t n = 0; n < count; n++ ) + result.Add(GetString(n)); + + return result; +} + +// ============================================================================ +// wxItemContainer implementation +// ============================================================================ + +wxItemContainer::~wxItemContainer() +{ + // this destructor is required for Darwin +} + // ---------------------------------------------------------------------------- // appending items // ----------------------------------------------------------------------------