some changes to events

This commit is contained in:
Rolux 2010-02-08 20:12:00 +05:30
parent a8892cda30
commit 5c0de71eb3
4 changed files with 30 additions and 20 deletions

View File

@ -17,6 +17,11 @@ Bars
//background: -moz-linear-gradient(left top, left bottom, from(rgb(224, 224, 224)), to(rgb(192, 192, 192))); //background: -moz-linear-gradient(left top, left bottom, from(rgb(224, 224, 224)), to(rgb(192, 192, 192)));
//background: -webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), to(rgb(192, 192, 192))); //background: -webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), to(rgb(192, 192, 192)));
} }
.OxThemeClassic .OxBar.OxMainMenu {
background: -moz-linear-gradient(top, rgb(224, 224, 224), rgb(192, 192, 192));
background: -webkit-gradient(linear, left top, left bottom, from(rgb(224, 224, 224)), to(rgb(192, 192, 192)));
}
/* /*
================================================================================ ================================================================================
@ -101,8 +106,8 @@ Menus
*/ */
.OxThemeClassic .OxMainMenu > .OxTitle.OxSelected { .OxThemeClassic .OxMainMenu > .OxTitle.OxSelected {
background: -moz-linear-gradient(top, rgb(176, 176, 176), rgb(144, 144, 144)); background: -moz-linear-gradient(top, rgb(208, 208, 208), rgb(176, 176, 176));
background: -webkit-gradient(linear, left top, left bottom, from(rgb(176, 176, 176)), to(rgb(144, 144, 144))); background: -webkit-gradient(linear, left top, left bottom, from(rgb(208, 208, 208)), to(rgb(176, 176, 176)));
} }
.OxThemeClassic .OxMenu { .OxThemeClassic .OxMenu {

View File

@ -391,6 +391,8 @@ Menus
-moz-border-radius-bottomright: 4px; -moz-border-radius-bottomright: 4px;
-webkit-border-bottom-left-radius: 4px; -webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px; -webkit-border-bottom-right-radius: 4px;
-moz-user-select: none;
-webkit-user-select: none;
} }
.OxMenu.OxRight { .OxMenu.OxRight {
-moz-border-radius-topright: 4px; -moz-border-radius-topright: 4px;

View File

@ -907,10 +907,10 @@ requires
*/ */
if (Ox.isObject(arguments[0])) { if (Ox.isObject(arguments[0])) {
$.each(arguments[0], function(event, fn) { $.each(arguments[0], function(event, fn) {
Ox.Event.trigger(event + "_" + that.id, fn); Ox.Event.trigger(event + "_" + self.options.id, fn);
}); });
} else { } else {
Ox.Event.trigger(arguments[0] + "_" + that.id, arguments[1] || {}); Ox.Event.trigger(arguments[0] + "_" + self.options.id, arguments[1] || {});
} }
return that; return that;
} }
@ -1746,8 +1746,9 @@ requires
size: "medium" size: "medium"
}) })
.options(options) .options(options)
.addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size)), .addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size));
selected; self.buttonId = self.options.id + "_button"
self.menuId = self.options.id + "_menu",
$.each(self.options.items, function(i, item) { $.each(self.options.items, function(i, item) {
self.options.items[i] = $.extend(self.options.items[i], { self.options.items[i] = $.extend(self.options.items[i], {
@ -1755,14 +1756,14 @@ requires
group: self.options.id, group: self.options.id,
}); });
if (item.checked) { if (item.checked) {
selected = i; self.selected = i;
} }
}); });
that.$button = new Ox.Button($.extend(self.options, { that.$button = new Ox.Button($.extend(self.options, {
id: self.options.id, id: self.buttonId,
type: "text", // fixme: this shouldn't be necessary type: "text", // fixme: this shouldn't be necessary
value: self.options.items[selected].title value: self.options.items[self.selected].title
}), {}) }), {})
.click(clickButton) .click(clickButton)
.appendTo(that); .appendTo(that);
@ -1778,7 +1779,7 @@ requires
that.$menu = new Ox.Menu({ that.$menu = new Ox.Menu({
element: that.$button, element: that.$button,
id: self.options.id, id: self.menuId,
items: self.options.items, items: self.options.items,
offset: { offset: {
left: 8, left: 8,
@ -1788,11 +1789,11 @@ requires
size: self.options.size size: self.options.size
}); });
that.bindEvent("change_" + that.$button.id, changeButton); that.bindEvent("change_" + self.buttonId, changeButton);
that.bindEvent("click_" + that.$menu.id, clickMenu); that.bindEvent("click_" + self.menuId + "_menu", clickMenu);
function changeButton(event, data) { function changeButton(event, data) {
that.triggerEvent("change_" + that.id, data); that.triggerEvent("change", data);
} }
function clickButton() { function clickButton() {
@ -1846,6 +1847,7 @@ requires
that.menus = []; that.menus = [];
$.each(options.menus, function(position, menu) { $.each(options.menus, function(position, menu) {
var event =
that.titles[position] = $("<div>") that.titles[position] = $("<div>")
.addClass("OxTitle") .addClass("OxTitle")
.html(menu.title) .html(menu.title)
@ -1856,8 +1858,7 @@ requires
mainmenu: that, mainmenu: that,
size: self.options.size size: self.options.size
})); }));
Ox.print("binding", "click_" + that.menus[position].id) that.bindEvent("click_" + that.menus[position].options("id"), clickMenu);
that.bindEvent("click_" + that.menus[position].id, clickMenu);
}); });
function click(event) { function click(event) {
@ -2040,9 +2041,12 @@ requires
Ox.print("...", position, item) Ox.print("...", position, item)
if (!item.options("disabled")) { if (!item.options("disabled")) {
clickItem(position); clickItem(position);
} else {
that.triggerEvent("click");
} }
} else {
that.triggerEvent("click");
} }
that.triggerEvent("click");
} }
function clickItem(position) { function clickItem(position) {
@ -2056,8 +2060,7 @@ requires
item.options({ item.options({
checked: !item.options("checked") checked: !item.options("checked")
}); });
Ox.Event.trigger("click_" + that.id, { Ox.Event.trigger("click_" + item.options("id"), {
id: item.options("id"),
value: item.options("title")[0] // fixme: value or title? value: item.options("title")[0] // fixme: value or title?
}); });
} }

View File

@ -63,7 +63,7 @@
menus: [ menus: [
{ {
id: "oxjs", id: "oxjs",
title: "Ox.js", title: "Oxjs",
items: [ items: [
{ id: "about", title: "About" }, { id: "about", title: "About" },
{}, {},
@ -76,7 +76,7 @@
items: [ items: [
{ id: "load", keyboard: "control o", title: "Open" }, { id: "load", keyboard: "control o", title: "Open" },
{ id: "save", keyboard: "control a", title: "Save" }, { id: "save", keyboard: "control a", title: "Save" },
{ id: "save_ad", keyboard: "shift control s", title: "Save As..."} { id: "save_as", keyboard: "shift control s", title: "Save As..."}
] ]
}, },
{ {