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()); }
int main(int argc, char **argv) { ThemeLoader::init(); IconLoader::init(); win = new EdeWindow(455, 485, "Theme demo"); win->begin(); { Fl_Button* o = new Fl_Button(355, 450, 90, 25, "Load"); o->tooltip("Load predefined theme"); o->callback(load_theme_cb); } // Fl_Button* o { Fl_Menu_Bar* o = new Fl_Menu_Bar(0, 0, 455, 25); o->menu(menu_); } // Fl_Menu_Bar* o { Fl_Round_Button* o = new Fl_Round_Button(5, 285, 90, 25, "round"); o->down_box(FL_ROUND_DOWN_BOX); } // Fl_Round_Button* o { new Fl_Return_Button(5, 195, 90, 25, "button"); } // Fl_Return_Button* o { new Fl_Input(160, 196, 285, 25, "input:"); } // Fl_Input* o { Fl_Output* o = new Fl_Output(160, 225, 285, 25, "output:"); o->value("Some output value"); } // Fl_Output* o { Fl_File_Browser* o = new Fl_File_Browser(5, 30, 210, 125); o->load("/"); } // Fl_File_Browser* o { Fl_Check_Browser* o = new Fl_Check_Browser(220, 30, 225, 125); o->add("foo"); o->add("foo"); o->add("foo"); } // Fl_Check_Browser* o { Fl_Progress* o = new Fl_Progress(5, 160, 210, 25, "progress bar"); o->value(50); } // Fl_Progress* o { Fl_Slider* o = new Fl_Slider(220, 160, 225, 25); o->type(1); o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); } // Fl_Slider* o { new Fl_Light_Button(5, 225, 90, 25, "button"); } // Fl_Light_Button* o { Fl_Check_Button* o = new Fl_Check_Button(5, 255, 90, 25, "check"); o->down_box(FL_DOWN_BOX); } // Fl_Check_Button* o { Fl_File_Input* o = new Fl_File_Input(160, 256, 285, 35, "file:"); o->value("/home/foo/baz/taz.txt"); } // Fl_File_Input* o { Fl_Text_Editor* o = new Fl_Text_Editor(160, 325, 285, 115, "Text editor"); o->buffer(new Fl_Text_Buffer()); } // Fl_Text_Editor* o { Fl_Box* o = new Fl_Box(25, 328, 80, 80, "image"); IconLoader::set(o, "utilities-terminal", ICON_SIZE_MEDIUM); } // Fl_Box* o win->end(); win->show(argc, argv); Fl::run(); ThemeLoader::shutdown(); IconLoader::shutdown(); return 0; }
void info(Fl_Widget* widget, void* vfl) { Fl_Output *output = new Fl_Output(0, 0, 500, 40, "Hello"); output->value("Minesweeper FLTK Creaters: Shahzain Ali"); Fl_Box *pic1 = new Fl_Box(0, 100, 500, 41, ""); pic1->image(Shahz); fl->redraw(); fl->end(); fl->show(); fl->make_current(); }
Fl_Widget *onelabGroup::_addParameterWidget(onelab::function &p, int ww, int hh, Fl_Tree_Item *n, bool highlight, Fl_Color c) { // non-editable value if(1 || p.getReadOnly()){ Fl_Output *but = new Fl_Output(1, 1, ww, hh); but->value("TODO function"); but->align(FL_ALIGN_RIGHT); if(highlight) but->color(c); return but; } }
HelpPageUI::HelpPageUI() { Fl_Window* w; { Fl_Window* o = mainWindow = new Fl_Window(390, 366, "About my image filter :)"); w = o; o->user_data((void*)(this)); { Fl_Output* o = helpText = new Fl_Output(0, 25, 390, 305, " How to ..."); o->type(4); o->align(FL_ALIGN_TOP_LEFT); } { Fl_Button* o = new Fl_Button(130, 335, 135, 25, "OK"); o->callback((Fl_Callback*)cb_OK); } o->end(); } }
void OnUpClick(Fl_Widget * button, void * pVoid) { Fl_Output * pOutput = (Fl_Output *) pVoid; //std::cout << pPrice->ask << " " << button->label() <<std::endl; pOutput->label("Up Clicked"); pOutput->value("500"); Fl_Button *pButton = (Fl_Button *) button; if (strcmp(pButton->label(),"Clicked Up") == 0) { (*pButton).label("again Up"); } else { pButton->label("Clicked Up"); } }
//==== Create & Init Text Output ====// void GroupLayout::AddOutput( StringOutput& string_output, const char* label ) { assert( m_Group && m_Screen ); //==== Button ====// AddParmButton( label ); //==== Add Text Input ====// int iw = FitWidth( m_ButtonWidth, m_InputWidth ); Fl_Output* output = new Fl_Output( m_X, m_Y, iw, m_StdHeight ); output->color( ( Fl_Color )23 ); output->labelfont( 1 ); output->labelsize( 12 ); output->textfont( 1 ); output->textsize( 12 ); m_Group->add( output ); AddX( iw ); AddY( m_StdHeight ); NewLineX(); string_output.Init( m_Screen, output ); }
// add parameter string to tree Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &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); // macro button if(p.getAttribute("Macro") == "Gmsh"){ Fl_Button *but = new Fl_Button(1, 1, ww / _widgetLabelRatio, hh); but->box(FL_FLAT_BOX); but->color(_tree->color()); but->selection_color(_tree->color()); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); //TODO but->callback(onelab_string_button_cb, (void*)path); if(highlight) but->color(c); return but; } // non-editable value if(p.getReadOnly()){ Fl_Output *but = new Fl_Output(1, 1, ww, hh); but->value(p.getValue().c_str()); but->align(FL_ALIGN_RIGHT); if(highlight) but->color(c); return but; } // simple string (no menu) if(p.getChoices().empty() && p.getKind() != "file"){ Fl_Input *but = new Fl_Input(1, 1, ww, hh); but->value(p.getValue().c_str()); //TODO but->callback(onelab_string_input_cb, (void*)path); but->when(FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT); if(highlight) but->color(c); return but; } // general string input Fl_Input_Choice *but = new Fl_Input_Choice(1, 1, ww, hh); std::string multipleSelection = p.getAttribute("MultipleSelection"); if(multipleSelection.size()) ;//but->menubutton()->callback(multiple_selection_menu_cb, but); std::vector<Fl_Menu_Item> menu; for(unsigned int j = 0; j < p.getChoices().size(); j++){ char *str = strdup(p.getChoices()[j].c_str()); _treeStrings.push_back(str); bool divider = (p.getKind() == "file" && j == p.getChoices().size() - 1); int choice = multipleSelection.size() ? FL_MENU_TOGGLE : 0; if(multipleSelection.size() > j && multipleSelection[j] == '1') choice |= FL_MENU_VALUE; Fl_Menu_Item it = {str, 0, 0, 0, divider ? FL_MENU_DIVIDER : choice}; menu.push_back(it); } //if(p.getKind() == "file"){ // Fl_Menu_Item it = {"Choose...", 0, onelab_input_choice_file_chooser_cb, (void*)n}; // menu.push_back(it); // Fl_Menu_Item it2 = {"Edit...", 0, onelab_input_choice_file_edit_cb, (void*)n}; // menu.push_back(it2); // if(GuessFileFormatFromFileName(p.getValue()) >= 0){ // Fl_Menu_Item it3 = {"Merge...", 0, onelab_input_choice_file_merge_cb, (void*)n}; // menu.push_back(it3); // } //} Fl_Menu_Item it = {0}; menu.push_back(it); but->menubutton()->copy(&menu[0]); but->value(p.getValue().c_str()); but->callback(onelab_string_input_choice_cb, (void*)path); but->input()->when(FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT); if(highlight) but->input()->color(c); return but; }
int main(int argc, char *argv[]) { printf("Gaigen HP version 2.0 -- Copyright 2006 University of Amsterdam\n"); // profiling for Gaigen 2: e3ga::g2Profiling::init(); Fl_Output *label; Fl_Output *vlabel; Fl_Output *labelBoxes; g_window = new Fl_Window(1024,612, "HP Index / Gaigen 2"); g_window->size_range(1024,612); g_GLWindow = new glwindow(0, 0, 512, 512, "g_GLWindow"); g_GLWindow->mode(FL_RGB | FL_DEPTH | FL_DOUBLE); g_window->resizable(g_GLWindow); int x, y; y = 0; x = 512; ui_exitButton = new Fl_Button(x, y, 100, 25, "exit"); ui_exitButton->callback(ui_callBack); x += 230; ui_goButton = new Fl_Button(x, y, 100, 25, "Go"); ui_goButton->callback(ui_callBack); x += 110; uif_fieldMenuLabel = new Fl_Output(x, y, 40, 25); uif_fieldMenuLabel->value("field:"); uif_fieldMenuLabel->color(FL_GRAY); uif_fieldMenuLabel->box(FL_FLAT_BOX); uif_fieldMenu= new Fl_Menu_Button(x + 35, y, 130, 25, uif_fieldMenuItem[0].text); uif_fieldMenu->menu(uif_fieldMenuItem); y += 30; x = 512; label = new Fl_Output(x, y, 50, 25); label->value("time: "); label->color(FL_GRAY); label->box(FL_FLAT_BOX); x += 35; g_timingOutput = new Fl_Output(x, y, 95, 25); g_timingOutput->value(""); x += 100; labelBoxes = new Fl_Output(x,y,60,25); labelBoxes->value("Boxes: "); labelBoxes->color(FL_GRAY); labelBoxes->box(FL_FLAT_BOX); x += 50; g_boxesOutput = new Fl_Output(x,y, 50, 25); g_boxesOutput->value(""); x += 100; ui_Dbox = new Fl_Value_Input(x, y, 50, 25, "DBox"); ui_Dbox->step(1); ui_Dbox->range(0,10000); ui_Dbox->callback(ui_callBack); ui_Dbox->value(g_Dcube); x += 70; vlabel = new Fl_Output(x, y, 50, 25); vlabel->value("Value: "); vlabel->color(FL_GRAY); vlabel->box(FL_FLAT_BOX); x += 35; g_hpvalueOutput = new Fl_Output(x, y, 95, 25); g_hpvalueOutput->value(""); y += 25; x = 512; ui_showField = new Fl_Check_Button(x, y, 100, 25, "show field"); ui_showField->callback(ui_callBack); ui_showField->value(g_showField); x += 100; ui_showOctree = new Fl_Check_Button(x, y, 100, 25, "show octree"); ui_showOctree->callback(ui_callBack); ui_showOctree->value(g_showOctree); x += 110; ui_showResult = new Fl_Check_Button(x, y, 100, 25, "show result"); ui_showResult->callback(ui_callBack); ui_showResult->value(g_showResult); x += 100; ui_lighting = new Fl_Check_Button(x, y, 100, 25, "lighting"); ui_lighting->callback(ui_callBack); ui_lighting->value(g_lighting); x += 80; ui_bottom = new Fl_Check_Button(x, y, 100, 25, "show o-all"); ui_bottom->callback(ui_callBack); ui_bottom->value(g_bottom); y += 25; x = 512; ui_sphere = new Fl_Check_Button(x, y, 100, 25, "V sphere"); ui_sphere->callback(ui_callBack); ui_sphere->value(g_showSphere); x += 100; ui_psphere = new Fl_Check_Button(x, y, 100, 25, "P sphere"); ui_psphere->callback(ui_callBack); ui_psphere->value(g_showPSphere); x += 100; ui_nsphere = new Fl_Check_Button(x, y, 100, 25, "M sphere"); ui_nsphere->callback(ui_callBack); ui_nsphere->value(g_showNSphere); x += 100; ui_usphere = new Fl_Check_Button(x, y, 100, 25, "Unit"); ui_usphere->callback(ui_callBack); ui_usphere->value(g_USphere); x += 100; ui_isphere = new Fl_Check_Button(x, y, 100, 25, "Inscribed"); ui_isphere->callback(ui_callBack); ui_isphere->value(g_ISphere); y += 25; x = 512; ui_circ = new Fl_Check_Button(x, y, 100, 25, "Circ"); ui_circ->callback(ui_callBack); ui_circ->value(g_showCirc); y -= 25; // Octree Controls y += 50; Fl_Box* b2 = new Fl_Box(FL_UP_BOX, 512, y, 512, 120, "Octree Controls"); b2->align(FL_ALIGN_TOP); y += 15; x = 513; ui_cubeSizeSlider = new Fl_Value_Slider(x, y, 115, 25, "main cube size"); ui_cubeSizeSlider->type(FL_HOR_NICE_SLIDER); ui_cubeSizeSlider->range(0.5, 10.0); ui_cubeSizeSlider->callback(ui_callBack); ui_cubeSizeSlider->value(g_cubeSize); x += 130; ui_depthSlider = new Fl_Value_Slider(x, y, 115, 25, "max depth"); ui_depthSlider->step(1); ui_depthSlider->type(FL_HOR_NICE_SLIDER); ui_depthSlider->range(0, 12); ui_depthSlider->callback(ui_callBack); ui_depthSlider->value(g_maxDepth); x += 130; ui_gsSlider = new Fl_Value_Slider(x, y, 115, 25, "grid sample"); ui_gsSlider->step(1); ui_gsSlider->type(FL_HOR_NICE_SLIDER); ui_gsSlider->range(1, 20); ui_gsSlider->callback(ui_callBack); ui_gsSlider->value(g_gs); x += 130; ui_adapSlider = new Fl_Value_Slider(x, y, 115, 25, "Adaptive depth"); ui_adapSlider->step(1); ui_adapSlider->type(FL_HOR_NICE_SLIDER); ui_adapSlider->range(0, 20); ui_adapSlider->callback(ui_callBack); ui_adapSlider->value(g_adap); y += 50; Fl_Box* b3; b3 = new Fl_Box(512, y, 512, 20, "Octree Center"); y += 20; x = 513+100; ui_cx = new Fl_Value_Input(x, y, 100, 25, "x"); ui_cx->step(0.05); ui_cx->range(-5.0,5.0); ui_cx->callback(ui_callBack); ui_cx->value(g_cx); x = 513+220; ui_cy = new Fl_Value_Input(x, y, 100, 25, "y"); ui_cy->step(0.05); ui_cy->range(-5.0,5.0); ui_cy->callback(ui_callBack); ui_cy->value(g_cy); x = 513+340; ui_cz = new Fl_Value_Input(x, y, 100, 25, "z"); ui_cz->step(0.05); ui_cz->range(-5.0,5.0); ui_cz->callback(ui_callBack); ui_cz->value(g_cz); // Singularity controls y += 60; Fl_Box* b1 = new Fl_Box(FL_UP_BOX, 512, y, 512, 140, "Singularity Controls"); b1->align(FL_ALIGN_TOP); y += 5; x = 513+170; ui_lineSing = new Fl_Check_Button(x, y, 100, 25, "line sing"); ui_lineSing->callback(ui_callBack); ui_lineSing->value(g_lineSing); x = 513+330; ui_surfSing = new Fl_Check_Button(x, y, 100, 25, "surface sing"); ui_surfSing->callback(ui_callBack); ui_surfSing->value(g_surfSing); y += 20; x = 513+170; ui_falseLineSing = new Fl_Check_Button(x, y, 100, 25, "filter line sing"); ui_falseLineSing->callback(ui_callBack); ui_falseLineSing->value(g_falseLineSing); x = 513+330; ui_falseSurfSing = new Fl_Check_Button(x, y, 100, 25, "filter surface"); ui_falseSurfSing->callback(ui_callBack); ui_falseSurfSing->value(g_falseSurfSing); y += 25; x = 513+160; ui_lratioSlider = new Fl_Value_Slider(x, y, 150, 25, "l ratio"); ui_lratioSlider->type(FL_HOR_NICE_SLIDER); ui_lratioSlider->range(1.0, 50.0); ui_lratioSlider->callback(ui_callBack); ui_lratioSlider->value(g_lratio); x = 513+320; ui_sratioSlider = new Fl_Value_Slider(x, y, 150, 25, "s ratio"); ui_sratioSlider->type(FL_HOR_NICE_SLIDER); ui_sratioSlider->range(1.0, 50.0); ui_sratioSlider->callback(ui_callBack); ui_sratioSlider->value(g_sratio); y += 45; x = 513+5; ui_psingSlider = new Fl_Value_Slider(x, y, 150, 25, "point sing"); ui_psingSlider->type(FL_HOR_NICE_SLIDER); ui_psingSlider->range(0.01,1.0); ui_psingSlider->callback(ui_callBack); ui_psingSlider->value(g_psing); x = 513+160; ui_lsingSlider = new Fl_Value_Slider(x, y, 150, 25, "line sing"); ui_lsingSlider->type(FL_HOR_NICE_SLIDER); ui_lsingSlider->range(0.01,1.0); ui_lsingSlider->callback(ui_callBack); ui_lsingSlider->value(g_lsing); // Vector Field Controls y += 75; Fl_Box* b4 = new Fl_Box(FL_UP_BOX, 512, y, 512, 70, "Vector Field Controls"); b4->align(FL_ALIGN_TOP); y += 15; x = 513; ui_vgsSlider = new Fl_Value_Slider(x, y, 145, 25, "vector sample"); ui_vgsSlider->step(1); ui_vgsSlider->type(FL_HOR_NICE_SLIDER); ui_vgsSlider->range(3, 20); ui_vgsSlider->callback(ui_callBack); ui_vgsSlider->value(g_vgs); x += 160; ui_vectorSizeSlider = new Fl_Value_Slider(x, y, 145, 25, "length"); ui_vectorSizeSlider->type(FL_HOR_NICE_SLIDER); ui_vectorSizeSlider->range(0.5, 10.0); ui_vectorSizeSlider->callback(ui_callBack); ui_vectorSizeSlider->value(g_vectorSize); x += 160; ui_unitField = new Fl_Check_Button(x, y, 100, 25, "unit field"); ui_unitField->callback(ui_callBack); ui_unitField->value(g_unitField); // Parameter controls y += 75; Fl_Box* b5 = new Fl_Box(FL_UP_BOX, 1, y, 1022, 70, "Vortex Parameters"); b5->align(FL_ALIGN_TOP); y += 15; x = 10; ui_omegaSlider = new Fl_Value_Slider(x, y, 145, 25, "Omega"); ui_omegaSlider->type(FL_HOR_NICE_SLIDER); ui_omegaSlider->range(0.,10.); ui_omegaSlider->callback(ui_callBack); ui_omegaSlider->value(g_omega); x += 160; ui_gammaSlider = new Fl_Value_Slider(x, y, 145, 25, "Gamma"); ui_gammaSlider->type(FL_HOR_NICE_SLIDER); ui_gammaSlider->range(0., 10.); ui_gammaSlider->callback(ui_callBack); ui_gammaSlider->value(g_gamma); x += 160; ui_RcoreSlider = new Fl_Value_Slider(x, y, 145, 25, "R"); ui_RcoreSlider->type(FL_HOR_NICE_SLIDER); ui_RcoreSlider->range(0.5, 10.0); ui_RcoreSlider->callback(ui_callBack); ui_RcoreSlider->value(g_Rcore); x += 160; ui_dxSlider = new Fl_Value_Slider(x, y, 145, 25, "dx"); ui_dxSlider->type(FL_HOR_NICE_SLIDER); ui_dxSlider->range(0.0, 2.0); ui_dxSlider->callback(ui_callBack); ui_dxSlider->value(g_dx); x += 160; ui_dySlider = new Fl_Value_Slider(x, y, 145, 25, "dy"); ui_dySlider->type(FL_HOR_NICE_SLIDER); ui_dySlider->range(0.0, 2.0); ui_dySlider->callback(ui_callBack); ui_dySlider->value(g_dy); x += 160; ui_dzSlider = new Fl_Value_Slider(x, y, 145, 25, "dz"); ui_dzSlider->type(FL_HOR_NICE_SLIDER); ui_dzSlider->range(0.0, 2.0); ui_dzSlider->callback(ui_callBack); ui_dzSlider->value(g_dz); g_window->end(); g_window->show(argc, argv); // Fl::add_timeout(1.0f, timerCallback); Fl::run(); // e3ga::printProfile(); //Sleep(10000); return 0; }