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
|
2013-09-25 10:21:09 +00:00
|
|
|
* @param {Object} [config] Configuration 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 */
|
|
|
|
|
2013-10-11 21:44:09 +00:00
|
|
|
OO.inheritClass( ve.ui.FieldsetLayout, ve.ui.Layout );
|
2013-05-03 22:17:35 +00:00
|
|
|
|
2013-10-11 21:44:09 +00:00
|
|
|
OO.mixinClass( ve.ui.FieldsetLayout, ve.ui.LabeledElement );
|
2013-05-03 22:17:35 +00:00
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ui.FieldsetLayout.static.tagName = 'fieldset';
|