X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/eb553cb25b48eb0062508eb6852f20682d0a4015..b0a6bb75bcd4b5a4873d766a9208ac6376fe8625:/src/generic/choicdgg.cpp diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 560eee9c2b..f2c529666a 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -45,10 +45,11 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); + wxString choice; if ( dialog.ShowModal() == wxID_OK ) - return dialog.GetStringSelection(); - else - return wxT(""); + choice = dialog.GetStringSelection(); + + return choice; } // Overloaded for backward compatibility @@ -75,10 +76,13 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices); + int choice; if ( dialog.ShowModal() == wxID_OK ) - return dialog.GetSelection(); + choice = dialog.GetSelection(); else - return -1; + choice = -1; + + return choice; } // Overloaded for backward compatibility @@ -102,10 +106,13 @@ void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, i int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices, (char **)client_data); + void *data; if ( dialog.ShowModal() == wxID_OK ) - return dialog.GetSelectionClientData(); + data = dialog.GetSelectionClientData(); else - return NULL; + data = NULL; + + return data; } // Overloaded for backward compatibility @@ -156,14 +163,12 @@ int wxGetMultipleChoice(const wxString& message, const wxString& caption, // wxSingleChoiceDialog -#if !USE_SHARED_LIBRARY BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) EVT_LISTBOX_DCLICK(wxID_LISTBOX, wxSingleChoiceDialog::OnListBoxDClick) END_EVENT_TABLE() IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) -#endif #if defined(__WXMSW__) || defined(__WXMAC__) #define wxCHOICEDLG_DIALOG_STYLE (wxDEFAULT_DIALOG_STYLE | \ @@ -237,14 +242,14 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), m_dialogStyle = style; wxBeginBusyCursor(); - + wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); // 1) text message topsizer->Add( CreateTextSizer( message ), 0, wxALL, 10 ); - + // 2) list box - m_listbox = new wxListBox( this, wxID_LISTBOX, wxDefaultPosition, wxSize(160,100) , + m_listbox = new wxListBox( this, wxID_LISTBOX, wxDefaultPosition, wxSize(160,100) , n, choices, wxLB_ALWAYS_SB ); m_listbox->SetSelection( m_selection ); if (clientData) @@ -264,7 +269,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), SetAutoLayout( TRUE ); SetSizer( topsizer ); - + topsizer->SetSizeHints( this ); topsizer->Fit( this ); @@ -288,9 +293,11 @@ void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); + // TODO! +#ifndef __WXMOTIF__ if ( m_listbox->HasClientUntypedData() ) SetClientData(m_listbox->GetClientData(m_selection)); - +#endif EndModal(wxID_OK); } @@ -298,8 +305,12 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); + + // TODO! +#ifndef __WXMOTIF__ if ( m_listbox->HasClientUntypedData() ) SetClientData(m_listbox->GetClientData(m_selection)); +#endif EndModal(wxID_OK); }