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-08-07 01:50:44 +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;
|
2012-08-27 21:34:08 +00:00
|
|
|
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 */
|
|
|
|
|
2012-02-06 23:50:56 +00:00
|
|
|
ve.ui.Tool.tools = {};
|
2011-12-05 21:10:19 +00:00
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.ui.Tool.prototype.updateState = function () {
|
2012-08-08 17:48:53 +00:00
|
|
|
throw new Error( 'Tool.updateState not implemented in this subclass:' + this.constructor );
|
2011-12-04 02:59:53 +00:00
|
|
|
};
|
2012-03-22 20:53:26 +00:00
|
|
|
|
2012-08-07 01:50:44 +00:00
|
|
|
ve.ui.Tool.prototype.clearState = function () {
|
2012-08-27 21:34:08 +00:00
|
|
|
this.$.removeClass( 've-ui-toolbarButtonTool-down' );
|
2012-04-02 22:28:26 +00:00
|
|
|
};
|