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;
}
Esempio n. 2
0
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;
}