oxjs/source/Ox.UI/js/Bar/Ox.Bar.js
2012-01-02 13:55:34 +05:30

28 lines
997 B
JavaScript

// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
/*@
Ox.Bar <f:Ox.Element> Bar
() -> <o> Bar object
(options) -> <o> Bar object
(options, self) -> <o> Bar object
options <o> Options object
orientation <s|horizontal>
size <s|medium> can be small, medium, large or number
self <o> Shared private variable
@*/
Ox.Bar = function(options, self) {
self = self || {};
var that = Ox.Element({}, self)
.defaults({
orientation: 'horizontal',
size: 'medium'
})
.options(options || {})
.addClass('OxBar Ox' + Ox.toTitleCase(self.options.orientation)),
dimensions = Ox.UI.DIMENSIONS[self.options.orientation];
self.options.size = Ox.isString(self.options.size)
? Ox.UI.getBarSize(self.options.size) : self.options.size;
that.css(dimensions[0], '100%')
.css(dimensions[1], self.options.size + 'px');
return that;
};