本文整理汇总了C++中Fl_Tree_Item::widget方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Tree_Item::widget方法的具体用法?C++ Fl_Tree_Item::widget怎么用?C++ Fl_Tree_Item::widget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Tree_Item
的用法示例。
在下文中一共展示了Fl_Tree_Item::widget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateParameter
void onelabGroup::updateParameter(onelab::string &p)
{
Fl_Tree_Item *n = _tree->find_item(p.getName().c_str());
if(!n) {
addParameter(p);
return;
}
Fl_Group *grp = (Fl_Group *)n->widget();
// macro button
if(p.getAttribute("Macro") == "Gmsh"){
return;
}
// non-editable value FIXME
if(p.getReadOnly()){
Fl_Output *but = (Fl_Output *)grp->child(0);
but->value(p.getValue().c_str());
return;
}
// simple string (no menu)
if(p.getChoices().empty() && p.getKind() != "file"){
Fl_Input *but = (Fl_Input *)grp->child(0);
but->value(p.getValue().c_str());
return;
}
// general string input TODO
Fl_Input_Choice *but = (Fl_Input_Choice *)grp->child(0);
but->value(p.getValue().c_str());
}
示例2: addParameter
void onelabGroup::addParameter(onelab::parameter &p)
{
if(!p.getVisible() || CTX::instance()->solver.showInvisibleParameters) return;
bool highlight = false;
Fl_Color c;
if(getFlColor(p.getAttribute("Highlight"), c)) highlight = true;
Fl_Tree_Item *n = _tree->add(p.getName().c_str());
if(!n) return;
n->labelsize(FL_NORMAL_SIZE + 4);
_tree->begin();
int ww = _baseWidth - (n->depth() + 1) * _indent;
ww *= _widgetLabelRatio; // FIXME CHANGE THIS
int hh = n->labelsize() + 4;
Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
Fl_Widget *widget = _addParameterWidget(p, ww, hh, n, highlight, c);
grp->end();
if(!_enableTreeWidgetResize) grp->resizable(0);
_treeWidgets.push_back(grp);
widget->copy_label(p.getShortName().c_str());
std::string help = p.getLabel().size() ? p.getLabel() : p.getShortName();
if(p.getHelp().size()) help += ":\n" + p.getHelp();
widget->copy_tooltip(help.c_str());
n->widget(grp);
_tree->end();
if(p.getAttribute("Closed") == "1" && p.getPath().size()) _tree->close(p.getPath().c_str(), 0);
_tree->redraw();
}
示例3: sprintf
viewButton *onelabGroup::getViewButton(int num)
{
char tmp[256];
sprintf(tmp, "0Post-processing/View%d", num);
Fl_Tree_Item *n = _tree->find_item(tmp);
if(n){
Fl_Group *grp = (Fl_Group*)n->widget();
return (viewButton*)grp->child(0);
}
return 0;
}
示例4: _addSolverMenu
void onelabGroup::_addSolverMenu(int num)
{
std::ostringstream path;
path << "0Solver/View" << num;
Fl_Tree_Item *n = _tree->add(path.str().c_str());
int ww = _baseWidth - (n->depth() + 1) * _indent;
int hh = n->labelsize() + 4;
_tree->begin();
Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
new solverButton(1, 1, ww, hh, num, _tree->color());
grp->end();
if(!_enableTreeWidgetResize) grp->resizable(0);
_treeWidgets.push_back(grp);
n->widget(grp);
_tree->end();
}
示例5: _addViewMenu
void onelabGroup::_addViewMenu(int num)
{
std::ostringstream path;
path << "0Post-processing/View" << num;
Fl_Tree_Item *n;
if((n = _tree->find_item(path.str().c_str())) != NULL) { // check if the item already exists
_tree->remove(n);
}
n = _tree->add(path.str().c_str());
int ww = _baseWidth - (n->depth() + 1) * _indent;
int hh = n->labelsize() + 4;
_tree->begin();
Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
new viewButton(1, 1, ww, hh, num, _tree->color());
grp->end();
if(!_enableTreeWidgetResize) grp->resizable(0);
_treeWidgets.push_back(grp);
n->widget(grp);
_tree->end();
}
示例6: _addMenu
void onelabGroup::_addMenu(const std::string &path, Fl_Callback *callback, void *data)
{
Fl_Tree_Item *n = _tree->add(path.c_str());
_tree->begin();
int ww = _baseWidth - (n->depth() + 1) * _indent;
int hh = n->labelsize() + 4;
Fl_Group *grp = new Fl_Group(1, 1, ww, hh);
Fl_Button *but = new Fl_Button(1, 1, ww, hh);
but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);
but->callback(callback, data);
but->box(FL_FLAT_BOX);
but->color(_tree->color());
but->selection_color(_tree->color());
grp->end();
if(!_enableTreeWidgetResize) grp->resizable(0);
_treeWidgets.push_back(grp);
std::string label = path;
std::string::size_type last = path.find_last_of('/');
if(last != std::string::npos) label = path.substr(last + 1);
but->copy_label(label.c_str());
n->widget(grp);
_tree->end();
}