From 7dac327396d486fc22fe8dace961addc2c9dfd52 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 9 Dec 2012 01:43:33 +0100 Subject: [PATCH] add 'overlap' option to ButtonGroup --- source/Ox.UI/js/Form/ButtonGroup.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/Ox.UI/js/Form/ButtonGroup.js b/source/Ox.UI/js/Form/ButtonGroup.js index 93cc27ad..977638fb 100644 --- a/source/Ox.UI/js/Form/ButtonGroup.js +++ b/source/Ox.UI/js/Form/ButtonGroup.js @@ -21,6 +21,7 @@ Ox.ButtonGroup = function(options, self) { buttons: [], max: 1, min: 1, + overlap: 'none', selectable: false, size: 'medium', 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({ disabled: button.disabled, 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, tooltip: button.tooltip, width: button.width @@ -75,6 +82,7 @@ Ox.ButtonGroup = function(options, self) { disabled: button.disabled || false, // FIXME: getset should handle undefined group: true, id: button.id, + overlap: button.overlap, selectable: self.options.selectable, size: self.options.size, style: self.options.style,