1999-05-27 21:59:00 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// This is the only correct cross-platform way to specify a file.
|
|
|
|
// Strings are not such a way. If you grew up on windows or unix, you
|
|
|
|
// may think they are. Welcome to reality.
|
|
|
|
|
|
|
|
#include "nsIFileSpec.idl"
|
|
|
|
|
|
|
|
%{C++
|
|
|
|
#include "nscore.h" // for NS_WIDGET
|
1999-06-22 07:51:11 +04:00
|
|
|
#include "nsIComponentManager.h"
|
1999-05-27 21:59:00 +04:00
|
|
|
%}
|
|
|
|
native StandardFilterMask(nsIFileSpecWithUI::StandardFilterMask);
|
|
|
|
|
|
|
|
[scriptable, uuid(8ddf7681-139a-11d3-915f-dc1f8c138b7c)]
|
|
|
|
interface nsIFileSpecWithUI : nsIFileSpec
|
|
|
|
{
|
|
|
|
%{C++
|
|
|
|
//
|
|
|
|
// The "choose" functions present the file picker UI in order to set the
|
|
|
|
// value of the file spec.
|
|
|
|
%}
|
|
|
|
void chooseOutputFile(in string windowTitle, in string suggestedLeafName);
|
|
|
|
|
|
|
|
%{C++
|
|
|
|
// The mask for standard filters is given as follows:
|
|
|
|
enum StandardFilterMask
|
|
|
|
{
|
|
|
|
eAllReadable = (1<<0)
|
|
|
|
, eHTMLFiles = (1<<1)
|
|
|
|
, eXMLFiles = (1<<2)
|
|
|
|
, eImageFiles = (1<<3)
|
|
|
|
, eAllFiles = (1<<4)
|
|
|
|
|
|
|
|
// Mask containing all the above default filters
|
|
|
|
, eAllStandardFilters = (
|
|
|
|
eAllReadable
|
|
|
|
| eHTMLFiles
|
|
|
|
| eXMLFiles
|
|
|
|
| eImageFiles
|
|
|
|
| eAllFiles)
|
|
|
|
|
|
|
|
// The "extra filter" bit should be set if the "extra filter"
|
|
|
|
// is passed in to chooseInputFile.
|
|
|
|
, eExtraFilter = (1<<31)
|
|
|
|
};
|
|
|
|
enum { kNumStandardFilters = 5 };
|
|
|
|
%}
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] void chooseInputFile(
|
1999-05-27 21:59:00 +04:00
|
|
|
in string title
|
|
|
|
, in StandardFilterMask standardFilterMask
|
|
|
|
, in string extraFilterTitle
|
|
|
|
, in string extraFilter
|
|
|
|
);
|
1999-07-31 22:45:22 +04:00
|
|
|
string chooseFile(in string title);
|
1999-05-27 21:59:00 +04:00
|
|
|
void chooseDirectory(in string title);
|
|
|
|
};
|
|
|
|
|
|
|
|
%{C++
|
1999-06-22 07:51:11 +04:00
|
|
|
// Define Progid and CID
|
|
|
|
// {e3326a80-2816-11d3-a7e5-98cb48c74f3c}
|
|
|
|
#define NS_FILESPECWITHUI_CID \
|
|
|
|
{ 0xe3326a80, 0x2816, 0x11d3, { 0xa7, 0xe5, 0x98, 0xcb, 0x48, 0xc7, 0x4f, 0x3c } }
|
|
|
|
|
|
|
|
#define NS_FILESPECWITHUI_PROGID "component://netscape/filespecwithui"
|
|
|
|
#define NS_FILESPECWITHUI_CLASSNAME "nsIFileSpecWithUI"
|
|
|
|
|
1999-05-27 21:59:00 +04:00
|
|
|
// Factory methods
|
1999-06-22 07:51:11 +04:00
|
|
|
inline nsIFileSpecWithUI* NS_CreateFileSpecWithUI()
|
|
|
|
{
|
|
|
|
nsIFileSpecWithUI* spec = nsnull;
|
|
|
|
nsresult rv = nsComponentManager::CreateInstance(
|
|
|
|
(const char*)NS_FILESPECWITHUI_PROGID,
|
|
|
|
(nsISupports*)nsnull,
|
|
|
|
(const nsID&)nsIFileSpecWithUI::GetIID(),
|
|
|
|
(void**)&spec);
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Could not make a file spec.");
|
|
|
|
return spec;
|
|
|
|
}
|
1999-05-27 21:59:00 +04:00
|
|
|
%}
|