[ Index ] |
|
Code source de FCKeditor 2.4 |
1 /* 2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 4 * 5 * == BEGIN LICENSE == 6 * 7 * Licensed under the terms of any of the following licenses at your 8 * choice: 9 * 10 * - GNU General Public License Version 2 or later (the "GPL") 11 * http://www.gnu.org/licenses/gpl.html 12 * 13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 * http://www.gnu.org/licenses/lgpl.html 15 * 16 * - Mozilla Public License Version 1.1 or later (the "MPL") 17 * http://www.mozilla.org/MPL/MPL-1.1.html 18 * 19 * == END LICENSE == 20 * 21 * File Name: fcktoolbarbutton.js 22 * FCKToolbarButton Class: represents a button in the toolbar. 23 * 24 * File Authors: 25 * Frederico Caldeira Knabben (www.fckeditor.net) 26 */ 27 28 var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive, icon ) 29 { 30 this.CommandName = commandName ; 31 this.Label = label ; 32 this.Tooltip = tooltip ; 33 this.Style = style ; 34 this.SourceView = sourceView ? true : false ; 35 this.ContextSensitive = contextSensitive ? true : false ; 36 37 if ( icon == null ) 38 this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ; 39 else if ( typeof( icon ) == 'number' ) 40 this.IconPath = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ; 41 } 42 43 FCKToolbarButton.prototype.Create = function( targetElement ) 44 { 45 this._UIButton = new FCKToolbarButtonUI( this.CommandName, this.Label, this.Tooltip, this.IconPath, this.Style ) ; 46 this._UIButton.OnClick = this.Click ; 47 this._UIButton._ToolbarButton = this ; 48 this._UIButton.Create( targetElement ) ; 49 } 50 51 FCKToolbarButton.prototype.RefreshState = function() 52 { 53 // Gets the actual state. 54 var eState = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ; 55 56 // If there are no state changes than do nothing and return. 57 if ( eState == this._UIButton.State ) return ; 58 59 // Sets the actual state. 60 this._UIButton.ChangeState( eState ) ; 61 } 62 63 FCKToolbarButton.prototype.Click = function() 64 { 65 var oToolbarButton = this._ToolbarButton || this ; 66 FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oToolbarButton.CommandName ).Execute() ; 67 } 68 69 FCKToolbarButton.prototype.Enable = function() 70 { 71 this.RefreshState() ; 72 } 73 74 FCKToolbarButton.prototype.Disable = function() 75 { 76 // Sets the actual state. 77 this._UIButton.ChangeState( FCK_TRISTATE_DISABLED ) ; 78 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |