]> git.wh0rd.org Git - tt-rss.git/blob - lib/dijit/form/ComboButton.js.uncompressed.js
upgrade dojo to 1.8.3 (refs #570)
[tt-rss.git] / lib / dijit / form / ComboButton.js.uncompressed.js
1 require({cache:{
2 'url:dijit/form/templates/ComboButton.html':"<table class=\"dijit dijitReset dijitInline dijitLeft\"\n\tcellspacing='0' cellpadding='0' role=\"presentation\"\n\t><tbody role=\"presentation\"><tr role=\"presentation\"\n\t\t><td class=\"dijitReset dijitStretch dijitButtonNode\" data-dojo-attach-point=\"buttonNode\" data-dojo-attach-event=\"ondijitclick:_onClick,onkeypress:_onButtonKeyPress\"\n\t\t><div id=\"${id}_button\" class=\"dijitReset dijitButtonContents\"\n\t\t\tdata-dojo-attach-point=\"titleNode\"\n\t\t\trole=\"button\" aria-labelledby=\"${id}_label\"\n\t\t\t><div class=\"dijitReset dijitInline dijitIcon\" data-dojo-attach-point=\"iconNode\" role=\"presentation\"></div\n\t\t\t><div class=\"dijitReset dijitInline dijitButtonText\" id=\"${id}_label\" data-dojo-attach-point=\"containerNode\" role=\"presentation\"></div\n\t\t></div\n\t\t></td\n\t\t><td id=\"${id}_arrow\" class='dijitReset dijitRight dijitButtonNode dijitArrowButton'\n\t\t\tdata-dojo-attach-point=\"_popupStateNode,focusNode,_buttonNode\"\n\t\t\tdata-dojo-attach-event=\"onkeypress:_onArrowKeyPress\"\n\t\t\ttitle=\"${optionsTitle}\"\n\t\t\trole=\"button\" aria-haspopup=\"true\"\n\t\t\t><div class=\"dijitReset dijitArrowButtonInner\" role=\"presentation\"></div\n\t\t\t><div class=\"dijitReset dijitArrowButtonChar\" role=\"presentation\">&#9660;</div\n\t\t></td\n\t\t><td style=\"display:none !important;\"\n\t\t\t><input ${!nameAttrSetting} type=\"${type}\" value=\"${value}\" data-dojo-attach-point=\"valueNode\" role=\"presentation\"\n\t\t/></td></tr></tbody\n></table>\n"}});
3 define("dijit/form/ComboButton", [
4         "dojo/_base/declare", // declare
5         "dojo/_base/event", // event.stop
6         "dojo/keys", // keys
7         "../focus",             // focus.focus()
8         "./DropDownButton",
9         "dojo/text!./templates/ComboButton.html"
10 ], function(declare, event, keys, focus, DropDownButton, template){
11
12 // module:
13 //              dijit/form/ComboButton
14
15 return declare("dijit.form.ComboButton", DropDownButton, {
16         // summary:
17         //              A combination button and drop-down button.
18         //              Users can click one side to "press" the button, or click an arrow
19         //              icon to display the drop down.
20         //
21         // example:
22         // |    <button data-dojo-type="dijit/form/ComboButton" onClick="...">
23         // |            <span>Hello world</span>
24         // |            <div data-dojo-type="dijit/Menu">...</div>
25         // |    </button>
26         //
27         // example:
28         // |    var button1 = new ComboButton({label: "hello world", onClick: foo, dropDown: "myMenu"});
29         // |    dojo.body().appendChild(button1.domNode);
30         //
31
32         templateString: template,
33
34         // Map widget attributes to DOMNode attributes.
35         _setIdAttr: "", // override _FormWidgetMixin which puts id on the focusNode
36         _setTabIndexAttr: ["focusNode", "titleNode"],
37         _setTitleAttr: "titleNode",
38
39         // optionsTitle: String
40         //              Text that describes the options menu (accessibility)
41         optionsTitle: "",
42
43         baseClass: "dijitComboButton",
44
45         // Set classes like dijitButtonContentsHover or dijitArrowButtonActive depending on
46         // mouse action over specified node
47         cssStateNodes: {
48                 "buttonNode": "dijitButtonNode",
49                 "titleNode": "dijitButtonContents",
50                 "_popupStateNode": "dijitDownArrowButton"
51         },
52
53         _focusedNode: null,
54
55         _onButtonKeyPress: function(/*Event*/ evt){
56                 // summary:
57                 //              Handler for right arrow key when focus is on left part of button
58                 if(evt.charOrCode == keys[this.isLeftToRight() ? "RIGHT_ARROW" : "LEFT_ARROW"]){
59                         focus.focus(this._popupStateNode);
60                         event.stop(evt);
61                 }
62         },
63
64         _onArrowKeyPress: function(/*Event*/ evt){
65                 // summary:
66                 //              Handler for left arrow key when focus is on right part of button
67                 if(evt.charOrCode == keys[this.isLeftToRight() ? "LEFT_ARROW" : "RIGHT_ARROW"]){
68                         focus.focus(this.titleNode);
69                         event.stop(evt);
70                 }
71         },
72
73         focus: function(/*String*/ position){
74                 // summary:
75                 //              Focuses this widget to according to position, if specified,
76                 //              otherwise on arrow node
77                 // position:
78                 //              "start" or "end"
79                 if(!this.disabled){
80                         focus.focus(position == "start" ? this.titleNode : this._popupStateNode);
81                 }
82         }
83 });
84
85 });