+ wxClientDC dc(this);
+ dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+ long widthText;
+#if defined(__VISAGECPP__)
+// have two versions of this in wxWindowDC tp avoid function hiding
+// since there are two of these in wxDCBase, and in turn in wxDC.
+// VA cannot resolve this so:
+ dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL);
+#else
+ dc.GetTextExtent(message, &widthText, (long*)NULL);
+#endif
+
+ m_msg = new wxStaticText(this, -1, message);
+ c = new wxLayoutConstraints;
+ c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN);
+ c->top.SameAs(this, wxTop, 2*LAYOUT_Y_MARGIN);
+ c->width.AsIs();
+ c->height.AsIs();
+ m_msg->SetConstraints(c);
+
+ wxSize sizeDlg, sizeLabel = m_msg->GetSize();
+ sizeDlg.y = 2*LAYOUT_Y_MARGIN + sizeLabel.y;
+
+ wxWindow *lastWindow = m_msg;
+
+ if ( maximum > 0 )
+ {
+ m_gauge = new wxGauge(this, -1, maximum,
+ wxDefaultPosition, wxDefaultSize,
+ wxGA_HORIZONTAL | wxRAISED_BORDER | (style & wxGA_SMOOTH));
+ c = new wxLayoutConstraints;
+ c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN);
+ c->top.Below(m_msg, 2*LAYOUT_Y_MARGIN);
+ c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
+ c->height.AsIs();
+ m_gauge->SetConstraints(c);
+ m_gauge->SetValue(0);
+ lastWindow = m_gauge;
+
+ wxSize sizeGauge = m_gauge->GetSize();
+ sizeDlg.y += 2*LAYOUT_Y_MARGIN + sizeGauge.y;
+ }
+ else
+ m_gauge = (wxGauge *)NULL;
+
+ // create the estimated/remaining/total time zones if requested
+ m_elapsed = m_estimated = m_remaining = (wxStaticText*)NULL;
+
+ int nTimeLabels = 0;
+ if ( style & wxPD_ELAPSED_TIME )
+ {
+ nTimeLabels++;
+
+ m_elapsed = CreateLabel(_("Elapsed time : "), &lastWindow);
+ }
+
+ if ( style & wxPD_ESTIMATED_TIME )
+ {
+ nTimeLabels++;
+
+ m_estimated = CreateLabel(_("Estimated time : "), &lastWindow);
+ }
+
+ if ( style & wxPD_REMAINING_TIME )
+ {
+ nTimeLabels++;
+
+ m_remaining = CreateLabel(_("Remaining time : "), &lastWindow);
+ }
+
+ if ( nTimeLabels > 0 )
+ {
+ // set it to the current time
+ m_timeStart = wxGetCurrentTime();
+ sizeDlg.y += nTimeLabels * (sizeLabel.y + LAYOUT_Y_MARGIN);
+ }
+
+ if ( hasAbortButton )
+ {
+ m_btnAbort = new wxButton(this, wxID_CANCEL, _("Cancel"));
+ c = new wxLayoutConstraints;
+
+ // Windows dialogs usually have buttons in the lower right corner
+#ifdef __WXMSW__
+ c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
+#else // !MSW
+ c->centreX.SameAs(this, wxCentreX);
+#endif // MSW/!MSW
+ c->bottom.SameAs(this, wxBottom, 2*LAYOUT_Y_MARGIN);
+
+ wxSize sizeBtn = wxButton::GetDefaultSize();
+ c->width.Absolute(sizeBtn.x);
+ c->height.Absolute(sizeBtn.y);
+
+ m_btnAbort->SetConstraints(c);
+
+ sizeDlg.y += 2*LAYOUT_Y_MARGIN + sizeBtn.y;
+ }
+ else
+ m_btnAbort = (wxButton *)NULL;
+
+ SetAutoLayout(TRUE);
+ Layout();
+
+ sizeDlg.y += 2*LAYOUT_Y_MARGIN;
+
+ // try to make the dialog not square but rectangular of reasonabel width
+ sizeDlg.x = (wxCoord)wxMax(widthText, 4*sizeDlg.y/3);
+ sizeDlg.x *= 3;
+ sizeDlg.x /= 2;
+ SetClientSize(sizeDlg);
+
+ Centre(wxCENTER_FRAME | wxBOTH);
+
+ if ( m_disableParentOnly )
+ {
+ if ( m_parent )
+ m_parent->Enable(FALSE);
+ }
+ else
+ {
+ wxEnableTopLevelWindows(FALSE);
+ }
+
+ Show(TRUE);
+ Enable(TRUE); // enable this window
+
+ // Update the display (especially on X, GTK)
+ wxYield();
+
+#ifdef __WXMAC__
+ MacUpdateImmediately();
+#endif