2004-07-21 15:44:00 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2004-07-21 15:44:00 +00:00
|
|
|
|
|
|
|
#ifndef nsFilePicker_h__
|
|
|
|
#define nsFilePicker_h__
|
|
|
|
|
2009-01-03 07:37:52 +00:00
|
|
|
#include <gtk/gtk.h>
|
2004-07-21 15:44:00 +00:00
|
|
|
|
|
|
|
#include "nsBaseFilePicker.h"
|
|
|
|
#include "nsString.h"
|
2009-01-22 04:15:34 +00:00
|
|
|
#include "nsTArray.h"
|
2004-09-27 17:52:57 +00:00
|
|
|
#include "nsCOMArray.h"
|
2004-07-21 15:44:00 +00:00
|
|
|
|
|
|
|
class nsIWidget;
|
2012-06-06 02:08:30 +00:00
|
|
|
class nsIFile;
|
2004-07-21 15:44:00 +00:00
|
|
|
|
|
|
|
class nsFilePicker : public nsBaseFilePicker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsFilePicker();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2005-01-14 14:40:17 +00:00
|
|
|
// nsIFilePicker (less what's in nsBaseFilePicker)
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD Open(nsIFilePickerShownCallback *aCallback) override;
|
|
|
|
NS_IMETHODIMP AppendFilters(int32_t aFilterMask) override;
|
2015-01-20 21:39:44 +00:00
|
|
|
NS_IMETHODIMP AppendFilter(const nsAString& aTitle,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsAString& aFilter) override;
|
|
|
|
NS_IMETHODIMP SetDefaultString(const nsAString& aString) override;
|
|
|
|
NS_IMETHODIMP GetDefaultString(nsAString& aString) override;
|
|
|
|
NS_IMETHODIMP SetDefaultExtension(const nsAString& aExtension) override;
|
|
|
|
NS_IMETHODIMP GetDefaultExtension(nsAString& aExtension) override;
|
|
|
|
NS_IMETHODIMP GetFilterIndex(int32_t *aFilterIndex) override;
|
|
|
|
NS_IMETHODIMP SetFilterIndex(int32_t aFilterIndex) override;
|
|
|
|
NS_IMETHODIMP GetFile(nsIFile **aFile) override;
|
|
|
|
NS_IMETHODIMP GetFileURL(nsIURI **aFileURL) override;
|
|
|
|
NS_IMETHODIMP GetFiles(nsISimpleEnumerator **aFiles) override;
|
|
|
|
NS_IMETHODIMP Show(int16_t *aReturn) override;
|
2004-07-21 15:44:00 +00:00
|
|
|
|
2012-08-22 04:56:55 +00:00
|
|
|
// nsBaseFilePicker
|
2015-01-20 21:39:44 +00:00
|
|
|
virtual void InitNative(nsIWidget *aParent,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsAString& aTitle) override;
|
2004-07-21 15:44:00 +00:00
|
|
|
|
2004-08-08 11:09:51 +00:00
|
|
|
static void Shutdown();
|
|
|
|
|
2004-07-21 15:44:00 +00:00
|
|
|
protected:
|
2014-06-24 16:36:44 +00:00
|
|
|
virtual ~nsFilePicker();
|
2004-07-21 15:44:00 +00:00
|
|
|
|
|
|
|
void ReadValuesFromFileChooser(GtkWidget *file_chooser);
|
|
|
|
|
2012-08-22 04:56:55 +00:00
|
|
|
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);
|
|
|
|
|
2004-07-21 15:44:00 +00:00
|
|
|
nsCOMPtr<nsIWidget> mParentWidget;
|
2012-08-22 04:56:55 +00:00
|
|
|
nsCOMPtr<nsIFilePickerShownCallback> mCallback;
|
2012-06-06 02:08:30 +00:00
|
|
|
nsCOMArray<nsIFile> mFiles;
|
2004-07-21 15:44:00 +00:00
|
|
|
|
2012-08-22 16:32:21 +00:00
|
|
|
int16_t mSelectedType;
|
|
|
|
int16_t mResult;
|
2012-08-22 04:56:55 +00:00
|
|
|
bool mRunning;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mAllowURLs;
|
2008-02-26 16:12:17 +00:00
|
|
|
nsCString mFileURL;
|
2004-07-21 15:44:00 +00:00
|
|
|
nsString mTitle;
|
|
|
|
nsString mDefault;
|
|
|
|
nsString mDefaultExtension;
|
|
|
|
|
2009-01-22 04:15:34 +00:00
|
|
|
nsTArray<nsCString> mFilters;
|
|
|
|
nsTArray<nsCString> mFilterNames;
|
2004-07-21 15:44:00 +00:00
|
|
|
|
2004-08-08 11:09:51 +00:00
|
|
|
private:
|
2012-06-06 02:08:30 +00:00
|
|
|
static nsIFile *mPrevDisplayDirectory;
|
2015-05-22 04:36:00 +00:00
|
|
|
|
2015-05-27 05:40:28 +00:00
|
|
|
#if (MOZ_WIDGET_GTK == 3)
|
2015-05-22 04:36:00 +00:00
|
|
|
GtkFileChooserWidget *mFileChooserDelegate;
|
2015-05-27 05:40:28 +00:00
|
|
|
#endif
|
2004-07-21 15:44:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|