- m_dialogStyle = style;
-
- wxBeginBusyCursor();
-
- wxSizer *topSizer = new wxSizer(this, wxSizerShrink);
- topSizer->SetBorder(10, 10);
-
- wxRowColSizer *messageSizer = new wxRowColSizer(topSizer, wxSIZER_COLS, 100);
- messageSizer->SetName("messageSizer");
-
-// bool centre = ((style & wxCENTRE) == wxCENTRE);
-
- wxList messageList;
- wxSplitMessage2(message, &messageList, this, messageSizer);
-
- // Insert a spacer
- wxSpacingSizer *spacingSizer = new wxSpacingSizer(topSizer, wxBelow, messageSizer, 20);
-
- wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS);
- buttonSizer->SetName("buttonSizer");
-
- // Specify constraints for the button sizer
- wxLayoutConstraints *c = new wxLayoutConstraints;
- c->width.AsIs ();
- c->height.AsIs ();
- c->top.Below (spacingSizer);
- c->centreX.SameAs (spacingSizer, wxCentreX);
- buttonSizer->SetConstraints(c);
-
- wxButton *ok = NULL;
- wxButton *cancel = NULL;
- wxButton *yes = NULL;
- wxButton *no = NULL;
-
- if (style & wxYES_NO) {
- yes = new wxButton(this, wxID_YES, _("Yes"));
- no = new wxButton(this, wxID_NO, _("No"));
-
- buttonSizer->AddSizerChild(yes);
- buttonSizer->AddSizerChild(no);
- }
-
- if (style & wxOK) {
- ok = new wxButton(this, wxID_OK, _("OK"));
- buttonSizer->AddSizerChild(ok);
- }
-
- if (style & wxCANCEL) {
- cancel = new wxButton(this, wxID_CANCEL, _("Cancel"));
- buttonSizer->AddSizerChild(cancel);
- }
-
- if (ok)
- {
- ok->SetDefault();
- ok->SetFocus();
- }
- else if (yes)
- {
- yes->SetDefault();
- yes->SetFocus();
- }
-
- Layout();
- Centre(wxBOTH);
-
- wxEndBusyCursor();
+ SetMessageDialogStyle(style);
+
+ bool is_pda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
+
+ wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer *icon_text = new wxBoxSizer( wxHORIZONTAL );
+
+ // 1) icon
+ if (style & wxICON_MASK)
+ {
+ wxBitmap bitmap;
+ switch ( style & wxICON_MASK )
+ {
+ default:
+ wxFAIL_MSG(_T("incorrect log style"));
+ // fall through
+
+ case wxICON_ERROR:
+ bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX);
+ break;
+
+ case wxICON_INFORMATION:
+ bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX);
+ break;
+
+ case wxICON_WARNING:
+ bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX);
+ break;
+
+ case wxICON_QUESTION:
+ bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX);
+ break;
+ }
+ wxStaticBitmap *icon = new wxStaticBitmap(this, wxID_ANY, bitmap);
+ if (is_pda)
+ topsizer->Add( icon, 0, wxTOP|wxLEFT|wxRIGHT | wxALIGN_LEFT, 10 );
+ else
+ icon_text->Add( icon, 0, wxCENTER );
+ }
+
+ // 2) text
+ icon_text->Add( CreateTextSizer( message ), 0, wxALIGN_CENTER | wxLEFT, 10 );
+
+ topsizer->Add( icon_text, 1, wxCENTER | wxLEFT|wxRIGHT|wxTOP, 10 );
+
+#if wxUSE_STATLINE
+ // 3) static line
+ topsizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
+#endif // wxUSE_STATLINE
+
+ // 4) buttons
+ int center_flag = wxEXPAND;
+ if (style & wxYES_NO) center_flag = wxALIGN_CENTRE;
+ topsizer->Add( CreateButtonSizer( style & (wxOK|wxCANCEL|wxYES_NO|wxYES_DEFAULT|wxNO_DEFAULT) ),
+ 0, center_flag | wxALL, 10 );
+
+ SetAutoLayout( true );
+ SetSizer( topsizer );
+
+ topsizer->SetSizeHints( this );
+ topsizer->Fit( this );
+ wxSize size( GetSize() );
+ if (size.x < size.y*3/2)
+ {
+ size.x = size.y*3/2;
+ SetSize( size );
+ }
+
+ Centre( wxBOTH | wxCENTER_FRAME);