fixing mainmenu bugs

This commit is contained in:
Rolux 2010-02-08 15:47:00 +05:30
parent 273e13190a
commit 11d1db1372

View file

@ -1872,35 +1872,46 @@ requires
function mousemove(event) { function mousemove(event) {
var $target = $(event.target), var $target = $(event.target),
position = $target.data("position"); position = typeof $target.data("position") != "undefined" ? $target.data("position") : -1;
if (self.focused && position != self.selected) { if (self.focused) {
clickTitle(position); if (self.focused && position != self.selected) {
clickTitle(position);
}
} }
} }
function clickMenu() { function clickMenu() {
Ox.print("clickMenu!!") Ox.print("self.selected", self.selected)
that.titles[self.selected].removeClass("OxSelected"); that.titles[self.selected].removeClass("OxSelected");
self.selected = -1; self.selected = -1;
self.focused = false; self.focused = false;
} }
function clickTitle(position) { function clickTitle(position) {
Ox.print("clickMenu", position) var menu, title;
var title = that.titles[position], if (position == -1) {
menu = that.menus[position]; if (self.selected > -1) {
if (self.selected > -1) { that.menus[self.selected].hideMenu();
that.menus[self.selected].hideMenu(); that.titles[self.selected].removeClass("OxSelected");
that.titles[self.selected].removeClass("OxSelected") self.selected = -1;
} }
if (self.selected == position) {
self.focused = false;
self.selected = -1;
} else { } else {
self.focused = true; title = that.titles[position],
self.selected = position; menu = that.menus[position];
that.titles[self.selected].addClass("OxSelected"); if (self.selected > -1) {
that.menus[self.selected].showMenu(); that.menus[self.selected].hideMenu();
that.titles[self.selected].removeClass("OxSelected");
}
if (self.selected == position) {
self.focused = false;
self.selected = -1;
} else {
Ox.print("pos", position)
self.focused = true;
self.selected = position;
that.titles[self.selected].addClass("OxSelected");
that.menus[self.selected].showMenu();
}
} }
} }
@ -1908,6 +1919,18 @@ requires
}; };
that.addMenuAfter = function() {
};
that.addMenuBefore = function() {
};
that.removeMenu = function() {
};
that.selectNextMenu = function() { that.selectNextMenu = function() {
if (self.selected < self.options.menus.length - 1) { if (self.selected < self.options.menus.length - 1) {
clickTitle(self.selected + 1); clickTitle(self.selected + 1);
@ -2023,6 +2046,7 @@ requires
function clickItem(position) { function clickItem(position) {
var item = that.items[position]; var item = that.items[position];
Ox.print("clickItem", position, item.options("items").length)
if (!item.options("items").length) { if (!item.options("items").length) {
if (that.options("parent")) { if (that.options("parent")) {
that.options("parent").hideMenu().triggerEvent("click"); that.options("parent").hideMenu().triggerEvent("click");
@ -2040,6 +2064,7 @@ requires
item.toggleTitle(); item.toggleTitle();
} }
} }
closeMenu();
} }
function clickSelectedItem() { function clickSelectedItem() {
@ -2050,6 +2075,11 @@ requires
} }
} }
function closeMenu() {
that.triggerEvent("click");
that.hideMenu();
}
function constructLine() { function constructLine() {
return $("<tr>").append( return $("<tr>").append(
$("<td>", { $("<td>", {
@ -2309,6 +2339,14 @@ requires
} }
that.addItemAfter = function(item) {
};
that.addItemBefore = function(item) {
};
that.hasEnabledItems = function() { that.hasEnabledItems = function() {
var ret = false; var ret = false;
$.each(that.items, function(i, item) { $.each(that.items, function(i, item) {
@ -2347,6 +2385,10 @@ requires
//that.triggerEvent("hide"); //that.triggerEvent("hide");
}; };
that.removeItem = function() {
};
that.selectFirstItem = function() { that.selectFirstItem = function() {
selectNextItem(); selectNextItem();
}; };
@ -2385,7 +2427,7 @@ requires
key_down: selectNextItem, key_down: selectNextItem,
key_left: selectSupermenu, key_left: selectSupermenu,
key_right: selectSubmenu, key_right: selectSubmenu,
key_escape: that.hideMenu, key_escape: closeMenu,
key_enter: clickSelectedItem key_enter: clickSelectedItem
}); });
setTimeout(function() { setTimeout(function() {
@ -2503,18 +2545,6 @@ requires
} }
} }
that.insertItemAfter = function(item) {
};
that.insertItemBefore = function(item) {
};
that.removeItem = function() {
};
that.toggleChecked = function() { that.toggleChecked = function() {
}; };