bool TRFactory::WriteDescription(fstream& outfile, const TRDescription& inDescription) { bool theSuccess = true; // Write out the start block outfile << "start" << " " << inDescription.GetType() << " " << inDescription.GetName() << std::endl; // Write out the property tags TRDescription::const_iterator theIter; for(theIter = inDescription.begin(); theIter != inDescription.end(); theIter++) { outfile << " " << theIter->first << " = " << theIter->second << std:: endl; } // Write out the end block. outfile << "end" << std::endl; return theSuccess; }
bool UIPanel::SetClassProperties(const TRDescription& inDesc, Panel* inPanel, CSchemeManager* inSchemeManager) { bool theArgOne, theArgTwo; UIComponent::SetClassProperties(inDesc, inPanel, inSchemeManager); // Position (normalized screen coords) float theXPos = UIDefaultXPos; float theYPos = UIDefaultYPos; theArgOne = inDesc.GetTagValue(UITagXPos, theXPos); theArgTwo = inDesc.GetTagValue(UITagYPos, theYPos); if(theArgOne || theArgTwo) { inPanel->setPos(theXPos*ScreenWidth(), theYPos*ScreenHeight()); } // Width and height (normalized screen coords) float theWidth = UIDefaultWidth; float theHeight = UIDefaultHeight; theArgOne = inDesc.GetTagValue(UITagWidth, theWidth); theArgTwo = inDesc.GetTagValue(UITagHeight, theHeight); if(theArgOne || theArgTwo) { inPanel->setSize(theWidth*ScreenWidth(), theHeight*ScreenHeight()); } // Preferred size (normalized screen coords) float thePreferredWidth = UIDefaultPreferredWidth; float thePreferredHeight = UIDefaultPreferredHeight; theArgOne = inDesc.GetTagValue(UITagPreferredWidth, thePreferredWidth); theArgTwo = inDesc.GetTagValue(UITagPreferredHeight, thePreferredHeight); if(theArgOne || theArgTwo) { inPanel->setPreferredSize(thePreferredWidth*ScreenWidth(), thePreferredHeight*ScreenHeight()); } // Background color (rgba) string theColorString; if(inDesc.GetTagValue(UITagBGColor, theColorString)) { Color theColor; UIStringToColor(theColorString, theColor); inPanel->setBgColor(theColor); } // Foreground color (rgba) if(inDesc.GetTagValue(UITagFGColor, theColorString)) { Color theColor; UIStringToColor(theColorString, theColor); inPanel->setFgColor(theColor); } // Default visibility (bool) bool theTempBool = UIDefaultVisibility; if(inDesc.GetTagValue(UITagVisible, theTempBool)) { inPanel->setVisible(theTempBool); } // Remember the comp name this->SetName(inDesc.GetName()); return true; }