]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/choicdgg.cpp
implemented menu drawing in the GTK theme
[wxWidgets.git] / src / generic / choicdgg.cpp
index 2e0df746a8b9a09b05a0da53fed182f374228d89..50e29af9102372f28f8c36261ff07e3cbc371e24 100644 (file)
@@ -28,6 +28,8 @@
     #pragma hdrstop
 #endif
 
     #pragma hdrstop
 #endif
 
+#if wxUSE_CHOICEDLG
+
 #ifndef WX_PRECOMP
     #include <stdio.h>
     #include "wx/utils.h"
 #ifndef WX_PRECOMP
     #include <stdio.h>
     #include "wx/utils.h"
@@ -81,9 +83,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;
@@ -126,7 +129,7 @@ wxString wxGetSingleChoice( const wxString& message,
     return res;
 }
 
     return res;
 }
 
-#ifdef WXWIN_COMPATIBILITY_2
+#if WXWIN_COMPATIBILITY_2
 // Overloaded for backward compatibility
 wxString wxGetSingleChoice( const wxString& message,
                             const wxString& caption,
 // Overloaded for backward compatibility
 wxString wxGetSingleChoice( const wxString& message,
                             const wxString& caption,
@@ -166,7 +169,24 @@ int wxGetSingleChoiceIndex( const wxString& message,
     return choice;
 }
 
     return choice;
 }
 
-#ifdef WXWIN_COMPATIBILITY_2
+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;
+}
+
+#if WXWIN_COMPATIBILITY_2
 // Overloaded for backward compatibility
 int wxGetSingleChoiceIndex( const wxString& message,
                             const wxString& caption,
 // Overloaded for backward compatibility
 int wxGetSingleChoiceIndex( const wxString& message,
                             const wxString& caption,
@@ -194,7 +214,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,7 +225,26 @@ void *wxGetSingleChoiceData( const wxString& message,
     return data;
 }
 
     return data;
 }
 
-#ifdef WXWIN_COMPATIBILITY_2
+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;
+}
+
+#if WXWIN_COMPATIBILITY_2
 // Overloaded for backward compatibility
 void *wxGetSingleChoiceData( const wxString& message,
                              const wxString& caption,
 // Overloaded for backward compatibility
 void *wxGetSingleChoiceData( const wxString& message,
                              const wxString& caption,
@@ -238,6 +278,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
@@ -273,7 +317,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 WXUNUSED(styleDlg), // FIXME: why unused?
+                               long styleDlg,
                                const wxPoint& pos,
                                long styleLbox)
 {
                                const wxPoint& pos,
                                long styleLbox)
 {
@@ -302,7 +346,7 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent,
 #endif
 
     // 4) buttons
 #endif
 
     // 4) buttons
-    topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxCENTRE | wxALL, 10 );
+    topsizer->Add( CreateButtonSizer( styleDlg & (wxOK|wxCANCEL) ), 0, wxCENTRE | wxALL, 10 );
 
     SetAutoLayout( TRUE );
     SetSizer( topsizer );
 
     SetAutoLayout( TRUE );
     SetSizer( topsizer );
@@ -340,7 +384,7 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
     Create(parent, message, caption, n, choices, clientData, style);
 }
 
     Create(parent, message, caption, n, choices, clientData, style);
 }
 
-#ifdef WXWIN_COMPATIBILITY_2
+#if WXWIN_COMPATIBILITY_2
 
 wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
                                            const wxString& message,
 
 wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
                                            const wxString& message,
@@ -481,3 +525,5 @@ bool wxMultiChoiceDialog::TransferDataFromWindow()
 
     return TRUE;
 }
 
     return TRUE;
 }
+
+#endif // wxUSE_CHOICEDLG