summaryrefslogtreecommitdiff
path: root/src/wx/screens_panel.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-03-13 21:10:36 +0100
committerCarl Hetherington <cth@carlh.net>2022-03-17 22:20:04 +0100
commit76de93fb16f8f2bb08fa2cde106a621169b973ee (patch)
tree3a8a0fee9e509338735bb8560fdf66b804dd9da2 /src/wx/screens_panel.h
parent0eda3196f0e3a4f01bfbd39f24dd924fe0eff8fd (diff)
Replace class shim with a custom comparator.
Diffstat (limited to 'src/wx/screens_panel.h')
-rw-r--r--src/wx/screens_panel.h32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/wx/screens_panel.h b/src/wx/screens_panel.h
index 4885a8454..fc7e9751c 100644
--- a/src/wx/screens_panel.h
+++ b/src/wx/screens_panel.h
@@ -36,25 +36,6 @@ namespace dcpomatic {
class Cinema;
-/** Shim around wxTreeListCtrl so we can use strcoll() to compare things */
-class TreeListCtrl : public wxTreeListCtrl
-{
-public:
- wxDECLARE_DYNAMIC_CLASS (TreeListCtrl);
-
- TreeListCtrl () {}
-
- TreeListCtrl (wxWindow* parent)
- : wxTreeListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTL_MULTIPLE | wxTL_3STATE | wxTL_NO_HEADER)
- {}
-
- virtual ~TreeListCtrl () {}
-
-private:
- int OnCompareItems (wxTreeListItem const& a, wxTreeListItem const& b);
-};
-
-
class ScreensPanel : public wxPanel
{
public:
@@ -83,7 +64,7 @@ private:
boost::optional<std::pair<wxTreeListItem, std::shared_ptr<Cinema>>> cinema_for_operation () const;
wxSearchCtrl* _search;
- TreeListCtrl* _targets;
+ wxTreeListCtrl* _targets;
wxButton* _add_cinema;
wxButton* _edit_cinema;
wxButton* _remove_cinema;
@@ -100,4 +81,15 @@ private:
ScreenMap _selected_screens;
bool _ignore_selection_change;
+
+ class Comparator : public wxTreeListItemComparator
+ {
+ public:
+ int Compare (wxTreeListCtrl* tree_list, unsigned, wxTreeListItem a, wxTreeListItem b) override
+ {
+ return strcoll(wx_to_std(tree_list->GetItemText(a)).c_str(), wx_to_std(tree_list->GetItemText(b)).c_str());
+ }
+ };
+
+ Comparator _comparator;
};