add files for pref revamp

(not part of seamonkey build)
This commit is contained in:
alecf%netscape.com 2000-03-04 01:45:51 +00:00
parent 4dc78e22b8
commit f58a6a6df0
2 changed files with 154 additions and 8 deletions

View File

@ -0,0 +1,134 @@
/* -*- Mode: IDL; 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.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>
*/
#include "nsISupports.idl"
#include "nsIFileSpec.idl"
#include "nsIPrefListener.idl"
native PrefEnumerationFunc(PrefEnumerationFunc);
[scriptable, uuid(56c35506-f14b-11d3-99d3-ddbfac2ccf65)]
interface nsIPrefBranch : nsISupports
{
/**
* the root of this branch, such as "browser."
*/
readonly attribute string root;
/*
* standard methods for accessing prefs
*/
boolean getBoolPref(in string prefName);
void setBoolPref(in string prefName, in long value);
long getIntPref(in string prefName);
void setIntPref(in string prefName, in long value);
string getCharPref(in string prefName);
void setCharPref(in string prefName, in string value);
wstring getUnicharPref(in string prefName);
void setUnicharPref(in string prefName, in wstring value);
/* going away in favor of nsIFile! */
nsIFileSpec getFileSpecPref(in string prefName);
void setFileSpecPref(in string prefName, in nsIFileSpec value);
void clearPref(in string prefName);
/* do we need other prefs like color, rect, etc?
or maybe we should just have a prefTranslation service
that translates a string pref into any other type */
/*
* same as above but for getting default prefs
*/
boolean getDefaultBoolPref(in string prefName);
void setDefaultBoolPref(in string prefName in boolean value);
long getDefaultIntPref(in string prefName);
void setDefaultIntPref(in string prefName, in long value)
string getDefaultCharPref(in string prefName);
void setDefaultCharPref(in string prefName, in string value);
wstring getDefaultUnicharPref(in string prefName);
void setDefaultUnicharPref(in string prefName, in wstring value);
/* going away in favor of nsIFile! */
nsIFileSpec getDefaultFileSpecPref(in string prefName);
void setDefaultFileSpecPref(in string prefName, in nsIFileSpec value);
/*
* branch-level operations
*/
/**
* clearBranch
*
* clears all prefs starting at the given pref prefix
* pass in null or "" to clear this branch
*/
void clearBranch(in string startingAt);
/**
* EnumerateChildren
*
* Call back function "callback" with every preference string
* having prefix "parent". Pass "data" to "callback" when calling.
*
* @param parent A string representation of a prefix of preferences
* @param callback A function to call back for each matching preference
* @param data A piece of data to pass on to the callback
*/
[noscript]
void EnumerateChildren(in string parent,
in PrefEnumerationFunc callback,
in voidStar data);
/*
* Listeners/Callbacks
*/
/**
* addListener
* removeListener - for adding/removing interfaces that listen on
* preference changes
*/
void addListener(in string prefName, in nsIPrefListener listener);
void removeListener(in string prefName, in nsIPrefListener listener);
/**
* registerCallback
* unregisterCallback - old C-style registration system
*/
[noscript] void registerCallback(in string domain,
in PrefChangedFunc callback,
in voidStar closure);
[noscript] void unregisterCallback(in string domain,
in PrefChangedFunc callback,
in voidStar closure);
};

View File

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: IDL; 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.1 (the "License"); you may not use this file
@ -21,14 +21,26 @@
* Alec Flett <alecf@netscape.com>
*/
#include "nsISupports.idl"
[scriptable, uuid(b08d2804-1dd1-11b2-80ea-9fee2622f017)]
interface nsIPrefListener : nsISupports
{
/**
* called when the given pref changes
*
* @param prefName
*/
void prefChanged(in string prefName);
/**
* called when the given pref changes
*
* @param prefName - name of pref
*/
void onBoolPrefChanged(in string prefName,
in boolean oldValue, in boolean newValue);
void onIntPrefChanged(in string prefName,
in long oldValue, in long newValue);
void onCharPrefChanged(in string prefName,
in string oldValue, in string newValue);
void onUnicharPrefChanged(in string prefName,
in wstring oldValue, in string newValue);
};
}