some changes to events
This commit is contained in:
parent
9b40330982
commit
73ea43ec01
4 changed files with 30 additions and 20 deletions
|
@ -17,6 +17,11 @@ Bars
|
|||
//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)));
|
||||
}
|
||||
.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 {
|
||||
background: -moz-linear-gradient(top, rgb(176, 176, 176), rgb(144, 144, 144));
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(rgb(176, 176, 176)), to(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(208, 208, 208)), to(rgb(176, 176, 176)));
|
||||
}
|
||||
|
||||
.OxThemeClassic .OxMenu {
|
||||
|
|
|
@ -391,6 +391,8 @@ Menus
|
|||
-moz-border-radius-bottomright: 4px;
|
||||
-webkit-border-bottom-left-radius: 4px;
|
||||
-webkit-border-bottom-right-radius: 4px;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
.OxMenu.OxRight {
|
||||
-moz-border-radius-topright: 4px;
|
||||
|
|
|
@ -907,10 +907,10 @@ requires
|
|||
*/
|
||||
if (Ox.isObject(arguments[0])) {
|
||||
$.each(arguments[0], function(event, fn) {
|
||||
Ox.Event.trigger(event + "_" + that.id, fn);
|
||||
Ox.Event.trigger(event + "_" + self.options.id, fn);
|
||||
});
|
||||
} else {
|
||||
Ox.Event.trigger(arguments[0] + "_" + that.id, arguments[1] || {});
|
||||
Ox.Event.trigger(arguments[0] + "_" + self.options.id, arguments[1] || {});
|
||||
}
|
||||
return that;
|
||||
}
|
||||
|
@ -1746,8 +1746,9 @@ requires
|
|||
size: "medium"
|
||||
})
|
||||
.options(options)
|
||||
.addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size)),
|
||||
selected;
|
||||
.addClass("OxSelect Ox" + Ox.toTitleCase(self.options.size));
|
||||
self.buttonId = self.options.id + "_button"
|
||||
self.menuId = self.options.id + "_menu",
|
||||
|
||||
$.each(self.options.items, function(i, item) {
|
||||
self.options.items[i] = $.extend(self.options.items[i], {
|
||||
|
@ -1755,14 +1756,14 @@ requires
|
|||
group: self.options.id,
|
||||
});
|
||||
if (item.checked) {
|
||||
selected = i;
|
||||
self.selected = i;
|
||||
}
|
||||
});
|
||||
|
||||
that.$button = new Ox.Button($.extend(self.options, {
|
||||
id: self.options.id,
|
||||
id: self.buttonId,
|
||||
type: "text", // fixme: this shouldn't be necessary
|
||||
value: self.options.items[selected].title
|
||||
value: self.options.items[self.selected].title
|
||||
}), {})
|
||||
.click(clickButton)
|
||||
.appendTo(that);
|
||||
|
@ -1778,7 +1779,7 @@ requires
|
|||
|
||||
that.$menu = new Ox.Menu({
|
||||
element: that.$button,
|
||||
id: self.options.id,
|
||||
id: self.menuId,
|
||||
items: self.options.items,
|
||||
offset: {
|
||||
left: 8,
|
||||
|
@ -1788,11 +1789,11 @@ requires
|
|||
size: self.options.size
|
||||
});
|
||||
|
||||
that.bindEvent("change_" + that.$button.id, changeButton);
|
||||
that.bindEvent("click_" + that.$menu.id, clickMenu);
|
||||
that.bindEvent("change_" + self.buttonId, changeButton);
|
||||
that.bindEvent("click_" + self.menuId + "_menu", clickMenu);
|
||||
|
||||
function changeButton(event, data) {
|
||||
that.triggerEvent("change_" + that.id, data);
|
||||
that.triggerEvent("change", data);
|
||||
}
|
||||
|
||||
function clickButton() {
|
||||
|
@ -1846,6 +1847,7 @@ requires
|
|||
that.menus = [];
|
||||
|
||||
$.each(options.menus, function(position, menu) {
|
||||
var event =
|
||||
that.titles[position] = $("<div>")
|
||||
.addClass("OxTitle")
|
||||
.html(menu.title)
|
||||
|
@ -1856,8 +1858,7 @@ requires
|
|||
mainmenu: that,
|
||||
size: self.options.size
|
||||
}));
|
||||
Ox.print("binding", "click_" + that.menus[position].id)
|
||||
that.bindEvent("click_" + that.menus[position].id, clickMenu);
|
||||
that.bindEvent("click_" + that.menus[position].options("id"), clickMenu);
|
||||
});
|
||||
|
||||
function click(event) {
|
||||
|
@ -2040,9 +2041,12 @@ requires
|
|||
Ox.print("...", position, item)
|
||||
if (!item.options("disabled")) {
|
||||
clickItem(position);
|
||||
} else {
|
||||
that.triggerEvent("click");
|
||||
}
|
||||
} else {
|
||||
that.triggerEvent("click");
|
||||
}
|
||||
that.triggerEvent("click");
|
||||
}
|
||||
|
||||
function clickItem(position) {
|
||||
|
@ -2056,8 +2060,7 @@ requires
|
|||
item.options({
|
||||
checked: !item.options("checked")
|
||||
});
|
||||
Ox.Event.trigger("click_" + that.id, {
|
||||
id: item.options("id"),
|
||||
Ox.Event.trigger("click_" + item.options("id"), {
|
||||
value: item.options("title")[0] // fixme: value or title?
|
||||
});
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
menus: [
|
||||
{
|
||||
id: "oxjs",
|
||||
title: "Ox.js",
|
||||
title: "Oxjs",
|
||||
items: [
|
||||
{ id: "about", title: "About" },
|
||||
{},
|
||||
|
@ -76,7 +76,7 @@
|
|||
items: [
|
||||
{ id: "load", keyboard: "control o", title: "Open" },
|
||||
{ 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..."}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue