history.js: comment
[conkeror.git] / content / annotated-textbox.xml
blobe57986526a8a75ad02c66cfc8cd9f7a12d574e2c
1 <?xml version="1.0"?>
2 <!--
3 (C) Copyright 2012 David Kettler
5 Use, modification, and distribution are subject to the terms specified in the
6 COPYING file.
7 -->
8 <bindings
9     xmlns="http://www.mozilla.org/xbl"
10     xmlns:html="http://www.w3.org/1999/xhtml"
11     xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
12     xmlns:xbl="http://www.mozilla.org/xbl">
14   <binding id="annotated-textbox"
15            extends="chrome://global/content/bindings/textbox.xml#textbox">
17     <content>
18       <children/>
19       <xul:deck flex="1">
20         <xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context,spellcheck">
21           <html:input class="textbox-input" flex="1" anonid="input"
22                       xbl:inherits="onfocus,onblur,value,type,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey,noinitialfocus,mozactionhint,spellcheck"/>
23         </xul:hbox>
24         <xul:hbox style="overflow: hidden">
25           <xul:label class="plain" anonid="strut"/>
26         </xul:hbox>
27       </xul:deck>
28       <xul:label class="plain" anonid="annotation"
29                  xbl:inherits="value=annotation"
30                  flex="1000" crop="right" collapsed="true"/>
31     </content>
33     <implementation>
35       <field name="_annotate"> false </field>
36       <field name="_annot" readonly="true">
37         document.getAnonymousElementByAttribute(this, "anonid", "annotation");
38       </field>
39       <field name="_strut" readonly="true">
40         document.getAnonymousElementByAttribute(this, "anonid", "strut");
41       </field>
43       <property name="annotate">
44         <getter>
45           return this._annotate;
46         </getter>
47         <setter><![CDATA[
48           this._annotate = !!val;
49           this.annotation = "";
50           this._strut.setAttribute("value", "");
51           this._annot.setAttribute("collapsed",
52                                    this._annotate ? "false" : "true");
53           return this._annotate;
54         ]]></setter>
55       </property>
57       <property name="annotation"
58                 onset="this.setAttribute('annotation', val); return val;"
59                 onget="return this.getAttribute('annotation');"/>
61     </implementation>
63     <handlers>
64       <handler event="input">
65         if (this._annotate)
66           this._strut.setAttribute("value", this.value);
67       </handler>
68     </handlers>
70   </binding>
71 </bindings>