GuiControl* GuiInspectorDatablockField::constructEditControl() { GuiControl* retCtrl = new GuiPopUpMenuCtrl(); // If we couldn't construct the control, bail! if( retCtrl == NULL ) return retCtrl; GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl); // Let's make it look pretty. retCtrl->setDataField( StringTable->insert("profile"), NULL, "InspectorTypeEnumProfile" ); menu->setField("text", getData()); _registerEditControl( retCtrl ); // Configure it to update our value when the popup is closed char szBuffer[512]; dSprintf( szBuffer, 512, "%d.apply(%d.getText());%d.inspect(%d);",getId(), retCtrl->getId(),mParent->mParent->getId(), mTarget->getId() ); //dSprintf( szBuffer, 512, "%d.%s = %d.getText();%d.inspect(%d);",mTarget->getId(), getFieldName(), menu->getId(), mParent->mParent->getId(), mTarget->getId() ); menu->setField("Command", szBuffer ); Vector<StringTableEntry> entries; SimDataBlockGroup * grp = Sim::getDataBlockGroup(); for(SimDataBlockGroup::iterator i = grp->begin(); i != grp->end(); i++) { SimDataBlock * datablock = dynamic_cast<SimDataBlock*>(*i); // Skip non-datablocks if we somehow encounter them. if(!datablock) continue; // Ok, now we have to figure inheritance info. if( datablock && datablock->getClassRep()->isClass(mDesiredClass) ) entries.push_back(datablock->getName()); } // sort the entries dQsort(entries.address(), entries.size(), sizeof(StringTableEntry), stringCompare); // add them to our enum for(U32 j = 0; j < entries.size(); j++) menu->addEntry(entries[j], 0); return retCtrl; }
GuiControl* GuiInspectorMountingGroup::buildMenuCtrl() { GuiControl* retCtrl = new GuiPopUpMenuCtrl(); // If we couldn't construct the control, bail! if( retCtrl == NULL ) return retCtrl; GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl); // Let's make it look pretty. retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiPopUpMenuProfile" ); //GuiInspectorTypeMenuBase::_registerEditControl( retCtrl ); char szName[512]; dSprintf( szName, 512, "IE_%s_%d_%s_Field", retCtrl->getClassName(), mParentInspector->getInspectObject()->getId(), mCaption.c_str()); // Register the object retCtrl->registerObject( szName ); // Configure it to update our value when the popup is closed char szBuffer[512]; dSprintf( szBuffer, 512, "%d.apply( %d.getText() );", getId(), menu->getId() ); menu->setField("Command", szBuffer ); return menu; }