mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-11 02:10:17 +01:00
387 lines
12 KiB
XML
387 lines
12 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<!-- ***** 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 XForms support.
|
|
-
|
|
- The Initial Developer of the Original Code is
|
|
- Alexander Surkov.
|
|
- Portions created by the Initial Developer are Copyright (C) 2006
|
|
- the Initial Developer. All Rights Reserved.
|
|
-
|
|
- Contributor(s):
|
|
- Alexander Surkov <surkov@dc.baikal.ru>
|
|
-
|
|
- Alternatively, the contents of this file may be used under the terms of
|
|
- either 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 GPL or the LGPL. 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 ***** -->
|
|
|
|
<!-- SELECT CONTROLS FOR XUL
|
|
This file contains xforms select and xforms select1 controls implementations
|
|
for XUL.
|
|
-->
|
|
|
|
<bindings id="xformsBindings"
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
xmlns:xbl="http://www.mozilla.org/xbl"
|
|
xmlns:xforms="http://www.w3.org/2002/xforms"
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
xmlns:mozType="http://www.mozilla.org/projects/xforms/2005/type">
|
|
|
|
|
|
<!-- SELECT, SELECT1 CONTROLS
|
|
The section contains xforms select and select1 controls implementations for
|
|
XUL. All controls are inherited from interface bindings realized in
|
|
select.xml file.
|
|
|
|
XXX: Element select of minimal appearance is not implemented (see bug 332928).
|
|
|
|
select/select1 of full appearance are implemented in selects-xul.xml file.
|
|
-->
|
|
|
|
<binding id="xformswidget-select"
|
|
extends="chrome://xforms/content/select.xml#xformswidget-select-base">
|
|
<content>
|
|
<xul:hbox flex="1">
|
|
<children includes="label"/>
|
|
<xul:box anonid="control"
|
|
xbl:inherits="style, accesskey, mozType:tabindex=tabindex"
|
|
class="xf-value" flex="1"/>
|
|
</xul:hbox>
|
|
<children/>
|
|
</content>
|
|
</binding>
|
|
|
|
<binding id="xformswidget-select1"
|
|
extends="chrome://xforms/content/select.xml#xformswidget-select1-base">
|
|
<content>
|
|
<xul:hbox flex="1">
|
|
<children includes="label"/>
|
|
<xul:box anonid="control"
|
|
xbl:inherits="style, accesskey, mozType:tabindex=tabindex"
|
|
class="xf-value" flex="1"/>
|
|
</xul:hbox>
|
|
<children/>
|
|
</content>
|
|
</binding>
|
|
|
|
|
|
<!-- The following bindings do a trick. When appearance attribute is changed
|
|
then we should call nsIXFormsDelegate.widgetAttached() method. If we'll have
|
|
separate binding for each appearance attribute value then it will be happen
|
|
automatically.
|
|
-->
|
|
|
|
<binding id="xformswidget-select-compact"
|
|
extends="#xformswidget-select"/>
|
|
|
|
<binding id="xformswidget-select1-minimal"
|
|
extends="#xformswidget-select1"/>
|
|
|
|
<binding id="xformswidget-select1-compact"
|
|
extends="#xformswidget-select1"/>
|
|
|
|
<!-- CONTROL WIDGETS FOR SELECT CONTROLS
|
|
The section contains underlying widgets implementations needed for xforms
|
|
select controls. All underlying widgets implement the interface what base
|
|
widget for xforms select controls ask for. You can find interface description
|
|
in 'select.xml' file.
|
|
-->
|
|
|
|
<!-- CONTROL WIDGET FOR SELECT APPEARANCE='COMPACT' -->
|
|
<binding id="controlwidget-select-compact"
|
|
extends="chrome://xforms/content/select.xml#controlwidget-base">
|
|
|
|
<content>
|
|
<xul:listbox xbl:inherits="style, accesskey, disabled=readonly, tabindex=mozType:tabindex"
|
|
rows="5" flex="1"
|
|
seltype="multiple"
|
|
anonid="control"/>
|
|
</content>
|
|
|
|
<implementation>
|
|
<method name="removeAllItems">
|
|
<body>
|
|
// removeItemAt fires 'select' event event if 'suppressonselect'
|
|
// attribute is specified, we shouldn't listen the event (bug 312149)
|
|
|
|
this.suppress = true;
|
|
for (var i = this.control.childNodes.length-1; i >= 0; i--) {
|
|
this.control.removeItemAt(i);
|
|
}
|
|
this.suppress = false;
|
|
</body>
|
|
</method>
|
|
<field name="suppress">false</field>
|
|
|
|
<method name="appendItem">
|
|
<parameter name="aLabel"/>
|
|
<parameter name="aValue"/>
|
|
<parameter name="aGroup"/>
|
|
<body>
|
|
var item = this.ownerDocument.createElementNS(this.XUL_NS, "listitem");
|
|
item.setAttribute("value", aValue);
|
|
if (aLabel) {
|
|
// since label node can contains textnodes then we use
|
|
// 'description' element as container for label node.
|
|
var description = this.ownerDocument.
|
|
createElementNS(this.XUL_NS, "description");
|
|
description.appendChild(aLabel.cloneNode(true));
|
|
item.appendChild(description);
|
|
}
|
|
|
|
// XXX: Group supporting isn't implemented
|
|
this.control.appendChild(item);
|
|
|
|
return item;
|
|
</body>
|
|
</method>
|
|
|
|
<method name="appendGroup">
|
|
<parameter name="aLabel"/>
|
|
<parameter name="aGroup"/>
|
|
<body>
|
|
// XXX: Group supporting isn't implemented
|
|
return null;
|
|
</body>
|
|
</method>
|
|
|
|
<method name="addItemToSelection">
|
|
<parameter name="aItem"/>
|
|
<body>
|
|
// there are cases when 'listitem' binding isn't created yet,
|
|
// therefore we use setTimeout
|
|
|
|
window.setTimeout(
|
|
function(list, item) {
|
|
list.setAttribute("suppressonselect", "true");
|
|
list.addItemToSelection(item);
|
|
list.removeAttribute("suppressonselect");
|
|
},
|
|
0,
|
|
this.control, aItem
|
|
);
|
|
</body>
|
|
</method>
|
|
|
|
<method name="removeItemFromSelection">
|
|
<parameter name="aItem"/>
|
|
<body>
|
|
this.control.setAttribute("suppressonselect", "true");
|
|
this.control.removeItemFromSelection(aItem);
|
|
this.control.removeAttribute("suppressonselect");
|
|
</body>
|
|
</method>
|
|
|
|
<method name="isItemSelected">
|
|
<parameter name="aItem"/>
|
|
<body>
|
|
return aItem.selected;
|
|
</body>
|
|
</method>
|
|
|
|
<constructor>
|
|
// 'select' event is not always handled when handler is added by using
|
|
// xbl:handler element.
|
|
var selectHandler = {
|
|
control: this,
|
|
handleEvent: function() {
|
|
if (!this.control.suppress) {
|
|
this.control.updateInstanceData(true);
|
|
}
|
|
}
|
|
};
|
|
this.addEventListener("select", selectHandler, false);
|
|
</constructor>
|
|
</implementation>
|
|
|
|
<handlers>
|
|
<handler event="focus" phase="capturing">
|
|
this.dispatchDOMUIEvent("DOMFocusIn");
|
|
</handler>
|
|
|
|
<handler event="blur" phase="capturing">
|
|
this.updateInstanceData(false);
|
|
this.dispatchDOMUIEvent("DOMFocusOut");
|
|
</handler>
|
|
|
|
<!--
|
|
XXX: Since xforms:label can include arbitrary elements then 'focus',
|
|
'blur' and 'command' events should be listen from 'xul:listbox'
|
|
element only.
|
|
-->
|
|
</handlers>
|
|
</binding>
|
|
|
|
|
|
<!-- CONTROL WIDGETS FOR SELECT1 CONTROLS
|
|
The section contains underlying widgets implementations needed for xforms
|
|
select1 controls. All underlying widgets implement the interface what base
|
|
widget for xforms select1 controls ask for. You can find interface description
|
|
in 'select.xml' file.
|
|
-->
|
|
|
|
<!-- CONTROL WIDGET FOR SELECT1 APPEARANCE='MINIMAL' -->
|
|
<binding id="controlwidget-select1-minimal"
|
|
extends="chrome://xforms/content/select.xml#controlwidget-base">
|
|
|
|
<content>
|
|
<xul:menulist xbl:inherits="style, accesskey, disabled=readonly, tabindex=mozType:tabindex"
|
|
anonid="control" flex="1">
|
|
<xul:menupopup/>
|
|
</xul:menulist>
|
|
</content>
|
|
|
|
<implementation>
|
|
<method name="removeAllItems">
|
|
<body>
|
|
var popup = this.control.menupopup;
|
|
while (popup.hasChildNodes()) {
|
|
popup.removeChild(popup.lastChild);
|
|
}
|
|
</body>
|
|
</method>
|
|
|
|
<method name="appendItem">
|
|
<parameter name="aLabel"/>
|
|
<parameter name="aValue"/>
|
|
<parameter name="aGroup"/>
|
|
<body>
|
|
var item = this.ownerDocument.createElementNS(this.XUL_NS, "menuitem");
|
|
item.setAttribute("value", aValue);
|
|
if (aLabel) {
|
|
// XXX: We should use node instead of its text content to add a
|
|
// label. But we cannot put node into menuitem, therefore we now
|
|
// use label text and set @label for menulist.
|
|
item.setAttribute("label", aLabel.textContent);
|
|
}
|
|
|
|
// XXX: Group supporting isn't implemented
|
|
this.control.menupopup.appendChild(item);
|
|
return item;
|
|
</body>
|
|
</method>
|
|
|
|
<method name="appendGroup">
|
|
<parameter name="aLabel"/>
|
|
<parameter name="aGroup"/>
|
|
<body>
|
|
// XXX: Group supporting isn't implemented
|
|
return null;
|
|
</body>
|
|
</method>
|
|
|
|
<method name="addItemToSelection">
|
|
<parameter name="aItem"/>
|
|
<body>
|
|
this.control.selectedItem = aItem;
|
|
</body>
|
|
</method>
|
|
|
|
<method name="removeItemFromSelection">
|
|
<parameter name="aItem"/>
|
|
<body>
|
|
if (this.control.selectedItem == aItem)
|
|
this.control.selectedItem = null;
|
|
</body>
|
|
</method>
|
|
|
|
<method name="isItemSelected">
|
|
<parameter name="aItem"/>
|
|
<body>
|
|
return aItem.getAttribute("selected") == "true";
|
|
</body>
|
|
</method>
|
|
|
|
<method name="getFreeEntryValues">
|
|
<body>
|
|
if (this.control.getAttribute("editable") == "true") {
|
|
if (!this.control.selectedItem)
|
|
return this.control.value;
|
|
return "";
|
|
}
|
|
</body>
|
|
</method>
|
|
|
|
<method name="allowFreeEntry">
|
|
<parameter name="aAllowed"/>
|
|
<body>
|
|
if (aAllowed)
|
|
this.control.setAttribute("editable", "true");
|
|
else
|
|
this.control.removeAttribute("editable");
|
|
</body>
|
|
</method>
|
|
|
|
<method name="appendFreeEntryItem">
|
|
<parameter name="aValue"/>
|
|
<body>
|
|
if (this.control.getAttribute("editable") == "true") {
|
|
this.control.value = aValue;
|
|
}
|
|
</body>
|
|
</method>
|
|
</implementation>
|
|
|
|
<handlers>
|
|
<handler event="input">
|
|
this.updateInstanceData(true);
|
|
</handler>
|
|
|
|
<handler event="focus" phase="capturing">
|
|
this.dispatchDOMUIEvent("DOMFocusIn");
|
|
</handler>
|
|
|
|
<handler event="blur" phase="capturing">
|
|
this.updateInstanceData(false);
|
|
this.dispatchDOMUIEvent("DOMFocusOut");
|
|
</handler>
|
|
|
|
<handler event="command">
|
|
this.updateInstanceData(true);
|
|
</handler>
|
|
|
|
<!--
|
|
XXX: Since xforms:label can include arbitrary elements then 'focus',
|
|
'blur', 'command' and 'input' events should be listen from
|
|
'xul:menulist' element only. The described problem is not actual now.
|
|
Note we will get it when we will use node instead of text content for
|
|
a label.
|
|
-->
|
|
</handlers>
|
|
</binding>
|
|
|
|
|
|
<!-- CONTROL WIDGET FOR SELECT1 APPEARANCE='COMPACT' -->
|
|
<binding id="controlwidget-select1-compact"
|
|
extends="#controlwidget-select-compact">
|
|
<content>
|
|
<xul:listbox xbl:inherits="style, accesskey, disabled=readonly, tabindex=mozType:tabindex"
|
|
rows="5" anonid="control"/>
|
|
</content>
|
|
</binding>
|
|
|
|
</bindings>
|