2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* FCKToolbarButton Class: represents a button in the toolbar.
24
var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive, icon )
26
this.CommandName = commandName ;
28
this.Tooltip = tooltip ;
30
this.SourceView = sourceView ? true : false ;
31
this.ContextSensitive = contextSensitive ? true : false ;
34
this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
35
else if ( typeof( icon ) == 'number' )
36
this.IconPath = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ;
38
this.IconPath = icon ;
41
FCKToolbarButton.prototype.Create = function( targetElement )
43
this._UIButton = new FCKToolbarButtonUI( this.CommandName, this.Label, this.Tooltip, this.IconPath, this.Style ) ;
44
this._UIButton.OnClick = this.Click ;
45
this._UIButton._ToolbarButton = this ;
46
this._UIButton.Create( targetElement ) ;
49
FCKToolbarButton.prototype.RefreshState = function()
51
var uiButton = this._UIButton ;
56
// Gets the actual state.
57
var eState = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ;
59
// If there are no state changes than do nothing and return.
60
if ( eState == uiButton.State ) return ;
62
// Sets the actual state.
63
uiButton.ChangeState( eState ) ;
66
FCKToolbarButton.prototype.Click = function()
68
var oToolbarButton = this._ToolbarButton || this ;
69
FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oToolbarButton.CommandName ).Execute() ;
72
FCKToolbarButton.prototype.Enable = function()
77
FCKToolbarButton.prototype.Disable = function()
79
// Sets the actual state.
80
this._UIButton.ChangeState( FCK_TRISTATE_DISABLED ) ;