diff options
Diffstat (limited to 'src/Fl_File_Chooser2.cxx')
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 288 |
1 files changed, 277 insertions, 11 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index c7d481df4..8447ab080 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -24,6 +24,276 @@ // // http://www.fltk.org/str.php // + +// fabien: ATTENTION: Only Out Of Source Gen. because cxx/H files are autogenerated by fluid. + +/** \class Fl_File_Chooser + The Fl_File_Chooser widget displays a standard file selection + dialog that supports various selection modes. + + <CENTER>\image html Fl_File_Chooser.jpg</CENTER> + + <P>The Fl_File_Chooser class also exports several static values + that may be used to localize or customize the appearance of all file chooser + dialogs: + + <CENTER><TABLE BORDER="1"> + <TR> + <TH>Member</TH> + <TH>Default value</TH> + </TR> + <TR> + <TD>add_favorites_label</TD> + <TD>"Add to Favorites"</TD> + </TR> + <TR> + <TD>all_files_label</TD> + <TD>"All Files (*)"</TD> + </TR> + <TR> + <TD>custom_filter_label</TD> + <TD>"Custom Filter"</TD> + </TR> + <TR> + <TD>existing_file_label</TD> + <TD>"Please choose an existing file!"</TD> + </TR> + <TR> + <TD>favorites_label</TD> + <TD>"Favorites"</TD> + </TR> + <TR> + <TD>filename_label</TD> + <TD>"Filename:"</TD> + </TR> + <TR> + <TD>filesystems_label</TD> + <TD>"My Computer" (WIN32)<BR> + "File Systems" (all others)</TD> + </TR> + <TR> + <TD>manage_favorites_label</TD> + <TD>"Manage Favorites"</TD> + </TR> + <TR> + <TD>new_directory_label</TD> + <TD>"New Directory?"</TD> + </TR> + <TR> + <TD>new_directory_tooltip</TD> + <TD>"Create a new directory."</TD> + </TR> + <TR> + <TD>preview_label</TD> + <TD>"Preview"</TD> + </TR> + <TR> + <TD>save_label</TD> + <TD>"Save"</TD> + </TR> + <TR> + <TD>show_label</TD> + <TD>"Show:"</TD> + </TR> + <TR> + <TD>sort</TD> + <TD>fl_numericsort</TD> + </TR> + </TABLE></CENTER> + + <P>The sort member specifies the sort function that is + used when loading the contents of a directory. +*/ + +/** \fn Fl_File_Chooser::Fl_File_Chooser(const char *pathname, const char *pattern, int type, const char *title) + The constructor creates the Fl_File_Chooser dialog pictured + above. The pathname argument can be a directory name or a + complete file name (in which case the corresponding file is highlighted + in the list and in the filename input field.) + + <P>The pattern argument can be a NULL + string or "*" to list all files, or it can be a + series of descriptions and filter strings separated by tab + characters (\t). The format of filters is either + "Description text (patterns)" or just "patterns". A file chooser + that provides filters for HTML and image files might look like: + + <UL><PRE> + "HTML Files (*.html)\tImage Files (*.{bmp,gif,jpg,png})" + </PRE></UL> + + <P>The file chooser will automatically add the "All Files (*)" + pattern to the end of the string you pass if you do not provide + one. The first filter in the string is the default filter. + + <P>See the FLTK documentation on fl_filename_match() + for the kinds of pattern strings that are supported. + + <P>The type argument can be one of the following: + + <UL> + <LI>SINGLE - allows the user to select a + single, existing file. + <LI>MULTI - allows the user to select one + or more existing files. + <LI>CREATE - allows the user to select a + single, existing file or specify a new filename. + <LI>DIRECTORY - allows the user to select a + single, existing directory. + </UL> + + <P>The title argument is used to set the title bar text for the + Fl_File_Chooser window. +*/ + +/** \fn Fl_File_Chooser::~Fl_File_Chooser() + Destroys the widget and frees all memory used by it.*/ + +/** \fn void Fl_File_Chooser::color(Fl_Color c) + Sets or gets the background color of the Fl_File_Browser list.*/ + +/** \fn Fl_Color Fl_File_Chooser::color() + Sets or gets the background color of the Fl_File_Browser list.*/ + +/** \fn int Fl_File_Chooser::count() + Returns the number of selected files.*/ + +/** \fn void Fl_File_Chooser::directory(const char *pathname) + Sets or gets the current directory.*/ + +/** \fn const char *Fl_File_Chooser::directory() + Sets or gets the current directory.*/ + +/** \fn void Fl_File_Chooser::filter(const char *pattern) + Sets or gets the current filename filter patterns. The filter + patterns use fl_filename_match(). + Multiple patterns can be used by separating them with tabs, like + "*.jpg\t*.png\t*.gif\t*". In addition, you can provide + human-readable labels with the patterns inside parenthesis, like + "JPEG Files (*.jpg)\tPNG Files (*.png)\tGIF Files (*.gif)\tAll Files (*)". + Use filter(NULL) to show all files. +*/ + +/** \fn const char *Fl_File_Chooser::filter() + See void filter(const char *pattern)*/ + +/** \fn void Fl_File_Chooser::filter_value(int f) + Sets or gets the current filename filter selection.*/ + +/** \fn int Fl_File_Chooser::filter_value() + Sets or gets the current filename filter selection.*/ + +/** \fn void Fl_File_Chooser::hide() + Hides the Fl_File_Chooser window.*/ + +/** \fn void Fl_File_Chooser::iconsize(uchar s) + Sets or gets the size of the icons in the Fl_File_Browser. By + default the icon size is set to 1.5 times the textsize(). +*/ + +/** \fn uchar Fl_File_Chooser::iconsize() + Sets or gets the size of the icons in the Fl_File_Browser. By + default the icon size is set to 1.5 times the textsize(). +*/ + +/** \fn void Fl_File_Chooser::label(const char *l) + Sets or gets the title bar text for the Fl_File_Chooser.*/ + +/** \fn const char *Fl_File_Chooser::label() + Sets or gets the title bar text for the Fl_File_Chooser.*/ + +/** \fn void Fl_File_Chooser::ok_label(const char *l) + Sets or gets the label for the "ok" button in the + Fl_File_Chooser. +*/ + +/** \fn const char *Fl_File_Chooser::ok_label() + Sets or gets the label for the "ok" button in the + Fl_File_Chooser. +*/ + +/** \fn int Fl_File_Chooser::preview() const + Returns the current state of the preview box. */ + +/** \fn void Fl_File_Chooser::rescan() + Reloads the current directory in the Fl_File_Browser.*/ + +/** \fn void Fl_File_Chooser::show() + Shows the Fl_File_Chooser window.*/ + +/** \fn void Fl_File_Chooser::textcolor(Fl_Color c) + Sets or gets the current Fl_File_Browser text color.*/ + +/** \fn Fl_Color Fl_File_Chooser::textcolor() + Sets or gets the current Fl_File_Browser text color.*/ + +/** \fn void Fl_File_Chooser::textfont(Fl_Font f) + Sets or gets the current Fl_File_Browser text font.*/ + +/** \fn Fl_Font Fl_File_Chooser::textfont() + Sets or gets the current Fl_File_Browser text font.*/ + +/** \fn void Fl_File_Chooser::textsize(Fl_Fontsize s) + Sets or gets the current Fl_File_Browser text size.*/ + +/** \fn Fl_Fontsize Fl_File_Chooser::textsize() + Sets or gets the current Fl_File_Browser text size.*/ + +/** \fn void Fl_File_Chooser::type(int t) + Sets or gets the current type of Fl_File_Chooser.*/ + +/** \fn int Fl_File_Chooser::type() + Sets or gets the current type of Fl_File_Chooser.*/ + +/** \fn const char *Fl_File_Chooser::value(const char *pathname) + Sets or gets the current value of the selected file. + + <P>In the second form, <i>file</i> is a <i>1</i>-based index into a list of + file names. The number of selected files is returned by + Fl_File_Chooser::count(). + + <P>This sample code loops through all selected files: + <PRE> + // Get list of filenames user selected from a MULTI chooser + for ( int t=1; t<=chooser->count(); t++ ) { + const char *filename = chooser->value(t); + .. + } + </PRE> +*/ + +/** \fn const char *Fl_File_Chooser::value(int file) + See const char *value(const char *pathname)*/ + +/** \fn const char *Fl_File_Chooser::value() + See const char *value(const char *pathname)*/ + +/** \fn int Fl_File_Chooser::visible() + Returns 1 if the Fl_File_Chooser window is visible.*/ + +/** \fn Fl_Widget* Fl_File_Chooser::add_extra(Fl_Widget*) + Adds extra widget at the bottom of Fl_File_Chooser window. + Returns pointer for previous extra widget or NULL if not set previously. + If argument is NULL only remove previous extra widget.<BR> + <I>NOTE! Fl_File_Chooser doesn't delete extra widget in destructor! To prevent memory leakage don't forget + delete unused extra widgets by yourself.</I> +*/ + /** \fn int Fl_File_Chooser::shown() + Returns non-zero if the file chooser main window show() has been called (but not hide() + see Fl_Window::shown() + */ + + /** \fn void Fl_File_Chooser::callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0) + Sets the file chooser callback cb and associated data d */ + + /** \fn void Fl_File_Chooser::user_data(void *d) + Sets the file chooser user data d */ + + /** \fn void * Fl_File_Chooser::user_data() const + Gets the file chooser user data d */ + +// *** END OF OUT OF SOURCE DOC *** + // Contents: // // Fl_File_Chooser::count() - Return the number of selected files. @@ -794,12 +1064,9 @@ Fl_File_Chooser::newdir() } -// -// 'Fl_File_Chooser::preview()' - Enable or disable the preview tile. -// -void -Fl_File_Chooser::preview(int e)// I - 1 = enable preview, 0 = disable preview +/** Enable or disable the preview tile. 1 = enable preview, 0 = disable preview. */ +void Fl_File_Chooser::preview(int e) { previewButton->value(e); prefs_.set("preview", e); @@ -868,12 +1135,11 @@ Fl_File_Chooser::rescan() } // -// 'Fl_File_Chooser::rescan_keep_filename()' - Rescan the current directory -// without clearing the filename, then select the file if it is in the list -// - -void -Fl_File_Chooser::rescan_keep_filename() +/** + Rescan the current directory without clearing the filename, + then select the file if it is in the list +*/ +void Fl_File_Chooser::rescan_keep_filename() { // if no filename was set, this is likely a diretory browser const char *fn = fileName->value(); |
