summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-24 11:58:40 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-24 12:23:59 +0100
commitba049fdab4a47023d6d5ee8b5ff9bbb710afbabb (patch)
treebaa7dde1cb12056a787174f9900e08d260d63e8a /src/lib
parentaaf1d809a0ebbc2eb7dcd9ea7146cfe7bb4702f1 (diff)
Support basic drag-and-drop of DKDMs.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dkdm_wrapper.cc2
-rw-r--r--src/lib/dkdm_wrapper.h16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/dkdm_wrapper.cc b/src/lib/dkdm_wrapper.cc
index 316a0581e..809739e06 100644
--- a/src/lib/dkdm_wrapper.cc
+++ b/src/lib/dkdm_wrapper.cc
@@ -75,6 +75,7 @@ DKDMGroup::add (shared_ptr<DKDMBase> child)
{
DCPOMATIC_ASSERT (child);
_children.push_back (child);
+ child->set_parent (dynamic_pointer_cast<DKDMGroup> (shared_from_this ()));
}
void
@@ -83,6 +84,7 @@ DKDMGroup::remove (shared_ptr<DKDMBase> child)
for (list<shared_ptr<DKDMBase> >::iterator i = _children.begin(); i != _children.end(); ++i) {
if (*i == child) {
_children.erase (i);
+ child->set_parent (shared_ptr<DKDMGroup> ());
return;
}
shared_ptr<DKDMGroup> g = dynamic_pointer_cast<DKDMGroup> (*i);
diff --git a/src/lib/dkdm_wrapper.h b/src/lib/dkdm_wrapper.h
index b877722d9..d3ee2a095 100644
--- a/src/lib/dkdm_wrapper.h
+++ b/src/lib/dkdm_wrapper.h
@@ -20,18 +20,32 @@
#include <dcp/encrypted_kdm.h>
#include <libcxml/cxml.h>
+#include <boost/enable_shared_from_this.hpp>
namespace xmlpp {
class Element;
}
-class DKDMBase
+class DKDMGroup;
+
+class DKDMBase : public boost::enable_shared_from_this<DKDMBase>
{
public:
virtual std::string name () const = 0;
virtual void as_xml (xmlpp::Element *) const = 0;
static boost::shared_ptr<DKDMBase> read (cxml::ConstNodePtr node);
+
+ boost::shared_ptr<DKDMGroup> parent () const {
+ return _parent;
+ }
+
+ void set_parent (boost::shared_ptr<DKDMGroup> parent) {
+ _parent = parent;
+ }
+
+private:
+ boost::shared_ptr<DKDMGroup> _parent;
};
class DKDM : public DKDMBase