2001-11-06 18:35:24 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#ifndef nsFilePicker_h_
|
|
|
|
#define nsFilePicker_h_
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
#include "nsBaseFilePicker.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsIFileChannel.h"
|
2012-06-06 06:08:30 +04:00
|
|
|
#include "nsIFile.h"
|
2003-04-09 00:14:18 +04:00
|
|
|
#include "nsCOMArray.h"
|
2009-01-18 23:14:14 +03:00
|
|
|
#include "nsTArray.h"
|
2002-12-13 11:43:18 +03:00
|
|
|
|
|
|
|
class nsILocalFileMac;
|
|
|
|
@class NSArray;
|
|
|
|
|
2001-11-06 18:35:24 +03:00
|
|
|
class nsFilePicker : public nsBaseFilePicker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsFilePicker();
|
|
|
|
virtual ~nsFilePicker();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2009-06-30 22:55:30 +04:00
|
|
|
|
|
|
|
// nsIFilePicker (less what's in nsBaseFilePicker)
|
2004-04-22 03:38:22 +04:00
|
|
|
NS_IMETHOD GetDefaultString(nsAString& aDefaultString);
|
|
|
|
NS_IMETHOD SetDefaultString(const nsAString& aDefaultString);
|
|
|
|
NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension);
|
2002-12-13 11:43:18 +03:00
|
|
|
NS_IMETHOD GetFilterIndex(PRInt32 *aFilterIndex);
|
|
|
|
NS_IMETHOD SetFilterIndex(PRInt32 aFilterIndex);
|
2004-04-22 03:38:22 +04:00
|
|
|
NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension);
|
2012-06-06 06:08:30 +04:00
|
|
|
NS_IMETHOD GetFile(nsIFile * *aFile);
|
2008-02-26 19:12:17 +03:00
|
|
|
NS_IMETHOD GetFileURL(nsIURI * *aFileURL);
|
2003-04-09 00:14:18 +04:00
|
|
|
NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles);
|
2001-11-06 18:35:24 +03:00
|
|
|
NS_IMETHOD Show(PRInt16 *_retval);
|
2004-04-22 03:38:22 +04:00
|
|
|
NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter);
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2011-04-21 21:39:12 +04:00
|
|
|
/**
|
|
|
|
* Returns the current filter list in the format used by Cocoa's NSSavePanel
|
|
|
|
* and NSOpenPanel.
|
|
|
|
* Returns nil if no filter currently apply.
|
|
|
|
*/
|
|
|
|
NSArray* GetFilterList();
|
|
|
|
|
2001-11-06 18:35:24 +03:00
|
|
|
protected:
|
|
|
|
|
2009-06-30 22:55:30 +04:00
|
|
|
virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle, PRInt16 aMode);
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2009-06-30 22:55:30 +04:00
|
|
|
// actual implementations of get/put dialogs using NSOpenPanel & NSSavePanel
|
|
|
|
// aFile is an existing but unspecified file. These functions must specify it.
|
|
|
|
//
|
|
|
|
// will return |returnCancel| or |returnOK| as result.
|
2012-06-06 06:08:30 +04:00
|
|
|
PRInt16 GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray<nsIFile>& outFiles);
|
|
|
|
PRInt16 GetLocalFolder(const nsString& inTitle, nsIFile** outFile);
|
|
|
|
PRInt16 PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsIFile** outFile);
|
2003-04-09 00:14:18 +04:00
|
|
|
|
2002-12-13 11:43:18 +03:00
|
|
|
void SetDialogTitle(const nsString& inTitle, id aDialog);
|
|
|
|
NSString *PanelDefaultDirectory();
|
2007-12-11 06:44:51 +03:00
|
|
|
NSView* GetAccessoryView();
|
2001-11-06 18:35:24 +03:00
|
|
|
|
|
|
|
nsString mTitle;
|
|
|
|
PRInt16 mMode;
|
2012-06-06 06:08:30 +04:00
|
|
|
nsCOMArray<nsIFile> mFiles;
|
2001-11-06 18:35:24 +03:00
|
|
|
nsString mDefault;
|
|
|
|
|
2009-01-18 23:14:14 +03:00
|
|
|
nsTArray<nsString> mFilters;
|
|
|
|
nsTArray<nsString> mTitles;
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2008-02-29 08:36:35 +03:00
|
|
|
PRInt32 mSelectedTypeIndex;
|
2001-11-06 18:35:24 +03:00
|
|
|
};
|
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#endif // nsFilePicker_h_
|