Bug 1527719 [wpt PR 15359] - KV storage: make backingStore return the same frozen...
[gecko.git] / widget / nsIFilePicker.idl
blob39b95ea29cad7aebdf4ba99431b98322f73e92e5
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 interface nsIFile;
10 interface nsIURI;
11 interface mozIDOMWindowProxy;
12 interface nsISimpleEnumerator;
14 [scriptable, function, uuid(0d79adad-b244-49A5-9997-2a8cad93fc44)]
15 interface nsIFilePickerShownCallback : nsISupports
17 /**
18 * Callback which is called when a filepicker is shown and a result
19 * is returned.
21 * @param aResult One of returnOK, returnCancel, or returnReplace
23 void done(in short aResult);
26 [scriptable, uuid(9285b984-02d3-46b4-9514-7da8c471a747)]
27 interface nsIFilePicker : nsISupports
29 const short modeOpen = 0; // Load a file or directory
30 const short modeSave = 1; // Save a file or directory
31 const short modeGetFolder = 2; // Select a folder/directory
32 const short modeOpenMultiple= 3; // Load multiple files
34 const short returnOK = 0; // User hit Ok, process selection
35 const short returnCancel = 1; // User hit cancel, ignore selection
36 const short returnReplace = 2; // User acknowledged file already exists so ok to replace, process selection
38 const long filterAll = 0x001; // *.*
39 const long filterHTML = 0x002; // *.html; *.htm
40 const long filterText = 0x004; // *.txt
41 const long filterImages = 0x008; // *.jpe; *.jpg; *.jpeg; *.gif;
42 // *.png; *.bmp; *.ico; *.svg;
43 // *.svgz; *.tif; *.tiff; *.ai;
44 // *.drw; *.pct; *.psp; *.xcf;
45 // *.psd; *.raw
46 const long filterXML = 0x010; // *.xml
47 const long filterXUL = 0x020; // *.xul
48 const long filterApps = 0x040; // Applications (per-platform implementation)
49 const long filterAllowURLs = 0x080; // Allow URLs
50 const long filterAudio = 0x100; // *.aac; *.aif; *.flac; *.iff;
51 // *.m4a; *.m4b; *.mid; *.midi;
52 // *.mp3; *.mpa; *.mpc; *.oga;
53 // *.ogg; *.ra; *.ram; *.snd;
54 // *.wav; *.wma
55 const long filterVideo = 0x200; // *.avi; *.divx; *.flv; *.m4v;
56 // *.mkv; *.mov; *.mp4; *.mpeg;
57 // *.mpg; *.ogm; *.ogv; *.ogx;
58 // *.rm; *.rmvb; *.smil; *.webm;
59 // *.wmv; *.xvid
61 /**
62 * Initialize the file picker widget. The file picker is not valid until this
63 * method is called.
65 * @param parent mozIDOMWindow parent. This dialog will be dependent
66 * on this parent. parent must be non-null.
67 * @param title The title for the file widget
68 * @param mode load, save, or get folder
71 void init(in mozIDOMWindowProxy parent, in AString title, in short mode);
73 /**
74 * Append to the filter list with things from the predefined list
76 * @param filters mask of filters i.e. (filterAll | filterHTML)
79 void appendFilters(in long filterMask);
81 /**
82 * Add a filter
84 * @param title name of the filter
85 * @param filter extensions to filter -- semicolon and space separated
88 void appendFilter(in AString title,
89 in AString filter);
91 /**
92 * Add a raw filter (eg, add a MIME type without transforming it to a list of
93 * extensions).
95 * @param filter a filter taken directly from the accept attribute
96 * without processing
99 void appendRawFilter(in AString filter);
102 * The filename that should be suggested to the user as a default. This should
103 * include the extension.
105 * @throws NS_ERROR_FAILURE on attempts to get
107 attribute AString defaultString;
110 * The extension that should be associated with files of the type we
111 * want to work with. On some platforms, this extension will be
112 * automatically appended to filenames the user enters, if needed.
114 attribute AString defaultExtension;
117 * The filter which is currently selected in the File Picker dialog
119 * @return Returns the index (0 based) of the selected filter in the filter list.
121 attribute long filterIndex;
124 * Set the directory that the file open/save dialog initially displays
125 * Note that, if displaySpecialDirectory has been already set, this value will
126 * be ignored.
128 * @param displayDirectory the name of the directory
131 attribute nsIFile displayDirectory;
134 * Set the directory that the file open/save dialog initially displays using
135 * one of the special name as such as 'Desk', 'TmpD', and so on.
136 * Note that, if displayDirectory has been already set, this value will be
137 * ignored.
139 * @param displaySpecialDirectory the name of the special directory
142 attribute AString displaySpecialDirectory;
146 * Get the nsIFile for the file or directory.
148 * @return Returns the file currently selected
150 readonly attribute nsIFile file;
153 * Get the nsIURI for the file or directory.
155 * @return Returns the file currently selected
157 readonly attribute nsIURI fileURL;
160 * Get the enumerator for the selected files
161 * only works in the modeOpenMultiple mode
163 * @return Returns the files currently selected
165 readonly attribute nsISimpleEnumerator files;
168 * Get the DOM File or the DOM Directory
170 * @return Returns the file or directory currently selected DOM object.
172 readonly attribute nsISupports domFileOrDirectory;
175 * Get the enumerator for the selected files or directories
176 * only works in the modeOpenMultiple mode
178 * @return Returns the files/directories currently selected as DOM object.
180 readonly attribute nsISimpleEnumerator domFileOrDirectoryEnumerator;
183 * Controls whether the chosen file(s) should be added to the system's recent
184 * documents list. This attribute will be ignored if the system has no "Recent
185 * Docs" concept, or if the application is in private browsing mode (in which
186 * case the file will not be added). Defaults to true.
188 attribute boolean addToRecentDocs;
191 * Opens the file dialog asynchrounously.
192 * The passed in object's done method will be called upon completion.
194 void open(in nsIFilePickerShownCallback aFilePickerShownCallback);
197 * The picker's mode, as set by the 'mode' argument passed to init()
198 * (one of the modeOpen et. al. constants specified above).
200 readonly attribute short mode;
203 * If set to non-empty string, the nsIFilePicker implementation
204 * may use okButtonLabel as the label for the button the user uses to accept
205 * file selection.
207 attribute AString okButtonLabel;