2001-02-15 01:04:26 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Alec Flett <alecf@netscape.com>
|
|
|
|
* Brian Nesse <bnesse@netscape.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2001-03-23 02:34:41 +03:00
|
|
|
#include "nsIObserver.idl"
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
[scriptable, uuid(56c35506-f14b-11d3-99d3-ddbfac2ccf65)]
|
|
|
|
interface nsIPrefBranch : nsISupports
|
|
|
|
{
|
|
|
|
const long ePrefInvalid = 0;
|
|
|
|
const long ePrefLocked = 1;
|
|
|
|
const long ePrefUserset = 2;
|
|
|
|
const long ePrefConfig = 4;
|
|
|
|
const long ePrefRemote = 8;
|
|
|
|
const long ePrefLilocal = 16;
|
|
|
|
const long ePrefString = 32;
|
|
|
|
const long ePrefInt = 64;
|
|
|
|
const long ePrefBool = 128;
|
|
|
|
const long ePrefValuetypeMask = (ePrefString | ePrefInt | ePrefBool);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* the root of this branch, such as "browser."
|
|
|
|
*/
|
|
|
|
readonly attribute string root;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* standard methods for accessing preferences
|
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
long getPrefType(in string aPrefName);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
boolean getBoolPref(in string aPrefName);
|
|
|
|
void setBoolPref(in string aPrefName, in long aValue);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
string getCharPref(in string aPrefName);
|
|
|
|
void setCharPref(in string aPrefName, in string aValue);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
long getIntPref(in string aPrefName);
|
|
|
|
void setIntPref(in string aPrefName, in long aValue);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* methods for accessing complex preferences (i.e. items beyond the simple bool, char, and int)
|
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
void getComplexValue(in string aPrefName, in nsIIDRef aType, [iid_is(aType), retval] out nsQIResult aValue);
|
|
|
|
void setComplexValue(in string aPrefName, in nsIIDRef aType, in nsISupports aValue);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* methods for preference state manipulation
|
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
void clearUserPref(in string aPrefName);
|
|
|
|
void lockPref(in string aPrefName);
|
|
|
|
boolean prefIsLocked(in string aPrefName);
|
|
|
|
void unlockPref(in string aPrefName);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* branch-level operations
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* clearBranch
|
|
|
|
*
|
|
|
|
* clears all user preferences starting at the given preference prefix
|
|
|
|
* pass in null or "" to clear this branch
|
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
void clearBranch(in string aStartingAt);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* deleteBranch
|
|
|
|
*
|
|
|
|
* removes all preferences starting at the given preference prefix
|
|
|
|
* pass in null or "" to remove this branch
|
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
void deleteBranch(in string aStartingAt);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* getChildList
|
|
|
|
*
|
|
|
|
* Returns an array of strings representing the child preferences of the branch root
|
|
|
|
*
|
|
|
|
* @param startingAt pass in null or "" to enumerate the entire branch
|
|
|
|
* @param count Receives the number of elements in the array.
|
|
|
|
* @param childArray Receives the array of child preferences.
|
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
void getChildList(in string aStartingAt,
|
|
|
|
out unsigned long aCount,
|
|
|
|
[array, size_is(aCount), retval] out string aChildArray);
|
2001-02-15 01:04:26 +03:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Listeners
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The observers have their |Observe| methods called with
|
|
|
|
* ([the observer], "nsPref:changed", [pref name]).
|
|
|
|
*/
|
2001-03-23 02:34:41 +03:00
|
|
|
void addObserver(in string aDomain, in nsIObserver aObserver);
|
|
|
|
void removeObserver(in string aDomain, in nsIObserver aObserver);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* nsIPrefLocalizedString is simply a wrapper for nsISupportsWString so we can have a unique
|
|
|
|
* identifier to distinguish between requests for normal wstrings and localized wstrings
|
|
|
|
*/
|
|
|
|
[scriptable, uuid(ae419e24-1dd1-11b2-b39a-d3e5e7073802)]
|
|
|
|
interface nsIPrefLocalizedString : nsISupports
|
|
|
|
{
|
|
|
|
attribute wstring data;
|
|
|
|
wstring toString();
|
2001-02-15 01:04:26 +03:00
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
// do not include space for null termination in |length|. It is handled
|
|
|
|
// internally. |length| is in characters, not in bytes.
|
|
|
|
void setDataWithLength(in unsigned long length,
|
|
|
|
[size_is(length)] in wstring data);
|
2001-02-15 01:04:26 +03:00
|
|
|
};
|
|
|
|
|
2001-03-23 02:34:41 +03:00
|
|
|
%{C++
|
|
|
|
|
|
|
|
#define NS_PREFBRANCH_CONTRACTID "@mozilla.org/preferencesbranch;1"
|
|
|
|
#define NS_PREFBRANCH_CLASSNAME "Preferences Branch"
|
|
|
|
|
|
|
|
#define NS_SUPPORTS_PREFLOCALIZEDSTRING_CONTRACTID "@mozilla.org/supports-preflocalizedstring;1"
|
|
|
|
#define NS_SUPPORTS_PREFLOCALIZEDSTRING_CLASSNAME "Supports PrefLocalizedString"
|
|
|
|
|
|
|
|
%}
|