CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / widget / src / cocoa / nsFilePicker.h
blob08732802ebb621a00ea22e8ae12fcc6af4eba23a
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2000
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Stuart Parmenter <pavlov@netscape.com>
25 * Steve Dagley <sdagley@netscape.com>
26 * David Haas <haasd@cae.wisc.edu>
27 * Steve Dagley <sdagley@netscape.com>
29 * Alternatively, the contents of this file may be used under the terms of
30 * either the GNU General Public License Version 2 or later (the "GPL"), or
31 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
32 * in which case the provisions of the GPL or the LGPL are applicable instead
33 * of those above. If you wish to allow use of your version of this file only
34 * under the terms of either the GPL or the LGPL, and not to allow others to
35 * use your version of this file under the terms of the MPL, indicate your
36 * decision by deleting the provisions above and replace them with the notice
37 * and other provisions required by the GPL or the LGPL. If you do not delete
38 * the provisions above, a recipient may use your version of this file under
39 * the terms of any one of the MPL, the GPL or the LGPL.
41 * ***** END LICENSE BLOCK ***** */
43 #ifndef nsFilePicker_h_
44 #define nsFilePicker_h_
46 #include "nsBaseFilePicker.h"
47 #include "nsString.h"
48 #include "nsIFileChannel.h"
49 #include "nsILocalFile.h"
50 #include "nsCOMArray.h"
51 #include "nsTArray.h"
53 class nsILocalFileMac;
54 @class NSArray;
56 class nsFilePicker : public nsBaseFilePicker
58 public:
59 nsFilePicker();
60 virtual ~nsFilePicker();
62 NS_DECL_ISUPPORTS
64 // nsIFilePicker (less what's in nsBaseFilePicker)
65 NS_IMETHOD GetDefaultString(nsAString& aDefaultString);
66 NS_IMETHOD SetDefaultString(const nsAString& aDefaultString);
67 NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension);
68 NS_IMETHOD GetFilterIndex(PRInt32 *aFilterIndex);
69 NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex);
70 NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension);
71 NS_IMETHOD GetFile(nsILocalFile * *aFile);
72 NS_IMETHOD GetFileURL(nsIURI * *aFileURL);
73 NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles);
74 NS_IMETHOD Show(PRInt16 *_retval);
75 NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter);
77 protected:
79 virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle, PRInt16 aMode);
81 // actual implementations of get/put dialogs using NSOpenPanel & NSSavePanel
82 // aFile is an existing but unspecified file. These functions must specify it.
84 // will return |returnCancel| or |returnOK| as result.
85 PRInt16 GetLocalFiles(const nsString& inTitle, const nsString& inDefaultName, PRBool inAllowMultiple, nsCOMArray<nsILocalFile>& outFiles);
86 PRInt16 GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile);
87 PRInt16 PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsILocalFile** outFile);
89 NSArray *GenerateFilterList();
90 void SetDialogTitle(const nsString& inTitle, id aDialog);
91 NSString *PanelDefaultDirectory();
92 NSView* GetAccessoryView();
94 nsString mTitle;
95 PRInt16 mMode;
96 nsCOMArray<nsILocalFile> mFiles;
97 nsString mDefault;
99 nsTArray<nsString> mFilters;
100 nsTArray<nsString> mTitles;
102 PRInt32 mSelectedTypeIndex;
105 #endif // nsFilePicker_h_