X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/92afa2b150803da84a4bc7dfa4e580dbbff15c9a..b7fff980e73fcb74228d6fc451b1d2eace94fa0d:/src/generic/choicdgg.cpp diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 608fec4009..ec8857fa4d 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -48,7 +48,7 @@ wxString wxGetSingleChoice( const wxString& message, const wxString& caption, in if ( dialog.ShowModal() == wxID_OK ) return dialog.GetStringSelection(); else - return _T(""); + return wxT(""); } // Overloaded for backward compatibility @@ -96,21 +96,21 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in return ans; } -wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, - const wxString *choices, wxChar **client_data, wxWindow *parent, +void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, + const wxString *choices, void **client_data, wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre), int WXUNUSED(width), int WXUNUSED(height) ) { wxSingleChoiceDialog dialog(parent, message, caption, n, choices, (char **)client_data); if ( dialog.ShowModal() == wxID_OK ) - return (wxChar *)dialog.GetSelectionClientData(); + return dialog.GetSelectionClientData(); else return NULL; } // Overloaded for backward compatibility -wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, - wxChar *choices[], wxChar **client_data, wxWindow *parent, +void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n, + wxChar *choices[], void **client_data, wxWindow *parent, int x, int y, bool centre, int width, int height ) { @@ -120,7 +120,7 @@ wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, { strings[i] = choices[i]; } - wxChar *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent, + void *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent, x, y, centre, width, height); delete[] strings; return data; @@ -156,14 +156,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 | \ @@ -233,20 +231,18 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxPoint& WXUNUSED(pos) ) { m_selection = 0; - m_clientData = NULL; - m_stringSelection = _T(""); 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,10 +260,11 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), // 4) buttons topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxCENTRE | wxALL, 10 ); + SetAutoLayout( TRUE ); + SetSizer( topsizer ); + topsizer->SetSizeHints( this ); topsizer->Fit( this ); - SetSizer( topsizer ); - SetAutoLayout( TRUE ); Centre( wxBOTH ); @@ -289,8 +286,11 @@ void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); - m_clientData = m_listbox->GetClientData(m_selection); - + // TODO! +#ifndef __WXMOTIF__ + if ( m_listbox->HasClientUntypedData() ) + SetClientData(m_listbox->GetClientData(m_selection)); +#endif EndModal(wxID_OK); } @@ -298,7 +298,12 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) { m_selection = m_listbox->GetSelection(); m_stringSelection = m_listbox->GetStringSelection(); - m_clientData = m_listbox->GetClientData(m_selection); + + // TODO! +#ifndef __WXMOTIF__ + if ( m_listbox->HasClientUntypedData() ) + SetClientData(m_listbox->GetClientData(m_selection)); +#endif EndModal(wxID_OK); }