2012-07-19 00:11:26 +00:00
|
|
|
/**
|
|
|
|
* VisualEditor user interface Tool class.
|
2012-07-19 21:25:16 +00:00
|
|
|
*
|
2012-07-19 00:11:26 +00:00
|
|
|
* @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
|
|
|
/**
|
2012-02-06 23:50:56 +00:00
|
|
|
* Creates an ve.ui.Tool object.
|
2012-06-20 01:20:28 +00:00
|
|
|
*
|
2011-12-05 21:10:19 +00:00
|
|
|
* @class
|
|
|
|
* @constructor
|
2012-02-06 23:50:56 +00:00
|
|
|
* @param {ve.ui.Toolbar} toolbar
|
2011-12-05 21:10:19 +00:00
|
|
|
* @param {String} name
|
|
|
|
*/
|
2012-02-06 23:50:56 +00:00
|
|
|
ve.ui.Tool = function( toolbar, name, title ) {
|
2011-12-04 02:59:53 +00:00
|
|
|
this.toolbar = toolbar;
|
|
|
|
this.name = name;
|
2011-12-09 21:16:42 +00:00
|
|
|
this.title = title;
|
|
|
|
this.$ = $( '<div class="es-tool"></div>' ).attr( 'title', this.title );
|
2011-12-04 02:59:53 +00:00
|
|
|
};
|
|
|
|
|
2011-12-05 21:10:19 +00:00
|
|
|
/* Static Members */
|
|
|
|
|
2012-02-06 23:50:56 +00:00
|
|
|
ve.ui.Tool.tools = {};
|
2011-12-05 21:10:19 +00:00
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
2012-02-06 23:50:56 +00:00
|
|
|
ve.ui.Tool.prototype.updateState = function() {
|
2011-12-04 02:59:53 +00:00
|
|
|
throw 'Tool.updateState not implemented in this subclass:' + this.constructor;
|
|
|
|
};
|
2012-03-22 20:53:26 +00:00
|
|
|
|
|
|
|
ve.ui.Tool.prototype.clearState = function() {
|
|
|
|
this.$.removeClass( 'es-toolbarButtonTool-down' );
|
2012-04-02 22:28:26 +00:00
|
|
|
};
|