summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-05-22 23:33:40 +0200
committerCarl Hetherington <cth@carlh.net>2021-06-25 21:58:38 +0200
commit8eaf36467713e7ba9a1a2272a44aa1581e31c1b0 (patch)
tree8d79c388363803e0f811331e50c43e4e1cc71467
parentb7aa70911ed89511c2dc8b430e3c348a43b9c020 (diff)
Extract gui_is_dark() to wx_util.
-rw-r--r--src/wx/simple_video_view.cc9
-rw-r--r--src/wx/wx_util.cc12
-rw-r--r--src/wx/wx_util.h1
3 files changed, 14 insertions, 8 deletions
diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc
index 0df4d6d22..1740e0ffd 100644
--- a/src/wx/simple_video_view.cc
+++ b/src/wx/simple_video_view.cc
@@ -75,14 +75,7 @@ SimpleVideoView::paint ()
dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));
}
-#if defined(DCPOMATIC_OSX) && wxCHECK_VERSION(3, 1, 0)
- auto appearance = wxSystemSettings::GetAppearance();
- auto dark = appearance.IsDark();
-#else
- auto dark = false;
-#endif
-
- auto const pad_colour = (_viewer->pad_black() || dark) ? wxColour(0, 0, 0) : wxColour(240, 240, 240);
+ auto const pad_colour = (_viewer->pad_black() || gui_is_dark()) ? wxColour(0, 0, 0) : wxColour(240, 240, 240);
if (out_size.width < panel_size.GetWidth()) {
wxPen p (pad_colour);
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 1a34e5fa8..a0beb8f72 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -661,3 +661,15 @@ small_button_size (wxWindow* parent, wxString text)
return size;
}
+
+bool
+gui_is_dark ()
+{
+#if defined(DCPOMATIC_OSX) && wxCHECK_VERSION(3, 1, 0)
+ auto appearance = wxSystemSettings::GetAppearance();
+ return appearance.IsDark();
+#else
+ return false;
+#endif
+}
+
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index aa3dc60db..585a30611 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -119,6 +119,7 @@ extern bool display_progress (wxString title, wxString task);
extern bool report_errors_from_last_job (wxWindow* parent);
extern wxString bitmap_path (std::string name);
extern wxSize small_button_size (wxWindow* parent, wxString text);
+extern bool gui_is_dark ();
struct Offset