#pragma hdrstop
#endif
+#if wxUSE_CHOICEDLG
+
#ifndef WX_PRECOMP
#include <stdio.h>
#include "wx/utils.h"
{
int n = aChoices.GetCount();
*choices = new wxString[n];
+
for ( int i = 0; i < n; i++ )
{
- *choices[i] = aChoices[i];
+ (*choices)[i] = aChoices[i];
}
return n;
return res;
}
-#ifdef WXWIN_COMPATIBILITY_2
+#if WXWIN_COMPATIBILITY_2
// Overloaded for backward compatibility
wxString wxGetSingleChoice( const wxString& message,
const wxString& caption,
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,
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();
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,
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
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,
int n, const wxString *choices,
- long styleDlg,
+ long WXUNUSED(styleDlg), // FIXME: why unused?
const wxPoint& pos,
long styleLbox)
{
const wxString *choices,
char **clientData,
long style,
- const wxPoint& pos)
+ const wxPoint& WXUNUSED(pos))
{
Create(parent, message, caption, n, choices, clientData, style);
}
-#ifdef WXWIN_COMPATIBILITY_2
+#if WXWIN_COMPATIBILITY_2
wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent,
const wxString& message,
const wxStringList& choices,
char **clientData,
long style,
- const wxPoint& pos)
+ const wxPoint& WXUNUSED(pos))
{
Create(parent, message, caption, choices, clientData, style);
}
// 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,
if ( !wxAnyChoiceDialog::Create(parent, message, caption,
n, choices,
style, pos,
- wxLB_ALWAYS_SB | wxLB_MULTIPLE) )
+ wxLB_ALWAYS_SB | wxLB_EXTENDED) )
return FALSE;
return TRUE;
}
}
-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.Add(n);
}
- EndModal(wxID_OK);
+ return TRUE;
}
+
+#endif // wxUSE_CHOICEDLG