add 'uncheckItem' method to menus and menubuttons, fix toggleSize in video editor

This commit is contained in:
rlx 2012-04-18 07:57:59 +00:00
parent 132e8d2207
commit 02696ae741
3 changed files with 14 additions and 3 deletions

View file

@ -600,7 +600,7 @@ Ox.Menu = function(options, self) {
/*@
checkItem <f>
@*/
that.checkItem = function(id) {
that.checkItem = function(id, checked) {
Ox.Log('Menu', 'checkItem id', id)
var group,
ids = id.split('_'),
@ -608,6 +608,7 @@ Ox.Menu = function(options, self) {
offset,
position,
toggled;
checked = Ox.isUndefined(checked) ? true : checked;
if (ids.length == 1) {
item = that.getItem(id);
group = item.options('group');
@ -621,7 +622,7 @@ Ox.Menu = function(options, self) {
});
}
} else {
item.options({checked: true});
item.options({checked: checked});
}
} else {
that.submenus[ids.shift()].checkItem(ids.join('_'));
@ -802,6 +803,10 @@ Ox.Menu = function(options, self) {
return that.is(':hidden') ? that.showMenu() : that.hideMenu();
};
that.uncheckItem = function(id) {
that.checkItem(id, false);
};
return that;
};

View file

@ -150,6 +150,10 @@ Ox.MenuButton = function(options, self) {
return that;
};
that.uncheckItem = function(id) {
self.$menu.uncheckItem(id);
};
return that;
};

View file

@ -1300,7 +1300,9 @@ Ox.VideoEditor = function(options, self) {
self.options.videoSize = self.options.videoSize == 'small'
? 'large' : 'small';
setSizes();
self.$menuButton.checkItem(self.options.videoSize);
self.$menuButton[
self.options.videoSize == 'small' ? 'uncheckItem' : 'checkItem'
]('size');
self.$player[0].options({
sizeIsLarge: self.options.videoSize == 'large'
});