michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsMetroFilePicker_h__ michael@0: #define nsMetroFilePicker_h__ michael@0: michael@0: #include "../nsFilePicker.h" michael@0: #include "nsString.h" michael@0: #include "nsCOMArray.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsILocalFile.h" michael@0: michael@0: #include "mozwrlbase.h" michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: /** michael@0: * Metro file picker michael@0: */ michael@0: michael@0: class nsMetroFilePicker : michael@0: public nsBaseWinFilePicker michael@0: { michael@0: typedef Microsoft::WRL::Wrappers::HString HString; michael@0: typedef ABI::Windows::Storage::StorageFile StorageFile; michael@0: typedef ABI::Windows::Foundation::AsyncStatus AsyncStatus; michael@0: michael@0: public: michael@0: nsMetroFilePicker(); michael@0: virtual ~nsMetroFilePicker(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: // nsIFilePicker (less what's in nsBaseFilePicker) michael@0: NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex); michael@0: NS_IMETHOD SetFilterIndex(int32_t aFilterIndex); michael@0: NS_IMETHOD GetFile(nsIFile * *aFile); michael@0: NS_IMETHOD GetFileURL(nsIURI * *aFileURL); michael@0: NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles); michael@0: NS_IMETHOD Show(int16_t *aReturnVal); michael@0: NS_IMETHOD Open(nsIFilePickerShownCallback *aCallback); michael@0: NS_IMETHOD AppendFilter(const nsAString& aTitle, const nsAString& aFilter); michael@0: NS_IMETHOD Init(nsIDOMWindow *parent, const nsAString& title, michael@0: int16_t mode); michael@0: michael@0: // Async callbacks michael@0: HRESULT OnPickSingleFile(ABI::Windows::Foundation::IAsyncOperation* aFile, AsyncStatus aStatus); michael@0: HRESULT OnPickMultipleFiles(ABI::Windows::Foundation::IAsyncOperation*>* aFileList, AsyncStatus aStatus); michael@0: michael@0: private: michael@0: void InitNative(nsIWidget*, const nsAString&) {}; michael@0: nsresult ParseFiltersIntoVector(Microsoft::WRL::ComPtr>& aVector, michael@0: const nsAString& aFilter, michael@0: bool aAllowAll); michael@0: nsCOMArray mFiles; michael@0: Microsoft::WRL::ComPtr mFileOpenPicker; michael@0: Microsoft::WRL::ComPtr mFileSavePicker; michael@0: HString mFilePath; michael@0: HString mFirstTitle; michael@0: nsRefPtr mCallback; michael@0: }; michael@0: michael@0: #endif // nsMetroFilePicker_h__