X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f9eee2db810695ae4417e9935475f268bb68bbac..0966d1fe2639772efab156387f95f63ce766bf17:/src/os2/choice.cpp diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index 88fff750fb..793111d6b5 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -23,6 +23,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +bool wxChoice::Create( + wxWindow* pParent +, wxWindowID vId +, const wxPoint& rPos +, const wxSize& rSize +, const wxArrayString& asChoices +, long lStyle +, const wxValidator& rValidator +, const wxString& rsName +) +{ + wxCArrayString chs(asChoices); + + return Create(pParent, vId, rPos, rSize, chs.GetCount(), chs.GetStrings(), + lStyle, rValidator, rsName); +} + bool wxChoice::Create( wxWindow* pParent , wxWindowID vId @@ -97,7 +114,7 @@ int wxChoice::DoAppend( ) { int nIndex; - SHORT nIndexType = 0; + LONG nIndexType = 0; if (m_windowStyle & wxLB_SORT) nIndexType = LIT_SORTASCENDING; @@ -111,6 +128,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; + LONG 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 ) @@ -184,7 +227,17 @@ void wxChoice::SetString( , const wxString& rsStr ) { - SHORT nIndexType = 0; + LONG 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); @@ -197,13 +250,20 @@ void wxChoice::SetString( ,(MPARAM)nIndexType ,(MPARAM)rsStr.c_str() ); + + if (pData) + { + DoSetItemClientData( n + ,pData + ); + } } // end of wxChoice::SetString wxString wxChoice::GetString( int n ) const { - size_t nLen = 0; + int nLen = 0; wxString sStr = ""; char* zBuf;