projects
/
dcpomatic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add option to give HTMLDialog an OK button.
[dcpomatic.git]
/
src
/
wx
/
html_dialog.cc
diff --git
a/src/wx/html_dialog.cc
b/src/wx/html_dialog.cc
index 873aa718cf5026da1bd3b29c1cca1395b1dae0aa..19c3aaf2a11591987678cf666f105d66c5e7cbd1 100644
(file)
--- a/
src/wx/html_dialog.cc
+++ b/
src/wx/html_dialog.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2018
-2021
Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
This file is part of DCP-o-matic.
@@
-18,31
+18,37
@@
*/
*/
+
#include "html_dialog.h"
#include "wx_util.h"
#include "lib/cross.h"
#include "html_dialog.h"
#include "wx_util.h"
#include "lib/cross.h"
-#include "lib/warnings.h"
-#include <boost/filesystem.hpp>
-DCPOMATIC_DISABLE_WARNINGS
-#include <wx/wxhtml.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
#include <wx/fs_mem.h>
#include <wx/fs_mem.h>
-DCPOMATIC_ENABLE_WARNINGS
-#include <iostream>
+#include <wx/wxhtml.h>
+LIBDCP_ENABLE_WARNINGS
+#include <boost/filesystem.hpp>
-HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html)
+
+#if BOOST_VERSION >= 106100
+using namespace boost::placeholders;
+#endif
+
+
+HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html, bool ok)
: wxDialog (parent, wxID_ANY, title)
{
: wxDialog (parent, wxID_ANY, title)
{
-
wxBoxSizer*
sizer = new wxBoxSizer (wxVERTICAL);
+
auto
sizer = new wxBoxSizer (wxVERTICAL);
wxFileSystem::AddHandler(new wxMemoryFSHandler);
/* Add some resources that are used by HTML passed into this dialog */
wxMemoryFSHandler::AddFile(
"me.jpg",
wxFileSystem::AddHandler(new wxMemoryFSHandler);
/* Add some resources that are used by HTML passed into this dialog */
wxMemoryFSHandler::AddFile(
"me.jpg",
- wxBitmap(
std_to_wx(boost::filesystem::path(shared_path() / "me.jpg").string()
), wxBITMAP_TYPE_JPEG), wxBITMAP_TYPE_JPEG
+ wxBitmap(
bitmap_path("me.jpg"
), wxBITMAP_TYPE_JPEG), wxBITMAP_TYPE_JPEG
);
);
-
wxHtmlWindow*
h = new wxHtmlWindow (this);
+
auto
h = new wxHtmlWindow (this);
h->SetPage (html);
sizer->Add (h, 1, wxEXPAND | wxALL, 6);
h->SetPage (html);
sizer->Add (h, 1, wxEXPAND | wxALL, 6);
@@
-55,9
+61,17
@@
HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html)
SetSize (800, -1);
/* Set height */
SetSize (800, -1);
/* Set height */
- SetSize (h->GetInternalRepresentation()->GetWidth(), h->GetInternalRepresentation()->GetHeight() + 64);
+ SetSize (h->GetInternalRepresentation()->GetWidth(), h->GetInternalRepresentation()->GetHeight() + 256);
+
+ if (ok) {
+ auto buttons = CreateSeparatedButtonSizer(wxOK);
+ if (buttons) {
+ sizer->Add(buttons, wxSizerFlags().Expand().DoubleBorder());
+ }
+ }
}
}
+
void
HTMLDialog::link_clicked (wxHtmlLinkEvent& ev)
{
void
HTMLDialog::link_clicked (wxHtmlLinkEvent& ev)
{