From ca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 Mon Sep 17 00:00:00 2001 From: Lionel LASKE Date: Sat, 25 Aug 2012 20:23:36 +0000 Subject: Init commit --- (limited to 'html/lib/onyx/source/Checkbox.js') diff --git a/html/lib/onyx/source/Checkbox.js b/html/lib/onyx/source/Checkbox.js new file mode 100644 index 0000000..2b6143b --- /dev/null +++ b/html/lib/onyx/source/Checkbox.js @@ -0,0 +1,35 @@ +/** + A box that shows or hides a check mark when clicked. + The onChange event is fired when it is clicked. Use getValue() to fetch + the checked status. + + {kind: "onyx.Checkbox", onchange: "checkboxClicked"} + + checkboxClicked: function(inSender) { + if (inSender.getValue()) { + this.log("I've been checked!"); + } + } +*/ +enyo.kind({ + name: "onyx.Checkbox", + classes: "onyx-checkbox", + //* @protected + kind: enyo.Checkbox, + tag: "div", + handlers: { + ondown:"downHandler", + // prevent double onchange bubble in IE + onclick: "" + }, + downHandler: function(inSender, e) { + if (!this.disabled) { + this.setChecked(!this.getChecked()); + this.bubble("onchange"); + } + return true; + }, + tap: function(inSender, e) { + return !this.disabled; + } +}); -- cgit v0.9.1