/* 
 * 水平布局面板
 * 
 * 
 */
;(function(Love , $) {
    
    Love.widget("ui.hpanel", Love.ui.panel, {
        _create : function() {
            var me = this,
                i = 0,
                opt = me.options,
                val = opt.data.value,
                element = me.element,
                len = opt.len,
                elH = element.height(),
                elW = element.width(),
                padding = (opt.padding || 5) / 2;
            
            this._super();
        
            var dom = me.dom,
                span = dom.find("span");
            
            dom.addClass("ui-hpanel-dom");
            
            for (; i < len; i++) {
                var v = val[i],
                    w = (elW - padding * (len - 1) * 2) / len,
                    s = $(span[i]).css({
                        width : w,
                        height : elH
                    });
                
                typeof v === "string" ? s.append($(v)) : v.appendTo(s);
                
                i ? (i === len - 1 ? s.css("padding-left" , padding) :
                        s.css("padding" , "0 " + padding + "px")) :
                        s.css("padding-right" , padding);
            }
        }
    });
})(Love , Love.$);


