]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/choicdgg.cpp
Corrected some comments
[wxWidgets.git] / src / generic / choicdgg.cpp
index 6183fdefd3f4a29ba43e4c10fbab5586a3e04945..6e591c78cd370f518078f969e82b20e1e51db83a 100644 (file)
@@ -59,7 +59,7 @@
 // ---------------------------------------------------------------------------
 
 /* Macro for avoiding #ifdefs when value have to be different depending on size of
-   device we display on
+   device we display on - take it from something like wxDesktopPolicy in the future
  */
 
 #if defined(__SMARTPHONE__)
@@ -278,6 +278,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
 
     topsizer->Add( m_listbox, 1, wxEXPAND | wxLEFT|wxRIGHT, wxLARGESMALL(15,0) );
 
+    // smart phones does not support or do not waste space for wxButtons
 #ifdef __SMARTPHONE__
 
     SetRightMenu(wxID_CANCEL, _("Cancel"));
@@ -300,7 +301,8 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
     topsizer->SetSizeHints( this );
     topsizer->Fit( this );
 
-    Centre( wxBOTH );
+    if ( styleDlg & wxCENTRE )
+        Centre(wxBOTH);
 
     m_listbox->SetFocus();
 
@@ -456,8 +458,17 @@ bool wxMultiChoiceDialog::Create( wxWindow *parent,
 
 void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections)
 {
-    size_t count = selections.GetCount();
-    for ( size_t n = 0; n < count; n++ )
+    // first clear all currently selected items
+    size_t n,
+           count = m_listbox->GetCount();
+    for ( n = 0; n < count; ++n )
+    {
+        m_listbox->Deselect(n);
+    }
+
+    // now select the ones which should be selected
+    count = selections.GetCount();
+    for ( n = 0; n < count; n++ )
     {
         m_listbox->Select(selections[n]);
     }