diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /widget/nsBaseFilePicker.h | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | widget/nsBaseFilePicker.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/widget/nsBaseFilePicker.h b/widget/nsBaseFilePicker.h new file mode 100644 index 0000000000..370590c9d2 --- /dev/null +++ b/widget/nsBaseFilePicker.h @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * 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/. */ + +#ifndef nsBaseFilePicker_h__ +#define nsBaseFilePicker_h__ + +#include "nsISupports.h" +#include "nsIFilePicker.h" +#include "nsISimpleEnumerator.h" +#include "nsArrayEnumerator.h" +#include "nsCOMPtr.h" +#include "nsString.h" +#include "nsTArray.h" + +class nsPIDOMWindowOuter; +class nsIWidget; + +class nsBaseFilePicker : public nsIFilePicker { + class AsyncShowFilePicker; + + public: + nsBaseFilePicker(); + virtual ~nsBaseFilePicker(); + + NS_IMETHOD Init(mozIDOMWindowProxy* aParent, const nsAString& aTitle, + nsIFilePicker::Mode aMode) override; + + NS_IMETHOD Open(nsIFilePickerShownCallback* aCallback) override; + NS_IMETHOD AppendFilters(int32_t filterMask) override; + NS_IMETHOD AppendRawFilter(const nsAString& aFilter) override; + NS_IMETHOD GetCapture(nsIFilePicker::CaptureTarget* aCapture) override; + NS_IMETHOD SetCapture(nsIFilePicker::CaptureTarget aCapture) override; + NS_IMETHOD GetFilterIndex(int32_t* aFilterIndex) override; + NS_IMETHOD SetFilterIndex(int32_t aFilterIndex) override; + NS_IMETHOD GetFiles(nsISimpleEnumerator** aFiles) override; + NS_IMETHOD GetDisplayDirectory(nsIFile** aDisplayDirectory) override; + NS_IMETHOD SetDisplayDirectory(nsIFile* aDisplayDirectory) override; + NS_IMETHOD GetDisplaySpecialDirectory(nsAString& aDisplayDirectory) override; + NS_IMETHOD SetDisplaySpecialDirectory( + const nsAString& aDisplayDirectory) override; + NS_IMETHOD GetAddToRecentDocs(bool* aFlag) override; + NS_IMETHOD SetAddToRecentDocs(bool aFlag) override; + NS_IMETHOD GetMode(nsIFilePicker::Mode* aMode) override; + NS_IMETHOD SetOkButtonLabel(const nsAString& aLabel) override; + NS_IMETHOD GetOkButtonLabel(nsAString& aLabel) override; + + NS_IMETHOD GetDomFileOrDirectory(nsISupports** aValue) override; + NS_IMETHOD GetDomFileOrDirectoryEnumerator( + nsISimpleEnumerator** aValue) override; + + protected: + virtual void InitNative(nsIWidget* aParent, const nsAString& aTitle) = 0; + virtual nsresult Show(nsIFilePicker::ResultCode* _retval) = 0; + + virtual nsresult ResolveSpecialDirectory(const nsAString& aSpecialDirectory); + + bool mAddToRecentDocs; + nsCOMPtr<nsIFile> mDisplayDirectory; + nsString mDisplaySpecialDirectory; + + nsCOMPtr<nsPIDOMWindowOuter> mParent; + nsIFilePicker::Mode mMode; + nsString mOkButtonLabel; + nsTArray<nsString> mRawFilters; +}; + +#endif // nsBaseFilePicker_h__ |