[ 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: fcktoolbarpanelbutton.js 22 * FCKToolbarPanelButton Class: represents a special button in the toolbar 23 * that shows a panel when pressed. 24 * 25 * File Authors: 26 * Frederico Caldeira Knabben (www.fckeditor.net) 27 */ 28 29 var FCKToolbarPanelButton = function( commandName, label, tooltip, style, icon ) 30 { 31 this.CommandName = commandName ; 32 33 var oIcon ; 34 35 if ( icon == null ) 36 oIcon = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ; 37 else if ( typeof( icon ) == 'number' ) 38 oIcon = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ; 39 40 var oUIButton = this._UIButton = new FCKToolbarButtonUI( commandName, label, tooltip, oIcon, style ) ; 41 oUIButton._FCKToolbarPanelButton = this ; 42 oUIButton.ShowArrow = true ; 43 oUIButton.OnClick = FCKToolbarPanelButton_OnButtonClick ; 44 } 45 46 FCKToolbarPanelButton.prototype.TypeName = 'FCKToolbarPanelButton' ; 47 48 FCKToolbarPanelButton.prototype.Create = function( parentElement ) 49 { 50 parentElement.className += 'Menu' ; 51 52 this._UIButton.Create( parentElement ) ; 53 54 var oPanel = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName )._Panel ; 55 oPanel._FCKToolbarPanelButton = this ; 56 57 var eLineDiv = oPanel.Document.body.appendChild( oPanel.Document.createElement( 'div' ) ) ; 58 eLineDiv.style.position = 'absolute' ; 59 eLineDiv.style.top = '0px' ; 60 61 var eLine = this.LineImg = eLineDiv.appendChild( oPanel.Document.createElement( 'IMG' ) ) ; 62 eLine.className = 'TB_ConnectionLine' ; 63 // eLine.style.backgroundColor = 'Red' ; 64 eLine.src = FCK_SPACER_PATH ; 65 66 oPanel.OnHide = FCKToolbarPanelButton_OnPanelHide ; 67 } 68 69 /* 70 Events 71 */ 72 73 function FCKToolbarPanelButton_OnButtonClick( toolbarButton ) 74 { 75 var oButton = this._FCKToolbarPanelButton ; 76 var e = oButton._UIButton.MainElement ; 77 78 oButton._UIButton.ChangeState( FCK_TRISTATE_ON ) ; 79 80 oButton.LineImg.style.width = ( e.offsetWidth - 2 ) + 'px' ; 81 82 FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oButton.CommandName ).Execute( 0, e.offsetHeight - 1, e ) ; // -1 to be over the border 83 } 84 85 function FCKToolbarPanelButton_OnPanelHide() 86 { 87 var oMenuButton = this._FCKToolbarPanelButton ; 88 oMenuButton._UIButton.ChangeState( FCK_TRISTATE_OFF ) ; 89 } 90 91 // The Panel Button works like a normal button so the refresh state functions 92 // defined for the normal button can be reused here. 93 FCKToolbarPanelButton.prototype.RefreshState = FCKToolbarButton.prototype.RefreshState ; 94 FCKToolbarPanelButton.prototype.Enable = FCKToolbarButton.prototype.Enable ; 95 FCKToolbarPanelButton.prototype.Disable = FCKToolbarButton.prototype.Disable ;
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 |