Use the appropriate RtAudio exception (though I'm not sure if this
[dcpomatic.git] / src / wx / editable_list.h
index 3ee4359bf8022cfb10c55373745f92bde92836f5..c64c0948168f5ec40b759022efc6becbf060a3f7 100644 (file)
 class EditableListColumn
 {
 public:
-       EditableListColumn (std::string name_)
+       EditableListColumn (wxString name_)
                : name (name_)
                , growable (false)
        {}
 
-       EditableListColumn (std::string name_, boost::optional<int> width_, bool growable_)
+       EditableListColumn (wxString name_, boost::optional<int> width_, bool growable_)
                : name (name_)
                , width (width_)
                , growable (growable_)
        {}
 
-       std::string name;
+       wxString name;
        boost::optional<int> width;
        bool growable;
 };
@@ -78,7 +78,7 @@ public:
                SetSizer (_sizer);
 
                long style = wxLC_REPORT | wxLC_SINGLE_SEL;
-               if (title) {
+               if (!title) {
                        style |= wxLC_NO_HEADER;
                }
 
@@ -87,18 +87,33 @@ public:
                        total_width += i.width.get_value_or (_default_width);
                }
 
+#ifdef __WXGTK3__
+               /* With the GTK3 backend wxListCtrls are hard to pick out from the background of the
+                * window, so put a border in to help.
+                */
+               wxPanel* border = new wxPanel (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxBORDER_THEME);
+               _list = new wxListCtrl (border, wxID_ANY, wxDefaultPosition, wxSize(total_width, 100), style);
+               wxBoxSizer* border_sizer = new wxBoxSizer (wxHORIZONTAL);
+               border_sizer->Add (_list, 1, wxALL | wxEXPAND, 2);
+               border->SetSizer (border_sizer);
+#else
                _list = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize(total_width, 100), style);
+#endif
 
                int j = 0;
                BOOST_FOREACH (EditableListColumn i, _columns) {
                        wxListItem ip;
                        ip.SetId (j);
-                       ip.SetText (std_to_wx(i.name));
+                       ip.SetText (i.name);
                        _list->InsertColumn (j, ip);
                        ++j;
                }
 
+#ifdef __WXGTK3__
+               _sizer->Add (border, 1, wxEXPAND);
+#else
                _sizer->Add (_list, 1, wxEXPAND);
+#endif
 
                {
                        wxSizer* s = new wxBoxSizer (wxVERTICAL);
@@ -121,7 +136,11 @@ public:
 
                _list->Bind (wxEVT_COMMAND_LIST_ITEM_SELECTED, boost::bind (&EditableList::selection_changed, this));
                _list->Bind (wxEVT_COMMAND_LIST_ITEM_DESELECTED, boost::bind (&EditableList::selection_changed, this));
+#if BOOST_VERSION >= 106100
+               _list->Bind (wxEVT_SIZE, boost::bind (&EditableList::resized, this, boost::placeholders::_1));
+#else
                _list->Bind (wxEVT_SIZE, boost::bind (&EditableList::resized, this, _1));
+#endif
 
                refresh ();
                selection_changed ();