]> git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/DropDownButton.js.uncompressed.js
upgrade dojo to 1.8.3 (refs #570)
[tt-rss.git] / lib / dijit / form / DropDownButton.js.uncompressed.js
1 require({cache:{
2 'url:dijit/form/templates/DropDownButton.html':"<span class=\"dijit dijitReset dijitInline\"\n\t><span class='dijitReset dijitInline dijitButtonNode'\n\t\tdata-dojo-attach-event=\"ondijitclick:_onClick\" data-dojo-attach-point=\"_buttonNode\"\n\t\t><span class=\"dijitReset dijitStretch dijitButtonContents\"\n\t\t\tdata-dojo-attach-point=\"focusNode,titleNode,_arrowWrapperNode\"\n\t\t\trole=\"button\" aria-haspopup=\"true\" aria-labelledby=\"${id}_label\"\n\t\t\t><span class=\"dijitReset dijitInline dijitIcon\"\n\t\t\t\tdata-dojo-attach-point=\"iconNode\"\n\t\t\t></span\n\t\t\t><span class=\"dijitReset dijitInline dijitButtonText\"\n\t\t\t\tdata-dojo-attach-point=\"containerNode,_popupStateNode\"\n\t\t\t\tid=\"${id}_label\"\n\t\t\t></span\n\t\t\t><span class=\"dijitReset dijitInline dijitArrowButtonInner\"></span\n\t\t\t><span class=\"dijitReset dijitInline dijitArrowButtonChar\">&#9660;</span\n\t\t></span\n\t></span\n\t><input ${!nameAttrSetting} type=\"${type}\" value=\"${value}\" class=\"dijitOffScreen\" tabIndex=\"-1\"\n\t\tdata-dojo-attach-point=\"valueNode\" role=\"presentation\"\n/></span>\n"}});
3 define("dijit/form/DropDownButton", [
4 "dojo/_base/declare", // declare
5 "dojo/_base/lang", // hitch
6 "dojo/query", // query
7 "../registry", // registry.byNode
8 "../popup", // dijit.popup2.hide
9 "./Button",
10 "../_Container",
11 "../_HasDropDown",
12 "dojo/text!./templates/DropDownButton.html"
13 ], function(declare, lang, query, registry, popup, Button, _Container, _HasDropDown, template){
14
15 // module:
16 // dijit/form/DropDownButton
17
18
19 return declare("dijit.form.DropDownButton", [Button, _Container, _HasDropDown], {
20 // summary:
21 // A button with a drop down
22 //
23 // example:
24 // | <button data-dojo-type="dijit/form/DropDownButton">
25 // | Hello world
26 // | <div data-dojo-type="dijit/Menu">...</div>
27 // | </button>
28 //
29 // example:
30 // | var button1 = new DropDownButton({ label: "hi", dropDown: new dijit.Menu(...) });
31 // | win.body().appendChild(button1);
32 //
33
34 baseClass : "dijitDropDownButton",
35
36 templateString: template,
37
38 _fillContent: function(){
39 // Overrides Button._fillContent().
40 //
41 // My inner HTML contains both the button contents and a drop down widget, like
42 // <DropDownButton> <span>push me</span> <Menu> ... </Menu> </DropDownButton>
43 // The first node is assumed to be the button content. The widget is the popup.
44
45 if(this.srcNodeRef){ // programatically created buttons might not define srcNodeRef
46 //FIXME: figure out how to filter out the widget and use all remaining nodes as button
47 // content, not just nodes[0]
48 var nodes = query("*", this.srcNodeRef);
49 this.inherited(arguments, [nodes[0]]);
50
51 // save pointer to srcNode so we can grab the drop down widget after it's instantiated
52 this.dropDownContainer = this.srcNodeRef;
53 }
54 },
55
56 startup: function(){
57 if(this._started){ return; }
58
59 // the child widget from srcNodeRef is the dropdown widget. Insert it in the page DOM,
60 // make it invisible, and store a reference to pass to the popup code.
61 if(!this.dropDown && this.dropDownContainer){
62 var dropDownNode = query("[widgetId]", this.dropDownContainer)[0];
63 this.dropDown = registry.byNode(dropDownNode);
64 delete this.dropDownContainer;
65 }
66 if(this.dropDown){
67 popup.hide(this.dropDown);
68 }
69
70 this.inherited(arguments);
71 },
72
73 isLoaded: function(){
74 // Returns whether or not we are loaded - if our dropdown has an href,
75 // then we want to check that.
76 var dropDown = this.dropDown;
77 return (!!dropDown && (!dropDown.href || dropDown.isLoaded));
78 },
79
80 loadDropDown: function(/*Function*/ callback){
81 // Default implementation assumes that drop down already exists,
82 // but hasn't loaded it's data (ex: ContentPane w/href).
83 // App must override if the drop down is lazy-created.
84 var dropDown = this.dropDown;
85 var handler = dropDown.on("load", lang.hitch(this, function(){
86 handler.remove();
87 callback();
88 }));
89 dropDown.refresh(); // tell it to load
90 },
91
92 isFocusable: function(){
93 // Overridden so that focus is handled by the _HasDropDown mixin, not by
94 // the _FormWidget mixin.
95 return this.inherited(arguments) && !this._mouseDown;
96 }
97 });
98
99 });