(function () {
/**
- @name XV.ToggleButton
- @class A control that looks like a switch with labels for two states.<br />
- Derived from <a href="http://enyojs.com/api/#onyx.ToggleButton">onyx.ToggleButton</a>.
- @extends onyx.ToggleButton
+ @name XV.ToggleButtonWidget
+ @class An input control consisting of fittable columns:
+ label, decorator, and toggle button.<br />
+ Use to implement a toggle button, a switch with labels for two states.<br />
+ Creates an HTML input element.
+ @extends XV.Input
*/
- enyo.kind(
- /** @lends XV.ToggleButton# */{
- name: "XV.ToggleButton",
- kind: "onyx.ToggleButton",
+ enyo.kind({
+ name: "XV.ToggleButtonWidget",
+ kind: "XV.InputWidget",
+ classes: "xv-inputwidget xv-checkboxwidget",
published: {
attr: null
},
handlers: {
onChange: "changed"
},
- /**
- @todo Document the clear method.
- */
- clear: function (options) {
- this.setValue(false, options);
- },
+ components: [
+ {kind: "FittableColumns", components: [
+ {name: "label", content: "", classes: "xv-label"},
+ {kind: "onyx.InputDecorator", classes: "xv-input-decorator",
+ components: [
+ {name: "input", kind: "onyx.ToggleButton", onChange: "inputChanged"}
+ ]}
+ ]}
+ ],
/**
@todo Document the setValue method.
*/
inEvent.value = this.getValue();
this.doValueChange(inEvent);
}
- }
- });
-
- /**
- @name XV.ToggleButtonWidget
- @class An input control consisting of fittable columns:
- label, decorator, and toggle button.<br />
- Use to implement a toggle button, a switch with labels for two states.<br />
- Creates an HTML input element.
- @extends XV.Input
- */
- enyo.kind(/** @lends XV.ToggleButtonWidget# */{
- name: "XV.ToggleButtonWidget",
- kind: "XV.Input",
- classes: "xv-inputwidget xv-checkboxwidget",
- published: {
- label: ""
},
- components: [
- {kind: "FittableColumns", components: [
- {name: "label", content: "", classes: "xv-label"},
- {kind: "onyx.InputDecorator", classes: "xv-input-decorator",
- components: [
- {name: "input", kind: "onyx.ToggleButton", onChange: "inputChanged"}
- ]}
- ]}
- ],
/**
@todo Document the clear method.
*/
var options = {silent: true};
this.valueChanged(this.getValue(), options);
},
- disabledChanged: function () {
- this.inherited(arguments);
- this.$.label.addRemoveClass("disabled", this.getDisabled());
- },
/**
@todo Document the inputChanged method.
*/
var input = this.$.input.getValue();
this.setValue(input);
},
- /**
- @todo Document the labelChanged method.
- */
- labelChanged: function () {
- var label = (this.getLabel() || ("_" + this.attr || "").loc()) + ":";
- this.$.label.setContent(label);
- },
- /**
- Not applicable in the context of a toggle button,
- even though it is available to input widgets generally.
- */
- placeholderChanged: function () {
- // Not applicable
- },
/**
@todo Document the valueChanged method.
*/