FLTK Utility Library and Widget Collection (FLU): Flu_File_Chooser class Reference

Main Page | Class Hierarchy | Class List | File List | Class Members

# Flu_File_Chooser Class Reference

A file and directory choosing widget that looks and acts similar to the stock Windows file chooser. More...

`#include <Flu_File_Chooser.h>`

List of all members.

## Public Types
typedef PreviewWidgetBase * | pPreviewWidgetBase
enum | { ENTRY_NONE = 1, ENTRY_DIR = 2, ENTRY_FILE = 4, ENTRY_FAVORITE = 8, ENTRY_DRIVE = 16, ENTRY_MYDOCUMENTS = 32, ENTRY_MYCOMPUTER = 64 }
| File entry type. More...
enum | { SINGLE = 0, MULTI = 1, DIRECTORY = 4, DEACTIVATE_FILES = 8, SAVING = 16, STDFILE = 32 }
| Chooser type. More...
enum | { SORT_NAME = 1, SORT_SIZE = 2, SORT_TYPE = 4, SORT_DATE = 8, SORT_REVERSE = 16 }
## Public Member Functions
| Flu_File_Chooser (const char *path, const char *pattern, int type, const char *title)
| Constructor opening a file chooser with title title visiting directory path with files filtered according to pattern. type is a logical OR of Flu_File_Chooser::SINGLE, Flu_File_Chooser::MULTI, and Flu_File_Chooser::DIRECTORY.
| ~Flu_File_Chooser ()
| Destructor.
void | allow_file_editing (bool b)
| deprecated - do not use - right click to change filenames
bool | allow_file_editing () const
| deprecated - do not use - right click to change filenames
void | case_insensitive_sort (bool b)
| Set whether file sorting is case insensitive. Default value is case-insensitive for windows, case-sensitive for everything else.
bool | case_insensitive_sort () const
| Get whether file sorting is case insensitive.
void | cd (const char *path)
| Change the current directory the chooser is browsing to path.
void | clear_history ()
| Clear the history of which directories have been visited.
int | count ()
| how many files are selected
void | default_file_icon (Fl_Image *i)
| Set the default icon to use for all files for which no other icon has been specified.
void | directory (const char *d)
| Alias for cd().
void | filter (const char *p)
| Alias for pattern().
const char * | filter () const
| Alias for pattern().
const char * | get_current_directory () const
| the current directory that the browser is visiting
int | handle (int event)
| Override of Fl_Double_Window::handle().
void | pattern (const char *p)
| Change the file filter pattern to p.
const char * | pattern () const
| Get the current file filter pattern.
void | preview (bool b)
| Set the state of the preview button.
int | preview () const
| Get the state of the preview button.
void | rescan ()
| Refresh the current directory.
void | resize (int x, int y, int w, int h)
| Override of Fl_Double_Window::resize().
void | select_all ()
| Select all entries (only valid for multiple-selections).
void | set_sort_function (int(*cb)(const char *, const char *))
| Set a custom sorting function for sorting entries based on filename.
void | type (int t)
| Set the type of the chooser (see constructor).
int | type (int t) const
| Get the type of the chooser.
void | unselect_all ()
| Unselect all entries.
void | value (const char *v)
| Set the current file the chooser is selecting.
const char * | value ()
| Get the current file the chooser is selecting.
const char * | value (int n)
| For MULTI file queries, get selected file n (base 1 - i.e. 1 returns the first file, 2 the second, etc).
| FluMakeVectorClass (ContextHandler, ContextHandlerVector)
| FluMakeVectorClass (pPreviewWidgetBase, PreviewHandlerVector)
void | backCB ()
void | forwardCB ()
void | sortCB (Fl_Widget *w)
void | previewCB ()
void | listModeCB ()
void | filenameCB ()
void | locationCB (const char *path)
void | cancelCB ()
void | okCB ()
void | trashCB (bool recycle=true)
void | newFolderCB ()
void | reloadCB ()
void | homeCB ()
void | desktopCB ()
void | favoritesCB ()
void | myComputerCB ()
void | addToFavoritesCB ()
void | documentsCB ()
void | hideCB ()
void | do_callback ()
Fl_Group * | getEntryGroup ()
Fl_Group * | getEntryContainer ()
void | win2unix (FluSimpleString &s)
void | cleanupPath (FluSimpleString &s)
bool | correctPath (FluSimpleString &path)
void | updateEntrySizes ()
void | buildLocationCombo ()
void | updateLocationQJ ()
void | addToHistory ()
FluSimpleString | formatDate (const char *d)
void | recursiveScan (const char *dir, FluStringVector *files)
bool | stripPatterns (FluSimpleString s, FluStringVector *patterns)
int | popupContextMenu (Entry *entry)
FluSimpleString | commonStr ()
## Static Public Member Functions
void | add_context_handler (int type, const char *ext, const char *name, void(*cb)(const char *, int, void *), void *cbd)
| Add a custom callback that is called when the user right-clicks on an entry.
void | add_preview_handler (PreviewWidgetBase *w)
| Add a "preview" widget (derived from class Flu_File_Chooser::PreviewWidgetBase) that will handle custom previewing of files.
void | add_type (const char *extensions, const char *short_description, Fl_Image *icon=NULL)
| Add descriptive information and an icon for a file type.
FileTypeInfo * | find_type (const char *extension)
| a pointer to a FileTypeInfo structure for files with type extension
void | _backCB (Fl_Widget *w, void *arg)
void | _forwardCB (Fl_Widget *w, void *arg)
void | _sortCB (Fl_Widget *w, void *arg)
void | _previewCB (Fl_Widget *, void *arg)
void | _listModeCB (Fl_Widget *w, void *arg)
void | _filenameCB (Fl_Widget *w, void *arg)
void | _locationCB (Fl_Widget *w, void *arg)
void | _locationQJCB (Fl_Widget *w, void *arg)
void | delayedCdCB (void *arg)
void | selectCB (void *arg)
void | _cancelCB (Fl_Widget *, void *arg)
void | _okCB (Fl_Widget *, void *arg)
void | _trashCB (Fl_Widget *, void *arg)
void | _newFolderCB (Fl_Widget *, void *arg)
void | upDirCB (Fl_Widget *, void *arg)
void | reloadCB (Fl_Widget *, void *arg)
void | _homeCB (Fl_Widget *, void *arg)
void | _desktopCB (Fl_Widget *, void *arg)
void | _favoritesCB (Fl_Widget *, void *arg)
void | _myComputerCB (Fl_Widget *, void *arg)
void | _addToFavoritesCB (Fl_Widget *, void *arg)
void | _documentsCB (Fl_Widget *, void *arg)
void | _hideCB (Fl_Widget *, void *arg)
void | _qSort (int how, bool caseSort, Fl_Widget **array, int low, int high)
## Public Attributes
FileInput | filename
Flu_Button | ok
Flu_Button | cancel
Fl_Check_Button * | hiddenFiles
Flu_Combo_Tree * | location
PreviewGroup * | previewGroup
PreviewTile * | previewTile
Fl_Group * | fileGroup
Fl_Group * | locationQuickJump
Fl_Menu_Button | entryPopup
Fl_Image * | defaultFileIcon
Entry * | lastSelected
FileList * | filelist
FileColumns * | filecolumns
Fl_Group * | fileDetailsGroup
Fl_Scroll * | filescroll
FileDetails * | filedetails
Flu_Button * | detailNameBtn
Flu_Button * | detailTypeBtn
Flu_Button * | detailSizeBtn
Flu_Button * | detailDateBtn
FluSimpleString | currentDir
FluSimpleString | delayedCd
FluSimpleString | rawPattern
FluSimpleString | configFilename
FluSimpleString | userHome
FluSimpleString | userDesktop
FluSimpleString | userDocs
FluSimpleString | drives [26]
Fl_Pixmap * | driveIcons [26]
Flu_Button * | fileListBtn
Flu_Button * | fileListWideBtn
Flu_Button * | fileDetailsBtn
Flu_Button * | backBtn
Flu_Button * | forwardBtn
Flu_Button * | upDirBtn
Flu_Button * | trashBtn
Flu_Button * | newDirBtn
Flu_Button * | addFavoriteBtn
Flu_Button * | reloadBtn
Flu_Button * | previewBtn
Fl_Browser * | favoritesList
Flu_Combo_List * | filePattern
int | selectionType
bool | filenameEnterCallback
bool | filenameTabCallback
bool | walkingHistory
bool | caseSort
bool | fileEditing
int | sortMethod
FluStringVector | patterns
History * | history
History * | currentHist
Fl_Callback * | _callback
void * | _userdata
## Static Public Attributes
FluSimpleString | favoritesTxt
| strings to be set by a programmer to the correct phrase or name for their language
FluSimpleString | desktopTxt
FluSimpleString | myComputerTxt
FluSimpleString | myDocumentsTxt
FluSimpleString | filenameTxt
FluSimpleString | okTxt
FluSimpleString | cancelTxt
FluSimpleString | locationTxt
FluSimpleString | showHiddenTxt
FluSimpleString | fileTypesTxt
FluSimpleString | directoryTxt
FluSimpleString | allFilesTxt
FluSimpleString | defaultFolderNameTxt
FluSimpleString | backTTxt
FluSimpleString | forwardTTxt
FluSimpleString | upTTxt
FluSimpleString | reloadTTxt
FluSimpleString | trashTTxt
FluSimpleString | newDirTTxt
FluSimpleString | addFavoriteTTxt
FluSimpleString | previewTTxt
FluSimpleString | listTTxt
FluSimpleString | wideListTTxt
FluSimpleString | detailTTxt
FluSimpleString | detailTxt [4]
FluSimpleString | contextMenuTxt [3]
FluSimpleString | diskTypesTxt [6]
FluSimpleString | createFolderErrTxt
FluSimpleString | deleteFileErrTxt
FluSimpleString | fileExistsErrTxt
FluSimpleString | renameErrTxt
ContextHandlerVector | contextHandlers
PreviewHandlerVector | previewHandlers
ImgTxtPreview * | imgTxtPreview
int(* | customSort )(const char *, const char *)
FileTypeInfo * | types
int | numTypes
int | typeArraySize
FluSimpleString | dArrow [4]
FluSimpleString | uArrow [4]
## Friends
class | FileInput
class | Entry
class | FileList
class | FileDetails
class | CBTile
class | FileColumns
class | PreviewTile
class | PreviewGroup

