aboutsummaryrefslogtreecommitdiff
path: root/js/components/menu/menu-entry.reel/menu-entry.js
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /js/components/menu/menu-entry.reel/menu-entry.js
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'js/components/menu/menu-entry.reel/menu-entry.js')
-rw-r--r--js/components/menu/menu-entry.reel/menu-entry.js79
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>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component;
9
10exports.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