aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage-user/ui/popup/popup.reel/popup.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/montage-user/ui/popup/popup.reel/popup.js')
-rwxr-xr-xnode_modules/montage-user/ui/popup/popup.reel/popup.js519
1 files changed, 519 insertions, 0 deletions
diff --git a/node_modules/montage-user/ui/popup/popup.reel/popup.js b/node_modules/montage-user/ui/popup/popup.reel/popup.js
new file mode 100755
index 00000000..5c6f167e
--- /dev/null
+++ b/node_modules/montage-user/ui/popup/popup.reel/popup.js
@@ -0,0 +1,519 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<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.
5 </copyright> */
6
7/**
8 @module "montage/ui/popup/popup.reel"
9 @requires montage/core/core
10 @requires montage/ui/component
11*/
12var Montage = require("montage").Montage,
13 Component = require("ui/component").Component;
14
15/**
16 @class module:"montage/ui/popup.reel".Popup
17 @extends module:montage/ui/component.Component
18*/
19
20var Popup = exports.Popup = Montage.create(Component, { /** @lends module:"module/ui/popup/popup.reel".Popup */
21
22 hasTemplate: {value: true},
23
24 // anchor element to which this popup must be anchored to
25 anchor: {value: null},
26
27 // A Delegate to control positioning (and other features, in future) of the popup in a custom manner
28 delegate: {value: null},
29
30 contentEl: {
31 value: null
32 },
33/**
34 Description TODO
35 @type {Property}
36 @default {Container} null
37 */
38 containerEl: {
39 value: null
40 },
41
42/**
43 Description TODO
44 @private
45*/
46 _pointer: {
47 value: true
48 },
49/**
50 Description TODO
51 @type {Function}
52 @default {Boolean} true
53 */
54 pointer: {
55 get: function() {
56 return this._pointer;
57 },
58 set: function(value) {
59 if (this._pointer !== value) {
60 this._pointer = value;
61 this.needsDraw = true;
62 }
63 }
64 },
65/**
66 Description TODO
67 @private
68*/
69 _boxed: {
70 value: true
71 },
72/**
73 Description TODO
74 @type {Function}
75 @default {Boolean} true
76 */
77 boxed: {
78 get: function() {
79 return this._boxed;
80 },
81 set: function(value) {
82 if (this._boxed !== value) {
83 this._boxed = value;
84 this.needsDraw = true;
85 }
86 }
87 },
88/**
89 Description TODO
90 @private
91*/
92 _slot: {value: null},
93/**
94 Description TODO
95 @type {Function}
96 @default null
97 */
98 slot: {
99 get: function() {
100 return this._slot;
101 },
102 set: function(val) {
103 this._slot = val;
104 if (this.content) {
105 this._slot.content = this.content;
106 }
107 }
108 },
109/**
110 Description TODO
111 @private
112*/
113 _content: {value: null},
114/**
115 Description TODO
116 @type {Function}
117 @default null
118 */
119 content: {
120 serializable: true,
121 get: function() {
122 return this._content;
123 },
124 set: function(value) {
125 if (this._content !== value && this.slot) {
126 this.slot.content = value;
127 }
128 this._content = value;
129 // set the popup property of the content.
130 this._content.popup = this;
131 this.needsDraw = true;
132 }
133 },
134/**
135 Description TODO
136 @private
137*/
138 _modal: { value: false },
139/**
140 Description TODO
141 @type {Function}
142 @default {Boolean} false
143 */
144 modal: {
145 get: function() {
146 return this._modal;
147 },
148 set: function(value) {
149 // force this to be a boolean
150 value = !!value;
151
152 if (this._modal !== value) {
153 this._modal = value;
154 this.needsDraw = true;
155 }
156 }
157 },
158
159 // An Object wtih values {top, left}. Set it only if the popup should display at a
160 // given location instead of anchoring it to a anchor element or at the center of the screen.
161 _position: {value: null},
162 position: {
163 get: function() {
164 return this._position;
165 },
166 set: function(pos) {
167 this._position = pos;
168 //this.needsDraw = true;
169 }
170 },
171
172 autoDismiss: { value: 0 },
173
174 _displayed: { value: false },
175 displayed: {
176 get: function() {
177 return this._displayed;
178 },
179 set: function(value) {
180 if (this._displayed !== value) {
181 this.needsDraw = true;
182 }
183 this._displayed = value;
184
185 }
186 },
187/**
188 Description TODO
189 @function
190 */
191 prepareForDraw: {
192 value: function() {
193
194 }
195 },
196
197 _popupSlot: {
198 value: null
199 },
200
201 _modalDialogMask: {
202 value: null
203 },
204
205
206 /**
207 @private
208 */
209 _getPosition: {
210 value: function(obj) {
211 var curleft = 0, curtop = 0, curHt = 0, curWd = 0;
212 if (obj.offsetParent) {
213 do {
214 curleft += obj.offsetLeft;
215 curtop += obj.offsetTop;
216 curHt += obj.offsetHeight;
217 curWd += obj.offsetWidth;
218 } while ((obj = obj.offsetParent));
219 }
220 return [curleft,curtop, curHt, curWd];
221
222 }
223 },
224
225 _calculatePosition: {
226 value: function() {
227 var pos, delegate = this.delegate, anchor = this.anchor, type = (this.type || 'custom');
228