1999-05-29 02:01:07 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
%{C++
|
|
|
|
#include "jsapi.h"
|
|
|
|
|
|
|
|
|
1999-06-15 09:17:55 +04:00
|
|
|
typedef int (*PrefChangedFunc)(const char *, void *);
|
1999-05-29 02:01:07 +04:00
|
|
|
|
|
|
|
#define NS_PREF_CID \
|
|
|
|
{ /* {dc26e0e0-ca94-11d1-a9a4-00805f8a7ac4} */ \
|
|
|
|
0xdc26e0e0, \
|
|
|
|
0xca94, \
|
|
|
|
0x11d1, \
|
|
|
|
{ 0xa9, 0xa4, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xc4 } \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_PREF_VALUE_CHANGED 1
|
|
|
|
%}
|
|
|
|
[ptr] native JSContext(JSContext);
|
|
|
|
[ptr] native JSObject(JSObject);
|
|
|
|
native PrefChangedFunc(PrefChangedFunc);
|
1999-06-15 09:17:55 +04:00
|
|
|
|
|
|
|
interface nsIFileSpec;
|
1999-05-29 02:01:07 +04:00
|
|
|
|
1999-05-29 03:04:19 +04:00
|
|
|
[scriptable, uuid(a22ad7b0-ca86-11d1-a9a4-00805f8a7ac4)]
|
1999-05-29 02:01:07 +04:00
|
|
|
interface nsIPref : nsISupports {
|
1999-08-27 10:05:04 +04:00
|
|
|
%{C++
|
|
|
|
/* Pref types - see GetPrefType() */
|
|
|
|
enum {
|
|
|
|
ePrefInvalid = 0,
|
|
|
|
ePrefLocked = 1,
|
|
|
|
ePrefUserset = 2,
|
|
|
|
ePrefConfig = 4,
|
|
|
|
ePreRemote = 8,
|
|
|
|
ePrefLilocal = 16,
|
|
|
|
ePrefString = 32,
|
|
|
|
ePrefInt = 64,
|
|
|
|
ePrefBool = 128,
|
|
|
|
ePrefValuetypeMask = (ePrefString | ePrefInt | ePrefBool)
|
|
|
|
};
|
|
|
|
%}
|
|
|
|
|
1999-08-21 12:54:47 +04:00
|
|
|
// Initialize/shutdown
|
1999-05-29 02:01:07 +04:00
|
|
|
void StartUp();
|
1999-06-15 09:17:55 +04:00
|
|
|
void ReadUserPrefs();
|
|
|
|
void ReadUserPrefsFrom(in nsIFileSpec spec);
|
1999-05-29 02:01:07 +04:00
|
|
|
void ShutDown();
|
|
|
|
|
1999-08-21 12:54:47 +04:00
|
|
|
// Config file input
|
1999-06-15 09:17:55 +04:00
|
|
|
void ReadUserJSFile(in nsIFileSpec filename);
|
|
|
|
void ReadLIJSFile(in nsIFileSpec filename);
|
1999-05-29 02:01:07 +04:00
|
|
|
|
|
|
|
void EvaluateConfigScript(in string js_buffer, in PRUint32 length,
|
|
|
|
in boolean bGlobalContext,
|
|
|
|
in boolean bCallbacks);
|
|
|
|
|
|
|
|
void EvaluateConfigScriptFile(in string js_buffer, in PRUint32 length,
|
1999-06-15 09:17:55 +04:00
|
|
|
in nsIFileSpec filename,
|
1999-05-29 02:01:07 +04:00
|
|
|
in boolean bGlobalContext,
|
|
|
|
in boolean bCallbacks);
|
|
|
|
|
1999-06-15 09:17:55 +04:00
|
|
|
void SavePrefFileAs(in nsIFileSpec filename);
|
|
|
|
void SaveLIPrefFile(in nsIFileSpec filename);
|
1999-05-29 02:01:07 +04:00
|
|
|
|
|
|
|
/* JS Stuff - don't allow this to be scriptable */
|
|
|
|
[noscript] readonly attribute JSContext configContext;
|
|
|
|
[noscript] readonly attribute JSObject globalConfigObject;
|
|
|
|
[noscript] readonly attribute JSObject prefConfigObject;
|
|
|
|
|
|
|
|
/* Getters */
|
1999-08-27 10:05:04 +04:00
|
|
|
long GetPrefType(in string pref);
|
1999-05-29 02:01:07 +04:00
|
|
|
long GetIntPref(in string pref);
|
|
|
|
boolean GetBoolPref(in string pref);
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] void GetBinaryPref(in string pref, in voidStar buf, inout long buf_length);
|
1999-05-29 02:01:07 +04:00
|
|
|
void GetColorPref(in string pref, out octet red, out octet green, out octet blue);
|
|
|
|
|
|
|
|
unsigned long GetColorPrefDWord(in string pref);
|
|
|
|
void GetRectPref(in string pref,
|
|
|
|
out short left, out short top,
|
|
|
|
out short right, out short bottom);
|
|
|
|
|
|
|
|
/* set preferences */
|
|
|
|
void SetCharPref(in string pref, in string value);
|
|
|
|
void SetIntPref(in string pref, in long value);
|
|
|
|
void SetBoolPref(in string pref, in boolean value);
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] void SetBinaryPref(in string pref, in voidStar value, in unsigned long size);
|
1999-05-29 02:01:07 +04:00
|
|
|
void SetColorPref(in string pref,in octet red, in octet green,in octet blue);
|
|
|
|
void SetColorPrefDWord(in string pref, in unsigned long colorref);
|
|
|
|
|
|
|
|
void SetRectPref(in string pref,
|
|
|
|
in short left, in short top,
|
|
|
|
in short right, in short bottom);
|
|
|
|
void ClearUserPref(in string pref_name);
|
|
|
|
|
|
|
|
/* get defaults */
|
|
|
|
long GetDefaultIntPref(in string pref);
|
|
|
|
boolean GetDefaultBoolPref(in string pref);
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] void GetDefaultBinaryPref(in string pref, in voidStar value,
|
1999-05-29 02:01:07 +04:00
|
|
|
out long length);
|
|
|
|
void GetDefaultColorPref(in string pref,
|
|
|
|
out octet red, out octet green, out octet blue);
|
|
|
|
|
|
|
|
unsigned long GetDefaultColorPrefDWord(in string pref);
|
|
|
|
void GetDefaultRectPref(in string pref,
|
|
|
|
out short left, out short top,
|
|
|
|
out short right, out short bottom);
|
|
|
|
|
|
|
|
/* set defaults */
|
|
|
|
void SetDefaultCharPref(in string pref, in string value);
|
|
|
|
void SetDefaultIntPref(in string pref, in long value);
|
|
|
|
void SetDefaultBoolPref(in string pref, in boolean value);
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] void SetDefaultBinaryPref(in string pref, in voidStar value, in unsigned long size);
|
1999-05-29 02:01:07 +04:00
|
|
|
void SetDefaultColorPref(in string pref,in octet red, in octet green,in octet blue);
|
|
|
|
|
|
|
|
void SetDefaultRectPref(in string pref,
|
|
|
|
in short left, in short top,
|
|
|
|
in short right, in short bottom);
|
|
|
|
|
|
|
|
/* copy versions of getters */
|
|
|
|
string CopyCharPref(in string pref);
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] voidStar CopyBinaryPref(in string pref, out long size);
|
1999-05-29 02:01:07 +04:00
|
|
|
|
|
|
|
string CopyDefaultCharPref(in string pref);
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] voidStar CopyDefaultBinaryPref(in string pref, out long size);
|
1999-05-29 02:01:07 +04:00
|
|
|
|
1999-06-15 09:17:55 +04:00
|
|
|
nsIFileSpec GetFilePref(in string pref);
|
|
|
|
void SetFilePref(in string pref, in nsIFileSpec value, in boolean setDefault);
|
1999-05-29 02:01:07 +04:00
|
|
|
|
|
|
|
/* pref attributes */
|
|
|
|
boolean PrefIsLocked(in string pref);
|
|
|
|
|
1999-08-21 12:54:47 +04:00
|
|
|
/* save pref values */
|
1999-05-29 02:01:07 +04:00
|
|
|
void SavePrefFile();
|
|
|
|
|
1999-08-21 12:54:47 +04:00
|
|
|
/* callbacks */
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] void RegisterCallback(in string domain,
|
1999-05-29 02:01:07 +04:00
|
|
|
in PrefChangedFunc callback,
|
|
|
|
in voidStar closure);
|
1999-08-10 16:18:01 +04:00
|
|
|
[noscript] void UnregisterCallback(in string domain,
|
1999-05-29 02:01:07 +04:00
|
|
|
in PrefChangedFunc callback,
|
|
|
|
in voidStar closure);
|
|
|
|
|
|
|
|
void CopyPrefsTree(in string srcRoot, in string destRoot);
|
|
|
|
void DeleteBranch(in string branchName);
|
|
|
|
|
1999-06-04 01:25:25 +04:00
|
|
|
string CreateChildList(in string parent_node);
|
|
|
|
string NextChild(in string child_list, out short index);
|
|
|
|
|
1999-05-29 02:01:07 +04:00
|
|
|
};
|