本文整理汇总了C++中Fl_Tree_Item::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Tree_Item::add方法的具体用法?C++ Fl_Tree_Item::add怎么用?C++ Fl_Tree_Item::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Tree_Item
的用法示例。
在下文中一共展示了Fl_Tree_Item::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
/// Descend into the path specified by \p arr, and add a new child there.
/// Should be used only by Fl_Tree's internals.
/// Adds the item based on the value of prefs.sortorder().
///
Fl_Tree_Item *Fl_Tree_Item::add(const Fl_Tree_Prefs &prefs, char **arr) {
int t = find_child(*arr);
Fl_Tree_Item *item;
if ( t == -1 ) {
item = (Fl_Tree_Item*)add(prefs, *arr);
} else {
item = (Fl_Tree_Item*)child(t);
}
if ( *(arr+1) ) { // descend?
return(item->add(prefs, arr+1));
} else {
return(item); // end? done
}
}
示例2: init_appendai_list
void init_appendai_list() {
std::shared_ptr<AppendAIPatch> aip = std::dynamic_pointer_cast<AppendAIPatch>(mods->get("aip"));
Fl_Tree* tree = new Fl_Tree(5, 70+40, 254, 70, "Hybrid Enemies Mod");
if(!aip->valid()) {
tree->deactivate();
return;
}
Fl_Tree_Item* first = tree->first();
first->label("Enemy AI");
AppendAIPatch::entity_storage appended_ais = aip->appended_ai();
int idx = 0;
for(unsigned ai : appended_ais) {
first->add(Fl_Tree_Prefs(), AppendAIPatch::FriendlyName(ai).c_str())->user_data(new int(idx));
idx++;
}
new AddAIButton(150, 145+40, 35, 20, "Add");
new RemoveAIButton(190, 145+40, 70, 20, "Remove");
appended_ai_tree = tree;
}