]> git.saurik.com Git - wxWidgets.git/commitdiff
fixes for the dialog layout for the multiline labels
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Nov 2001 14:00:10 +0000 (14:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 19 Nov 2001 14:00:10 +0000 (14:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12484 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/progdlgg.cpp

index 12a2aa179762458e2b88f8bee713d0d895fc4e12..94109c5660157d515ff71887c3ae7a598f314cf9 100644 (file)
@@ -128,7 +128,8 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
     c->height.AsIs();
     m_msg->SetConstraints(c);
 
-    wxSize sizeDlg, sizeLabel = m_msg->GetSize();
+    wxSize sizeDlg,
+           sizeLabel = m_msg->GetSize();
     sizeDlg.y = 2*LAYOUT_Y_MARGIN + sizeLabel.y;
 
     wxWindow *lastWindow = m_msg;
@@ -160,11 +161,17 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
     // create the estimated/remaining/total time zones if requested
     m_elapsed = m_estimated = m_remaining = (wxStaticText*)NULL;
 
-    int nTimeLabels = 0;
+    // if we are going to have at least one label, remmeber it in this var
+    wxStaticText *label = NULL;
+
+    // also count how many labels we really have
+    size_t nTimeLabels = 0;
+
     if ( style & wxPD_ELAPSED_TIME )
     {
         nTimeLabels++;
 
+        label =
         m_elapsed = CreateLabel(_("Elapsed time : "), &lastWindow);
     }
 
@@ -172,6 +179,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
     {
         nTimeLabels++;
 
+        label =
         m_estimated = CreateLabel(_("Estimated time : "), &lastWindow);
     }
 
@@ -179,6 +187,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
     {
         nTimeLabels++;
 
+        label =
         m_remaining = CreateLabel(_("Remaining time : "), &lastWindow);
     }
 
@@ -186,7 +195,7 @@ wxProgressDialog::wxProgressDialog(wxString const &title,
     {
         // set it to the current time
         m_timeStart = wxGetCurrentTime();
-        sizeDlg.y += nTimeLabels * (sizeLabel.y + LAYOUT_Y_MARGIN);
+        sizeDlg.y += nTimeLabels * (label->GetSize().y + LAYOUT_Y_MARGIN);
     }
 
     if ( hasAbortButton )