X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/debe6624c1e9d4bf3243381153d1e173c849bcd8..1baa5e4ab5761a92cf62bb3fc8829e613eb97edc:/src/generic/choicdgg.cpp?ds=sidebyside diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index ee1280ca39..46f8fdc3b9 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: choicesg.cpp +// Name: choicdgg.cpp // Purpose: Choice dialogs // Author: Julian Smart // Modified by: @@ -33,7 +33,38 @@ #include "wx/generic/choicdgg.h" -extern void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer); +// Split message, using constraints to position controls +static void wxSplitMessage2(const char *message, wxList *messageList, wxWindow *parent, wxRowColSizer *sizer) +{ + char *copyMessage = copystring(message); + size_t i = 0; + size_t len = strlen(copyMessage); + char *currentMessage = copyMessage; + +// wxWindow *lastWindow = parent; + + while (i < len) { + while ((i < len) && (copyMessage[i] != '\n')) i++; + if (i < len) copyMessage[i] = 0; + wxStaticText *mess = new wxStaticText(parent, -1, currentMessage); + +/* + wxLayoutConstraints *c = new wxLayoutConstraints; + c->left.SameAs (parent, wxLeft, 10); + c->top.SameAs (lastWindow, wxBottom, 5); + c->right.AsIs (); + c->height.AsIs (); + + mess->SetConstraints(c); +*/ + sizer->AddSizerChild(mess); + + messageList->Append(mess); + + currentMessage = copyMessage + i + 1; + } + delete[] copyMessage; +} wxString wxGetSingleChoice( const wxString& message, const wxString& caption, int n, const wxString *choices, wxWindow *parent, @@ -172,7 +203,7 @@ IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, const wxString& message, const wxString& caption, int n, const wxString *choices, char **clientData, long style, const wxPoint& pos): - wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL) + wxDialog(parent, -1, caption, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxTAB_TRAVERSAL) { Create(parent, message, caption, n, choices, clientData, style); } @@ -253,6 +284,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& m // Insert a sizer for the buttons wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); buttonSizer->SetName("buttonSizer"); + buttonSizer->SetSpacing(12,0); // Specify constraints for the button sizer wxLayoutConstraints *c = new wxLayoutConstraints; @@ -266,12 +298,12 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& m wxButton *cancel = NULL; if (style & wxOK) { - ok = new wxButton(this, wxID_OK, _("OK")); + ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) ); buttonSizer->AddSizerChild(ok); } if (style & wxCANCEL) { - cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); + cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1)); buttonSizer->AddSizerChild(cancel); } @@ -307,7 +339,7 @@ void wxSingleChoiceDialog::OnOK(wxCommandEvent& WXUNUSED(event)) { m_selection = listBox->GetSelection(); m_stringSelection = listBox->GetStringSelection(); - m_clientData = listBox->GetClientData(m_selection); + m_clientData = (char*)listBox->GetClientData(m_selection); } EndModal(wxID_OK); @@ -320,7 +352,7 @@ void wxSingleChoiceDialog::OnListBoxDClick(wxCommandEvent& WXUNUSED(event)) { m_selection = listBox->GetSelection(); m_stringSelection = listBox->GetStringSelection(); - m_clientData = listBox->GetClientData(m_selection); + m_clientData = (char*)listBox->GetClientData(m_selection); } EndModal(wxID_OK);