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;
|
2016-08-08 03:54:47 +03:00
|
|
|
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;
|
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, 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
|
|
|
|
2017-08-06 07:15:31 +03:00
|
|
|
nsresult Show(int16_t* aReturn) override;
|
2018-10-15 22:25:10 +03:00
|
|
|
void ReadValuesFromFileChooser(void* file_chooser);
|
2004-07-21 19:44:00 +04:00
|
|
|
|
2018-10-15 22:25:10 +03:00
|
|
|
static void OnResponse(void* file_chooser, gint response_id,
|
2012-08-22 08:56:55 +04:00
|
|
|
gpointer user_data);
|
2018-10-15 22:25:10 +03:00
|
|
|
static void OnDestroy(GtkWidget* file_chooser, gpointer user_data);
|
|
|
|
void Done(void* file_chooser, gint response_id);
|
2012-08-22 08:56:55 +04:00
|
|
|
|
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
|
|
|
|
2018-10-15 22:25:10 +03:00
|
|
|
void* GtkFileChooserNew(const gchar* title, GtkWindow* parent,
|
|
|
|
GtkFileChooserAction action,
|
|
|
|
const gchar* accept_label);
|
|
|
|
void GtkFileChooserShow(void* file_chooser);
|
|
|
|
void GtkFileChooserDestroy(void* file_chooser);
|
|
|
|
void GtkFileChooserSetModal(void* file_chooser, GtkWindow* parent_widget,
|
|
|
|
gboolean modal);
|
|
|
|
|
2015-05-22 07:36:00 +03:00
|
|
|
GtkFileChooserWidget* mFileChooserDelegate;
|
2019-01-11 14:21:27 +03:00
|
|
|
bool mUseNativeFileChooser;
|
2004-07-21 19:44:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|