int main(int argc, char** argv) { if (argc == 1); else if (argc == 2 && argv[1][0]!='-') dname = argv[1]; else {fprintf(stderr,"usage: %s <display>\n",argv[0]); exit(1);} list_visuals(); return 0; }
int main(int argc, char ** argv) { Fl_set_color_rgb(fullcolor_cell,145,159,170); fl_Window window = (fl_Window)Fl_Window_New(400,400); fl_Box box = (fl_Box)Fl_Box_New(50,50,300,300); Fl_Box_set_box(box,FL_THIN_DOWN_BOX); c = fullcolor_cell; Fl_Box_set_color(box,c); fl_Button b1 = (fl_Button)Fl_Button_New_WithLabel(140,120,120,30,"fl_show_colormap"); Fl_Button_set_callback_with_user_data(b1,cb1,&box); fl_Button b2 = (fl_Button)Fl_Button_New_WithLabel(140,160,120,30,"fl_choose_color"); Fl_Button_set_callback_with_user_data(b2,cb2,&box); (fl_Box) Fl_Box_New_WithLabel(140,200,120,120,0); make_image(); (fl_Box) Fl_Box_New_WithLabel(140,320,120,0,"Example of fl_draw_image()"); fl_Box_Virtual_Funcs* funcs = Fl_Box_default_virtual_funcs(); funcs->draw = &draw; fl_Box p = (fl_Box) Fl_OverriddenBox_New_WithLabel(80,200,3*8,120,"lines",funcs); Fl_Box_set_align(p,FL_ALIGN_TOP); int i = 1; if (!Fl_args_with_i(argc,argv,i) || i < argc-1) { printf("usage: %s <switches> visual-number\n" " - : default visual\n" " r : call Fl::visual(FL_RGB)\n" " c : call Fl::own_colormap()\n",argv[0]); #if !defined(WIN32) && !defined(__APPLE__) printf(" # : use this visual with an empty colormap:\n"); list_visuals(); #endif exit(1); } printf("%d %d\n" ,argc, i); if (i!=argc) { if (argv[i][0] == 'r') { if (!Fl_visual(FL_RGB)) { printf("Fl::visual(FL_RGB) returned false.\n"); } } else if (argv[i][0] == 'c') { Fl_own_colormap(); } else if (argv[i][0] != '-') { #if !defined(WIN32) && !defined(__APPLE__) int visid = atoi(argv[i]); if (!visid) puts("visid NULL"); flc_open_display(); XVisualInfo templt; int num; templt.visualid = visid; flc_set_fl_visual(XGetVisualInfo(fl_display, VisualIDMask, &templt, &num)); char visid_str[10]; sprintf(visid_str,"%d",visid); if (!(flc_fl_visual())) { flc_message_with_args("No visual with id %s",visid_str,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); } Colormap m = XCreateColormap(flc_fl_display(), RootWindow(flc_fl_display(),flc_fl_screen()), (flc_fl_visual())->visual, AllocNone); puts("here"); flc_set_fl_colormap(m); flc_xpixel(FL_BLACK); // make sure black is allocated #else flc_message("Visual id's not supported on MSWindows or MacOS."); #endif } } Fl_Window_show_with_args(window,argc,argv); return Fl_run(); }
int main(int argc, char **argv) { #if 0//ndef _WIN32 int i = 1; if (Fl::args(argc,argv,i,arg) < argc) { fprintf(stderr," -v # : use visual\n%s\n",Fl::help); exit(1); } if (visid >= 0) { fl_open_display(); XVisualInfo templt; int num; templt.visualid = visid; fl_visual = XGetVisualInfo(fl_display, VisualIDMask, &templt, &num); if (!fl_visual) { fprintf(stderr, "No visual with id %d, use one of:\n",visid); list_visuals(); exit(1); } fl_colormap = XCreateColormap(fl_display, RootWindow(fl_display,fl_screen), fl_visual->visual, AllocNone); fl_xpixel(FL_BLACK); // make sure black is allocated in overlay visuals } else { Fl::visual(FL_RGB); } #endif Fl_Renderer::system_init(); //Fl_Double_Window window(300,300); ::w = &window; Fl_Window window(400,300); ::w = &window; char title[64]; sprintf(title, "System byte order is '%s'", Fl_Renderer::big_endian()?"BIG-ENDIAN":"LIL-ENDIAN"); window.label(title); Fl_Toggle_Button b(10,10,200,200,"Fl_Pixmap"); //Fl_Box b(10,10,200,200,"Fl_Pixmap"); //b.box(FL_ENGRAVED_BOX); ::b = &b; b.image(pixmap); b.tooltip("This Fl_Toggle_Button has:\n" "image() set to the Fl_Image class selected below.\n" "label() set to the name of that class.\n" "align() set to the flags selected below.\n" "Be sure to resize the window to see how it lays out"); #define BWIDTH 60 #define BHEIGHT 21 Fl_Group controls(10, 300-3*BHEIGHT-20, 380, 3*BHEIGHT+10); controls.box(FL_ENGRAVED_BOX); Fl_Choice choice(5, 5, 110, BHEIGHT); choice.begin(); Fl_Item i1("Fl_Bitmap"); i1.callback(choice_cb, &bitmap); Fl_Item i2("Fl_Pixmap"); i2.callback(choice_cb, &pixmap); Fl_Item i3("Fl_RGB_Image"); i3.callback(choice_cb, &rgb_image); choice.end(); choice.value(1); // set it to pixmap choice.tooltip("Subclass of Fl_Image to use"); int y = 5+BHEIGHT; int x = 5; topb = new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "top"); x += BWIDTH; topb->callback(button_cb); topb->tooltip("FL_ALIGN_TOP"); bottomb= new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "bottom");x += BWIDTH; bottomb->callback(button_cb); bottomb->tooltip("FL_ALIGN_BOTTOM"); leftb = new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "left"); x += BWIDTH; leftb->callback(button_cb); leftb->tooltip("FL_ALIGN_LEFT"); rightb = new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "right"); x += BWIDTH; rightb->callback(button_cb); rightb->tooltip("FL_ALIGN_RIGHT"); scaleb = new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "scale"); x += BWIDTH; scaleb->callback(button_cb); scaleb->tooltip("FL_ALIGN_SCALE"); y += BHEIGHT; x = 5; insideb= new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "inside");x += BWIDTH; insideb->callback(button_cb); insideb->tooltip("FL_ALIGN_INSIDE"); clipb= new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "clip"); x += BWIDTH; clipb->callback(button_cb); clipb->tooltip("FL_ALIGN_CLIP"); wrapb= new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "wrap"); x += BWIDTH; wrapb->callback(button_cb); wrapb->tooltip("FL_ALIGN_WRAP"); tileb= new Fl_Check_Button(x, y, BWIDTH, BHEIGHT, "tile"); x += BWIDTH; tileb->callback(button_cb); tileb->tooltip("FL_ALIGN_TILED"); controls.end(); /* Fl_Box box(10,0,290,controls.y()); box.hide(); window.resizable(box);*/ p2 = new Fl_Button(10,0,290,controls.y(),"Print to file"); p2->callback(print,&controls); window.end(); window.show(argc, argv); return Fl::run(); }