wxWidgets: /home/Hamish/wxwidgets/wxWidgets3.0-3.0.5.1-1.src/wxWidgets3.0-3.0.5.1-1.i686/src/wxWidgets-3.0.5.1/interface/wx/filedlg.h File Reference

| Version: 3.0.5

Classes | Macros | Enumerations | Functions | Variables
filedlg.h File Reference

## Classes
class | wxFileDialog
| This class represents the file chooser dialog. More...

## Macros
#define | wxFD_DEFAULT_STYLE wxFD_OPEN

## Enumerations
enum | { wxFD_OPEN = 0x0001, wxFD_SAVE = 0x0002, wxFD_OVERWRITE_PROMPT = 0x0004, wxFD_FILE_MUST_EXIST = 0x0010, wxFD_MULTIPLE = 0x0020, wxFD_CHANGE_DIR = 0x0080, wxFD_PREVIEW = 0x0100 }

## Functions
wxString | wxFileSelector (const wxString &message, const wxString &default_path=wxEmptyString, const wxString &default_filename=wxEmptyString, const wxString &default_extension=wxEmptyString, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, int flags=0, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
| Pops up a file selector box. More...
wxString | wxFileSelectorEx (const wxString &message=wxFileSelectorPromptStr, const wxString &default_path=wxEmptyString, const wxString &default_filename=wxEmptyString, int *indexDefaultExtension=NULL, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, int flags=0, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
| An extended version of wxFileSelector. More...
wxString | wxLoadFileSelector (const wxString &what, const wxString &extension, const wxString &default_name=wxEmptyString, wxWindow *parent=NULL)
| Ask for filename to load. More...
wxString | wxSaveFileSelector (const wxString &what, const wxString &extension, const wxString &default_name=wxEmptyString, wxWindow *parent=NULL)
| Ask for filename to save. More...

## Variables
const char | wxFileSelectorDefaultWildcardStr []
| Default wildcard string used in wxFileDialog corresponding to all files. More...

## Macro Definition Documentation

## ◆ wxFD_DEFAULT_STYLE

#define wxFD_DEFAULT_STYLE wxFD_OPEN

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
wxFD_OPEN |
wxFD_SAVE |
wxFD_OVERWRITE_PROMPT |
wxFD_FILE_MUST_EXIST |
wxFD_MULTIPLE |
wxFD_CHANGE_DIR |
wxFD_PREVIEW |

## Function Documentation

## ◆ wxFileSelector()

wxString wxFileSelector | ( | const wxString & | message,
|  | const wxString & | default_path = `wxEmptyString`,
|  | const wxString & | default_filename = `wxEmptyString`,
|  | const wxString & | default_extension = `wxEmptyString`,
|  | const wxString & | wildcard = `wxFileSelectorDefaultWildcardStr`,
|  | int | flags = `0`,
|  | wxWindow * | parent = `NULL`,
|  | int | x = `wxDefaultCoord`,
|  | int | y = `wxDefaultCoord`
| ) |  |

Pops up a file selector box.

In Windows, this is the common file selector dialog. In X, this is a file selector box with the same functionality. The path and filename are distinct elements of a full file pathname. If path is empty, the current directory will be used. If filename is empty, no default filename will be supplied. The wildcard determines what files are displayed in the file selector, and file extension supplies a type extension for the required filename. Flags may be a combination of wxFD_OPEN, wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST.

Note
  wxFD_MULTIPLE can only be used with wxFileDialog and not here since this function only returns a single file name.

Both the Unix and Windows versions implement a wildcard filter. Typing a filename containing wildcards (*, ?) in the filename text item, and clicking on Ok, will result in only those files matching the pattern being displayed.

The wildcard may be a specification for multiple types of file with a description for each, such as:

"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"

The application must check for an empty return value (the user pressed Cancel). For example:

wxString filename = wxFileSelector("Choose a file to open");
if ( !filename.empty() )
{
// work with the file
...
}
//else: cancelled by user

Include file:

    #include <wx/filedlg.h>

## ◆ wxFileSelectorEx()

wxString wxFileSelectorEx | ( | const wxString & | message = `wxFileSelectorPromptStr`,
|  | const wxString & | default_path = `wxEmptyString`,
|  | const wxString & | default_filename = `wxEmptyString`,
|  | int * | indexDefaultExtension = `NULL`,
|  | const wxString & | wildcard = `wxFileSelectorDefaultWildcardStr`,
|  | int | flags = `0`,
|  | wxWindow * | parent = `NULL`,
|  | int | x = `wxDefaultCoord`,
|  | int | y = `wxDefaultCoord`
| ) |  |

An extended version of wxFileSelector.

## ◆ wxLoadFileSelector()

wxString wxLoadFileSelector | ( | const wxString & | what,
|  | const wxString & | extension,
|  | const wxString & | default_name = `wxEmptyString`,
|  | wxWindow * | parent = `NULL`
| ) |  |

Ask for filename to load.

## ◆ wxSaveFileSelector()

wxString wxSaveFileSelector | ( | const wxString & | what,
|  | const wxString & | extension,
|  | const wxString & | default_name = `wxEmptyString`,
|  | wxWindow * | parent = `NULL`
| ) |  |

Ask for filename to save.

## Variable Documentation

## ◆ wxFileSelectorDefaultWildcardStr

const char wxFileSelectorDefaultWildcardStr[]

Default wildcard string used in wxFileDialog corresponding to all files.

It is defined as "*.*" under MSW and OS/2 and "*" everywhere else.

wxFileSelector
wxString wxFileSelector(const wxString &message, const wxString &default_path=wxEmptyString, const wxString &default_filename=wxEmptyString, const wxString &default_extension=wxEmptyString, const wxString &wildcard=wxFileSelectorDefaultWildcardStr, int flags=0, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Pops up a file selector box.
wxString
String class for passing textual data to or receiving it from wxWidgets.
Definition: string.h:314
wxString::empty
bool empty() const
An 'invalid' value for string index.