1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsFilePicker_h__
7 #define nsFilePicker_h__
11 #include "nsBaseFilePicker.h"
14 #include "nsCOMArray.h"
19 class nsFilePicker
: public nsBaseFilePicker
{
25 // nsIFilePicker (less what's in nsBaseFilePicker)
26 NS_IMETHOD
Open(nsIFilePickerShownCallback
* aCallback
) override
;
27 NS_IMETHOD
AppendFilters(int32_t aFilterMask
) override
;
28 NS_IMETHOD
AppendFilter(const nsAString
& aTitle
,
29 const nsAString
& aFilter
) override
;
30 NS_IMETHOD
SetDefaultString(const nsAString
& aString
) override
;
31 NS_IMETHOD
GetDefaultString(nsAString
& aString
) override
;
32 NS_IMETHOD
SetDefaultExtension(const nsAString
& aExtension
) override
;
33 NS_IMETHOD
GetDefaultExtension(nsAString
& aExtension
) override
;
34 NS_IMETHOD
GetFilterIndex(int32_t* aFilterIndex
) override
;
35 NS_IMETHOD
SetFilterIndex(int32_t aFilterIndex
) override
;
36 NS_IMETHOD
GetFile(nsIFile
** aFile
) override
;
37 NS_IMETHOD
GetFileURL(nsIURI
** aFileURL
) override
;
38 NS_IMETHOD
GetFiles(nsISimpleEnumerator
** aFiles
) override
;
41 virtual void InitNative(nsIWidget
* aParent
, const nsAString
& aTitle
) override
;
43 static void Shutdown();
46 virtual ~nsFilePicker();
48 nsresult
Show(int16_t* aReturn
) override
;
49 void ReadValuesFromFileChooser(void* file_chooser
);
51 static void OnResponse(void* file_chooser
, gint response_id
,
53 static void OnDestroy(GtkWidget
* file_chooser
, gpointer user_data
);
54 void Done(void* file_chooser
, gint response_id
);
56 nsCOMPtr
<nsIWidget
> mParentWidget
;
57 nsCOMPtr
<nsIFilePickerShownCallback
> mCallback
;
58 nsCOMArray
<nsIFile
> mFiles
;
60 int16_t mSelectedType
;
67 nsString mDefaultExtension
;
69 nsTArray
<nsCString
> mFilters
;
70 nsTArray
<nsCString
> mFilterNames
;
73 static nsIFile
* mPrevDisplayDirectory
;
75 void* GtkFileChooserNew(const gchar
* title
, GtkWindow
* parent
,
76 GtkFileChooserAction action
,
77 const gchar
* accept_label
);
78 void GtkFileChooserShow(void* file_chooser
);
79 void GtkFileChooserDestroy(void* file_chooser
);
80 void GtkFileChooserSetModal(void* file_chooser
, GtkWindow
* parent_widget
,
83 GtkFileChooserWidget
* mFileChooserDelegate
;
84 bool mUseNativeFileChooser
;