Component* ComponentTypeHandler::createCopyOf (JucerDocument* document, Component& existing) { jassert (getHandlerFor (existing) == this); Component* const newOne = createNewComponent (document); ScopedPointer<XmlElement> xml (createXmlFor (&existing, document->getComponentLayout())); if (xml != nullptr) restoreFromXml (*xml, newOne, document->getComponentLayout()); return newOne; }
Component* ComponentTypeHandler::createCopyOf (JucerDocument* document, Component& existing) { jassert (getHandlerFor (existing) == this); Component* const newOne = createNewComponent (document); XmlElement* const xml = createXmlFor (&existing, document->getComponentLayout()); if (xml != 0) { restoreFromXml (*xml, newOne, document->getComponentLayout()); delete xml; } return newOne; }