Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / widget / src / cocoa / nsFilePicker.h
blob35f553ae829170d3d5647c2ef26c4289b32a96bd
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"
52 class nsILocalFileMac;
53 @class NSArray;
56 /**
57 * Native Mac Cocoa FileSelector wrapper
60 class nsFilePicker : public nsBaseFilePicker
62 public:
63 nsFilePicker();
64 virtual ~nsFilePicker();
66 NS_DECL_ISUPPORTS
68 // nsIFilePicker (less what's in nsBaseFilePicker)
69 NS_IMETHOD GetDefaultString(nsAString& aDefaultString);
70 NS_IMETHOD SetDefaultString(const nsAString& aDefaultString);
71 NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension);
72 NS_IMETHOD GetFilterIndex(PRInt32 *aFilterIndex);
73 NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex);
74 NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension);
75 NS_IMETHOD GetFile(nsILocalFile * *aFile);
76 NS_IMETHOD GetFileURL(nsIURI * *aFileURL);
77 NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles);
78 NS_IMETHOD Show(PRInt16 *_retval);
79 NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter);
81 protected:
83 virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle,
84 PRInt16 aMode);
86 // actual implementations of get/put dialogs using NSOpenPanel & NSSavePanel
87 // aFile is an existing but unspecified file. These functions must specify it.
89 // will return |returnCancel| or |returnOK| as result.
90 PRInt16 GetLocalFiles(const nsString& inTitle, PRBool inAllowMultiple, nsCOMArray<nsILocalFile>& outFiles);
91 PRInt16 GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile);
92 PRInt16 PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsILocalFile** outFile);
94 NSArray *GenerateFilterList();
95 void SetDialogTitle(const nsString& inTitle, id aDialog);
96 NSString *PanelDefaultDirectory();
97 NSView* GetAccessoryView();
99 nsString mTitle;
100 PRInt16 mMode;
101 nsCOMArray<nsILocalFile> mFiles;
102 nsString mDefault;
104 nsStringArray mFilters;
105 nsStringArray mTitles;
107 PRInt32 mSelectedTypeIndex;
110 #endif // nsFilePicker_h_