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