pass on modifier keys in Ox.List add item event

This commit is contained in:
rlx 2011-09-04 13:40:07 +00:00
parent bd61a2e97e
commit 6adacf484f

View file

@ -43,6 +43,7 @@ Ox.List <f:Ox.Element> List Element
select <!> select item
@*/
// fixme: rename the add event to new, or the delete event to remove
Ox.List = function(options, self) {
@ -105,7 +106,18 @@ Ox.List = function(options, self) {
itemMargin: self.options.type == 'text' ? 0 : 8, // 2 x 4 px margin ... fixme: the 2x should be computed later
keyboardEvents: {
key_control_c: copyItems,
key_control_n: addItem,
key_control_n: function() {
addItem('');
},
key_alt_control_n: function() {
addItem('alt');
},
key_alt_shift_control_n: function() {
addItem('alt_shift');
},
key_shift_control_n: function() {
addItem('shift');
},
key_control_v: pasteItems,
key_control_x: cutItems,
key_delete: deleteItems,
@ -240,8 +252,10 @@ Ox.List = function(options, self) {
}
}
function addItem() {
that.triggerEvent('add', {});
function addItem(keys) {
that.triggerEvent('add', {
keys: keys
});
}
function addNextToSelection() {