本文整理汇总了C++中GuiControl::valueFromString方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiControl::valueFromString方法的具体用法?C++ GuiControl::valueFromString怎么用?C++ GuiControl::valueFromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiControl
的用法示例。
在下文中一共展示了GuiControl::valueFromString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFromXml
void GuiContainer::loadFromXml(string file) {
controls.clear();
ofxXmlSettings xml;
res.init(file);
xml.loadFile(file);
loadBaseInfo("view", xml, 0);
x = 0;
y = 0;
load();
//movable = xml.getAttribute("view", "movable", 0, 0);
xml.pushTag("view");
int numControls = xml.getNumTags("control");
for(int i = 0; i < numControls; i++) {
GuiControl *c = instantiator(
xml.getAttribute("control", "type", "", i),
xml.getAttribute("control", "name", "", i),
xml.getAttribute("control", "id", "", i), &res, this);
string valueStr = xml.getAttribute("control", "value", "", i);
if(valueStr!="") {
c->valueFromString(valueStr);
}
c->loadBaseInfo("control", xml, i);
c->load();
c->listeners = listeners;
c->numListeners = numListeners;
c->load(xml, i);
add(c);
}
}
示例2: loadValues
/**
* loads an xml file with the values specified
* in the file. If the file doesn't exist, it just
* returns.
*/
void GuiContainer::loadValues(string file) {
if(!guiFileExists(ofToDataPath(file))) return;
ofxXmlSettings xml;
xml.loadFile(file);
xml.pushTag("values");
int numVals = xml.getNumTags("value");
for(int i = 0; i < numVals; i++) {
string controlId = xml.getAttribute("value", "controlId", "", i);
if(controlId!="") {
GuiControl *ctrl = getControlById(controlId);
if(ctrl!=NULL) {
ctrl->valueFromString(xml.getAttribute("value", "value", "", i));
}
}
}
}
示例3: loadBaseInfo
void GuiControl::loadBaseInfo(string tag, ofxXmlSettings xml, int pos) {
x = xml.getAttribute(tag, "x", 0.f, pos);
y = xml.getAttribute(tag, "y", 0.f, pos);
width = xml.getAttribute(tag, "width", 0.f, pos);
height = xml.getAttribute(tag, "height", 0.f, pos);
controlId = xml.getAttribute(tag, "id", "", pos);
name = xml.getAttribute(tag, "name", "", pos);
vector<ParameterInfo> params = this->getParameterInfo();
for(int i = 0; i < params.size(); i++) {
GuiControl *g = instantiator(params[i].type, "", "", resources, this);
g->valueFromString(xml.getAttribute(tag, params[i].xmlName, "", pos));
// this is re-pointing a pointer - what we actually want to do is copy
memcpy(params[i].value, g->value, sizeof(void*));
}
}