summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-03-01 22:40:57 +0100
committerCarl Hetherington <cth@carlh.net>2022-03-14 00:14:08 +0100
commit413372cf0010018cc8de579f3ae324e59654e8d8 (patch)
treea2b2dd1bfd28e171fb7ab832a344b36c3fb73dcc
parentde743387f7ac947a6effbf36039583d9cb3c60ac (diff)
Add search_ctrl_height()
-rw-r--r--src/wx/screens_panel.cc8
-rw-r--r--src/wx/wx_util.cc12
-rw-r--r--src/wx/wx_util.h1
3 files changed, 14 insertions, 7 deletions
diff --git a/src/wx/screens_panel.cc b/src/wx/screens_panel.cc
index 0038a30fb..c5aea4223 100644
--- a/src/wx/screens_panel.cc
+++ b/src/wx/screens_panel.cc
@@ -47,13 +47,7 @@ ScreensPanel::ScreensPanel (wxWindow* parent)
{
auto sizer = new wxBoxSizer (wxVERTICAL);
-#ifdef __WXGTK3__
- int const height = 30;
-#else
- int const height = -1;
-#endif
-
- _search = new wxSearchCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, height));
+ _search = new wxSearchCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200, search_ctrl_height()));
#ifndef __WXGTK3__
/* The cancel button seems to be strangely broken in GTK3; clicking on it twice sometimes works */
_search->ShowCancelButton (true);
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 62e3de9cc..beab1151c 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -688,3 +688,15 @@ dpi_scale_factor (wxWindow*)
}
#endif
+
+
+int
+search_ctrl_height ()
+{
+#ifdef __WXGTK3__
+ return 30;
+#else
+ return -1;
+#endif
+}
+
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index cd9a06a4f..5057ad423 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -121,6 +121,7 @@ extern wxString bitmap_path (std::string name);
extern wxSize small_button_size (wxWindow* parent, wxString text);
extern bool gui_is_dark ();
extern double dpi_scale_factor (wxWindow* window);
+extern int search_ctrl_height ();
struct Offset