Scheme_Object* spark_fltk_button::when(int argc, Scheme_Object** argv) { DEFAULT_RET_INIT; Fl_Button* button = _get_fl_button(argc, argv, 0); if (button) { if (argc == 1) { Fl_When w = button->when(); long i = static_cast<long>(w); _ret_ = scheme_make_integer(i); } else { long i = 0; Fl_When w; if (spark::Utils::long_from_scheme_long(argv[1], i)) { w = static_cast<Fl_When>(i); button->when(w); _ret_ = scheme_true; } } } DEFAULT_RET_FINISH; }
Scheme_Object* spark_fltk_button::type(int argc, Scheme_Object** argv) { DEFAULT_RET_INIT; Fl_Button* button = _get_fl_button(argc, argv, 0); if (button) { if (argc == 1) { int i = button->type(); _ret_ = scheme_make_integer(i); } else { int i = 0; if (spark::Utils::int_from_scheme_long(argv[1], i)) { button->type(i); _ret_ = scheme_true; } } } DEFAULT_RET_FINISH; }
void cb_open_about() { { a_diag = new Fl_Double_Window(210, 165, "About"); a_diag->color((Fl_Color)29); { a_mess = new Fl_Group(5, 10, 200, 45, "Calc 80"); a_mess->box(FL_RFLAT_BOX); a_mess->color((Fl_Color)206); a_mess->labelsize(21); a_mess->align(Fl_Align(FL_ALIGN_CENTER)); a_mess->end(); } // Fl_Group* a_mess { Fl_Group* o = new Fl_Group(5, 70, 205, 25, "Version 0.04"); o->align(Fl_Align(FL_ALIGN_CENTER)); o->end(); } // Fl_Group* o { Fl_Group* o = new Fl_Group(10, 95, 200, 25, "\302\251""2016, Patrik Wallander"); o->align(Fl_Align(FL_ALIGN_CENTER)); o->end(); } // Fl_Group* o { Fl_Button* o = new Fl_Button(70, 135, 70, 20, "Close"); o->box(FL_RFLAT_BOX); o->color(FL_BACKGROUND2_COLOR); o->callback((Fl_Callback*)cb_close_about); } // Fl_Button* o a_diag->show(); a_diag->position(m_win->x(), m_win->y()); a_diag->end(); } // Fl_Double_Window* a_diag }
void MainForm::BtnSigNDel0_Click(Fl_Widget *w, void *data) { try { Fl_Button *lpbtn = (Fl_Button *)w; MainForm *lpwnd = (MainForm *)data; string tmp = lpwnd->Output->value(); if(tmp == "0" && lpbtn->label() == "-")//特殊情况 { lpwnd->Output->value("-"); return; } if(lpwnd->mode == 1)//单步模式 { lpwnd->UpWnd->value((tmp + " =").c_str()); Calculator *calc = new Calculator(tmp + ";"); double val = calc->calculate(); stringstream ss; ss.precision(10); ss<<val; ss>>tmp; delete calc; } tmp += lpbtn->label(); lpwnd->Output->value(tmp.c_str()); }
void OnStartClick(Fl_Widget * button, void * pVoid) { Price * pPrice = (Price *) pVoid; //std::cout << pPrice->ask << " " << button->label() <<std::endl; std::string strLbl = button->label(); //const char * strLbl = button->label(); //int nSize = strlen(strLbl); (pPrice->bid); Fl_Button *pButton = (Fl_Button *) button; // all FLTK objects are derived from class Fl_Widget. // here, we are casting the pointer button of type Fl_Widget to // a pointer of class Fl_Button // button was pointing to the button that calls this function /* if (strcmp(pButton->label(),"Clicked") == 0) { pButton->label("again"); } else { pButton->label("Clicked"); } */ pButton->label("mine!"); }
Scheme_Object* spark_fltk_button::state(int argc, Scheme_Object** argv) { DEFAULT_RET_INIT; Fl_Button* button = _get_fl_button(argc, argv, 0); if (button) { if (argc == 1) { char c = button->value(); _ret_ = c ? scheme_true : scheme_false; } else { int i = 0; if (spark::Utils::int_from_scheme_long(argv[1], i)) { button->value(i); _ret_ = scheme_true; } } } DEFAULT_RET_FINISH; }
int main() { Fl_Window* w = new Fl_Window(width,height); Widgets widgets; w->begin(); widgets.img[0] = new Fl_JPEG_Image("f1.jpg"); widgets.img[1] = new Fl_JPEG_Image("f2.jpg"); widgets.img[2] = new Fl_JPEG_Image("f3.jpg"); widgets.box = new Fl_Box(100,100,100,100); Fl_Button* button = new Fl_Button(300,400,50,30,"CHANGE"); w->end(); button->callback(button_clicked,&widgets); w->show(); return(Fl::run()); }
/* Initial creation of ui components. */ void SelectorGUI::create(){ Fl_Window *window = new Fl_Window(400,460,"Stream Selector"); x = 80; y = 10; char* participantList[100]; test = "this is a member"; window->size_range(400, 400, 600, 600); // Scroll window containing participants swindow = new Fl_Scroll(0, y, 400, 380); Fl_Group* o = new Fl_Group(x, y, 380, 280); o->box(FL_THIN_UP_FRAME); // Add buttons to scroll window update(); // Apply and close button. y = 400; x = 150; Fl_Button *applyButton = new Fl_Button(150, y, 60, 40, "Refresh"); Fl_Button *closeButton = new Fl_Button(x + 70, y, 60, 40, "Close"); // Callbacks. applyButton->callback(static_applyCB, this); closeButton->callback(static_closeCB, this); window->end(); window->show(); // For some reason, the idle callback causes a segfault. //Fl::add_idle(static_idleCB); }
Scheme_Object* spark_fltk_button::down_box(int argc, Scheme_Object** argv) { DEFAULT_RET_INIT; Fl_Button* button = _get_fl_button(argc, argv, 0); if (button) { if (argc == 1) { Fl_Boxtype bt = button->down_box(); int i = static_cast<int>(bt); _ret_ = scheme_make_integer(i); } else { int i = 0; if (spark::Utils::int_from_scheme_long(argv[1], i)) { Fl_Boxtype bt = static_cast<Fl_Boxtype>(i); button->down_box(bt); _ret_ = scheme_true; } } } DEFAULT_RET_FINISH; }
Synth_Window(void) :Fl_Double_Window(800,700, "RT-OSC Test Synth") { osc = &OSC_API; pane_name = "/"; ADSR_Pane *ampl_env = new ADSR_Pane(0,0,400,200, "amp_env/"); ADSR_Pane *freq_env = new ADSR_Pane(0,200,400,200, "frq_env/"); ampl_env->box(FL_DOWN_BOX); freq_env->box(FL_DOWN_BOX); //Trigger Fl_Button *b=new Fl_Osc_Button(0,400,400,50,"gate",""); b->type(FL_TOGGLE_BUTTON); b->label("Gate Switch"); Fl_Osc_Slider *s = new Fl_Osc_Slider(0, 460, 400, 50, "freq", Synth::ports["freq"]->metadata); s->type(FL_HOR_SLIDER); Fl_Button *save = new Fl_Osc_Button(0,550, 200, 600, "save",""); save->label("save"); Fl_Button *load = new Fl_Osc_Button(200,550, 400, 600, "load",""); load->label("load"); undo = new Fl_Undo_History(400,0,700,400); undo->init(uh); end(); resizable(new Fl_Box(0,0,400,400)); Fl::add_handler(undo_redo_handler); uh.setCallback(undo_cb); }
void ElevatorSimWindow::pauseSimCB(Fl_Widget* w, void* userData) { if(isDebugBuild()) { std::stringstream dbgSS; dbgSS << "in pauseSimCB with widget ptr " << w << " and userData " << userData << std::endl; LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) ); } Fl_Button* pauseButton = (Fl_Button*)w; if(pauseButton->value()) { if(isDebugBuild()) { std::stringstream dbgSS; dbgSS << "pauseSimCB fired " << std::endl; LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) ); } if( SimulationState::acquire().togglePause() ) { w->label("Resume"); } else { w->label("Pause"); } } }
int main(int argc, char** argv) { CrazyContainer *container = new CrazyContainer(); container->loadXML(); MyWindow *window = new MyWindow(); window->setCrazyContainer(container); Fl_Button *b1 = new Fl_Button(20, 20, 80, 25, "Connect"); b1->callback(connect,(void *)container); Fl_Button *b2 = new Fl_Button(100, 20, 80, 25, "Go 11000"); b2->callback(run,(void *)container); FLContainer::thrustOutput = new Fl_Value_Slider(100,50,250,25,"Thrust meter"); FLContainer::thrustOutput->type(FL_HOR_FILL_SLIDER); FLContainer::thrustOutput->scrollvalue(5000, 100, 5000, 100000); FLContainer::thrustOutput->callback(runCustomThrust,(void *)container); FLContainer::pitch = new Fl_Value_Slider(100,100,250,25,"Pitch"); FLContainer::pitch->type(FL_HORIZONTAL); FLContainer::pitch->scrollvalue(0,10,-180,370); FLContainer::pitch->precision(2); FLContainer::roll = new Fl_Value_Slider(100,140,250,25,"Roll"); FLContainer::roll->type(FL_HORIZONTAL); FLContainer::roll->scrollvalue(0,10,-180,370); FLContainer::roll->precision(2); FLContainer::yaw = new Fl_Value_Slider(100,180,250,25,"Yaw"); FLContainer::yaw->type(FL_HORIZONTAL); FLContainer::yaw->scrollvalue(0,10,-180,370); FLContainer::yaw->precision(2); FLContainer::offsetPitch = new Fl_Value_Slider(100,220,250,25,"Offset Pitch"); FLContainer::offsetPitch->type(FL_HORIZONTAL); FLContainer::offsetPitch->scrollvalue(container->getOffsetPitch(),10,-20,50); FLContainer::offsetPitch->precision(2); FLContainer::offsetPitch->callback(setOffsetPitch,(void *)container); FLContainer::offsetRoll = new Fl_Value_Slider(100,260,250,25,"Offset Roll"); FLContainer::offsetRoll->type(FL_HORIZONTAL); FLContainer::offsetRoll->scrollvalue(container->getOffsetRoll(),10,-20,50); FLContainer::offsetRoll->precision(2); FLContainer::offsetRoll->callback(setOffsetRoll,(void *)container); Fl_Button *b3 = new Fl_Button(200, 20, 80, 25, "Stop"); b3->callback(stop,(void *)container); Fl_Button *bfocus = new Fl_Button(20, 45, 80, 25, "Focus"); Fl_Button *b5 = new Fl_Button(400, 20, 80, 25, "Kill n' Exit"); b5->callback(killnstop,(void *)container); Fl_Button *bsave = new Fl_Button(500, 20, 80, 25, "Plot"); bsave->callback(save,(void *)container); Fl_Button *bload = new Fl_Button(500, 50, 80, 25, "Load"); bload->callback(load,(void *)container); window->end(); window->show(argc,argv); return Fl::run(); }
void ElevatorSimWindow::stopSimCB(Fl_Widget* w, void* userData) { if(isDebugBuild()) { std::stringstream dbgSS; dbgSS << "in stopSimCB with widget ptr " << w << " and userData " << userData << std::endl; LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) ); } Fl_Button* stopButton = (Fl_Button*) w; ElevatorSimWindow* thisWin = (ElevatorSimWindow*) userData; if(stopButton->value()) { if(isDebugBuild()) { std::stringstream dbgSS; dbgSS << "stopSimCB fired " << std::endl; LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) ); } SimulationState::acquire().stop(); thisWin -> resultsWin -> updateChartData(); thisWin -> resultsWin -> show(); } }
//==== Add Geom Picker ====// void GroupLayout::AddGeomPicker( GeomPicker & geom_picker ) { assert( m_Group && m_Screen ); //==== Geom Button ====// Fl_Button* button = new Fl_Button( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, "Geom" ); button->box( FL_THIN_UP_BOX ); button->labelfont( 1 ); button->labelsize( 12 ); button->labelcolor( FL_BLACK ); m_Group->add( button ); AddX( m_ChoiceButtonWidth ); //==== Geom Picker ====// int choice_w = FitWidth( m_ChoiceButtonWidth, m_SliderWidth ); Fl_Choice* geom_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight ); geom_choice->down_box( FL_BORDER_BOX ); geom_choice->textfont( 1 ); geom_choice->textsize( 12 ); geom_choice->textcolor( FL_DARK_BLUE ); m_Group->add( geom_choice ); AddX( choice_w ); AddY( m_StdHeight ); NewLineX(); geom_picker.Init( m_Screen, geom_choice ); }
static int start_dialog(int argc, char** argv) { LaunchWindow* win = new LaunchWindow(370, 195, _("Run Command")); win->begin(); Fl_Box* icon = new Fl_Box(10, 10, 55, 55); icon->image(image_run); Fl_Box* txt = new Fl_Box(70, 10, 290, 69, _("Enter the name of the application " "you would like to run or the URL you would like to view")); txt->align(132|FL_ALIGN_INSIDE); dialog_input = new Fl_Input(70, 90, 290, 25, _("Open:")); Resource rc; char buf[128]; if(rc.load("ede-launch-history") && rc.get("History", "open", buf, sizeof(buf))) { dialog_input->value(buf); /* make text appear selected */ dialog_input->position(0, dialog_input->size()); } in_term = new Fl_Check_Button(70, 125, 290, 25, _("Run in terminal")); in_term->down_box(FL_DOWN_BOX); Fl_Button* ok = new Fl_Button(175, 160, 90, 25, _("&OK")); ok->callback(ok_cb, win); Fl_Button* cancel = new Fl_Button(270, 160, 90, 25, _("&Cancel")); cancel->callback(cancel_cb, win); win->end(); win->window_icon(run_xpm); win->show(argc, argv); return Fl::run(); }
void editbookmark(bookmark * const ptr) { if (!bookedit_win) { bookedit_win = new Fl_Double_Window(350, 180, _("Edit bookmark")); { bookedit_name = new Fl_Input(60, 20, 265, 25, _("Name:")); } // Fl_Input* bookedit_name { bookedit_url = new Fl_Input(60, 55, 265, 25, _("URL:")); } // Fl_Input* bookedit_url { Fl_Box* o = new Fl_Box(60, 80, 265, 50, _("The changes get applied immediately.")); o->align(FL_ALIGN_WRAP); } // Fl_Box* o { Fl_Button * o = new Fl_Button(60, 130, 115, 30, _("OK")); o->callback(bookedit_ok); bookedit_okbtn = o; } // Fl_Button* o { Fl_Button* o = new Fl_Button(195, 130, 115, 30, _("Cancel")); o->callback(bookedit_cancel); } // Fl_Button* o bookedit_win->end(); } // Fl_Double_Window* bookedit_win bookedit_name->value(ptr->name); bookedit_url->value(ptr->url); bookedit_url->activate(); if (!ptr->url) bookedit_url->deactivate(); bookedit_okbtn->user_data(ptr); bookedit_win->show(); }
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; }
static void shadedColorCB( Fl_Widget *w, void* ) { Fl_Button *b = (Fl_Button*)w; b->color( fl_show_colormap( b->color() ) ); b->redraw(); tree->shaded_entry_colors( shadedEvenColor->color(), shadedOddColor->color() ); tree->redraw(); }
// Callback (funzione richiamata) eseguita alla pressione del bottone. // La firma della funzione è (Fl_Widget*, void*), a noi non serve il secondo argomento // quindi lo lasciamo vuoto void button_callback(Fl_Widget * o, void *) { Fl_Button* b = (Fl_Button*)o; //Con questa linea facciamo un *cast* del puntatore a widget generico in un puntatore di tipo Fl_Button. //In questo caso particolare e' superfluo perche' i metodi che useremo (label(), resize(), redraw()) su "b" sono tutti metodi membri della classe base widget b->label("Good job"); //Il redraw non e' necessario perche' label() e value() sono gli unici membri di widget che chiamano redraw() automaticamente b->resize(10, 150, 140, 30); //redraw() necessario b->redraw(); //redraw() eseguito! }
static void reverse_cb(Fl_Widget *w, void *v) { Fl_Button *button = (Fl_Button *)w; VMDApp *app = (VMDApp *)v; if (button->value()) app->animation_set_dir(Animation::ANIM_REVERSE); else app->animation_set_dir(Animation::ANIM_PAUSE); }
static void forward_cb(Fl_Widget *w, void *v) { Fl_Button *button = (Fl_Button *)w; VMDApp *app = (VMDApp *)v; if (button->value()) app->animation_set_dir(Animation::ANIM_FORWARD); else app->animation_set_dir(Animation::ANIM_PAUSE); }
Scheme_Object* spark_fltk_button::fl_button(int argc, Scheme_Object** argv) { DEFAULT_RET_INIT; int x = 0; int y = 0; int w = 0; int h = 0; spark::Utils::int_from_scheme_long(argv[0], x); spark::Utils::int_from_scheme_long(argv[1], y); spark::Utils::int_from_scheme_long(argv[2], w); spark::Utils::int_from_scheme_long(argv[3], h); std::string title; if (argv[4] != scheme_null) { Scheme_Object* str = scheme_char_string_to_byte_string(argv[4]); title = SCHEME_BYTE_STR_VAL(str); } Fl_Button* button = 0; if (argc == 5) button = new Fl_Button(x, y, w, h); else { if (!SCHEME_SYMBOLP(argv[5])) scheme_wrong_type("fl-button", "symbol", 5, argc, argv); std::string s = SCHEME_SYM_VAL(argv[5]); if (s == "check") button = new Fl_Check_Button(x, y, w, h); else if (s == "light") button = new Fl_Light_Button(x, y, w, h); else if (s == "repeat") button = new Fl_Repeat_Button(x, y, w, h); else if (s == "return") button = new Fl_Return_Button(x, y, w, h); else if (s == "radio" || s == "round") button = new Fl_Round_Button(x, y, w, h); else if (s == "toggle") button = new Fl_Toggle_Button(x, y, w, h); else { DEFAULT_RET_FINISH; } } if (title.length() > 0) button->copy_label(title.c_str()); Fltk_tag t = FL_WIDGET_TAG; spark_fltk::Widget* widget = new spark_fltk::Widget; button->argument(reinterpret_cast<long>(widget)); { Scheme_Object* tag = 0; MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, tag); MZ_GC_REG(); tag = scheme_make_integer(t); MZ_GC_UNREG(); _ret_ = scheme_make_cptr(button, tag); } DEFAULT_RET_FINISH; }
// program button void button_cb(Fl_Widget* buttonptr, void* data) { const char* program_call = (const char*) data; Fl_Button *butt; butt = (Fl_Button *) buttonptr; butt->color(button_pressed__color); execute_program(program_call,NULL); }
void button_callback(Fl_Widget* widget, void* data) { Pair* pair = (Pair *)data; Fl_Button* button = pair->button; Fl_Input* input = pair->input; button->label(input->value()); printf(input->value()); }
Fl_Window* make_about_panel(const char *copyright) { Fl_Window* w; {Fl_Window* o = about_panel = new Fl_Window(330, 276, _("About eFluid")); w = o; o->type(240); o->selection_color((Fl_Color)47); o->shortcut(0xff1b); {Fl_Group* o = display_group = new Fl_Group(0, 0, 330, 240); {Fl_Group* o = new Fl_Group(5, 5, 320, 55, _("eFluid")); o->box(FL_ENGRAVED_BOX); o->label_font(fl_fonts+1); o->label_type(FL_EMBOSSED_LABEL); o->color((Fl_Color)0xb3b3be00); o->label_color((Fl_Color)32); o->selection_color((Fl_Color)47); o->label_size(40); o->align(FL_ALIGN_INSIDE); o->end(); } {Fl_Button* o = new Fl_Button(5, 165, 320, 70, _("\302\251""2002-2003\nClick here for more information")); o->box(FL_ENGRAVED_BOX); o->label_font(fl_fonts+1); o->color((Fl_Color)0xb3b3be00); o->label_color((Fl_Color)32); o->highlight_color((Fl_Color)0x9d9da700); o->highlight_label_color((Fl_Color)55); o->label_size(14); o->callback((Fl_Callback*)cb_2002); o->align(FL_ALIGN_WRAP); } {Fl_Box* o = new Fl_Box(5, 60, 320, 105, _("EFLTK User Interface Designer\nVersion 2.0.3")); o->box(FL_ENGRAVED_BOX); o->label_font(fl_fonts+1); o->label_type(FL_EMBOSSED_LABEL); o->color((Fl_Color)0xb3b3be00); o->label_color((Fl_Color)32); o->selection_color((Fl_Color)47); o->label_size(18); } o->end(); } {Fl_Box* o = copyright_box = new Fl_Box(0, 0, 330, 240); o->label_size(10); o->align(FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP|FL_ALIGN_WRAP); o->hide(); o->label(copyright); } {Fl_Return_Button* o = new Fl_Return_Button(5, 245, 320, 25, _("OK")); o->label_size(10); o->shortcut(0xff0d); o->callback((Fl_Callback*)cb_OK); } o->end(); } return w; }
void MainForm::BtnNum_Click(Fl_Widget *w, void *data)//这个不变 { Fl_Button *lpbtn = (Fl_Button *)w; MainForm *lpwnd = (MainForm *)data; string tmp = lpwnd->Output->value(); if(tmp == "0") tmp = ""; tmp += lpbtn->label(); lpwnd->Output->value(tmp.c_str()); }
void Fl_Combo_Box::buttons(int buttons_set) { // Browse button is always shown for (int i = 1; i < 5; i++) { Fl_Button *b = m_buttons[i]; if (buttons_set & b->argument()) b->show(); else b->hide(); } relayout(); }
void changeBoxColor(Fl_Button *box) { Fl_Button *colorBox = box; Fl_Color oldColor = colorBox->color(); Fl_Color defColor = oldColor; fl_color_chooser(_("Choose color"), defColor); if ( defColor != oldColor ) { colorBox->color(defColor); colorBox->redraw(); } }
//----------------------------------------------------------------------------- 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(); }
bool bugzilla_send_with_progress(const char *title, const char *content) { data_submitted = false; cancel_sending = false; bdata = bugzilla_new(EDE_BUGZILLA_XMLRPC_URL); if(!bdata) { alert(_("Unable to initialize bugzilla interface!")); return false; } if(pipe(report_pipe) != 0) { alert(_("Unable to initialize communication pipe")); return false; } /* prepare mutex */ pthread_mutex_init(&runner_mutex, NULL); /* register our callback on pipe */ Fl::add_fd(report_pipe[0], FL_READ, report_pipe_cb); win = new Fl_Double_Window(275, 90, _("Sending report data")); win->begin(); progress = new PulseProgress(10, 20, 255, 25, _("Sending report...")); progress->selection_color((Fl_Color)137); Fl_Button *cancel = new Fl_Button(175, 55, 90, 25, _("&Cancel")); cancel->callback(cancel_cb); win->end(); win->set_modal(); win->show(); progress->label(_("Preparing data...")); Fl::add_timeout(PROGRESS_STEP_REFRESH, progress_timeout); perform_send(title, content); while(win->shown()) Fl::wait(); /* clear pipe callback */ Fl::remove_fd(report_pipe[0]); clear_timeouts(); pthread_mutex_destroy(&runner_mutex); close(report_pipe[0]); close(report_pipe[1]); bugzilla_free(bdata); /* true if we completed all stages */ return data_submitted; }