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();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2009-06-30 22:55:30 +04:00
|
|
|
|
|
|
|
// nsIFilePicker (less what's in nsBaseFilePicker)
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetDefaultString(nsAString& aDefaultString) override;
|
|
|
|
NS_IMETHOD SetDefaultString(const nsAString& aDefaultString) override;
|
|
|
|
NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension) override;
|
|
|
|
NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex) override;
|
|
|
|
NS_IMETHOD SetFilterIndex(int32_t aFilterIndex) override;
|
|
|
|
NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension) override;
|
|
|
|
NS_IMETHOD GetFile(nsIFile * *aFile) override;
|
|
|
|
NS_IMETHOD GetFileURL(nsIURI * *aFileURL) override;
|
|
|
|
NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles) override;
|
|
|
|
NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter) override;
|
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:
|
2014-07-06 19:25:31 +04:00
|
|
|
virtual ~nsFilePicker();
|
2001-11-06 18:35:24 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle) override;
|
2017-08-06 07:15:31 +03:00
|
|
|
nsresult Show(int16_t *_retval) override;
|
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-08-22 19:56:38 +04: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-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;
|
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
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mSelectedTypeIndex;
|
2001-11-06 18:35:24 +03:00
|
|
|
};
|
|
|
|
|
2007-01-18 09:34:07 +03:00
|
|
|
#endif // nsFilePicker_h_
|