1
0
Fork 0
forked from 0x2620/oxjs

self.setOption ~> that.update

This commit is contained in:
j 2012-05-28 19:35:41 +00:00
commit 005d50c389
56 changed files with 919 additions and 933 deletions

View file

@ -120,10 +120,6 @@ Ox.MainMenu = function(options, self) {
that.menus[position].remove();
}
self.setOption = function(key, value) {
};
that.addMenuAfter = function(id) {
};

View file

@ -45,6 +45,15 @@ Ox.Menu = function(options, self) {
size: 'medium' // fixme: remove
})
.options(options || {})
.update({
items: function() {
renderItems(self.options.items);
},
selected: function() {
that.$content.find('.OxSelected').removeClass('OxSelected');
selectItem(self.options.selected);
}
})
.addClass(
'OxMenu Ox' + Ox.toTitleCase(self.options.side) +
' Ox' + Ox.toTitleCase(self.options.size)
@ -567,15 +576,6 @@ Ox.Menu = function(options, self) {
}
}
self.setOption = function(key, value) {
if (key == 'items') {
renderItems(value);
} else if (key == 'selected') {
that.$content.find('.OxSelected').removeClass('OxSelected');
selectItem(value);
}
}
/*@
addItem <f>
@*/

View file

@ -34,6 +34,19 @@ Ox.MenuButton = function(options, self) {
width: 'auto'
})
.options(options || {})
.update({
title: function() {
if (self.options.type == 'text') {
self.$title.html(self.options.title);
} else {
self.$button.options({title: self.options.title});
}
},
width: function() {
that.css({width: self.options.width - 2 + 'px'});
self.$title.css({width: self.options.width - 24 + 'px'});
}
})
.addClass(
'OxSelect Ox' + Ox.toTitleCase(self.options.style)
)
@ -98,19 +111,6 @@ Ox.MenuButton = function(options, self) {
that.triggerEvent('show');
}
self.setOption = function(key, value) {
if (key == 'title') {
if (self.options.type == 'text') {
self.$title.html(value);
} else {
self.$button.options({title: value});
}
} else if (key == 'width') {
that.css({width: value - 2 + 'px'});
self.$title.css({width: self.options.width - 24 + 'px'});
}
}
/*@
checkItem <f> checkItem
(id) -> <o> check item with id

View file

@ -41,6 +41,18 @@ Ox.MenuItem = function(options, self) {
keyboard: parseKeyboard(options.keyboard || self.defaults.keyboard),
title: Ox.makeArray(options.title || self.defaults.title)
}))
.update({
checked: function() {
that.$status.html(self.options.checked ? Ox.UI.symbols.check : '')
},
disabled: function() {
that.toggleClass('OxDisabled');
},
title: function() {
self.options.title = Ox.makeArray(self.options.title);
that.$title.html(self.options.title[0]);
}
})
.addClass('OxItem' + (self.options.disabled ? ' OxDisabled' : ''))
/*
.attr({
@ -124,20 +136,6 @@ Ox.MenuItem = function(options, self) {
};
}
/*@
setOption <f> setOption
@*/
self.setOption = function(key, value) {
if (key == 'checked') {
that.$status.html(value ? Ox.UI.symbols.check : '')
} else if (key == 'disabled') {
that.toggleClass('OxDisabled');
} else if (key == 'title') {
self.options.title = Ox.makeArray(value);
that.$title.html(self.options.title[0]);
}
};
that.toggle = function() {
// toggle id and title
};