]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/choice.cpp
added wrapper for <commctrl.h> as well
[wxWidgets.git] / src / msw / choice.cpp
index f8620938f2a5651ab17803b637794c375473b123..f9629adaabf847fb8bd65cf7795076d0f033a700 100644 (file)
@@ -115,6 +115,20 @@ int wxChoice::DoAppend(const wxString& item)
     return n;
 }
 
+int wxChoice::DoInsert(const wxString& item, 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"));
+
+    int n = (int)SendMessage(GetHwnd(), CB_INSERTSTRING, pos, (LONG)item.c_str());
+    if ( n == CB_ERR )
+    {
+        wxLogLastError(wxT("SendMessage(CB_INSERTSTRING)"));
+    }
+
+    return n;
+}
+
 void wxChoice::Delete(int n)
 {
     wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
@@ -237,8 +251,6 @@ wxString wxChoice::GetString(int n) const
         {
             wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)"));
         }
-
-        str.UngetWriteBuf();
     }
 
     return str;
@@ -399,11 +411,6 @@ WXHBRUSH wxChoice::OnCtlColor(WXHDC pDC, WXHWND WXUNUSED(pWnd), WXUINT WXUNUSED(
      )
 {
     HDC hdc = (HDC)pDC;
-    if (GetParent()->GetTransparentBackground())
-        SetBkMode(hdc, TRANSPARENT);
-    else
-        SetBkMode(hdc, OPAQUE);
-
     wxColour colBack = GetBackgroundColour();
 
     if (!IsEnabled())