mediawiki-extensions-Visual.../modules/ve/ui/ve.ui.Tool.js

36 lines
812 B
JavaScript
Raw Normal View History

/**
* VisualEditor user interface Tool class.
*
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
2011-12-05 21:10:19 +00:00
/**
* Creates an ve.ui.Tool object.
*
2011-12-05 21:10:19 +00:00
* @class
* @constructor
* @param {ve.ui.Toolbar} toolbar
2011-12-05 21:10:19 +00:00
* @param {String} name
*/
ve.ui.Tool = function ( toolbar, name, title ) {
2011-12-04 02:59:53 +00:00
this.toolbar = toolbar;
this.name = name;
this.title = title;
this.$ = $( '<div class="ve-ui-tool"></div>' ).attr( 'title', this.title );
2011-12-04 02:59:53 +00:00
};
2011-12-05 21:10:19 +00:00
/* Static Members */
ve.ui.Tool.tools = {};
2011-12-05 21:10:19 +00:00
/* Methods */
ve.ui.Tool.prototype.updateState = function () {
throw new Error( 'Tool.updateState not implemented in this subclass:' + this.constructor );
2011-12-04 02:59:53 +00:00
};
ve.ui.Tool.prototype.clearState = function () {
this.$.removeClass( 've-ui-toolbarButtonTool-down' );
};