source: sandbox/filemanager/tp/fckeditor/editor/_source/classes/fcktoolbar.js @ 1575

Revision 1575, 2.7 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implentação, melhorias do modulo gerenciador de arquivos

  • Property svn:executable set to *
Line 
1/*
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2009 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 * FCKToolbar Class: represents a toolbar in the toolbarset. It is a group of
22 * toolbar items.
23 */
24
25var FCKToolbar = function()
26{
27        this.Items = new Array() ;
28}
29
30FCKToolbar.prototype.AddItem = function( item )
31{
32        return this.Items[ this.Items.length ] = item ;
33}
34
35FCKToolbar.prototype.AddButton = function( name, label, tooltip, iconPathOrStripInfoArrayOrIndex, style, state )
36{
37        if ( typeof( iconPathOrStripInfoArrayOrIndex ) == 'number' )
38                 iconPathOrStripInfoArrayOrIndex = [ this.DefaultIconsStrip, this.DefaultIconSize, iconPathOrStripInfoArrayOrIndex ] ;
39
40        var oButton = new FCKToolbarButtonUI( name, label, tooltip, iconPathOrStripInfoArrayOrIndex, style, state ) ;
41        oButton._FCKToolbar = this ;
42        oButton.OnClick = FCKToolbar_OnItemClick ;
43
44        return this.AddItem( oButton ) ;
45}
46
47function FCKToolbar_OnItemClick( item )
48{
49        var oToolbar = item._FCKToolbar ;
50
51        if ( oToolbar.OnItemClick )
52                oToolbar.OnItemClick( oToolbar, item ) ;
53}
54
55FCKToolbar.prototype.AddSeparator = function()
56{
57        this.AddItem( new FCKToolbarSeparator() ) ;
58}
59
60FCKToolbar.prototype.Create = function( parentElement )
61{
62        var oDoc = FCKTools.GetElementDocument( parentElement ) ;
63
64        var e = oDoc.createElement( 'table' ) ;
65        e.className = 'TB_Toolbar' ;
66        e.style.styleFloat = e.style.cssFloat = ( FCKLang.Dir == 'ltr' ? 'left' : 'right' ) ;
67        e.dir = FCKLang.Dir ;
68        e.cellPadding = 0 ;
69        e.cellSpacing = 0 ;
70
71        var targetRow = e.insertRow(-1) ;
72
73        // Insert the start cell.
74        var eCell ;
75
76        if ( !this.HideStart )
77        {
78                eCell = targetRow.insertCell(-1) ;
79                eCell.appendChild( oDoc.createElement( 'div' ) ).className = 'TB_Start' ;
80        }
81
82        for ( var i = 0 ; i < this.Items.length ; i++ )
83        {
84                this.Items[i].Create( targetRow.insertCell(-1) ) ;
85        }
86
87        // Insert the ending cell.
88        if ( !this.HideEnd )
89        {
90                eCell = targetRow.insertCell(-1) ;
91                eCell.appendChild( oDoc.createElement( 'div' ) ).className = 'TB_End' ;
92        }
93
94        parentElement.appendChild( e ) ;
95}
96
97var FCKToolbarSeparator = function()
98{}
99
100FCKToolbarSeparator.prototype.Create = function( parentElement )
101{
102        FCKTools.AppendElement( parentElement, 'div' ).className = 'TB_Separator' ;
103}
Note: See TracBrowser for help on using the repository browser.