MozillaZine

Preferences bindings

From MozillaZine Knowledge Base

(Difference between revisions)

Revision as of 15:33, 10 May 2005

Work in progress See also [1].

This is about new bindings introduced in Toolkit used in Firefox/Thunderbird 1.1. The new binding allow you write preferences UI faster, using less JavaScript code.


Todo:

  • list attributes too
  • more detailed descriptions
  • mark readonly properties as such
  • sort alphabetically
  • check correctness
  • platform specific issues:
    • instant apply
    • animation
  • possible use of dynamic overlays for panes

Contents

<prefwindow>

extends chrome://global/content/bindings/dialog.xml#dialog

Properties

preferencePanes 
A NodeList of <prefpane> elements.
type 
Gets and sets the value of the type attribute.
lastSelected 
Used to get the value of the lastSelected attribute.
instantApply 
Indicates whether the window is in "instant apply" mode.
currentPane 
Currently selected <prefpane> element. Use showPane() method to select another pane.

Methods

showPane(aPaneElement) 
Selects given pane.
animate(aOldPane, aNewPane) 
 ? is this a public method ?
addPane(aPaneElement) 
Adds a specified prefpane to the window.
openSubDialog(aURL, aFeatures, aParams) 
Opens a modal sub-dialog.
openWindow(aWindowType, aURL, aFeatures, aParams) 


<prefpane>

Properties

src 
Gets and sets the value of the src attribute.
selected 
Gets and sets the value of the selected attribute.
image 
Gets and sets the value of the image attribute.
label 
Gets and sets the value of the label attribute.
preferenceElements 
A NodeList of child elements with preference attribute.
preferences 
A NodeList of all child <preference> elements.
loaded 
Indicates whether the pane is fully loaded.
contentHeight 

Methods

writePreferences(aFlushToDisk) 
preferenceForElement(aElement) 
getPreferenceElement(aStartElement) 
userChangedValue(aElement) 


<preferences>

Methods

fireChangedEvent(aPreference) 

Fields

service 
The preferences service (nsIPrefService).
rootBranch 
The root prefs branch (nsIPrefBranch).
defaultBranch 
The root branch with default values (nsIPrefBranch).
rootBranchInternal 
The root prefs branch (nsIPrefBranch2).


<preference>

Properties

instantApply 
preferences 
name 
type 
inverted 
readonly 
value 
locked 
disabled 
tabIndex 
hasUserValue 
defaultValue 
valueFromPreferences 

Methods

reset() 
setElementValue(aElement) 
getElementValue(aElement) 
isElementEditable(aElement) 
updateElements()