]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listbox.cpp
Updated font dialog constructors to use a reference to the font data
[wxWidgets.git] / src / msw / listbox.cpp
index 6d1f05a55615149acb49198fcf6ecb19590a3a88..2eeafd8a784e6d50de4b559abb7e124342f6072a 100644 (file)
@@ -453,21 +453,32 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
 
     if ( HasMultipleSelection() )
     {
 
     if ( HasMultipleSelection() )
     {
-        int no_sel = ListBox_GetSelCount(GetHwnd());
-        if (no_sel != 0) {
-            int *selections = new int[no_sel];
-            int rc = ListBox_GetSelItems(GetHwnd(), no_sel, selections);
-
-            wxCHECK_MSG(rc != LB_ERR, -1, wxT("ListBox_GetSelItems failed"));
+        int countSel = ListBox_GetSelCount(GetHwnd());
+        if ( countSel == LB_ERR )
+        {
+            wxLogDebug(_T("ListBox_GetSelCount failed"));
+        }
+        else if ( countSel != 0 )
+        {
+            int *selections = new int[countSel];
 
 
-            aSelections.Alloc(no_sel);
-            for ( int n = 0; n < no_sel; n++ )
-                aSelections.Add(selections[n]);
+            if ( ListBox_GetSelItems(GetHwnd(),
+                                     countSel, selections) == LB_ERR )
+            {
+                wxLogDebug(wxT("ListBox_GetSelItems failed"));
+                countSel = -1;
+            }
+            else
+            {
+                aSelections.Alloc(countSel);
+                for ( int n = 0; n < countSel; n++ )
+                    aSelections.Add(selections[n]);
+            }
 
             delete [] selections;
         }
 
 
             delete [] selections;
         }
 
-        return no_sel;
+        return countSel;
     }
     else  // single-selection listbox
     {
     }
     else  // single-selection listbox
     {
@@ -516,12 +527,15 @@ wxListBox::DoInsertItems(const wxArrayString& items, int pos)
         int idx = ListBox_InsertString(GetHwnd(), i + pos, items[i]);
 
 #if wxUSE_OWNER_DRAWN
         int idx = ListBox_InsertString(GetHwnd(), i + pos, items[i]);
 
 #if wxUSE_OWNER_DRAWN
-        wxOwnerDrawn *pNewItem = CreateItem(idx);
-        pNewItem->SetName(items[i]);
-        pNewItem->SetFont(GetFont());
-        m_aItems.Insert(pNewItem, idx);
+        if ( m_windowStyle & wxLB_OWNERDRAW )
+        {
+            wxOwnerDrawn *pNewItem = CreateItem(idx);
+            pNewItem->SetName(items[i]);
+            pNewItem->SetFont(GetFont());
+            m_aItems.Insert(pNewItem, idx);
 
 
-        ListBox_SetItemData(GetHwnd(), idx, pNewItem);
+            ListBox_SetItemData(GetHwnd(), idx, pNewItem);
+        }
 #endif // wxUSE_OWNER_DRAWN
     }
 
 #endif // wxUSE_OWNER_DRAWN
     }