X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/451f6363c9ce312d7fefc1fe6920b9c6b3f04229..68df211faedeabdf4259858109d1bd7385fdccf5:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index bd7944b8ea..b643d1d1cb 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: choice.cpp +// Name: src/msw/choice.cpp // Purpose: wxChoice // Author: Julian Smart // Modified by: Vadim Zeitlin to derive from wxChoiceBase @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "choice.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -136,8 +132,6 @@ bool wxChoice::CreateAndInit(wxWindow *parent, const wxValidator& validator, const wxString& name) { - Init(); - // initialize wxControl if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return false; @@ -337,7 +331,7 @@ int wxChoice::GetCount() const return (int)SendMessage(GetHwnd(), CB_GETCOUNT, 0, 0); } -int wxChoice::FindString(const wxString& s) const +int wxChoice::FindString(const wxString& s, bool bCase) const { #if defined(__WATCOMC__) && defined(__WIN386__) // For some reason, Watcom in WIN386 mode crashes in the CB_FINDSTRINGEXACT message. @@ -346,7 +340,7 @@ int wxChoice::FindString(const wxString& s) const for ( int i = 0; i < count; i++ ) { // as CB_FINDSTRINGEXACT is case insensitive, be case insensitive too - if ( GetString(i).IsSameAs(s, false) ) + if ( GetString(i).IsSameAs(s, bCase) ) return i; } @@ -356,21 +350,26 @@ int wxChoice::FindString(const wxString& s) const //passed to SendMessage, so we have to do it ourselves in that case if ( s.empty() ) { - int count = GetCount(); - for ( int i = 0; i < count; i++ ) - { - if ( GetString(i).empty() ) - return i; - } - - return wxNOT_FOUND; + int count = GetCount(); + for ( int i = 0; i < count; i++ ) + { + if ( GetString(i).empty() ) + return i; + } + + return wxNOT_FOUND; + } + else if (bCase) + { + // back to base class search for not native search type + return wxItemContainerImmutable::FindString( s, bCase ); } else { - int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT, - (WPARAM)-1, (LPARAM)s.c_str()); + int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT, + (WPARAM)-1, (LPARAM)s.c_str()); - return pos == LB_ERR ? wxNOT_FOUND : pos; + return pos == LB_ERR ? wxNOT_FOUND : pos; } #endif // Watcom/!Watcom } @@ -681,4 +680,3 @@ WXHBRUSH wxChoice::MSWControlColor(WXHDC hDC, WXHWND hWnd) } #endif // wxUSE_CHOICE && !(__SMARTPHONE__ && __WXWINCE__) -