[TD]add extensions for drag and drop

This commit is contained in:
wandererfan
2022-11-27 22:23:12 -05:00
committed by WandererFan
parent 7ce5c2dcf4
commit da06fc45a2
16 changed files with 656 additions and 51 deletions

View File

@@ -56,20 +56,30 @@ PROPERTY_SOURCE(TechDrawGui::ViewProviderTemplate, Gui::ViewProviderDocumentObje
//**************************************************************************
// Construction/Destruction
ViewProviderTemplate::ViewProviderTemplate()
ViewProviderTemplate::ViewProviderTemplate() :
m_myName(std::string())
{
initExtension(this);
sPixmap = "TechDraw_TreePageTemplate";
DisplayMode.setStatus(App::Property::Hidden, true);
}
ViewProviderTemplate::~ViewProviderTemplate()
void ViewProviderTemplate::attach(App::DocumentObject *pcFeat)
{
// Base::Console().Message("VPT::attach(%s)\n", pcFeat->getNameInDocument());
ViewProviderDocumentObject::attach(pcFeat);
auto feature = getTemplate();
if (feature) {
m_myName = feature->getNameInDocument();
}
}
void ViewProviderTemplate::updateData(const App::Property* prop)
{
//This doesn't belong here. Should be in attach?
//This doesn't belong here. Should be in a ViewProviderSvgTemplate?
if (getTemplate()->isDerivedFrom(TechDraw::DrawSVGTemplate::getClassTypeId())) {
auto t = static_cast<TechDraw::DrawSVGTemplate*>(getTemplate());
if (prop == &(t->Template)) {
@@ -217,3 +227,8 @@ TechDraw::DrawTemplate* ViewProviderTemplate::getTemplate() const
{
return dynamic_cast<TechDraw::DrawTemplate*>(pcObject);
}
const char* ViewProviderTemplate::whoAmI() const
{
return m_myName.c_str();
}