1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/cocoa/nsFilePicker.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef nsFilePicker_h_ 1.11 +#define nsFilePicker_h_ 1.12 + 1.13 +#include "nsBaseFilePicker.h" 1.14 +#include "nsString.h" 1.15 +#include "nsIFileChannel.h" 1.16 +#include "nsIFile.h" 1.17 +#include "nsCOMArray.h" 1.18 +#include "nsTArray.h" 1.19 + 1.20 +class nsILocalFileMac; 1.21 +@class NSArray; 1.22 + 1.23 +class nsFilePicker : public nsBaseFilePicker 1.24 +{ 1.25 +public: 1.26 + nsFilePicker(); 1.27 + virtual ~nsFilePicker(); 1.28 + 1.29 + NS_DECL_ISUPPORTS 1.30 + 1.31 + // nsIFilePicker (less what's in nsBaseFilePicker) 1.32 + NS_IMETHOD GetDefaultString(nsAString& aDefaultString); 1.33 + NS_IMETHOD SetDefaultString(const nsAString& aDefaultString); 1.34 + NS_IMETHOD GetDefaultExtension(nsAString& aDefaultExtension); 1.35 + NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex); 1.36 + NS_IMETHOD SetFilterIndex(int32_t aFilterIndex); 1.37 + NS_IMETHOD SetDefaultExtension(const nsAString& aDefaultExtension); 1.38 + NS_IMETHOD GetFile(nsIFile * *aFile); 1.39 + NS_IMETHOD GetFileURL(nsIURI * *aFileURL); 1.40 + NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); 1.41 + NS_IMETHOD Show(int16_t *_retval); 1.42 + NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter); 1.43 + 1.44 + /** 1.45 + * Returns the current filter list in the format used by Cocoa's NSSavePanel 1.46 + * and NSOpenPanel. 1.47 + * Returns nil if no filter currently apply. 1.48 + */ 1.49 + NSArray* GetFilterList(); 1.50 + 1.51 +protected: 1.52 + 1.53 + virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle); 1.54 + 1.55 + // actual implementations of get/put dialogs using NSOpenPanel & NSSavePanel 1.56 + // aFile is an existing but unspecified file. These functions must specify it. 1.57 + // 1.58 + // will return |returnCancel| or |returnOK| as result. 1.59 + int16_t GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, nsCOMArray<nsIFile>& outFiles); 1.60 + int16_t GetLocalFolder(const nsString& inTitle, nsIFile** outFile); 1.61 + int16_t PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsIFile** outFile); 1.62 + 1.63 + void SetDialogTitle(const nsString& inTitle, id aDialog); 1.64 + NSString *PanelDefaultDirectory(); 1.65 + NSView* GetAccessoryView(); 1.66 + 1.67 + nsString mTitle; 1.68 + nsCOMArray<nsIFile> mFiles; 1.69 + nsString mDefault; 1.70 + 1.71 + nsTArray<nsString> mFilters; 1.72 + nsTArray<nsString> mTitles; 1.73 + 1.74 + int32_t mSelectedTypeIndex; 1.75 +}; 1.76 + 1.77 +#endif // nsFilePicker_h_