#include <GFileSelect.h>
Inherits GBase.
Public Member Functions | |
char * | Name () |
Returns the first file name selected. | |
bool | Name (const char *n) |
Sets the file name. | |
char * | operator[] (int i) |
Returns the n'th file name selected. | |
int | Length () |
Returns the number of file names selected. | |
GViewI * | Parent () |
Returns the parent window. | |
void | Parent (GViewI *Window) |
Sets the parent window. | |
bool | MultiSelect () |
Returns whether the use can select multiple files. | |
void | MultiSelect (bool Multi) |
Sets whether the use can select multiple files. | |
bool | ReadOnly () |
Returns whether read only was selected. | |
void | ShowReadOnly (bool ro) |
Sets whether the user sees a read only option. | |
char * | InitialDir () |
Gets the initial directory to open in. | |
void | InitialDir (const char *InitDir) |
Sets the initial directory to open in. | |
char * | Title () |
Gets the title of the dialog box. | |
void | Title (const char *Title) |
Sets the title of the dialog box. | |
char * | DefaultExtension () |
Gets the default extension to append to files selected without an extension. | |
void | DefaultExtension (const char *DefExt) |
Sets the default extension to append to files selected without an extension. | |
int | Types () |
Returns the number of types in the type list. | |
int | SelectedType () |
Returns the 0 based index of the type selected in the type list. | |
GFileType * | TypeAt (int n) |
Returns the type into at a given index. | |
bool | Type (const char *Description, const char *Extension, int Data=0) |
Adds a file type to the type filters list. | |
void | ClearTypes () |
Empties the type list. | |
bool | Open () |
bool | Save () |
bool | OpenFolder () |
Handles the UI for selecting files for opening and saving and selecting directories. Uses the Win32 system dialogs on Windows and has it's own native window on Linux.
A simple example of this class in action:
GFileSelect s; s.Parent(MyWindow); s.Type("PNG Files", "*.png"); if (s.Open()) { LgiMsg(MyWindow, "The file selected is '%s'", "Example", MB_OK, s.Name()); }
bool GFileSelect::Type | ( | const char * | Description, | |
const char * | Extension, | |||
int | Data = 0 | |||
) |
Adds a file type to the type filters list.
Description | This full description of the file type |
Extension | The extension(s) of the file type: e.g: '*.png;*.gif;*.jpg' |
Data | Application defined 32-bit value. |
Referenced by SystemFunctions::SelectFiles().
bool GFileSelect::Open | ( | ) |
Shows the open file dialog
References IDOK.
Referenced by SystemFunctions::SelectFiles().
bool GFileSelect::Save | ( | ) |
Shows the save file dialog
References IDOK.
bool GFileSelect::OpenFolder | ( | ) |
Shows the open folder dialog
References IDOK.