mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 08:34:54 +00:00
a2e59f7c86
*.php * Updated links to files ve.ui.MetaDialog * Added stack panel that now contains category and language editor panels * Attached outline widget to stack panel ve.ui.FlaggableWidget -> ve.ui.FlaggableElement * Moved to elements ve.ui.GroupWidget -> ve.ui.GroupElement * Moved to elements * Removed invalid event documentation ve.ui.LabledWidget -> ve.ui.LabledElement * Moved to elements ve.ui.StackPanelLayout.js * New class, mutually exclusive panel container ve.ui.TitledPanelLayout * Remvoed, using labeled element instead ve.ui.Element.css * Added for elements * Moved label style here, from widget styles *.css, ve.ui.ButtonWidget.js, ve.ui.InputLabelWidget, ve.ui.OptionWidget, ve.ui.SelectWidget * Adjusted class names to reflect widget -> element migration Change-Id: I32f504c844dba7aae1b286eef06ca046627bdc8d
63 lines
1.3 KiB
JavaScript
63 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface ButtonWidget class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Creates an ve.ui.ButtonWidget object.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.Widget
|
|
* @mixins ve.ui.FlaggableElement
|
|
* @mixins ve.ui.LabeledElement
|
|
*
|
|
* @constructor
|
|
* @param {Object} [config] Config options
|
|
*/
|
|
ve.ui.ButtonWidget = function VeUiButtonWidget( config ) {
|
|
// Parent constructor
|
|
ve.ui.Widget.call( this, config );
|
|
|
|
// Mixin constructors
|
|
ve.ui.FlaggableElement.call( this, config );
|
|
ve.ui.LabeledElement.call( this, this.$$( '<span>' ), config );
|
|
|
|
// Events
|
|
this.$.on( 'click', ve.bind( this.onClick, this ) );
|
|
|
|
// Initialization
|
|
this.$.addClass( 've-ui-buttonWidget' ).append( this.$label );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.inheritClass( ve.ui.ButtonWidget, ve.ui.Widget );
|
|
|
|
ve.mixinClass( ve.ui.ButtonWidget, ve.ui.FlaggableElement );
|
|
|
|
ve.mixinClass( ve.ui.ButtonWidget, ve.ui.LabeledElement );
|
|
|
|
/* Events */
|
|
|
|
/**
|
|
* @event click
|
|
*/
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Handles mouse click events.
|
|
*
|
|
* @method
|
|
* @param {jQuery.Event} e Mouse click event
|
|
* @emits click
|
|
*/
|
|
ve.ui.ButtonWidget.prototype.onClick = function () {
|
|
if ( !this.disabled ) {
|
|
this.emit( 'click' );
|
|
}
|
|
return false;
|
|
};
|