int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(400,350); int y = 10; input[0] = new Fl_Input(70,y,300,23,"Normal:"); y += 27; input[0]->tooltip("Normal input field"); // input[0]->cursor_color(FL_SELECTION_COLOR); // input[0]->maximum_size(20); // input[0]->static_value("this is a testgarbage"); input[1] = new Fl_Float_Input(70,y,300,23,"Float:"); y += 27; input[1]->tooltip("Input field for floating-point number"); input[2] = new Fl_Int_Input(70,y,300,23,"Int:"); y += 27; input[2]->tooltip("Input field for integer number"); input[3] = new Fl_Secret_Input(70,y,300,23,"Secret:"); y += 27; input[3]->tooltip("Input field for password"); input[4] = new Fl_Wordwrap_Input(70,y,300,100,"Wordwrap:"); y += 105; input[4]->tooltip("Input field for short text with newlines"); for (int i = 0; i < 4; i++) { input[i]->when(0); input[i]->callback(cb); } int y1 = y; Fl_Button *b; b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&CHANGED"); b->tooltip("Do callback each time the text changes"); b->callback(toggle_cb, FL_WHEN_CHANGED); y += 23; b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&RELEASE"); b->callback(toggle_cb, FL_WHEN_RELEASE); y += 23; b->tooltip("Do callback when widget loses focus"); b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&ENTER_KEY"); b->callback(toggle_cb, FL_WHEN_ENTER_KEY); y += 23; b->tooltip("Do callback when user hits Enter key"); b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&NOT_CHANGED"); b->callback(toggle_cb, FL_WHEN_NOT_CHANGED); y += 23; b->tooltip("Do callback even if the text is not changed"); y += 5; b = new Fl_Button(10,y,200,23,"&print changed()"); b->callback(button_cb); b->tooltip("Print widgets that have changed() flag set"); b = new Fl_Button(220,y1,100,23,"color"); y1 += 23; b->color(input[0]->color()); b->callback(color_cb, (void*)0); b->label_color(fl_contrast(FL_BLACK,b->color())); b->tooltip("Color behind the text"); b = new Fl_Button(220,y1,100,23,"selection_color"); y1 += 23; b->color(input[0]->selection_color()); b->callback(color_cb, (void*)1); b->label_color(fl_contrast(FL_BLACK,b->color())); b->tooltip("Color behind selected text"); b = new Fl_Button(220,y1,100,23,"text_color"); y1 += 23; b->color(input[0]->text_color()); b->callback(color_cb, (void*)2); b->label_color(fl_contrast(FL_BLACK,b->color())); b->tooltip("Color of the text"); window->resizable(window); window->end(); window->show(argc,argv); // CET - FIXME - crashes windows Fl::lock(); return Fl::run(); }
int main(int argc, char **argv) { Fl_Window *w; {Fl_Window* o = new Fl_Window(365, 525); w = o; scroll = new Fl_Scroll(10,10,345,285); {Fl_Pack* o = new Fl_Pack(10, 10, 345, 285); pack = o; o->box(FL_DOWN_BOX); //o->box(FL_ENGRAVED_FRAME); (void) new Fl_Button(35, 35, 25, 25, "b1"); (void) new Fl_Button(45, 45, 25, 25, "b2"); (void) new Fl_Button(55, 55, 25, 25, "b3"); (void) new Fl_Button(65, 65, 25, 25, "b4"); (void) new Fl_Button(75, 75, 25, 25, "b5"); (void) new Fl_Button(85, 85, 25, 25, "b6"); (void) new Fl_Button(95, 95, 25, 25, "b7"); (void) new Fl_Button(105, 105, 25, 25, "b8"); (void) new Fl_Button(115, 115, 25, 25, "b9"); (void) new Fl_Button(125, 125, 25, 25, "b10"); (void) new Fl_Button(135, 135, 25, 25, "b11"); (void) new Fl_Button(145, 145, 25, 25, "b12"); (void) new Fl_Button(155, 155, 25, 25, "b13"); (void) new Fl_Button(165, 165, 25, 25, "b14"); (void) new Fl_Button(175, 175, 25, 25, "b15"); (void) new Fl_Button(185, 185, 25, 25, "b16"); (void) new Fl_Button(195, 195, 25, 25, "b17"); (void) new Fl_Button(205, 205, 25, 25, "b18"); (void) new Fl_Button(215, 215, 25, 25, "b19"); (void) new Fl_Button(225, 225, 25, 25, "b20"); (void) new Fl_Button(235, 235, 25, 25, "b21"); (void) new Fl_Button(245, 245, 25, 25, "b22"); (void) new Fl_Button(255, 255, 25, 25, "b23"); (void) new Fl_Button(265, 265, 25, 25, "b24"); o->end(); w->resizable(o); } scroll->end(); {Fl_Light_Button* o = new Fl_Light_Button(10, 325, 175, 25, "HORIZONTAL"); o->type(FL_RADIO_BUTTON); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::HORIZONTAL)); } {Fl_Light_Button* o = new Fl_Light_Button(10, 350, 175, 25, "VERTICAL"); o->type(FL_RADIO_BUTTON); o->value(1); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::VERTICAL)); } {Fl_Value_Slider* o = new Fl_Value_Slider(50,375, 295,25,"spacing:"); o->clear_flag(FL_ALIGN_MASK); o->set_flag(FL_ALIGN_LEFT); o->type(Fl_Slider::HORIZONTAL); o->range(0,30); o->step(1); o->callback((Fl_Callback*)spacing_cb); } w->end(); } w->show(argc, argv); return Fl::run(); }
int run_main (int argc, ACE_TCHAR *argv[]) { ACE_START_TEST (ACE_TEXT ("FlReactor_Test")); Fl_Window window (300, 370); Test_Window tw (10, 75, window.w () - 20, window.h ()-90); window.resizable (&tw); Fl_Hor_Slider slider (60, 5, window.w () - 70, 30, "Sides:"); slider.align (FL_ALIGN_LEFT); slider.callback (sides_cb, &tw); slider.value (tw.sides ()); slider.step (1); slider.bounds (3, 10); ACE_FlReactor reactor; ACE_Reactor r (&reactor); Fl_Box *box = new Fl_Box (FL_UP_BOX, 10, 40, window.w () - 20, 30, "Setting up"); box->labelfont (FL_BOLD); Acceptor acceptor (&tw, box); ACE_INET_Addr address; if (acceptor.open (address, &r) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open acceptor"), -1); acceptor.acceptor ().get_local_addr (address); const int bufsiz = 128; char buf[bufsiz]; address.addr_to_string (buf, bufsiz, 0); char msg[2 * bufsiz]; ACE_OS::sprintf (msg, "Listening on <%s>\n", buf); box->label (msg); box->redraw (); window.end (); window.show (argc, argv); tw.show (); return Fl::run (); ACE_END_TEST; }
int japtest() { Fl::set_font(FL_HELVETICA, "Kochi Mincho"); // uncomment for linux Fl_Window *win = new Fl_Window(500,500,"Japanese Test"); Fl_Multiline_Output *output = new Fl_Multiline_Output(140,10,340,400,"Output\n産量\n[さんりょう]"); output->labelsize(22); output->textsize(22); Fl_Choice *choice = new Fl_Choice(140,output->y()+output->h()+10,340,30,"Choice\n取捨\n[しゅしゃ]"); choice->labelsize(22); choice->textsize(22); for ( int t=0; songnames[t]; t++ ) { choice->add(songnames[t]); output->insert(songnames[t]); output->insert("\n"); } choice->value(0); win->resizable(win); win->show(); return(Fl::run()); }
int main() { Fl_Window* w = new Fl_Window(200, 200, "Single Thread"); browser1 = new Fl_Browser(0, 0, 200, 175); w->resizable(browser1); value1 = new Fl_Value_Output(100, 175, 200, 25, "Max Prime:"); w->end(); w->show(); Fl_Window* w2 = new Fl_Window(200, 200, "5 Threads"); browser2 = new Fl_Browser(0, 0, 200, 175); w2->resizable(browser2); value2 = new Fl_Value_Output(100, 175, 200, 25, "Max Prime:"); w2->end(); w2->show(); browser1->add("Prime numbers:"); browser2->add("Prime numbers:"); Fl::lock(); // you must do this before creating any threads! // One thread displaying in one browser fl_create_thread(prime_thread, prime_func, browser1); // Several threads displaying in another browser fl_create_thread(prime_thread2[0], prime_func, browser2); fl_create_thread(prime_thread2[1], prime_func, browser2); fl_create_thread(prime_thread2[2], prime_func, browser2); fl_create_thread(prime_thread2[3], prime_func, browser2); fl_create_thread(prime_thread2[4], prime_func, browser2); while(w->visible() && w2->visible()) { Fl::wait(); // void* m = Fl::thread_message(); // printf("Received message: %p\n", m); } return 0; }
void edit_formula_cb( Fl_Widget* w, void* ) { const int heightInput = 28; const int heightText = 18; const int wideLabel = 50; const int wideInput = 450; const int Ybetween = 3; const int YbetweenMore = 6; const int alignStyle = FL_ALIGN_INSIDE | FL_ALIGN_RIGHT; const int textStyle = FL_ALIGN_INSIDE | FL_ALIGN_LEFT; const Fl_Boxtype inputStyle = FL_PLASTIC_DOWN_BOX; int x = 10; int y = 10; const int wide = x+wideLabel+wideInput+x; const int height = y + 3*heightText + Ybetween + 3*(heightInput+Ybetween) - Ybetween + YbetweenMore + y; Fl_Window* win = new Fl_Window( wide, height, _("Formulas editor") ); Fl_Group* win2 = new Fl_Group( 0, 0, wide, height ); win->resizable(win2); { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Enter the formulas of x(n+1) and y(n+1) using prefix notation.") ); o->align( textStyle ); } y += heightText; { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Variables: x y x1 x2 y1 y2 xc yc rand, and any number.") ); o->align( textStyle ); } y += heightText; { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Functions: ") ); o->align( textStyle ); } { Fl_Box* o = new Fl_Box( x + (int)( fl_width(_("Functions: ")) ), y, wideLabel+wideInput, heightText, "+ - * / < pow abs atan2 sin cos tan atan ln sign square sqrt." ); o->align( textStyle ); } y += heightText + Ybetween; { Fl_Box* o = new Fl_Box( x, y, wideLabel, heightInput, "x <- " ); o->align( alignStyle ); } { Fl_Input* o = new Fl_Input( x+wideLabel, y, wideInput, heightInput ); o->box(inputStyle); o->value( Function::formulaPoint.getStringX().c_str() ); } y += heightInput + Ybetween; { Fl_Box* o = new Fl_Box( x, y, wideLabel, heightInput, "y <- " ); o->align( alignStyle ); } { Fl_Input* o = new Fl_Input( x+wideLabel, y, wideInput, heightInput ); o->box(inputStyle); o->value( Function::formulaPoint.getStringY().c_str() ); } y += heightInput + Ybetween + YbetweenMore; { Fl_Return_Button* o = new Fl_Return_Button( wide - x - 150, y, 150, heightInput, _("Set formulas") ); o->box(FL_PLASTIC_UP_BOX); o->callback( (Fl_Callback*)set_formula, glito ); } win2->end(); win->end(); win->show(); }
void WinCtrlNetCDF::GenWindow(int x, int y, int w, int h, cxVolume * pVolume) { m_wMainWin = new Fl_Window(x, y,w,h, "VIDI-Climate"); m_wMainWin->user_data((void*)(this)); m_pVolume = pVolume; int left = 0; int top = 30; int width = w ; int height = h - 10; Fl_Window* volrendwin = new Fl_Window(1,1,width - 1, (height-20)/2 - 15, ""); volrendwin->user_data((void*)(this)); m_gGroupC = new Fl_Group(2, 2, width - 4, (height - 20)/2 - 25 , ""); m_gGroupC->box(FL_ENGRAVED_BOX); m_gGroupC->align(FL_ALIGN_CENTER); //Fl_Group::current()->resizable(m_gGroupC); m_pVisMain = new WinVisMain(5, 6, width - 10/*768*/, (height-20)/2 - 30/*384*/); m_pVisMain->SetVolume(pVolume); m_gGroupC->resizable(m_gGroupC); m_gGroupC->end(); //m_gGroupC->resizable(NULL); //volrendwin->resizable(volrendwin); volrendwin->resizable(volrendwin); volrendwin->end(); #ifdef WIN_SLICE //m_gGroupA = new Fl_Group(2, (height-20)/2, width - 4, (height)/2 + 18, "Slices"); m_gGroupA = new Fl_Group(2, (height-20)/2, width - 4, (height)/2 + 18); m_gGroupA->box(FL_ENGRAVED_BOX); m_gGroupA->align(FL_ALIGN_TOP_LEFT); m_wSliceMain = NULL; m_wSliceMain = CreateSliceViewWindow(m_gGroupA, SLICE_X_AXIS); //wSliceMain->show(argc,argv); m_wSliceMain->SetVolume(pVolume, SLICE_Z_AXIS); //m_wSliceMain = CreateSliceViewWindow(m_gGroupA, SLICE_Y_AXIS); //wSliceMain->show(argc,argv); //m_wSliceMain->SetVolume(pVolume, SLICE_Y_AXIS); //m_wSliceMain = CreateSliceViewWindow(wVisMain, SLICE_Z_AXIS); ////wSliceMain->show(argc,argv); //m_wSliceMain->SetVolume(pVolume, SLICE_Z_AXIS); m_gGroupA->resizable(m_gGroupA); m_gGroupA->end(); #endif /* m_tTab = new Fl_Tabs(left, top-20, width, height-20); //View and Cutting m_gGroupA = new Fl_Group(left, top, width, height, "NetCFD file"); Fl_Group::current()->resizable(m_gGroupA); m_wCtrlNetCDFView = new WinCtrlNetCDFView(left+2, 40, width-10, height-60, pVolume); m_gGroupA->end(); //Color Map m_gGroupB = new Fl_Group(left, top, width, height, "Information Analysis"); m_tTab->end(); m_wMainWin->end(); //m_wMainWin->resizable(m_wMainWin); //m_wMainWin->size_range(200,200); */ m_wMainWin->resizable(m_wMainWin); m_wMainWin->end(); //m_wMainWin->resizable(NULL); }
Fl_Window* make_codingstyle_window() { Fl_Window* w; {Fl_Window* o = new Fl_Window(310, 255); w = o; o->shortcut(0xff1b); {Fl_Tabs* o = new Fl_Tabs(0, 0, 303, 220); o->color((Fl_Color)0xfffffffe); {Fl_Group* o = new Fl_Group(1, 24, 301, 195, _("Brace Style")); {Fl_Group* o = new Fl_Group(14, 22, 282, 122, _("Brace Style")); o->box(FL_ENGRAVED_BOX); o->align(FL_ALIGN_TOP|FL_ALIGN_LEFT); {Fl_Box* o = new Fl_Box(20, 6, 47, 20, _("if ( x ) {")); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(20, 25, 45, 20, _("++y;")); o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(20, 41, 36, 20, _("}")); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(114, 6, 47, 20, _("if ( x )")); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(114, 25, 36, 20, _("{")); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(115, 42, 46, 20, _("++y;")); o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(114, 59, 36, 20, _("}")); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } {Fl_Round_Button* o = pStyle1 = new Fl_Round_Button(16, 84, 66, 25, _("Style 1")); o->type(Fl_Round_Button::RADIO); o->value(1); o->callback((Fl_Callback*)cb_pStyle1); } {Fl_Box* o = new Fl_Box(201, 6, 47, 20, _("if ( x )")); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(201, 25, 36, 20, _("{")); o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(227, 42, 34, 22, _("++y;")); o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); } {Fl_Box* o = new Fl_Box(201, 59, 36, 20, _("}")); o->align(FL_ALIGN_RIGHT|FL_ALIGN_INSIDE); } {Fl_Round_Button* o = pStyle2 = new Fl_Round_Button(109, 84, 66, 25, _("Style 2")); o->type(Fl_Round_Button::RADIO); o->callback((Fl_Callback*)cb_pStyle2); } {Fl_Round_Button* o = pStyle3 = new Fl_Round_Button(200, 84, 66, 25, _("Style 3")); o->type(Fl_Round_Button::RADIO); o->callback((Fl_Callback*)cb_pStyle3); } o->end(); } {Fl_Check_Button* o = pNoSpaceParens = new Fl_Check_Button(15, 147, 195, 22, _("No space before parentheses")); o->callback((Fl_Callback*)cb_pNoSpaceParens); } {Fl_Check_Button* o = pBraceFuncs = new Fl_Check_Button(15, 170, 174, 22, _("Apply to function braces")); o->value(1); o->callback((Fl_Callback*)cb_pBraceFuncs); } o->end(); } {Fl_Group* o = new Fl_Group(1, 24, 301, 195, _("Other")); o->hide(); {Fl_Group* o = new Fl_Group(11, 22, 284, 90, _("Indentation")); o->box(FL_ENGRAVED_BOX); o->align(FL_ALIGN_TOP|FL_ALIGN_LEFT); {Fl_Value_Input* o = pTabSize = new Fl_Value_Input(129, 33, 60, 22, _("Tab size for indents")); o->maximum(12); o->value(2); o->callback((Fl_Callback*)cb_pTabSize); } {Fl_Check_Button* o = pIndentTabs = new Fl_Check_Button(13, 7, 114, 22, _("Indent with tabs")); o->callback((Fl_Callback*)cb_pIndentTabs); } {Fl_Check_Button* o = pIndentCode = new Fl_Check_Button(14, 58, 151, 22, _("Indent code blocks")); o->callback((Fl_Callback*)cb_pIndentCode); } o->end(); } {Fl_Check_Button* o = pReturnParens = new Fl_Check_Button(10, 120, 220, 22, _("Always use parentheses on return")); o->callback((Fl_Callback*)cb_pReturnParens); } o->end(); } o->end(); } {Fl_Button* o = new Fl_Button(115, 227, 59, 23, _("Cancel")); o->callback((Fl_Callback*)cb_Cancel); } {Fl_Button* o = new Fl_Button(180, 227, 59, 23, _("Save")); o->callback((Fl_Callback*)cb_Save); } {Fl_Button* o = new Fl_Button(245, 227, 59, 23, _("Use")); o->callback((Fl_Callback*)cb_Use); } o->end(); o->resizable(o); } return w; }
int main (int argc, char **argv) { Fl_Window* w; fl_init_locale_support("eiconsconf", PREFIX"/share/locale"); readIconsConfiguration(); {Fl_Window* o = iconsConfWindow = new Fl_Window(265, 314, _("Icons settings")); w = o; o->shortcut(0xff1b); {Fl_Button* o = new Fl_Button(25, 280, 75, 25, _("&OK")); o->callback((Fl_Callback*)cb_OK); } {Fl_Button* o = new Fl_Button(185, 280, 75, 25, _("&Cancel")); o->callback((Fl_Callback*)cb_Cancel); } {Fl_Button* o = new Fl_Button(105, 280, 75, 25, _("&Apply")); o->callback((Fl_Callback*)cb_Apply); } {Fl_Tabs* o = new Fl_Tabs(3, 5, 257, 265); o->color((Fl_Color)0xfffffffe); {Fl_Group* o = new Fl_Group(1, 23, 255, 241, _("Look&&feel")); o->align(FL_ALIGN_TOP|FL_ALIGN_LEFT); {Fl_Button* o = colorButton = new Fl_Button(165, 17, 60, 18, _("Background color: ")); o->box(FL_DOWN_BOX); o->callback((Fl_Callback*)cb_colorButton); o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP); o->color((Fl_Color) label_background); if(label_trans) o->deactivate(); } {Fl_Button* o = colorButton1 = new Fl_Button(165, 47, 60, 18, _("Label color: ")); o->box(FL_DOWN_BOX); o->callback((Fl_Callback*)cb_colorButton1); o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP); o->color((Fl_Color) label_foreground); } {Fl_Value_Slider* o = maxWidthSlider = new Fl_Value_Slider(115, 95, 125, 20, _("Maximum width: ")); o->type(Fl_Value_Slider::HORIZONTAL); o->minimum(48); o->maximum(200); o->step(1); o->value(50); o->slider_size(10); o->callback((Fl_Callback*)cb_maxWidthSlider); o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP); o->value(label_maxwidth); } {Fl_Value_Slider* o = fontsizeSlider = new Fl_Value_Slider(115, 125, 125, 20, _("Font height: ")); o->type(Fl_Value_Slider::HORIZONTAL|Fl_Slider::TICK_ABOVE); o->minimum(8); o->maximum(48); o->step(1); o->value(10); o->slider_size(10); o->callback((Fl_Callback*)cb_fontsizeSlider); o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP); o->value(label_fontsize); } {Fl_Value_Slider* o = gridspaceSlider = new Fl_Value_Slider(115, 155, 125, 20, _("Grid spacing: ")); o->type(Fl_Value_Slider::HORIZONTAL|Fl_Slider::TICK_ABOVE); o->minimum(1); o->maximum(50); o->step(1); o->value(10); o->slider_size(10); o->callback((Fl_Callback*)cb_gridspaceSlider); o->align(FL_ALIGN_LEFT|FL_ALIGN_WRAP); o->value(label_gridspacing); } {Fl_Check_Button* o = autoArrButton = new Fl_Check_Button(25, 215, 222, 20, _("Auto arrange icons")); o->callback((Fl_Callback*)cb_autoArrButton); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); o->value(auto_arr); } {Fl_Check_Button* o = engageButton = new Fl_Check_Button(25, 190, 222, 20, _("Engage with just one click")); o->callback((Fl_Callback*)cb_engageButton); o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); o->value(label_engage_1click); } {Fl_Check_Button* o = bg_color_check = new Fl_Check_Button(227, 17, 20, 18); o->callback((Fl_Callback*)cb_bg_color_check); o->tooltip(_("Clear this, to get transparent background.")); if(!label_trans) o->set_value(); } o->end(); } o->end(); } o->end(); o->resizable(o); } w->show(argc, argv); return Fl::run(); }