source: Dev/branches/rest-dojo-ui/client/dojox/mobile/ToggleButton.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 814 bytes
Line 
1define([
2        "dojo/_base/declare",
3        "dojo/dom-class",
4        "dijit/form/_ToggleButtonMixin",
5        "./Button"
6], function(declare, domClass, ToggleButtonMixin, Button){
7
8        /*=====
9                Button = dojox.mobile.Button;
10                ToggleButtonMixin = dijit.form._ToggleButtonMixin;
11        =====*/
12        return declare("dojox.mobile.ToggleButton", [Button, ToggleButtonMixin], {
13                // summary:
14                //              A non-templated button widget that can be in two states (checked or not).
15                //              Can be base class for things like tabs or checkbox or radio buttons
16
17                baseClass: "mblToggleButton",
18
19                _setCheckedAttr: function(){
20                        this.inherited(arguments);
21                        var newStateClasses = (this.baseClass+' '+this["class"]).replace(/(\S+)\s*/g, "$1Checked ").split(" ");
22                        domClass[this.checked ? "add" : "remove"](this.focusNode || this.domNode, newStateClasses);
23                }
24        });
25});
Note: See TracBrowser for help on using the repository browser.