本文整理汇总了C++中UIElement::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ UIElement::getName方法的具体用法?C++ UIElement::getName怎么用?C++ UIElement::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement::getName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Button
UIElement *UserInterface::createElement(SlotType *iter, UIElement* parent) {
UIElement *el = nullptr;
// ----------- КНОПКА
if (iter->choiceValue.button != nullptr) {
Button *b = new Button(iter);
el = b;
buttonIndex[b->getName()] = b;
} else if (iter->choiceValue.image != nullptr) {
el = new Image(iter);
} else if (iter->choiceValue.text != nullptr) {
el = new TextLabel(iter);
} else if (iter->choiceValue.tableContainer != nullptr) {
TableContainer *tabCont = new TableContainer(iter);
for (auto subIter : iter->choiceValue.tableContainer->slot) {
tabCont->add(createElement(subIter, tabCont));
}
tabCont->pack();
el = tabCont;
tableIndex[tabCont->getName()] = tabCont;
} else if (iter->choiceValue.input != nullptr) {
InputField *ipf = new InputField(iter);
el = ipf;
inputIndex[ipf->getName()] = ipf;
} else if (iter->choiceValue.ddlb != nullptr) {
DropDownListBox *lb = new DropDownListBox(iter);
ddlbIndex[lb->getName()] = lb;
el = lb;
} else if (iter->choiceValue.context != nullptr) {
ButtonContextMenu *b = new ButtonContextMenu(iter);
el = b;
if (b->getName().size() > 0) {
if (contextMenuIndex.find(el->getName()) != contextMenuIndex.end()) {
logger.warn("Context Menu with name %s already exists!", el->getName().c_str());
}
contextMenuIndex[el->getName()] = b;
}
} else if (iter->choiceValue.dialog != nullptr) {
Dialog *d = new Dialog(iter);
for (auto subIter : iter->choiceValue.dialog->slot) {
d->add(createElement(subIter));
}
el = d;
} else if (iter->choiceValue.imagePicker != nullptr) {
ImagePicker *ip = new ImagePicker(iter);
imagePickerIndex[ip->getName()] = ip;
el = ip;
} else if (iter->choiceValue.rgb != nullptr) {
RGBSlider *s = new RGBSlider(iter);
el = s;
rgbSliderIndex[s->getName()] = s;
} else if (iter->choiceValue.healthbar != nullptr) {
el = new Healthbar(iter);
} else if (iter->choiceValue.slider != nullptr) {
Slider *s = new Slider(iter);
el = s;
sliderIndex[s->getName()] = s;
} else if (iter->choiceValue.checkbox != nullptr) {
Checkbox *lb = new Checkbox(iter);
checkboxIndex[lb->getName()] = lb;
el = lb;
} else if (iter->choiceValue.radio != nullptr) {
RadioButton *r = new RadioButton(iter);
checkboxIndex[r->getName()] = r;
el = r;
} else if (iter->choiceValue.labelsList!=nullptr){
LabelsList* ll = new LabelsList(iter);
el = ll;
} else if (iter->choiceValue.lineContainer!=nullptr){
el = new LineContainer(iter);
} else if(iter->choiceValue.containerSelector!=nullptr){
ContainerSelector* cs;
if(parent==nullptr) {
cs = new ContainerSelector(iter,nullptr);
}else{
TableContainer *contParent = dynamic_cast<TableContainer *>(parent);
if(contParent==nullptr){
logger.error("ContainerSelector [%s] parent can be only TableContainer", iter->name.c_str());
return nullptr;
}
cs = new ContainerSelector(iter,contParent);
}
containerSelectorIndex[cs->getName()]=cs;
el=cs;
}
//common atrs
if (el != nullptr) {
el->setVisible(iter->visible);
el->setEnabled(iter->enabled);
}
return el;
}