diff options
Diffstat (limited to 'js/ui/menu/menu-entry.reel/menu-entry.js')
-rwxr-xr-x | js/ui/menu/menu-entry.reel/menu-entry.js | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/js/ui/menu/menu-entry.reel/menu-entry.js b/js/ui/menu/menu-entry.reel/menu-entry.js new file mode 100755 index 00000000..ca512895 --- /dev/null +++ b/js/ui/menu/menu-entry.reel/menu-entry.js | |||
@@ -0,0 +1,110 @@ | |||
1 | /* <copyright> | ||
2 | Copyright (c) 2012, Motorola Mobility LLC. | ||
3 | All Rights Reserved. | ||
4 | |||
5 | Redistribution and use in source and binary forms, with or without | ||
6 | modification, are permitted provided that the following conditions are met: | ||
7 | |||
8 | * Redistributions of source code must retain the above copyright notice, | ||
9 | this list of conditions and the following disclaimer. | ||
10 | |||
11 | * Redistributions in binary form must reproduce the above copyright notice, | ||
12 | this list of conditions and the following disclaimer in the documentation | ||
13 | and/or other materials provided with the distribution. | ||
14 | |||
15 | * Neither the name of Motorola Mobility LLC nor the names of its | ||
16 | contributors may be used to endorse or promote products derived from this | ||
17 | software without specific prior written permission. | ||
18 | |||
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
29 | POSSIBILITY OF SUCH DAMAGE. | ||
30 | </copyright> */ | ||
31 | |||
32 | var Montage = require("montage/core/core").Montage; | ||
33 | var Component = require("montage/ui/component").Component; | ||
34 | |||
35 | exports.MenuEntry = Montage.create(Component, { | ||
36 | |||
37 | _label: { | ||
38 | value: null | ||
39 | }, | ||
40 | |||
41 | label: { | ||
42 | get: function() { | ||
43 | return this._label; | ||
44 | }, | ||
45 | set: function(value) { | ||
46 | if(this._label !== value) { | ||
47 | this._label = value; | ||
48 | } | ||
49 | } | ||
50 | }, | ||
51 | |||
52 | _entries: { | ||
53 | value: [] | ||
54 | }, | ||
55 | |||
56 | entries: { | ||
57 | get: function() { | ||
58 | return this._entries; | ||
59 | }, | ||
60 | set: function(value) { | ||
61 | if(this._entries !== value) { | ||
62 | this._entries = value; | ||
63 | } | ||
64 | } | ||
65 | }, | ||
66 | |||
67 | menuHeaderButton: { | ||
68 | value: null | ||
69 | }, | ||
70 | |||
71 | |||
72 | prepareForDraw: { | ||
73 | value: function() { | ||
74 | this.menuHeaderButton.element.addEventListener("mousedown", this, true); | ||
75 | } | ||
76 | }, | ||
77 | |||
78 | captureMousedown: { | ||
79 | value: function(event) { | ||
80 | var mouseDownEvent = document.createEvent("CustomEvent"); | ||
81 | mouseDownEvent.initCustomEvent("headermousedown", true, true, this); | ||
82 | this.dispatchEvent(mouseDownEvent); | ||
83 | } | ||
84 | }, | ||
85 | |||
86 | _menuIsActive: { | ||
87 | value: false | ||
88 | }, | ||
89 | |||
90 | menuIsActive: { | ||
91 | get: function() { | ||
92 | return this._menuIsActive; | ||
93 | }, | ||
94 | set: function(value) { | ||
95 | if(value) { | ||
96 | this.element.addEventListener("mouseover", this, false); | ||
97 | } else { | ||
98 | this.element.removeEventListener("mouseover", this, false); | ||
99 | } | ||
100 | } | ||
101 | }, | ||
102 | |||
103 | handleMouseover: { | ||
104 | value: function(event) { | ||
105 | var mouseOverEvent = document.createEvent("CustomEvent"); | ||
106 | mouseOverEvent.initCustomEvent("headermouseover", true, true, this); | ||
107 | this.dispatchEvent(mouseOverEvent); | ||
108 | } | ||
109 | } | ||
110 | }); | ||