lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master a71c8cd 4/8: Use wxSizerFlags for creating th


From: Greg Chicares
Subject: [lmi-commits] [lmi] master a71c8cd 4/8: Use wxSizerFlags for creating the "About" dialog
Date: Mon, 19 Apr 2021 20:37:29 -0400 (EDT)

branch: master
commit a71c8cd22e84127adc3779a8d8f019b6df77cd04
Author: Vadim Zeitlin <vadim@tt-solutions.com>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Use wxSizerFlags for creating the "About" dialog
    
    This is more readable than using overloaded wxSizer::Add() and avoids
    clang warnings about using bitwise operations on the values of different
    enum types (wxDirection and wxAlignment).
---
 about_dialog.cpp | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/about_dialog.cpp b/about_dialog.cpp
index af13152..c4b8303 100644
--- a/about_dialog.cpp
+++ b/about_dialog.cpp
@@ -78,13 +78,15 @@ int AboutDialog::ShowModal()
         ,"Let me illustrate"
         );
 
+    auto const borderFlags = wxSizerFlags().Border(wxALL, 3);
+
     wxBoxSizer* sizer1 = new(wx) wxBoxSizer(wxHORIZONTAL);
-    sizer1->Add(license_button, 0, wxALL, 3);
-    sizer1->Add(cancel_button , 0, wxALL, 3);
+    sizer1->Add(license_button, borderFlags);
+    sizer1->Add(cancel_button , borderFlags);
 
     wxBoxSizer* sizer0 = new(wx) wxBoxSizer(wxVERTICAL);
-    sizer0->Add(html_window, 1, wxALL                , 0);
-    sizer0->Add(sizer1     , 0, wxALL | wxALIGN_RIGHT, 3);
+    sizer0->Add(html_window, wxSizerFlags().Proportion(1)     );
+    sizer0->Add(sizer1     , wxSizerFlags(borderFlags).Right());
 
     SetSizerAndFit(sizer0);
     Center();
@@ -115,8 +117,8 @@ void AboutDialog::UponReadLicense(wxCommandEvent&)
     button->SetDefault();
 
     wxBoxSizer* sizer = new(wx) wxBoxSizer(wxVERTICAL);
-    sizer->Add(html_window, 1, wxALL | wxEXPAND     , 0);
-    sizer->Add(button     , 0, wxALL | wxALIGN_RIGHT, 6);
+    sizer->Add(html_window, wxSizerFlags().Proportion(1).Expand()  );
+    sizer->Add(button     , wxSizerFlags().Right().Border(wxALL, 6));
     dialog.SetSizerAndFit(sizer);
 
     wxRect r = wxDisplay(wxDisplay::GetFromWindow(this)).GetClientArea();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]