## Detailed Description

A file and directory choosing widget that looks and acts similar to the stock Windows file chooser.

## Member Enumeration Documentation

anonymous enum

  | File entry type. Enumeration values:
  ENTRY_NONE | An empty (or non-existant) entry
  ENTRY_DIR | A directory entry
  ENTRY_FILE | A file entry
  ENTRY_FAVORITE | A favorite entry
  ENTRY_DRIVE | An entry that refers to a disk drive
  ENTRY_MYDOCUMENTS | The entry referring to the current user's documents
  ENTRY_MYCOMPUTER | The entry referring to "My Computer" in Windows

anonymous enum

  | Chooser type. Enumeration values:
  SINGLE | Choose a single file or directory
  MULTI | Choose multiple files or directories
  DIRECTORY | Choose directories (choosing files is implicit if this bit is clear)
  DEACTIVATE_FILES | When choosing directories, also show the files in a deactivated state
  SAVING | When choosing files, whether to keep the current filename always in the input area
  STDFILE | Choose both files and directories at the same time

## Member Function Documentation

void Flu_File_Chooser::add_context_handler | ( | int | type,
|  | const char * | ext,
|  | const char * | name,
|  | void(* | cb)(const char *, int, void *),
|  | void * | cbd
| ) | `[static]`

  | Add a custom callback that is called when the user right-clicks on an entry. Parameters:
  type | is the type of entry to handle (i.e. a logical OR of `ENTRY_NONE`, `ENTRY_DIR`, `ENTRY_FILE`, `ENTRY_FAVORITE`, `ENTRY_DRIVE`, `ENTRY_MYDOCUMENTS`, `ENTRY_MYCOMPUTER`). To add a "nothing" handler (when the user right-clicks on nothing), use ENTRY_NONE
  ext | is the extension of the file that will cause this handler to be added to the popup menu
  name | is the name that will appear in the popup menu for this handler

void Flu_File_Chooser::add_type | ( | const char * | extensions,
|  | const char * | short_description,
|  | Fl_Image * | icon = NULL
| ) | `[static]`

  | Add descriptive information and an icon for a file type. Parameters:
  extensions | is a space- or comma-delimited list of file extensions, or `NULL` for directories. e.g. "zip,tgz,rar"
  short_description | is a short description (!) of the file type. e.g. "Compressed Archive"
  icon | is an optional custom icon to use for this file type

## Member Data Documentation

FluSimpleString Flu_File_Chooser::favoritesTxt`[static]`

| strings to be set by a programmer to the correct phrase or name for their language (they are in english by default)

The documentation for this class was generated from the following file:

- Flu_File_Chooser.h