Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Language
English













SourceForge.net Logo



FileSel

 

class FileSel : public WithFileSelectorLayout<TopWindow> 

 

 

Dialog for selecting files or directories.

 

 

Public Method List

 

Callback3<bool, const String&, Image&> WhenIcon

This callback can be used to alter icons for files. First parameter designates directory, second is the filename. Client code can alter Image passed as third parameter.

 


 

void Serialize(Stream& s)

Serializes current settings of FileSel. That includes current directory, currently selected file type, size of FileSel window, LRU list of visited directories and "Sort by" switch state.

 


 

bool ExecuteOpen(const char *title = NULL)

Executes "Open file" dialog. title can specify alternate caption of dialog. If user selects a file to open, returns true.

 


 

bool ExecuteSaveAs(const char *title = NULL)

Executes "Save as" dialog. title can specify alternate caption of dialog. If user selects a destination file, returns true.

 


 

bool ExecuteSelectDir(const char *title = NULL)

Executes directory selection dialog. title can specify alternate caption of dialog. If user selects a file to open, returns true.

 


 

String Get() const

Returns the path of the first chosen file. If there is none, returns empty String.

 


 

void Set(const String& s)

Sets s to be the chosen file: if it contains a full path, file selector goes to the directory, filename is put into the file name editor of file selector.

 


 

void Set(const Vector<String>& s)

Sets a group of files to be chosen.

 


 

operator String() const

Same as Get().

 


 

void operator=(const String& s)

Same as Set(s).

 


 

String operator~() const

Same as Get().

 


 

void operator<<=(const String& s)

Same as Set(s).

 


 

int GetCount() const

Returns a count of chosen files.

 


 

String GetFile(int iconst

Returns a chosen file i.

 


 

String operator[](int iconst

Same as GetFile(i).

 


 

void ClearFiles()

Clear the selection of files.

 


 

bool GetReadOnly() const

Returns the status of read-only option. (Usually this option is used to open files in read only mode).

 


 

String GetActiveDir() const

Returns the active directory of file selector.

 


 

int GetActiveType() const

Returns the active file type index of file selector.

 


 

void Filesystem(FileSystemInfo& fsys)

Sets the file system to browse. Default is normal local file system.

 


 

FileSystemInfo& GetFilesystem() const

Returns the file system used in file selector.

 


 

FileSel& Type(const char *name, const char *ext)

Adds a file type displayed as name. ext contains a set of file masks separated by spaces. Example: Type("Source files", "*.c *.h").

 


 

FileSel& Types(const char *d)

Adds a number of file types using simple text format: '\n' is used to separate types, '\t' is used to separate file type description and file mask. If there is no '\t', text is used for both file description and the file mask.

Examples: Types("All files\t*.*\nText files\t*.txt\nImage files\t*.bmp *.png *.jpg *.gif")).

 


 

FileSel& AllFilesType()

Same as Type("All files", "*.*").

 


 

FileSel& ClearTypes()

Removes all file types from FileSel.

 


 

FileSel& ActiveDir(const String& d)

Sets the active directory of file selector (directory where file selector starts).

 


 

FileSel& ActiveType(int i)

Sets the active file type.

 


 

FileSel& PreSelect(const String& path)

Preselects the file path.

 


 

FileSel& DefaultExt(const char *ext)

Sets the file extension to add for "Save as" dialog if none is specified.

 


 

FileSel& Multi(bool b = true)

In this mode, more than single file can be selected. Default is false.

 


 

FileSel& ReadOnlyOption(bool b = true)

Makes "Read only" option visible. Default is false.

 


 

FileSel& MkDirOption(bool b = true)

Makes "Make directory" button visible. Default is true.

 


 

FileSel& NoMkDirOption()

Same as MkDirOption(false).

 


 

FileSel& BaseDir(const char *dir)

Sets dir to be the base directory. If used, files can be selected only inside this base directory (or its subdirectories) and selected file paths are relative to it.

 


 

FileSel& Asking(bool b = true)

If active, file selector asks before returning the path of existing file in "Save as" dialog. Default is active.

 


 

FileSel& NoAsking()

Same as Asking(false).

 


 

FileSel& EditFileName(bool b)

If active, user can type files into filename edit field. Default is active.

 


 

FileSel& NoEditFileName()

Same as EditFileName(false).

 


 

FileSel& AppModal(bool b = true)

 


 

FileSel& NoAppModal()

If active (default), dialog is run as application modal.

 


 

FileSel& Preview(Ctrl& ctrl)

Sets ctrl to be provide a preview of currently selected file. This widget is placed into FileSel and receives the path of file via SetData to be previewed or Null if there is nothing to preview.

 


 

FileSel& Preview(const Display& d)

Sets d to be provide a preview of currently selected file. This Display is by FileSel to show the preview, the Value in Paint method is either the path of file or Null if there is nothing to preview.

 


 

FileSel& ClearPlaces()

Empties the list of special folders (platform specific, usually folders like Video, Pictures, Downloads are in the default list). The list, if not empty, is displayed in the left part of dialog.

 


 

FileSel& AddPlace(const String& path, const Image& m, const String& name, const char* group = NULL, int row = -1)

FileSel& AddPlace(const String& path, const String& name, const char* group = NULL, int row = -1)

FileSel& AddPlace(const String& path, const char* group = NULL, int row = -1)

Adds a folder path to the list of special folders with name and icon m. group and row must at the moment be left to its default values (they are only used internally). If name or icon m is not specified, they are created based on path.


 

FileSel& AddPlaceSeparator()

Adds horizontal separator line to the list of special folders.

 


 

FileSel& AddStandardPlaces()

Adds default special folders to the list. Called by FileSel constructor.

 

 

Do you want to contribute?