[ 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: fcktoolbar.js 14 * FCKToolbar Class: represents a toolbar in the toolbarset. It is a group of 15 * toolbar items. 16 * 17 * File Authors: 18 * Frederico Caldeira Knabben (fredck@fckeditor.net) 19 */ 20 21 var FCKToolbar = function() 22 { 23 this.Items = new Array() ; 24 25 if ( FCK.IECleanup ) 26 FCK.IECleanup.AddItem( this, FCKToolbar_Cleanup ) ; 27 } 28 29 FCKToolbar.prototype.AddItem = function( item ) 30 { 31 return this.Items[ this.Items.length ] = item ; 32 } 33 34 FCKToolbar.prototype.AddButton = function( name, label, tooltip, iconPathOrStripInfoArrayOrIndex, style, state ) 35 { 36 if ( typeof( iconPathOrStripInfoArrayOrIndex ) == 'number' ) 37 iconPathOrStripInfoArrayOrIndex = [ this.DefaultIconsStrip, this.DefaultIconSize, iconPathOrStripInfoArrayOrIndex ] ; 38 39 var oButton = new FCKToolbarButtonUI( name, label, tooltip, iconPathOrStripInfoArrayOrIndex, style, state ) ; 40 oButton._FCKToolbar = this ; 41 oButton.OnClick = FCKToolbar_OnItemClick ; 42 43 return this.AddItem( oButton ) ; 44 } 45 46 function FCKToolbar_OnItemClick( item ) 47 { 48 var oToolbar = item._FCKToolbar ; 49 50 if ( oToolbar.OnItemClick ) 51 oToolbar.OnItemClick( oToolbar, item ) ; 52 } 53 54 FCKToolbar.prototype.AddSeparator = function() 55 { 56 this.AddItem( new FCKToolbarSeparator() ) ; 57 } 58 59 FCKToolbar.prototype.Create = function( parentElement ) 60 { 61 if ( this.MainElement ) 62 { 63 // this._Cleanup() ; 64 if ( this.MainElement.parentNode ) 65 this.MainElement.parentNode.removeChild( this.MainElement ) ; 66 this.MainElement = null ; 67 } 68 69 var oDoc = FCKTools.GetElementDocument( parentElement ) ; 70 71 var e = this.MainElement = oDoc.createElement( 'table' ) ; 72 e.className = 'TB_Toolbar' ; 73 e.style.styleFloat = e.style.cssFloat = ( FCKLang.Dir == 'ltr' ? 'left' : 'right' ) ; 74 e.dir = FCKLang.Dir ; 75 e.cellPadding = 0 ; 76 e.cellSpacing = 0 ; 77 78 this.RowElement = e.insertRow(-1) ; 79 80 // Insert the start cell. 81 var eCell ; 82 83 if ( !this.HideStart ) 84 { 85 eCell = this.RowElement.insertCell(-1) ; 86 eCell.appendChild( oDoc.createElement( 'div' ) ).className = 'TB_Start' ; 87 } 88 89 for ( var i = 0 ; i < this.Items.length ; i++ ) 90 { 91 this.Items[i].Create( this.RowElement.insertCell(-1) ) ; 92 } 93 94 // Insert the ending cell. 95 if ( !this.HideEnd ) 96 { 97 eCell = this.RowElement.insertCell(-1) ; 98 eCell.appendChild( oDoc.createElement( 'div' ) ).className = 'TB_End' ; 99 } 100 101 parentElement.appendChild( e ) ; 102 } 103 104 function FCKToolbar_Cleanup() 105 { 106 this.MainElement = null ; 107 this.RowElement = null ; 108 } 109 110 var FCKToolbarSeparator = function() 111 {} 112 113 FCKToolbarSeparator.prototype.Create = function( parentElement ) 114 { 115 FCKTools.AppendElement( parentElement, 'div' ).className = 'TB_Separator' ; 116 }
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 |
![]() |