Fix macOS build.
[dcpomatic.git] / src / wx / content_widget.h
index 52a5e5851a9b09ecaef7bcea415b1c7b66007be5..788d1449a3fa45ffc0717e41ead97077ecc68b13 100644 (file)
 
 */
 
+
 /** @file  src/wx/content_widget.h
  *  @brief ContentWidget class.
  */
 
+
 #ifndef DCPOMATIC_CONTENT_WIDGET_H
 #define DCPOMATIC_CONTENT_WIDGET_H
 
+
 #include "wx_util.h"
 #include "lib/content.h"
-#include <wx/wx.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
 #include <wx/gbsizer.h>
 #include <wx/spinctrl.h>
-#include <boost/function.hpp>
+#include <wx/wx.h>
+LIBDCP_ENABLE_WARNINGS
 #include <vector>
 
+
 /** @class ContentWidget
  *  @brief A widget which represents some Content state and which can be used
  *  when multiple pieces of content are selected.
@@ -43,7 +49,7 @@
  *  @param V Data type of state as used by the view.
  */
 template <class S, class T, typename U, typename V>
-class ContentWidget : public boost::noncopyable
+class ContentWidget
 {
 public:
        /** @param parent Parent window.
@@ -60,12 +66,12 @@ public:
                wxWindow* parent,
                T* wrapped,
                int property,
-               boost::function<boost::shared_ptr<S> (Content*)> part,
-               boost::function<U (S*)> model_getter,
-               boost::function<void (S*, U)> model_setter,
-               boost::function<void ()> view_changed,
-               boost::function<U (V)> view_to_model,
-               boost::function<V (U)> model_to_view
+               std::function<std::shared_ptr<S> (Content*)> part,
+               std::function<U (S*)> model_getter,
+               std::function<void (S*, U)> model_setter,
+               std::function<void ()> view_changed,
+               std::function<U (V)> view_to_model,
+               std::function<V (U)> model_to_view
                )
                : _wrapped (wrapped)
                , _sizer (0)
@@ -84,13 +90,16 @@ public:
                _button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ContentWidget::button_clicked, this));
        }
 
+       ContentWidget (ContentWidget const&) = delete;
+       ContentWidget& operator= (ContentWidget const&) = delete;
+
        /** @return the widget that we are wrapping */
        T* wrapped () const
        {
                return _wrapped;
        }
 
-       typedef std::vector<boost::shared_ptr<Content> > List;
+       typedef std::vector<std::shared_ptr<Content> > List;
 
        /** Set the content that this control is working on (i.e. the selected content) */
        void set_content (List content)
@@ -117,12 +126,12 @@ public:
        }
 
        /** Add this widget to a wxGridBagSizer */
-       void add (wxGridBagSizer* sizer, wxGBPosition position, wxGBSpan span = wxDefaultSpan)
+       void add (wxGridBagSizer* sizer, wxGBPosition position, wxGBSpan span = wxDefaultSpan, int flag = 0)
        {
                _sizer = sizer;
                _position = position;
                _span = span;
-               _sizer->Add (_wrapped, _position, _span);
+               _sizer->Add (_wrapped, _position, _span, flag);
        }
 
        /** Update the view from the model */
@@ -195,14 +204,14 @@ private:
        void button_clicked ()
        {
                U const v = boost::bind (_model_getter, _part(_content.front().get()).get())();
-               for (typename List::iterator i = _content.begin (); i != _content.end(); ++i) {
-                       boost::bind (_model_setter, _part(i->get()).get(), v) ();
+               for (auto const& i: _content) {
+                       boost::bind (_model_setter, _part(i.get()).get(), v)();
                }
        }
 
        void model_changed (ChangeType type, int property)
        {
-               if (type == CHANGE_TYPE_DONE && property == _property && !_ignore_model_changes) {
+               if (type == ChangeType::DONE && property == _property && !_ignore_model_changes) {
                        update_from_model ();
                }
        }
@@ -214,12 +223,12 @@ private:
        wxButton* _button;
        List _content;
        int _property;
-       boost::function<boost::shared_ptr<S> (Content *)> _part;
-       boost::function<U (S*)> _model_getter;
-       boost::function<void (S*, U)> _model_setter;
-       boost::function<void ()> _view_changed;
-       boost::function<U (V)> _view_to_model;
-       boost::function<V (U)> _model_to_view;
+       std::function<std::shared_ptr<S> (Content *)> _part;
+       std::function<U (S*)> _model_getter;
+       std::function<void (S*, U)> _model_setter;
+       std::function<void ()> _view_changed;
+       std::function<U (V)> _view_to_model;
+       std::function<V (U)> _model_to_view;
        std::list<boost::signals2::connection> _connections;
        bool _ignore_model_changes;
 };
@@ -238,10 +247,10 @@ public:
                wxWindow* parent,
                wxSpinCtrl* wrapped,
                int property,
-               boost::function<boost::shared_ptr<S> (Content *)> part,
-               boost::function<int (S*)> getter,
-               boost::function<void (S*, int)> setter,
-               boost::function<void ()> view_changed = boost::function<void ()>()
+               std::function<std::shared_ptr<S> (Content *)> part,
+               std::function<int (S*)> getter,
+               std::function<void (S*, int)> setter,
+               std::function<void ()> view_changed = std::function<void ()>()
                )
                : ContentWidget<S, wxSpinCtrl, int, int> (
                        parent,
@@ -266,10 +275,10 @@ public:
                wxWindow* parent,
                wxSpinCtrlDouble* wrapped,
                int property,
-               boost::function<boost::shared_ptr<S> (Content *)> part,
-               boost::function<double (S*)> getter,
-               boost::function<void (S*, double)> setter,
-               boost::function<void ()> view_changed = boost::function<void ()>()
+               std::function<std::shared_ptr<S> (Content *)> part,
+               std::function<double (S*)> getter,
+               std::function<void (S*, double)> setter,
+               std::function<void ()> view_changed = std::function<void ()>()
                )
                : ContentWidget<S, wxSpinCtrlDouble, double, double> (
                        parent,
@@ -294,12 +303,12 @@ public:
                wxWindow* parent,
                wxChoice* wrapped,
                int property,
-               boost::function<boost::shared_ptr<S> (Content *)> part,
-               boost::function<U (S*)> getter,
-               boost::function<void (S*, U)> setter,
-               boost::function<U (int)> view_to_model,
-               boost::function<int (U)> model_to_view,
-               boost::function<void ()> view_changed = boost::function<void()>()
+               std::function<std::shared_ptr<S> (Content *)> part,
+               std::function<U (S*)> getter,
+               std::function<void (S*, U)> setter,
+               std::function<U (int)> view_to_model,
+               std::function<int (U)> model_to_view,
+               std::function<void ()> view_changed = std::function<void()>()
                )
                : ContentWidget<S, wxChoice, U, int> (
                        parent,