Public Member Functions | Public Attributes

nsIFilePicker Interface Reference

import "nsIFilePicker.idl";

Collaboration diagram for nsIFilePicker:

List of all members.

Public Member Functions

void init (in nsIDOMWindow parent, in AString title, in short mode)
 Initialize the file picker widget.
void appendFilters (in long filterMask)
 Append to the filter list with things from the predefined list.
void appendFilter (in AString title, in AString filter)
 Add a filter.
short show ()
 Show File Dialog.

Public Attributes

const short modeOpen = 0
const short modeSave = 1
const short modeGetFolder = 2
const short modeOpenMultiple = 3
const short returnOK = 0
const short returnCancel = 1
const short returnReplace = 2
const long filterAll = 0x01
const long filterHTML = 0x02
const long filterText = 0x04
const long filterImages = 0x08
const long filterXML = 0x10
const long filterXUL = 0x20
const long filterApps = 0x40
const long filterAllowURLs = 0x80
attribute AString defaultString
 The filename that should be suggested to the user as a default.
attribute AString defaultExtension
 The extension that should be associated with files of the type we want to work with.
attribute long filterIndex
 The filter which is currently selected in the File Picker dialog.
attribute nsILocalFile displayDirectory
 Set the directory that the file open/save dialog initially displays.
readonly attribute nsILocalFile file
 Get the nsILocalFile for the file or directory.
readonly attribute nsIURI fileURL
 Get the nsIURI for the file or directory.
readonly attribute
nsISimpleEnumerator 
files
 Get the enumerator for the selected files only works in the modeOpenMultiple mode.

Member Function Documentation

void nsIFilePicker::appendFilter ( in AString  title,
in AString  filter 
)

Add a filter.

Parameters:
title name of the filter
filter extensions to filter -- semicolon and space separated
void nsIFilePicker::appendFilters ( in long  filterMask  ) 

Append to the filter list with things from the predefined list.

Parameters:
filters mask of filters i.e. (filterAll | filterHTML)
void nsIFilePicker::init ( in nsIDOMWindow  parent,
in AString  title,
in short  mode 
)

Initialize the file picker widget.

The file picker is not valid until this method is called.

Parameters:
parent nsIDOMWindow parent. This dialog will be dependent on this parent. parent must be non-null.
title The title for the file widget
mode load, save, or get folder
short nsIFilePicker::show (  ) 

Show File Dialog.

The dialog is displayed modally.

Returns:
returnOK if the user selects OK, returnCancel if the user selects cancel

Member Data Documentation

The extension that should be associated with files of the type we want to work with.

On some platforms, this extension will be automatically appended to filenames the user enters, if needed.

attribute AString nsIFilePicker::defaultString

The filename that should be suggested to the user as a default.

Exceptions:
NS_ERROR_FAILURE on attempts to get

Set the directory that the file open/save dialog initially displays.

Parameters:
displayDirectory the name of the directory
readonly attribute nsILocalFile nsIFilePicker::file

Get the nsILocalFile for the file or directory.

Returns:
Returns the file currently selected

Get the enumerator for the selected files only works in the modeOpenMultiple mode.

Returns:
Returns the files currently selected
readonly attribute nsIURI nsIFilePicker::fileURL

Get the nsIURI for the file or directory.

Returns:
Returns the file currently selected
const long nsIFilePicker::filterAll = 0x01
const long nsIFilePicker::filterAllowURLs = 0x80
const long nsIFilePicker::filterApps = 0x40
const long nsIFilePicker::filterHTML = 0x02
const long nsIFilePicker::filterImages = 0x08

The filter which is currently selected in the File Picker dialog.

Returns:
Returns the index (0 based) of the selected filter in the filter list.
const long nsIFilePicker::filterText = 0x04
const long nsIFilePicker::filterXML = 0x10
const long nsIFilePicker::filterXUL = 0x20
const short nsIFilePicker::modeOpen = 0
const short nsIFilePicker::modeSave = 1
const short nsIFilePicker::returnCancel = 1
const short nsIFilePicker::returnOK = 0

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