diff options
Diffstat (limited to 'js/components/menu/menu-entry.reel/menu-entry.js')
-rw-r--r-- | js/components/menu/menu-entry.reel/menu-entry.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/js/components/menu/menu-entry.reel/menu-entry.js b/js/components/menu/menu-entry.reel/menu-entry.js new file mode 100644 index 00000000..57e6ec87 --- /dev/null +++ b/js/components/menu/menu-entry.reel/menu-entry.js | |||
@@ -0,0 +1,79 @@ | |||
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 | var Component = require("montage/ui/component").Component; | ||
9 | |||
10 | exports.MenuEntry = Montage.create(Component, { | ||
11 | topHeader: { value: null }, | ||
12 | topHeaderText: { value: null }, | ||
13 | |||
14 | // Reference to the parent Menu component | ||
15 | _menu: { | ||
16 | value: null | ||
17 | }, | ||
18 | |||
19 | data: { | ||
20 | value: null | ||
21 | }, | ||
22 | |||
23 | select: { | ||
24 | value: function() { | ||
25 | this.element.classList.add("selected"); | ||
26 | this.subEntries.style.display = "block"; | ||
27 | } | ||
28 | }, | ||
29 | |||
30 | deselect: { | ||
31 | value: function() { | ||
32 | this.element.classList.remove("selected"); | ||
33 | this.subEntries.style.display = "none"; | ||
34 | } | ||
35 | }, | ||
36 | |||
37 | _menuIsActive: { | ||
38 | value: false | ||
39 | }, | ||
40 | |||
41 | menuIsActive: { | ||
42 | get: function() { | ||
43 | return this._menuIsActive; | ||
44 | }, | ||
45 | set: function(value) { | ||
46 | if(value) this.topHeader.addEventListener("mouseover", this, false); | ||
47 | } | ||
48 | }, | ||
49 | |||
50 | handleClick: { | ||
51 | value: function(event) { | ||
52 | this._menu.toggleActivation(this); | ||
53 | } | ||
54 | }, | ||
55 | |||
56 | handleMouseover: { | ||
57 | value: function(event) { | ||
58 | this._menu.activeEntry = this; | ||
59 | } | ||
60 | }, | ||
61 | |||
62 | prepareForDraw: { | ||
63 | value: function() { | ||
64 | |||
65 | this.subEntries.style.display = "none"; | ||
66 | |||
67 | this.topHeaderText.innerHTML = this.data.header; | ||
68 | |||
69 | this.element.addEventListener("click", this, false); | ||
70 | |||
71 | Object.defineBinding(this, "menuIsActive", { | ||
72 | boundObject: this._menu, | ||
73 | boundObjectPropertyPath: "active", | ||
74 | oneway: true | ||
75 | }); | ||
76 | |||
77 | } | ||
78 | } | ||
79 | }); \ No newline at end of file | ||