2001-11-06 15:35:24 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
2012-05-21 11:12:37 +00: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 15:35:24 +00:00
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#ifndef nsFilePicker_h_
|
|
|
|
#define nsFilePicker_h_
|
2001-11-06 15:35:24 +00:00
|
|
|
|
|
|
|
#include "nsBaseFilePicker.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsIFileChannel.h"
|
2012-06-06 02:08:30 +00:00
|
|
|
#include "nsIFile.h"
|
2003-04-08 20:14:18 +00:00
|
|
|
#include "nsCOMArray.h"
|
2009-01-18 20:14:14 +00:00
|
|
|
#include "nsTArray.h"
|
2002-12-13 08:43:18 +00:00
|
|
|
|
|
|
|
class nsILocalFileMac;
|
|
|
|
@class NSArray;
|
|
|
|
|
2001-11-06 15:35:24 +00:00
|
|
|
class nsFilePicker : public nsBaseFilePicker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsFilePicker();
|
|
|
|
virtual ~nsFilePicker();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2009-06-30 18:55:30 +00:00
|
|
|
|
|
|
|
// nsIFilePicker (less what's in nsBaseFilePicker)
|
2004-04-21 23:38:22 +00:00
|
|
|
NS_IMETHOD GetDefaultString(nsAString& aDefaultString);
|
|
|
|
NS_IMETHOD SetDefaultString(const nsAString& aDefaultString);
|
|
|
|
NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex);
|
|
|
|
NS_IMETHOD SetFilterIndex(int32_t aFilterIndex);
|
2004-04-21 23:38:22 +00:00
|
|
|
NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension);
|
2012-06-06 02:08:30 +00:00
|
|
|
NS_IMETHOD GetFile(nsIFile * *aFile);
|
2008-02-26 16:12:17 +00:00
|
|
|
NS_IMETHOD GetFileURL(nsIURI * *aFileURL);
|
2003-04-08 20:14:18 +00:00
|
|
|
NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD Show(int16_t *_retval);
|
2004-04-21 23:38:22 +00:00
|
|
|
NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter);
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2011-04-21 17:39:12 +00: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 15:35:24 +00:00
|
|
|
protected:
|
|
|
|
|
2013-07-22 09:12:32 +00:00
|
|
|
virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle);
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2009-06-30 18:55:30 +00: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-08-22 15:56:38 +00:00
|
|
|
int16_t GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray<nsIFile>& outFiles);
|
|
|
|
int16_t GetLocalFolder(const nsString& inTitle, nsIFile** outFile);
|
|
|
|
int16_t PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsIFile** outFile);
|
2003-04-08 20:14:18 +00:00
|
|
|
|
2002-12-13 08:43:18 +00:00
|
|
|
void SetDialogTitle(const nsString& inTitle, id aDialog);
|
|
|
|
NSString *PanelDefaultDirectory();
|
2007-12-11 03:44:51 +00:00
|
|
|
NSView* GetAccessoryView();
|
2001-11-06 15:35:24 +00:00
|
|
|
|
|
|
|
nsString mTitle;
|
2012-06-06 02:08:30 +00:00
|
|
|
nsCOMArray<nsIFile> mFiles;
|
2001-11-06 15:35:24 +00:00
|
|
|
nsString mDefault;
|
|
|
|
|
2009-01-18 20:14:14 +00:00
|
|
|
nsTArray<nsString> mFilters;
|
|
|
|
nsTArray<nsString> mTitles;
|
2001-11-06 15:35:24 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mSelectedTypeIndex;
|
2001-11-06 15:35:24 +00:00
|
|
|
};
|
|
|
|
|
2007-01-18 06:34:07 +00:00
|
|
|
#endif // nsFilePicker_h_
|