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