- m_dialogStyle = style;
- m_selection = 0;
- m_stringSelection = _T("");
- m_clientData = NULL;
-
- wxBeginBusyCursor();
-
- wxSizer *topSizer = new wxSizer(this, wxSizerShrink);
- topSizer->SetBorder(10, 10);
-
- wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100);
- messageSizer->SetName(_T("messageSizer"));
-
-// bool centre = ((style & wxCENTRE) == wxCENTRE);
-
- wxList messageList;
- wxSplitMessage2(message, &messageList, this, messageSizer);
-
- // Insert a spacer
- wxSpacingSizer *spacingSizer = new wxSpacingSizer(topSizer, wxBelow, messageSizer, 10);
-
- wxListBox *listBox = new wxListBox(this, wxID_LISTBOX, wxPoint(-1, -1), wxSize(240, 160),
- n, choices);
- listBox->SetSelection(m_selection);
- if ( clientData )
- {
- int i;
- for ( i = 0; i < n; i++)
- {
- listBox->SetClientData(i, clientData[i]);
- }
- }
-
- wxRowColSizer *listBoxSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS);
- listBoxSizer->AddSizerChild(listBox);
- listBoxSizer->SetName(_T("listBoxSizer"));
-
- // Create constraints for the text sizer
- wxLayoutConstraints *textC = new wxLayoutConstraints;
- textC->left.SameAs (messageSizer, wxLeft);
- textC->top.Below (spacingSizer);
- listBoxSizer->SetConstraints(textC);
-
- // Insert another spacer
- wxSpacingSizer *spacingSizer2 = new wxSpacingSizer(topSizer, wxBelow, listBoxSizer, 10);
- spacingSizer->SetName(_T("spacingSizer2"));
-
- // Insert a sizer for the buttons
- wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS);
- buttonSizer->SetName(_T("buttonSizer"));
- buttonSizer->SetSpacing(12,0);
-
- // Specify constraints for the button sizer
- wxLayoutConstraints *c = new wxLayoutConstraints;
- c->width.AsIs ();
- c->height.AsIs ();
- c->top.Below (spacingSizer2);
- c->centreX.SameAs (listBoxSizer, wxCentreX);
- buttonSizer->SetConstraints(c);
-
- wxButton *ok = NULL;
- wxButton *cancel = NULL;
-
- if (style & wxOK) {
- ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) );
- buttonSizer->AddSizerChild(ok);
- }
-
- if (style & wxCANCEL) {
- cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1));
- buttonSizer->AddSizerChild(cancel);
- }
-
- if (ok)
- {
- ok->SetDefault();
- ok->SetFocus();
- }
-
- Layout();
- Centre(wxBOTH);
-
- wxEndBusyCursor();
-
- return TRUE;
+ m_selection = 0;
+
+ 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) ,
+ n, choices, wxLB_ALWAYS_SB );
+ m_listbox->SetSelection( m_selection );
+ if (clientData)
+ {
+ for (int i = 0; i < n; i++)
+ m_listbox->SetClientData(i, clientData[i]);
+ }
+ topsizer->Add( m_listbox, 1, wxEXPAND | wxLEFT|wxRIGHT, 15 );
+
+#if wxUSE_STATLINE
+ // 3) static line
+ topsizer->Add( new wxStaticLine( this, -1 ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+#endif
+
+ // 4) buttons
+ topsizer->Add( CreateButtonSizer( wxOK|wxCANCEL ), 0, wxCENTRE | wxALL, 10 );
+
+ SetAutoLayout( TRUE );
+ SetSizer( topsizer );
+
+ topsizer->SetSizeHints( this );
+ topsizer->Fit( this );
+
+ Centre( wxBOTH );
+
+ m_listbox->SetFocus();
+
+ wxEndBusyCursor();
+
+ return TRUE;