- // TODO:
- /*
- int n = (int)SendMessage(GetHwnd(), CB_ADDSTRING, 0, (LONG)item.c_str());
- if ( n == CB_ERR )
- {
- wxLogLastError("SendMessage(CB_ADDSTRING)");
- }
- */
- return 0; //n
-}
-
-void wxChoice::Delete(int n)
+ int nIndex;
+ SHORT nIndexType = 0;
+
+ if (m_windowStyle & wxLB_SORT)
+ nIndexType = LIT_SORTASCENDING;
+ else
+ nIndexType = LIT_END;
+ nIndex = (int)::WinSendMsg( GetHwnd()
+ ,LM_INSERTITEM
+ ,(MPARAM)nIndexType
+ ,(MPARAM)rsItem.c_str()
+ );
+ 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
+)