diff options
Diffstat (limited to 'js/components/toolbar.reel/toolbar.js')
-rw-r--r-- | js/components/toolbar.reel/toolbar.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js new file mode 100644 index 00000000..03edf477 --- /dev/null +++ b/js/components/toolbar.reel/toolbar.js | |||
@@ -0,0 +1,57 @@ | |||
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 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.Toolbar = Montage.create(Component, { | ||
11 | _needsButtonProperties : { | ||
12 | value: null | ||
13 | }, | ||
14 | _buttons : { value: null }, | ||
15 | buttons : { | ||
16 | get: function() { | ||
17 | return this._buttons; | ||
18 | }, | ||
19 | set: function(btns) { | ||
20 | this._buttons = btns; | ||
21 | this._needsButtonProperties = true; | ||
22 | console.log("buttons set"); | ||
23 | } | ||
24 | }, | ||
25 | prepareForDraw : { | ||
26 | value: function() { | ||
27 | console.log("toolbar - prepare for draw"); | ||
28 | if(this._needsButtonProperties) { | ||
29 | this.repetition.childComponents.forEach(function(button) { | ||
30 | button.identifier = button.sourceObject.identifier; | ||
31 | button.addEventListener('action', this.delegate, false); | ||
32 | }, this); | ||
33 | } | ||
34 | } | ||
35 | }, | ||
36 | draw : { | ||
37 | value: function() { | ||
38 | console.log("toolbar - draw - repetition ", this.repetition); | ||
39 | if(this._needsClass) { | ||
40 | |||
41 | this.repetition.childComponents.forEach(function(button) { | ||
42 | button.element.classList.add('toolbar-' + button.sourceObject.identifier + '-button'); | ||
43 | }, this); | ||
44 | } | ||
45 | |||
46 | if(this._needsButtonProperties) { | ||
47 | this._needsClass = this.needsDraw = true; | ||
48 | this._needsButtonProperties = false; | ||
49 | } | ||
50 | |||
51 | |||
52 | } | ||
53 | }, | ||
54 | _needsClass : { | ||
55 | value: null | ||
56 | } | ||
57 | }); \ No newline at end of file | ||