Add option to give HTMLDialog an OK button.
authorCarl Hetherington <cth@carlh.net>
Thu, 7 Jul 2022 13:21:04 +0000 (15:21 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 20 Jul 2022 08:25:54 +0000 (10:25 +0200)
src/wx/html_dialog.cc
src/wx/html_dialog.h

index cce62e1eb6a4291c40de4dc45943e3092c55bb1b..19c3aaf2a11591987678cf666f105d66c5e7cbd1 100644 (file)
@@ -35,7 +35,7 @@ using namespace boost::placeholders;
 #endif
 
 
-HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html)
+HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html, bool ok)
        : wxDialog (parent, wxID_ANY, title)
 {
        auto sizer = new wxBoxSizer (wxVERTICAL);
@@ -62,6 +62,13 @@ HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html)
 
        /* Set height */
        SetSize (h->GetInternalRepresentation()->GetWidth(), h->GetInternalRepresentation()->GetHeight() + 256);
+
+       if (ok) {
+               auto buttons = CreateSeparatedButtonSizer(wxOK);
+               if (buttons) {
+                       sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
+               }
+       }
 }
 
 
index 1792d86edbfa524d2a87f2cb3c2d5ef9dc927216..c5a538a5ccb03b3bdc59d908339786d7762b24cb 100644 (file)
@@ -31,7 +31,7 @@ class wxHtmlLinkEvent;
 class HTMLDialog : public wxDialog
 {
 public:
-       HTMLDialog (wxWindow* parent, wxString title, wxString html);
+       HTMLDialog (wxWindow* parent, wxString title, wxString html, bool ok = false);
 
 private:
        void link_clicked (wxHtmlLinkEvent& ev);