diff options
Diffstat (limited to 'lib/dijit/CheckedMenuItem.js.uncompressed.js')
-rw-r--r-- | lib/dijit/CheckedMenuItem.js.uncompressed.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/dijit/CheckedMenuItem.js.uncompressed.js b/lib/dijit/CheckedMenuItem.js.uncompressed.js new file mode 100644 index 000000000..b28a9887d --- /dev/null +++ b/lib/dijit/CheckedMenuItem.js.uncompressed.js @@ -0,0 +1,53 @@ +require({cache:{ +'url:dijit/templates/CheckedMenuItem.html':"<tr class=\"dijitReset dijitMenuItem\" data-dojo-attach-point=\"focusNode\" role=\"menuitemcheckbox\" tabIndex=\"-1\">\n\t<td class=\"dijitReset dijitMenuItemIconCell\" role=\"presentation\">\n\t\t<img src=\"${_blankGif}\" alt=\"\" class=\"dijitMenuItemIcon dijitCheckedMenuItemIcon\" data-dojo-attach-point=\"iconNode\"/>\n\t\t<span class=\"dijitCheckedMenuItemIconChar\">✓</span>\n\t</td>\n\t<td class=\"dijitReset dijitMenuItemLabel\" colspan=\"2\" data-dojo-attach-point=\"containerNode,labelNode\"></td>\n\t<td class=\"dijitReset dijitMenuItemAccelKey\" style=\"display: none\" data-dojo-attach-point=\"accelKeyNode\"></td>\n\t<td class=\"dijitReset dijitMenuArrowCell\" role=\"presentation\"> </td>\n</tr>\n"}}); +define("dijit/CheckedMenuItem", [ + "dojo/_base/declare", // declare + "dojo/dom-class", // domClass.toggle + "./MenuItem", + "dojo/text!./templates/CheckedMenuItem.html", + "./hccss" +], function(declare, domClass, MenuItem, template){ + + // module: + // dijit/CheckedMenuItem + + return declare("dijit.CheckedMenuItem", MenuItem, { + // summary: + // A checkbox-like menu item for toggling on and off + + templateString: template, + + // checked: Boolean + // Our checked state + checked: false, + _setCheckedAttr: function(/*Boolean*/ checked){ + // summary: + // Hook so attr('checked', bool) works. + // Sets the class and state for the check box. + domClass.toggle(this.domNode, "dijitCheckedMenuItemChecked", checked); + this.domNode.setAttribute("aria-checked", checked ? "true" : "false"); + this._set("checked", checked); + }, + + iconClass: "", // override dijitNoIcon + + onChange: function(/*Boolean*/ /*===== checked =====*/){ + // summary: + // User defined function to handle check/uncheck events + // tags: + // callback + }, + + _onClick: function(evt){ + // summary: + // Clicking this item just toggles its state + // tags: + // private + if(!this.disabled){ + this.set("checked", !this.checked); + this.onChange(this.checked); + } + this.onClick(evt); + } + }); +}); |