+ for ( size_t n = 0; n < count; n++ )
+ {
+ m_messages.Add(messages[n]);
+ m_severity.Add(severity[n]);
+ m_times.Add(times[n]);
+ }
+
+ m_listctrl = NULL;
+
+ bool isPda = (wxSystemSettings::GetScreenType() <= wxSYS_SCREEN_PDA);
+
+ // create the controls which are always shown and layout them: we use
+ // sizers even though our window is not resizable to calculate the size of
+ // the dialog properly
+ wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
+ wxBoxSizer *sizerAll = new wxBoxSizer(isPda ? wxVERTICAL : wxHORIZONTAL);
+
+ if (!isPda)
+ {
+ wxStaticBitmap *icon = new wxStaticBitmap
+ (
+ this,
+ wxID_ANY,
+ wxArtProvider::GetMessageBoxIcon(style)
+ );
+ sizerAll->Add(icon, wxSizerFlags().Centre());
+ }
+
+ // create the text sizer with a minimal size so that we are sure it won't be too small
+ wxString message = EllipsizeString(messages.Last());
+ wxSizer *szText = CreateTextSizer(message);
+ szText->SetMinSize(wxMin(300, wxGetDisplaySize().x / 3), -1);
+
+ sizerAll->Add(szText, wxSizerFlags(1).Centre().Border(wxLEFT | wxRIGHT));
+
+ wxButton *btnOk = new wxButton(this, wxID_OK);
+ sizerAll->Add(btnOk, wxSizerFlags().Centre());
+
+ sizerTop->Add(sizerAll, wxSizerFlags().Expand().Border());
+
+
+ // add the details pane
+#ifndef __SMARTPHONE__
+ wxCollapsiblePane * const
+ collpane = new wxCollapsiblePane(this, wxID_ANY, ms_details);
+ sizerTop->Add(collpane, wxSizerFlags(1).Expand().Border());
+
+ wxWindow *win = collpane->GetPane();
+ wxSizer * const paneSz = new wxBoxSizer(wxVERTICAL);
+
+ CreateDetailsControls(win);
+
+ paneSz->Add(m_listctrl, wxSizerFlags(1).Expand().Border(wxTOP));
+
+#if wxUSE_CLIPBOARD || CAN_SAVE_FILES
+ wxBoxSizer * const btnSizer = new wxBoxSizer(wxHORIZONTAL);
+
+ wxSizerFlags flagsBtn;
+ flagsBtn.Border(wxLEFT);
+
+#if wxUSE_CLIPBOARD
+ btnSizer->Add(new wxButton(win, wxID_COPY), flagsBtn);
+#endif // wxUSE_CLIPBOARD
+
+#if CAN_SAVE_FILES
+ btnSizer->Add(new wxButton(win, wxID_SAVE), flagsBtn);
+#endif // CAN_SAVE_FILES
+
+ paneSz->Add(btnSizer, wxSizerFlags().Right().Border(wxTOP));
+#endif // wxUSE_CLIPBOARD || CAN_SAVE_FILES
+
+ win->SetSizer(paneSz);
+ paneSz->SetSizeHints(win);
+#else // __SMARTPHONE__
+ SetLeftMenu(wxID_OK);
+ SetRightMenu(wxID_MORE, ms_details + EXPAND_SUFFIX);
+#endif // __SMARTPHONE__/!__SMARTPHONE__
+
+ SetSizerAndFit(sizerTop);
+
+ Centre();
+
+ if (isPda)
+ {
+ // Move up the screen so that when we expand the dialog,
+ // there's enough space.
+ Move(wxPoint(GetPosition().x, GetPosition().y / 2));
+ }
+}
+
+void wxLogDialog::CreateDetailsControls(wxWindow *parent)
+{
+ wxString fmt = wxLog::GetTimestamp();
+ bool hasTimeStamp = !fmt.IsEmpty();
+
+ // create the list ctrl now
+ m_listctrl = new wxListCtrl(parent, wxID_ANY,
+ wxDefaultPosition, wxDefaultSize,
+ wxBORDER_SIMPLE |
+ wxLC_REPORT |
+ wxLC_NO_HEADER |
+ wxLC_SINGLE_SEL);
+#ifdef __WXWINCE__
+ // This makes a big aesthetic difference on WinCE but I
+ // don't want to risk problems on other platforms
+ m_listctrl->Hide();
+#endif
+
+ // no need to translate these strings as they're not shown to the
+ // user anyhow (we use wxLC_NO_HEADER style)
+ m_listctrl->InsertColumn(0, wxT("Message"));
+
+ if (hasTimeStamp)
+ m_listctrl->InsertColumn(1, wxT("Time"));
+
+ // prepare the imagelist
+ static const int ICON_SIZE = 16;
+ wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE);
+
+ // order should be the same as in the switch below!
+ static const char* const icons[] =
+ {
+ wxART_ERROR,
+ wxART_WARNING,
+ wxART_INFORMATION
+ };
+
+ bool loadedIcons = true;
+
+ for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ )
+ {
+ wxBitmap bmp = wxArtProvider::GetBitmap(icons[icon], wxART_MESSAGE_BOX,
+ wxSize(ICON_SIZE, ICON_SIZE));
+
+ // This may very well fail if there are insufficient colours available.
+ // Degrade gracefully.
+ if ( !bmp.IsOk() )
+ {
+ loadedIcons = false;
+
+ break;