2013-05-03 22:17:35 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor UserInterface FieldsetLayout class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fieldset layout.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.Layout
|
|
|
|
* @mixins ve.ui.LabeledElement
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {Object} [config] Config options
|
2013-06-12 23:23:48 +00:00
|
|
|
* @cfg {string} [icon] Symbolic icon name
|
2013-05-03 22:17:35 +00:00
|
|
|
*/
|
|
|
|
ve.ui.FieldsetLayout = function VeUiFieldsetLayout( config ) {
|
|
|
|
// Config initialization
|
2013-06-12 23:23:48 +00:00
|
|
|
config = config || {};
|
2013-05-03 22:17:35 +00:00
|
|
|
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.Layout.call( this, config );
|
|
|
|
|
|
|
|
// Mixin constructors
|
|
|
|
ve.ui.LabeledElement.call( this, this.$$( '<legend>' ), config );
|
|
|
|
|
|
|
|
// Initialization
|
2013-06-12 23:23:48 +00:00
|
|
|
if ( config.icon ) {
|
|
|
|
this.$.addClass( 've-ui-fieldsetLayout-decorated' );
|
|
|
|
this.$label.addClass( 've-ui-icon-' + config.icon );
|
|
|
|
}
|
2013-07-15 22:42:00 +00:00
|
|
|
this.$.addClass( 've-ui-fieldsetLayout' );
|
|
|
|
if ( config.icon || config.label ) {
|
|
|
|
this.$
|
|
|
|
.addClass( 've-ui-fieldsetLayout-labeled' )
|
|
|
|
.append( this.$label );
|
|
|
|
}
|
2013-05-03 22:17:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.inheritClass( ve.ui.FieldsetLayout, ve.ui.Layout );
|
|
|
|
|
|
|
|
ve.mixinClass( ve.ui.FieldsetLayout, ve.ui.LabeledElement );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ui.FieldsetLayout.static.tagName = 'fieldset';
|