diff options
Diffstat (limited to 'examples/nativefilechooser-simple.cxx')
| -rw-r--r-- | examples/nativefilechooser-simple.cxx | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/examples/nativefilechooser-simple.cxx b/examples/nativefilechooser-simple.cxx index 8ab216950..7c8268027 100644 --- a/examples/nativefilechooser-simple.cxx +++ b/examples/nativefilechooser-simple.cxx @@ -1,7 +1,5 @@ // -// "$Id$" -// -// Simple example of using Fl_Native_File_Chooser. +// Simple example of using Fl_Native_File_Chooser. // // Copyright 1998-2010 by Bill Spitzak and others. // @@ -9,19 +7,19 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Menu_Button.H> #include <FL/Fl_Native_File_Chooser.H> #include <FL/fl_message.H> -#include <stdlib.h> /* exit() */ -#include <string.h> /* strcmp() */ +#include <stdlib.h> /* exit() */ +#include <string.h> /* strcmp() */ Fl_Window *G_win = 0; Fl_Menu_Button *G_menu = 0; @@ -30,28 +28,28 @@ Fl_Native_File_Chooser *G_chooser = 0; static void Menu_CB(Fl_Widget*,void*data) { // Handle the popup menu item the user picked.. const char *choice = (const char*)data; - if ( strcmp(choice, "quit") == 0 ) { // Handle "quit" + if ( strcmp(choice, "quit") == 0 ) { // Handle "quit" exit(0); - } else if ( strcmp(choice, "open") == 0 ) { // Handle "open" + } else if ( strcmp(choice, "open") == 0 ) { // Handle "open" if ( G_chooser == 0 ) { // Create an instance of file chooser we can reuse.. G_chooser = new Fl_Native_File_Chooser(); - G_chooser->directory("."); // directory to start browsing with - G_chooser->preset_file("nativefilechooser-simple.cxx"); // file to start with + G_chooser->directory("."); // directory to start browsing with + G_chooser->preset_file("nativefilechooser-simple.cxx"); // file to start with G_chooser->filter("C++\t*.{cxx,cpp,h,H}\n"); - G_chooser->type(Fl_Native_File_Chooser::BROWSE_FILE); // only picks files that exist - G_chooser->title("Pick a file please.."); // custom title for chooser window + G_chooser->type(Fl_Native_File_Chooser::BROWSE_FILE); // only picks files that exist + G_chooser->title("Pick a file please.."); // custom title for chooser window } // Show the chooser // This blocks while chooser is open. // switch ( G_chooser->show() ) { - case -1: break; // Error - case 1: break; // Cancel - default: // Choice - G_chooser->preset_file(G_chooser->filename()); - fl_message("You chose: %s", G_chooser->filename()); - break; + case -1: break; // Error + case 1: break; // Cancel + default: // Choice + G_chooser->preset_file(G_chooser->filename()); + fl_message("You chose: %s", G_chooser->filename()); + break; } } } @@ -71,7 +69,3 @@ int main(int argc, char *argv[]) { G_win->show(argc,argv); return(Fl::run()); } - -// -// End of "$Id$". -// |
