gecko-dev/modules/libpref/public/nsIPrefBranch.idl
2001-09-19 20:09:47 +00:00

161 lines
5.5 KiB
Plaintext

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
/* ----- BEGIN LICENSE BLOCK -----
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla 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/MPL/
*
* 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 Communications Corporation. are
* Copyright (C) 1998 Netscape Communications Corporation.. All
* Rights Reserved.
*
* Contributor(s):
* Alec Flett <alecf@netscape.com>
* Brian Nesse <bnesse@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the LGPL or the GPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ----- END LICENSE BLOCK ----- */
#include "nsISupports.idl"
[scriptable, uuid(56c35506-f14b-11d3-99d3-ddbfac2ccf65)]
interface nsIPrefBranch : nsISupports
{
const long PREF_INVALID = 0;
const long PREF_LOCKED = 1;
const long PREF_USER_SET = 2;
const long PREF_CONFIG = 4;
const long PREF_REMOTE = 8;
const long PREF_LI_LOCAL = 16;
const long PREF_STRING = 32;
const long PREF_INT = 64;
const long PREF_BOOL = 128;
const long PREF_VALUE_TYPE_MASK = (PREF_STRING | PREF_INT | PREF_BOOL);
/*
* the root of this branch, such as "browser.startup."
*/
readonly attribute string root;
/*
* standard methods for accessing preferences
* pass in a string to be added to the root such as "homepage"
*/
long getPrefType(in string aPrefName);
boolean getBoolPref(in string aPrefName);
void setBoolPref(in string aPrefName, in long aValue);
string getCharPref(in string aPrefName);
void setCharPref(in string aPrefName, in string aValue);
long getIntPref(in string aPrefName);
void setIntPref(in string aPrefName, in long aValue);
/*
* methods for accessing complex preferences (i.e. items beyond the simple
* bool, char, and int)
* Interfaces currently supported are:
* - nsILocalFile
* - nsISupportsWString (UniChar)
* - nsIPrefLocalizedString (Localized UniChar)
* - nsIFileSpec (depricated - support will be removed eventually)
*/
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);
/*
* clearUserPref
*
* resets a preference to the default value.
* pass in a string to be added to the root such as "homepage"
*/
void clearUserPref(in string aPrefName);
/*
* methods for manipulating the ability to change the state of a preference.
* pass in a string to be added to the root such as "homepage"
*/
void lockPref(in string aPrefName);
boolean prefHasUserValue(in string aPrefName);
boolean prefIsLocked(in string aPrefName);
void unlockPref(in string aPrefName);
/*
* branch-level operations
*
* These operations can effect multiple preferences.
*
* If the root is set to "mail.identity." and "vcard" is passed in all of the
* preferences related to "mail.identity.vcard" such as
* "mail.identity.vcard.adr" and "mail.identity.vcard.email.internet" will be
* manipulated but items such as "mail.identity.username" will be ignored. If
* null or "" is passed in all preferences in the "mail.identity." hierarchy
* will be manipulated.
*/
/*
* deleteBranch
*
* removes all preferences starting at the given preference prefix
* pass in null or "" to remove this branch
*/
void deleteBranch(in string aStartingAt);
/*
* 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.
*/
void getChildList(in string aStartingAt,
out unsigned long aCount,
[array, size_is(aCount), retval] out string aChildArray);
/*
* resetBranch
*
* clears all user preferences (i.e. resets them to their default values)
* starting at the given preference prefix.
* pass in null or "" to clear this branch
*/
void resetBranch(in string aStartingAt);
};
%{C++
#define NS_PREFBRANCH_CONTRACTID "@mozilla.org/preferencesbranch;1"
#define NS_PREFBRANCH_CLASSNAME "Preferences Branch"
%}