pjs/widget/public/nsIFileSpecWithUI.idl

96 строки
2.8 KiB
Plaintext

/* -*- 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
#include "nsIComponentManager.h"
%}
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 };
%}
void chooseInputFile(
in string title
, in StandardFilterMask standardFilterMask
, in string extraFilterTitle
, in string extraFilter
);
void chooseDirectory(in string title);
};
%{C++
// 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"
// Factory methods
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;
}
%}