X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfcebdb1bba3369205b6693f2593f74394354edd..44c2d8d0f39b589e35812be00c9f3721a7f48913:/src/os2/choice.cpp?ds=sidebyside diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index f3f95b2a91..6098b3afa4 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -31,9 +31,7 @@ bool wxChoice::Create( , int n , const wxString asChoices[] , long lStyle -#if wxUSE_VALIDATORS , const wxValidator& rValidator -#endif , const wxString& rsName ) { @@ -44,9 +42,7 @@ bool wxChoice::Create( ,rPos ,rSize ,lStyle -#if wxUSE_VALIDATORS ,rValidator -#endif ,rsName )) return FALSE; @@ -115,6 +111,32 @@ int wxChoice::DoAppend( return nIndex; } // end of wxChoice::DoAppend +int wxChoice::DoInsert( + const wxString& rsItem, + int pos +) +{ + wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list")); + wxCHECK_MSG((pos>=0) && (pos<=GetCount()), -1, wxT("invalid index")); + + if (pos == GetCount()) + return DoAppend(rsItem); + + int nIndex; + SHORT nIndexType = 0; + + if (m_windowStyle & wxLB_SORT) + nIndexType = LIT_SORTASCENDING; + else + nIndexType = pos; + nIndex = (int)::WinSendMsg( GetHwnd() + ,LM_INSERTITEM + ,(MPARAM)nIndexType + ,(MPARAM)rsItem.c_str() + ); + return nIndex; +} // end of wxChoice::DoInsert + void wxChoice::Delete( int n ) @@ -189,6 +211,16 @@ void wxChoice::SetString( ) { SHORT nIndexType = 0; + void* pData; + + if ( m_clientDataItemsType != wxClientData_None ) + { + pData = DoGetItemClientData(n); + } + else // no client data + { + pData = NULL; + } ::WinSendMsg(GetHwnd(), LM_DELETEITEM, (MPARAM)n, 0); @@ -201,6 +233,13 @@ void wxChoice::SetString( ,(MPARAM)nIndexType ,(MPARAM)rsStr.c_str() ); + + if (pData) + { + DoSetItemClientData( n + ,pData + ); + } } // end of wxChoice::SetString wxString wxChoice::GetString(