[ Index ] |
|
Code source de GeekLog 1.4.1 |
1 /* 2 * FCKeditor - The text editor for internet 3 * Copyright (C) 2003-2006 Frederico Caldeira Knabben 4 * 5 * Licensed under the terms of the GNU Lesser General Public License: 6 * http://www.opensource.org/licenses/lgpl-license.php 7 * 8 * For further information visit: 9 * http://www.fckeditor.net/ 10 * 11 * "Support Open Source software. What about a donation today?" 12 * 13 * File Name: fcktoolbarbutton.js 14 * FCKToolbarButton Class: represents a button in the toolbar. 15 * 16 * File Authors: 17 * Frederico Caldeira Knabben (fredck@fckeditor.net) 18 */ 19 20 var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive, icon ) 21 { 22 this.CommandName = commandName ; 23 this.Label = label ; 24 this.Tooltip = tooltip ; 25 this.Style = style ; 26 this.SourceView = sourceView ? true : false ; 27 this.ContextSensitive = contextSensitive ? true : false ; 28 29 if ( icon == null ) 30 this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ; 31 else if ( typeof( icon ) == 'number' ) 32 this.IconPath = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ; 33 } 34 35 FCKToolbarButton.prototype.Create = function( targetElement ) 36 { 37 this._UIButton = new FCKToolbarButtonUI( this.CommandName, this.Label, this.Tooltip, this.IconPath, this.Style ) ; 38 this._UIButton.OnClick = this.Click ; 39 this._UIButton._ToolbarButton = this ; 40 this._UIButton.Create( targetElement ) ; 41 } 42 43 FCKToolbarButton.prototype.RefreshState = function() 44 { 45 // Gets the actual state. 46 var eState = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ; 47 48 // If there are no state changes than do nothing and return. 49 if ( eState == this._UIButton.State ) return ; 50 51 // Sets the actual state. 52 this._UIButton.ChangeState( eState ) ; 53 } 54 55 FCKToolbarButton.prototype.Click = function() 56 { 57 var oToolbarButton = this._ToolbarButton || this ; 58 FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oToolbarButton.CommandName ).Execute() ; 59 } 60 61 FCKToolbarButton.prototype.Enable = function() 62 { 63 this.RefreshState() ; 64 } 65 66 FCKToolbarButton.prototype.Disable = function() 67 { 68 // Sets the actual state. 69 this._UIButton.ChangeState( FCK_TRISTATE_DISABLED ) ; 70 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 12:27:40 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |