diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /widget/gtk/nsFilePicker.h | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'widget/gtk/nsFilePicker.h')
-rw-r--r-- | widget/gtk/nsFilePicker.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h new file mode 100644 index 000000000..2b5042098 --- /dev/null +++ b/widget/gtk/nsFilePicker.h @@ -0,0 +1,82 @@ +/* -*- 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 nsFilePicker_h__ +#define nsFilePicker_h__ + +#include <gtk/gtk.h> + +#include "nsBaseFilePicker.h" +#include "nsString.h" +#include "nsTArray.h" +#include "nsCOMArray.h" + +class nsIWidget; +class nsIFile; + +class nsFilePicker : public nsBaseFilePicker +{ +public: + nsFilePicker(); + + NS_DECL_ISUPPORTS + + // nsIFilePicker (less what's in nsBaseFilePicker) + NS_IMETHOD Open(nsIFilePickerShownCallback *aCallback) override; + NS_IMETHOD AppendFilters(int32_t aFilterMask) override; + NS_IMETHOD AppendFilter(const nsAString& aTitle, + const nsAString& aFilter) override; + NS_IMETHOD SetDefaultString(const nsAString& aString) override; + NS_IMETHOD GetDefaultString(nsAString& aString) override; + NS_IMETHOD SetDefaultExtension(const nsAString& aExtension) override; + NS_IMETHOD GetDefaultExtension(nsAString& aExtension) override; + NS_IMETHOD GetFilterIndex(int32_t *aFilterIndex) override; + NS_IMETHOD SetFilterIndex(int32_t aFilterIndex) override; + NS_IMETHOD GetFile(nsIFile **aFile) override; + NS_IMETHOD GetFileURL(nsIURI **aFileURL) override; + NS_IMETHOD GetFiles(nsISimpleEnumerator **aFiles) override; + NS_IMETHOD Show(int16_t *aReturn) override; + + // nsBaseFilePicker + virtual void InitNative(nsIWidget *aParent, + const nsAString& aTitle) override; + + static void Shutdown(); + +protected: + virtual ~nsFilePicker(); + + void ReadValuesFromFileChooser(GtkWidget *file_chooser); + + static void OnResponse(GtkWidget* dialog, gint response_id, + gpointer user_data); + static void OnDestroy(GtkWidget* dialog, gpointer user_data); + void Done(GtkWidget* dialog, gint response_id); + + nsCOMPtr<nsIWidget> mParentWidget; + nsCOMPtr<nsIFilePickerShownCallback> mCallback; + nsCOMArray<nsIFile> mFiles; + + int16_t mSelectedType; + int16_t mResult; + bool mRunning; + bool mAllowURLs; + nsCString mFileURL; + nsString mTitle; + nsString mDefault; + nsString mDefaultExtension; + + nsTArray<nsCString> mFilters; + nsTArray<nsCString> mFilterNames; + +private: + static nsIFile *mPrevDisplayDirectory; + +#if (MOZ_WIDGET_GTK == 3) + GtkFileChooserWidget *mFileChooserDelegate; +#endif +}; + +#endif |