15c043f1aa693f6d5167ac2332dbbf6c362c83e7
[dcpomatic.git] / src / wx / recipients_panel.h
1 /*
2     Copyright (C) 2015-2020 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include "lib/dkdm_recipient.h"
22 #include <wx/wx.h>
23 #include <wx/srchctrl.h>
24 #include <wx/treectrl.h>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/signals2.hpp>
27 #include <list>
28 #include <map>
29
30 class DKDMRecipient;
31
32 class RecipientsPanel : public wxPanel
33 {
34 public:
35         explicit RecipientsPanel (wxWindow* parent);
36         ~RecipientsPanel ();
37
38         void setup_sensitivity ();
39
40         std::list<boost::shared_ptr<DKDMRecipient> > recipients () const;
41         boost::signals2::signal<void ()> RecipientsChanged;
42
43 private:
44         void add_recipients ();
45         void add_recipient (boost::shared_ptr<DKDMRecipient>);
46         void add_recipient_clicked ();
47         void edit_recipient_clicked ();
48         void remove_recipient_clicked ();
49         void selection_changed_shim (wxTreeEvent &);
50         void selection_changed ();
51         void search_changed ();
52
53         wxSearchCtrl* _search;
54         wxTreeCtrl* _targets;
55         wxButton* _add_recipient;
56         wxButton* _edit_recipient;
57         wxButton* _remove_recipient;
58         wxTreeItemId _root;
59
60         typedef std::map<wxTreeItemId, boost::shared_ptr<DKDMRecipient> > RecipientMap;
61         RecipientMap _recipients;
62         RecipientMap _selected;
63
64         bool _ignore_selection_change;
65 };