add 'overlap' option to ButtonGroup

This commit is contained in:
rolux 2012-12-09 01:43:33 +01:00
parent 568119cae8
commit 7dac327396

View file

@ -21,6 +21,7 @@ Ox.ButtonGroup = function(options, self) {
buttons: [], buttons: [],
max: 1, max: 1,
min: 1, min: 1,
overlap: 'none',
selectable: false, selectable: false,
size: 'medium', size: 'medium',
style: 'default', style: 'default',
@ -44,12 +45,18 @@ Ox.ButtonGroup = function(options, self) {
} }
} }
}) })
.addClass('OxButtonGroup'); .addClass(
'OxButtonGroup'
+ (self.options.overlap != 'none' ? ' OxOverlap' + Ox.toTitleCase(self.options.overlap) : '')
);
self.options.buttons = self.options.buttons.map(function(button) { self.options.buttons = self.options.buttons.map(function(button, i) {
return Ox.extend({ return Ox.extend({
disabled: button.disabled, disabled: button.disabled,
id: button.id || button, id: button.id || button,
overlap: self.options.overlap == 'left' && i == 0 ? 'left'
: self.options.overlap == 'right' && i == self.options.buttons.length - 1 ? 'right'
: 'none',
title: button.title || button, title: button.title || button,
tooltip: button.tooltip, tooltip: button.tooltip,
width: button.width width: button.width
@ -75,6 +82,7 @@ Ox.ButtonGroup = function(options, self) {
disabled: button.disabled || false, // FIXME: getset should handle undefined disabled: button.disabled || false, // FIXME: getset should handle undefined
group: true, group: true,
id: button.id, id: button.id,
overlap: button.overlap,
selectable: self.options.selectable, selectable: self.options.selectable,
size: self.options.size, size: self.options.size,
style: self.options.style, style: self.options.style,