Sha256: 0bfca5724f22a6d6b4f51cab39525aa41f07407acc5e109cd5c712708b94c327
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
uki.view.declare('uki.view.Checkbox', uki.view.Button, function(Base) { this._backgroundPrefix = 'checkbox-'; uki.each(['checked-normal', 'checked-hover', 'checked-disabled'], function(i, name) { var property = name + '-background'; this[property] = function(bg) { if (bg) this['_' + property] = bg; return this['_' + property] = this['_' + property] || uki.theme.background(this._backgroundPrefix + name, {height: this.rect().height, view: this}); }; }, this); this._setup = function() { Base._setup.call(this); this._focusable = false; }; this._updateBg = function() { var name = this._disabled ? 'disabled' : this._over ? 'hover' : 'normal'; if (this._checked) name = 'checked-' + name; this._backgroundByName(name); }; this.value = this.checked = uki.newProp('_checked', function(state) { var changed = this._checked != !!state; this._checked = !!state; this._updateBg(); if (changed) this.trigger('change', {checked: this._checked, source: this}); }); this._mouseup = function(e) { if (!this._down) return; this._down = false; if (!this._disabled) this.checked(!this.checked()) }; });
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
uki-1.1.1 | frameworks/uki/src/uki-view/view/checkbox.js |
uki-1.1.0 | frameworks/uki/src/uki-view/view/checkbox.js |
uki-1.0.2 | frameworks/uki/src/uki-view/view/checkbox.js |