// add a widget to both the ML and Juce worlds. The widget is retained by the Juce Component. // void MLWidgetContainer::addWidget(MLWidget* pW, const MLSymbol name) { MLSymbol newName; if (name) { if(mWidgets.find(name) != mWidgets.end()) { debug() << "MLWidgetContainer::addWidget: name " << name << " already taken! \n"; debug() << mWidgets.size() << " widgets:\n"; dumpWidgets(); theSymbolTable().dump(); theSymbolTable().audit(); } else { newName = name; } } else // get name for anon widgets { newName = mWidgetNamer.nextName(); } if(newName) { mWidgets[newName] = pW; pW->setWidgetName(newName); } pW->setContainer(this); // add parent JUCE component getComponent()->addChildComponent(pW->getComponent()); }
// add a widget to both the ML and Juce worlds. The widget is retained by the Juce Component. // void MLWidgetContainer::addWidget(MLWidget* pW, const ml::Symbol name) { // should be setView() pW->setContainer(this); // give root context pointer to all new containers if(pW->isWidgetContainer()) { MLWidgetContainer& resultContainer = static_cast<MLWidgetContainer&>(*pW); // all Containers in a tree of Widgets have pointers to the same root context. resultContainer.setRootView(getRootView()); } ml::Symbol newName; if (name) { if(mWidgets.find(name) != mWidgets.end()) { //debug() << "MLWidgetContainer::addWidget: name " << name << " already taken! \n"; //debug() << mWidgets.size() << " widgets:\n"; dumpWidgets(); ml::theSymbolTable().dump(); ml::theSymbolTable().audit(); } else { newName = name; } } else // get name for anon widgets { newName = mWidgetNamer.nextName(); } if(newName) { mWidgets[newName] = pW; pW->setWidgetName(newName); } // add parent JUCE component getComponent()->addChildComponent(pW->getComponent()); }