]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/choicdgg.cpp
corrected wxIsAbsolutePath for new Mac Path notation
[wxWidgets.git] / src / generic / choicdgg.cpp
index 62a5371f1572bd82cbfb992e876dac3f971a2ce7..4f47ab48eaa4ae41eaf9898a232cac3f215ca4f3 100644 (file)
@@ -81,9 +81,10 @@ int ConvertWXArrayToC(const wxArrayString& aChoices, wxString **choices)
 {
     int n = aChoices.GetCount();
     *choices = new wxString[n];
 {
     int n = aChoices.GetCount();
     *choices = new wxString[n];
+
     for ( int i = 0; i < n; i++ )
     {
     for ( int i = 0; i < n; i++ )
     {
-        *choices[i] = aChoices[i];
+        (*choices)[i] = aChoices[i];   
     }
 
     return n;
     }
 
     return n;
@@ -166,6 +167,23 @@ int wxGetSingleChoiceIndex( const wxString& message,
     return choice;
 }
 
     return choice;
 }
 
+int wxGetSingleChoiceIndex( const wxString& message,
+                            const wxString& caption,
+                            const wxArrayString& aChoices,
+                            wxWindow *parent,
+                            int x, int y,
+                            bool centre,
+                            int width, int height)
+{
+    wxString *choices;
+    int n = ConvertWXArrayToC(aChoices, &choices);
+    int res = wxGetSingleChoiceIndex(message, caption, n, choices, parent,
+                                     x, y, centre, width, height);
+    delete [] choices;
+
+    return res;
+}
+
 #ifdef WXWIN_COMPATIBILITY_2
 // Overloaded for backward compatibility
 int wxGetSingleChoiceIndex( const wxString& message,
 #ifdef WXWIN_COMPATIBILITY_2
 // Overloaded for backward compatibility
 int wxGetSingleChoiceIndex( const wxString& message,
@@ -194,7 +212,8 @@ void *wxGetSingleChoiceData( const wxString& message,
                              bool WXUNUSED(centre),
                              int WXUNUSED(width), int WXUNUSED(height) )
 {
                              bool WXUNUSED(centre),
                              int WXUNUSED(width), int WXUNUSED(height) )
 {
-    wxSingleChoiceDialog dialog(parent, message, caption, n, choices, (char **)client_data);
+    wxSingleChoiceDialog dialog(parent, message, caption, n, choices,
+                                (char **)client_data);
     void *data;
     if ( dialog.ShowModal() == wxID_OK )
         data = dialog.GetSelectionClientData();
     void *data;
     if ( dialog.ShowModal() == wxID_OK )
         data = dialog.GetSelectionClientData();
@@ -204,6 +223,25 @@ void *wxGetSingleChoiceData( const wxString& message,
     return data;
 }
 
     return data;
 }
 
+void *wxGetSingleChoiceData( const wxString& message,
+                             const wxString& caption,
+                             const wxArrayString& aChoices,
+                             void **client_data,
+                             wxWindow *parent,
+                             int x, int y,
+                             bool centre,
+                             int width, int height)
+{
+    wxString *choices;
+    int n = ConvertWXArrayToC(aChoices, &choices);
+    void *res = wxGetSingleChoiceData(message, caption, n, choices,
+                                      client_data, parent,
+                                      x, y, centre, width, height);
+    delete [] choices;
+
+    return res;
+}
+
 #ifdef WXWIN_COMPATIBILITY_2
 // Overloaded for backward compatibility
 void *wxGetSingleChoiceData( const wxString& message,
 #ifdef WXWIN_COMPATIBILITY_2
 // Overloaded for backward compatibility
 void *wxGetSingleChoiceData( const wxString& message,
@@ -238,6 +276,10 @@ size_t wxGetMultipleChoices(wxArrayInt& selections,
                             int WXUNUSED(width), int WXUNUSED(height))
 {
     wxMultiChoiceDialog dialog(parent, message, caption, n, choices);
                             int WXUNUSED(width), int WXUNUSED(height))
 {
     wxMultiChoiceDialog dialog(parent, message, caption, n, choices);
+
+    if ( !selections.IsEmpty() )
+        dialog.SetSelections(selections);
+
     if ( dialog.ShowModal() == wxID_OK )
         selections = dialog.GetSelections();
     else
     if ( dialog.ShowModal() == wxID_OK )
         selections = dialog.GetSelections();
     else
@@ -246,7 +288,7 @@ size_t wxGetMultipleChoices(wxArrayInt& selections,
     return selections.GetCount();
 }
 
     return selections.GetCount();
 }
 
-size_t wxGetMultipleChoices(wxArrayInt selections,
+size_t wxGetMultipleChoices(wxArrayInt& selections,
                             const wxString& message,
                             const wxString& caption,
                             const wxArrayString& aChoices,
                             const wxString& message,
                             const wxString& caption,
                             const wxArrayString& aChoices,
@@ -273,7 +315,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
                                const wxString& message,
                                const wxString& caption,
                                int n, const wxString *choices,
                                const wxString& message,
                                const wxString& caption,
                                int n, const wxString *choices,
-                               long styleDlg,
+                               long WXUNUSED(styleDlg), // FIXME: why unused?
                                const wxPoint& pos,
                                long styleLbox)
 {
                                const wxPoint& pos,
                                long styleLbox)
 {
@@ -335,7 +377,7 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
                                            const wxString *choices,
                                            char **clientData,
                                            long style,
                                            const wxString *choices,
                                            char **clientData,
                                            long style,
-                                           const wxPoint& pos)
+                                           const wxPoint& WXUNUSED(pos))
 {
     Create(parent, message, caption, n, choices, clientData, style);
 }
 {
     Create(parent, message, caption, n, choices, clientData, style);
 }
@@ -348,7 +390,7 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
                                            const wxStringList& choices,
                                            char **clientData,
                                            long style,
                                            const wxStringList& choices,
                                            char **clientData,
                                            long style,
-                                           const wxPoint& pos)
+                                           const wxPoint& WXUNUSED(pos))
 {
     Create(parent, message, caption, choices, clientData, style);
 }
 {
     Create(parent, message, caption, choices, clientData, style);
 }
@@ -436,10 +478,6 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event))
 // wxMultiChoiceDialog
 // ----------------------------------------------------------------------------
 
 // wxMultiChoiceDialog
 // ----------------------------------------------------------------------------
 
-BEGIN_EVENT_TABLE(wxMultiChoiceDialog, wxDialog)
-    EVT_BUTTON(wxID_OK, wxMultiChoiceDialog::OnOK)
-END_EVENT_TABLE()
-
 IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog)
 
 bool wxMultiChoiceDialog::Create( wxWindow *parent,
 IMPLEMENT_DYNAMIC_CLASS(wxMultiChoiceDialog, wxDialog)
 
 bool wxMultiChoiceDialog::Create( wxWindow *parent,
@@ -453,7 +491,7 @@ bool wxMultiChoiceDialog::Create( wxWindow *parent,
     if ( !wxAnyChoiceDialog::Create(parent, message, caption,
                                     n, choices,
                                     style, pos,
     if ( !wxAnyChoiceDialog::Create(parent, message, caption,
                                     n, choices,
                                     style, pos,
-                                    wxLB_ALWAYS_SB | wxLB_MULTIPLE) )
+                                    wxLB_ALWAYS_SB | wxLB_EXTENDED) )
         return FALSE;
 
     return TRUE;
         return FALSE;
 
     return TRUE;
@@ -468,8 +506,13 @@ void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections)
     }
 }
 
     }
 }
 
-void wxMultiChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
+bool wxMultiChoiceDialog::TransferDataFromWindow()
 {
 {
+    // VZ: I hate to do it but I can't fix wxMotif right now (FIXME)
+#ifdef __WXMOTIF__
+    #define IsSelected Selected
+#endif
+
     m_selections.Empty();
     size_t count = m_listbox->GetCount();
     for ( size_t n = 0; n < count; n++ )
     m_selections.Empty();
     size_t count = m_listbox->GetCount();
     for ( size_t n = 0; n < count; n++ )
@@ -478,5 +521,5 @@ void wxMultiChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event))
             m_selections.Add(n);
     }
 
             m_selections.Add(n);
     }
 
-    EndModal(wxID_OK);
+    return TRUE;
 }
 }