本文整理汇总了C++中Fl_Choice::copy方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Choice::copy方法的具体用法?C++ Fl_Choice::copy怎么用?C++ Fl_Choice::copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Choice
的用法示例。
在下文中一共展示了Fl_Choice::copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_dlg
//-----------------------------------------------------------------------------
void NrmDlg::create_dlg()
{
Fl_Menu_Item k[]={{"x"}, {"y"}, { "z"}, {0}};
wnd = new Fl_Double_Window(135, 215);
min = new Fl_Value_Input(10, 25, 115, 25, mgl_gettext("Minimal value (v1)"));
min->align(FL_ALIGN_TOP_LEFT);
min->tooltip(mgl_gettext("Minimal value for resulting data values"));
max = new Fl_Value_Input(10, 70, 115, 25, mgl_gettext("Maximal value (v2)"));
max->align(FL_ALIGN_TOP_LEFT);
max->tooltip(mgl_gettext("Maximal value for resulting data values"));
dir = new Fl_Choice(10, 115, 115, 25, mgl_gettext("Direction"));
dir->align(FL_ALIGN_TOP_LEFT); dir->copy(k);
dir->tooltip(mgl_gettext("Direction along which data will be filled"));
sym = new Fl_Check_Button(10, 115, 115, 25, mgl_gettext("Symetrical range"));
sym->tooltip(mgl_gettext("Normalize in symmetrical range: -max(|v1|,|v2|) ... max(|v1|,|v2|)"));
Fl_Button *o;
o = new Fl_Button(25, 150, 85, 25, mgl_gettext("Cancel")); o->callback(close_dlg_cb,wnd);
o->box(UDAV_UP_BOX); o->down_box(UDAV_DOWN_BOX);
o->tooltip(mgl_gettext("Do nothing and close this window"));
o = new Fl_Return_Button(25, 180, 85, 25, mgl_gettext("Change"));o->callback(nrm_dlg_cb,wnd);
o->box(UDAV_UP_BOX); o->down_box(UDAV_DOWN_BOX);
o->tooltip(mgl_gettext("Change data values and close this window"));
wnd->end();
}
示例2: strdup
// add a parameter number to the tree
Fl_Widget *onelabGroup::_addParameterWidget(onelab::number &p, int ww, int hh, Fl_Tree_Item *n, bool highlight, Fl_Color c)
{
char *path = strdup(getPath(n).c_str());
_treeStrings.push_back(path);
// enumeration (display choices as value labels, not numbers)
if(p.getChoices().size() &&
p.getChoices().size() == p.getValueLabels().size()){
Fl_Choice *but = new Fl_Choice(1, 1, ww, hh);
std::vector<Fl_Menu_Item> menu;
std::map<double, std::string> labels(p.getValueLabels());
for(std::map<double, std::string>::iterator it = labels.begin();
it != labels.end(); it++){
char *str = strdup(it->second.c_str());
_treeStrings.push_back(str);
Fl_Menu_Item menuItem = {str, 0, 0, 0, 0};
if(highlight) menuItem.labelcolor(c);
menu.push_back(menuItem);
}
Fl_Menu_Item it = {0};
menu.push_back(it);
but->copy(&menu[0]);
for(unsigned int i = 0; i < p.getChoices().size(); i++){
if(p.getValue() == p.getChoices()[i]){
but->value(i);
break;
}
}
but->callback(onelab_number_choice_cb, (void*)path);
but->align(FL_ALIGN_RIGHT);
if(p.getReadOnly()) but->deactivate();
return but;
}
// check box (boolean choice)
if(p.getChoices().size() == 2 &&
p.getChoices()[0] == 0 && p.getChoices()[1] == 1){
n->labelsize(FL_NORMAL_SIZE + 2);
Fl_Check_Button *but = new Fl_Check_Button(1, 1, ww / _widgetLabelRatio, hh);
but->box(FL_FLAT_BOX);
but->color(_tree->color());
but->value(p.getValue());
but->callback(onelab_number_check_button_cb, (void*)path);
if(highlight) but->color(c);
if(p.getReadOnly()) but->deactivate();
return but;
}
// non-editable value
if(p.getReadOnly()){
outputRange *but = new outputRange(1, 1, ww, hh);
//TODO but->callback(onelab_number_output_range_cb, (void*)path);
but->value(p.getValue());
but->align(FL_ALIGN_RIGHT);
but->graph(p.getAttribute("Graph"));
if(highlight) but->color(c);
return but;
}
// general number input
inputRange *but = new inputRange(1, 1, ww, hh, onelab::parameter::maxNumber(),
p.getAttribute("ReadOnlyRange") == "1");
but->value(p.getValue());
but->minimum(p.getMin());
but->maximum(p.getMax());
but->step(p.getStep());
but->choices(p.getChoices());
but->loop(p.getAttribute("Loop"));
but->graph(p.getAttribute("Graph"));
but->callback(onelab_number_input_range_cb, (void*)path);
but->when(FL_WHEN_RELEASE | FL_WHEN_ENTER_KEY);
but->align(FL_ALIGN_RIGHT);
if(highlight) but->color(c);
return but;
}