summaryrefslogtreecommitdiff
path: root/src/wx/content_sub_panel.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-01-07 16:02:33 +0000
committerCarl Hetherington <cth@carlh.net>2016-01-07 16:02:33 +0000
commitf61777543c611ed3ba818bf1c564322cb71b3009 (patch)
tree64368e19346a821e363fa8b93a6dc8ee65d2cae3 /src/wx/content_sub_panel.cc
parentc51f4dd82ada91d5e1c2c6a9b61089195e1fa85d (diff)
Factor out some common stuff and give a better tooltip on the 'refer' buttons when no DCP is selected.
Diffstat (limited to 'src/wx/content_sub_panel.cc')
-rw-r--r--src/wx/content_sub_panel.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/wx/content_sub_panel.cc b/src/wx/content_sub_panel.cc
index 7ea17c15c..780f31efb 100644
--- a/src/wx/content_sub_panel.cc
+++ b/src/wx/content_sub_panel.cc
@@ -17,10 +17,14 @@
*/
-#include <wx/notebook.h>
#include "content_sub_panel.h"
#include "content_panel.h"
+#include "wx_util.h"
+#include <wx/notebook.h>
+#include <boost/foreach.hpp>
+using std::list;
+using std::string;
using boost::shared_ptr;
ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
@@ -32,3 +36,19 @@ ContentSubPanel::ContentSubPanel (ContentPanel* p, wxString name)
SetSizer (_sizer);
}
+void
+ContentSubPanel::setup_refer_button (wxCheckBox* button, shared_ptr<DCPContent> dcp, bool can_reference, list<string> why_not) const
+{
+ button->Enable (can_reference);
+
+ wxString s;
+ if (!dcp) {
+ s = _("No DCP selected.");
+ } else if (!can_reference) {
+ s = _("Cannot reference this DCP. ");
+ BOOST_FOREACH (string i, why_not) {
+ s += std_to_wx(i) + wxT(" ");
+ }
+ }
+ button->SetToolTip (s);
+}