aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/toggle-button.reel
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-03 22:53:07 -0700
committerValerio Virgillito2012-05-03 22:53:07 -0700
commit24b483db367291b72170f969de78efcb1a9b95bd (patch)
treea691a7803cefbfa76a6331a50cbeebcd16287d91 /node_modules/montage/ui/toggle-button.reel
parentdc93269cfa7c315d22d85c8217e2412749643f28 (diff)
downloadninja-24b483db367291b72170f969de78efcb1a9b95bd.tar.gz
integrating the latest montage version
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/toggle-button.reel')
-rw-r--r--node_modules/montage/ui/toggle-button.reel/toggle-button.js74
1 files changed, 39 insertions, 35 deletions
diff --git a/node_modules/montage/ui/toggle-button.reel/toggle-button.js b/node_modules/montage/ui/toggle-button.reel/toggle-button.js
index eb304007..f668d227 100644
--- a/node_modules/montage/ui/toggle-button.reel/toggle-button.js
+++ b/node_modules/montage/ui/toggle-button.reel/toggle-button.js
@@ -3,22 +3,31 @@
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */ 5 </copyright> */
6
7/**
8 @module "montage/ui/toggle-button.reel"
9 @requires montage/ui/component
10 @requires "montage/ui/button.reel"
11*/
12
6var Montage = require("montage").Montage, 13var Montage = require("montage").Montage,
7 Component = require("ui/component").Component, 14 Component = require("ui/component").Component,
8 Button = require("ui/button.reel/button").Button; 15 Button = require("ui/button.reel/button").Button;
9/** 16/**
10 * The Text input 17 The ToggleButton component extends the Button component to include state management (pressed or not pressed), and the ability to specify labels and CSS classes for each state.
18 @class module:"montage/ui/toggle-button.reel".ToggleButton
19 @extends module:"montage/button.reel".Button
11 */ 20 */
12var ToggleButton = exports.ToggleButton = Montage.create(Button, { 21var ToggleButton = exports.ToggleButton = Montage.create(Button, /** @lends module:"montage/ui/toggle-button.reel".ToggleButton# */ {
13 _pressed: { 22 _pressed: {
14 enumerable: false, 23 enumerable: false,
15 value: false 24 value: false
16 }, 25 },
17 /** 26/**
18 Whether the toggle button is down/pressed or not. 27 Gets and sets the ToggleButton's current state, updates the button's label to its <code>pressedLabel</code> or <code>unpressedLabel</code>, and requests a draw.
19 @type {Property} 28 @type {Boolean}
20 @default {Boolean} false 29 @default false
21 */ 30*/
22 pressed: { 31 pressed: {
23 get: function() { 32 get: function() {
24 return this._pressed; 33 return this._pressed;
@@ -35,13 +44,11 @@ var ToggleButton = exports.ToggleButton = Montage.create(Button, {
35 value: null, 44 value: null,
36 serializable: true 45 serializable: true
37 }, 46 },
38 /** 47/**
39 The value the button should take when it is in the unpressed state. If 48 The label to display when the ToggleButton is in its unpressed state. By default, it is set to the value of the <code>value</code> attribute assigned to the input element.
40 this is not set at initialization it will be set to the `value` of the 49 @type {String}
41 button. 50 @default null
42 @type {Property} 51*/
43 @default {String} null
44 */
45 unpressedLabel: { 52 unpressedLabel: {
46 get: function() { 53 get: function() {
47 return this._unpressedLabel; 54 return this._unpressedLabel;
@@ -60,13 +67,11 @@ var ToggleButton = exports.ToggleButton = Montage.create(Button, {
60 value: null, 67 value: null,
61 serializable: true 68 serializable: true
62 }, 69 },
63 /** 70/**
64 The value the button should take when it is in the pressed state. If 71 The value the button should take when it is in the pressed state. By default, it is set to the value of the <code>value</code> attribute assigned to the input element.
65 this is not set at initialization it will be set to the `value` of the 72 @type {Property}
66 button. 73 @default {String} null
67 @type {Property} 74*/
68 @default {String} null
69 */
70 pressedLabel: { 75 pressedLabel: {
71 get: function() { 76 get: function() {
72 return this._pressedLabel; 77 return this._pressedLabel;
@@ -85,12 +90,12 @@ var ToggleButton = exports.ToggleButton = Montage.create(Button, {
85 value: "pressed", 90 value: "pressed",
86 serializable: true 91 serializable: true
87 }, 92 },
88 /** 93/**
89 The class that should be added to the element when the button is in 94 The CSS class that should be added to the element's class list when the button is in
90 the pressed state. It is removed when the button is unpressed. 95 the pressed state. It is removed when the button is unpressed.
91 @type {Property} 96 @type {string}
92 @default {String} "pressed" 97 @default "pressed"
93 */ 98*/
94 pressedClass: { 99 pressedClass: {
95 get: function() { 100 get: function() {
96 return this._pressedClass; 101 return this._pressedClass;
@@ -104,13 +109,12 @@ var ToggleButton = exports.ToggleButton = Montage.create(Button, {
104 }, 109 },
105 110
106 /** 111 /**
107 The current value of the button. It will be set to unpressedLabel or 112 The current value of the button. It is set to the value of <code>unpressedLabel</code> or
108 pressedLabel depending on state. 113 <code>pressedLabel</code> depending on the ToggleButton's state.
109 114
110 Setting this property equal to unpressedLabel or pressedLabel will 115 Setting this property equal to <code>unpressedLabel</code> or <code>pressedLabel</code> will change the <code>pressed</code> state of the button to `false` or `true`, respectively.
111 change the pressed state of the button to `false` and `true` respectively. 116 @type {string}
112 @type {Property} 117 @default null
113 @default {String} null, or the value of the element
114 */ 118 */
115 label: { 119 label: {
116 get: function() { 120 get: function() {
@@ -163,8 +167,8 @@ var ToggleButton = exports.ToggleButton = Montage.create(Button, {
163 }, 167 },
164 168
165 /** 169 /**
166 Change the button to the inverse of its current state. 170 Toggles the state of the button.
167 @type {Function} 171 @function
168 */ 172 */
169 toggle: { 173 toggle: {
170 value: function() { 174 value: function() {