void UIRuntimeOutletCollectionConnection::InitFromStory(XIBObject *obj) { ObjectConverter::InitFromStory(obj); _outputClassName = "UIRuntimeOutletCollectionConnection"; // Find the destination we're to plug into const char *destId = getAttrib("destination"); _label = getAttrib("property"); _source = _parent->_parent; ObjectConverter *destObj = (ObjectConverter *) findReference(destId); _destination = destObj; // Check if the destination property is part of our heirarchy XIBObject *curObj = this; while ( curObj ) { if ( curObj == destObj ) { destObj = (ObjectConverter *) _source; break; } curObj = curObj->_parent; } if ( !destObj->_connectedObjects ) destObj->_connectedObjects = new XIBArray(); destObj->_connectedObjects->AddMember(NULL, this); }
void UIViewController::InitFromStory(XIBObject *obj) { ObjectConverterSwapper::InitFromStory(obj); _view = (UIView *) obj->FindMember("view"); if ( _connections ) { for ( int i = 0; i < _connections->count(); i ++ ) { XIBObject *curObj = _connections->objectAtIndex(i); if ( strcmp(curObj->_className, "segue") == 0 ) { const char *pDest = curObj->getAttrib("destination"); const char *pKind = curObj->getAttrib("kind"); XIBObject *newController = findReference(pDest); if ( newController && strcmp(pKind, "relationship") == 0 ) { ((UIViewController *) newController)->_parentViewController = this; _childViewControllers->AddMember(NULL, newController); _viewControllers->AddMember(NULL, newController); } } } } _tabBarItem = (UITabBarItem *) FindMember("tabBarItem"); _navigationItem = (UINavigationItem *) obj->FindMember("navigationItem"); _outputClassName = "UIViewController"; }
void VRMLFile::use(const Char8 *szName) { SceneFileHandler::the()->updateReadProgress(); Time beginUse = getSystemTime(); FieldContainerUnrecPtr pUsedFC; // try to find a container with the given name attachment #ifdef OSG_DEBUG_VRML indentLog(VRMLNodeHelper::getIndent(), PINFO); PINFO << "VRMLFile::use : looking for " << szName << std::endl; VRMLNodeHelper::incIndent(); #endif pUsedFC = findReference(szName); if(pUsedFC == NULL) { PWARNING << "No fieldContainer with name found to use" << szName << std::endl; } else { // assign nodepointer to current sf|mf field if(_pCurrNodeHelper != NULL) { if(pUsedFC->getType().isNode()) { Node *pRootNode = dynamic_pointer_cast<Node>(pUsedFC); pUsedFC = cloneTree(pRootNode); } _pCurrNodeHelper->setContainerFieldValue( pUsedFC, _pCurrentFieldDesc, _pCurrentFieldFC ); } } #ifdef OSG_DEBUG_VRML VRMLNodeHelper::decIndent(); #endif useTime += (getSystemTime() - beginUse); }
void UIRuntimeEventConnection::InitFromStory(XIBObject *obj) { ObjectConverter::InitFromStory(obj); obj->_outputClassName = "UIRuntimeEventConnection"; // Find the destination we're to plug into const char *destId = getAttrib("destination"); if ( strcmp(obj->_className, "action") == 0 ) { _label = getAttrib("selector"); const char *type = getAttrib("eventType"); if ( type ) { if (strcmp(type, "touchUpInside") == 0) { _eventMask = UIControlEventTouchUpInside; } else if (strcmp(type, "touchDown") == 0) { _eventMask = UIControlEventTouchDown; } else { assert(0); } } } else { assert(0); } _source = _parent->_parent; ObjectConverter *destObj = (ObjectConverter *) findReference(destId); _destination = destObj; // Check if the destination property is part of our heirarchy XIBObject *curObj = this; while ( curObj ) { if ( curObj == destObj ) { destObj = (ObjectConverter *) _source; break; } curObj = curObj->_parent; } if ( !destObj->_connectedObjects ) destObj->_connectedObjects = new XIBArray(); destObj->_connectedObjects->AddMember(NULL, this); }
void VRMLFile::addRoute(const Char8 *szOutNodename, const Char8 *szOutFieldname, const Char8 *szInNodename, const Char8 *szInFieldname ) { if(szOutNodename == NULL || szOutFieldname == NULL || szInNodename == NULL || szInFieldname == NULL ) { FWARNING(("addRoute missing params\n")); } FieldContainer *pSrcNode = findReference(szOutNodename); FieldContainer *pDstNode = findReference(szInNodename); AttachmentContainer *pSrc = dynamic_cast<AttachmentContainer *>(pSrcNode); AttachmentContainer *pDst = dynamic_cast<AttachmentContainer *>(pDstNode); if(pSrc == NULL) { FWARNING(("Unknow src node %s\n", szOutNodename)); return; } if(pDstNode == NULL) { FWARNING(("Unknow dst node %s\n", szInNodename)); return; } VRMLGenericAtt *pSrcAtt = dynamic_cast<VRMLGenericAtt *>( pSrc->findAttachment(VRMLGenericAtt::getClassType())); VRMLGenericAtt *pDstAtt = NULL; if(pDst != NULL) { pDstAtt = dynamic_cast<VRMLGenericAtt *>( pDst->findAttachment(VRMLGenericAtt::getClassType())); } if(pSrcAtt == NULL) { Node *pNode = dynamic_cast<Node *>(pSrc); if(pNode != NULL && pNode->getCore() != NULL) { pSrcAtt = dynamic_cast<VRMLGenericAtt *>( pNode->getCore()->findAttachment( VRMLGenericAtt::getClassType())); } } if(pDstAtt == NULL) { Node *pNode = dynamic_cast<Node *>(pDst); if(pNode != NULL && pNode->getCore() != NULL) { pDstAtt = dynamic_cast<VRMLGenericAtt *>( pNode->getCore()->findAttachment( VRMLGenericAtt::getClassType())); } } std::string szOutFName = szOutFieldname; std::string szInFName = szInFieldname; std::string::size_type uiPos = szOutFName.rfind(std::string("_changed")); if(uiPos != std::string::npos) { szOutFName.erase(uiPos, std::string::npos); } uiPos = szInFName.find(std::string("set_")); if(uiPos != std::string::npos) { szInFName.erase(uiPos, uiPos + 4); } if(pSrcAtt != NULL) { VRMLNodeHelper *pHelper = findNodeHelper( pSrcAtt->getVrmlNodeTypename().c_str()); if(pHelper != NULL) { pHelper->mapFieldname(pSrcAtt->getVrmlNodeTypename(), szOutFName); } } if(pSrcAtt != NULL) { VRMLNodeHelper *pHelper = findNodeHelper( pDstAtt->getVrmlNodeTypename().c_str()); if(pHelper != NULL) { pHelper->mapFieldname(pDstAtt->getVrmlNodeTypename(), szInFName); } } addConnection(pSrc, szOutFName.c_str(), pDstNode, szInFName .c_str()); }