X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fwx%2Fcontent_widget.h;h=34755e4b5a7e1707b710f45487bc9cdf4934dfd3;hb=dae29c48ed404f8692ac050500937c0f36cd8e47;hp=52a5e5851a9b09ecaef7bcea415b1c7b66007be5;hpb=c04fec82d25127fafa73c3daff87bece9aa8c8e8;p=dcpomatic.git diff --git a/src/wx/content_widget.h b/src/wx/content_widget.h index 52a5e5851..34755e4b5 100644 --- a/src/wx/content_widget.h +++ b/src/wx/content_widget.h @@ -30,7 +30,6 @@ #include #include #include -#include #include /** @class ContentWidget @@ -43,7 +42,7 @@ * @param V Data type of state as used by the view. */ template -class ContentWidget : public boost::noncopyable +class ContentWidget { public: /** @param parent Parent window. @@ -60,12 +59,12 @@ public: wxWindow* parent, T* wrapped, int property, - boost::function (Content*)> part, - boost::function model_getter, - boost::function model_setter, - boost::function view_changed, - boost::function view_to_model, - boost::function model_to_view + std::function (Content*)> part, + std::function model_getter, + std::function model_setter, + std::function view_changed, + std::function view_to_model, + std::function model_to_view ) : _wrapped (wrapped) , _sizer (0) @@ -84,13 +83,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 > List; + typedef std::vector > List; /** Set the content that this control is working on (i.e. the selected content) */ void set_content (List content) @@ -117,12 +119,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 +197,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 +216,12 @@ private: wxButton* _button; List _content; int _property; - boost::function (Content *)> _part; - boost::function _model_getter; - boost::function _model_setter; - boost::function _view_changed; - boost::function _view_to_model; - boost::function _model_to_view; + std::function (Content *)> _part; + std::function _model_getter; + std::function _model_setter; + std::function _view_changed; + std::function _view_to_model; + std::function _model_to_view; std::list _connections; bool _ignore_model_changes; }; @@ -238,10 +240,10 @@ public: wxWindow* parent, wxSpinCtrl* wrapped, int property, - boost::function (Content *)> part, - boost::function getter, - boost::function setter, - boost::function view_changed = boost::function() + std::function (Content *)> part, + std::function getter, + std::function setter, + std::function view_changed = std::function() ) : ContentWidget ( parent, @@ -266,10 +268,10 @@ public: wxWindow* parent, wxSpinCtrlDouble* wrapped, int property, - boost::function (Content *)> part, - boost::function getter, - boost::function setter, - boost::function view_changed = boost::function() + std::function (Content *)> part, + std::function getter, + std::function setter, + std::function view_changed = std::function() ) : ContentWidget ( parent, @@ -294,12 +296,12 @@ public: wxWindow* parent, wxChoice* wrapped, int property, - boost::function (Content *)> part, - boost::function getter, - boost::function setter, - boost::function view_to_model, - boost::function model_to_view, - boost::function view_changed = boost::function() + std::function (Content *)> part, + std::function getter, + std::function setter, + std::function view_to_model, + std::function model_to_view, + std::function view_changed = std::function() ) : ContentWidget ( parent,