2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
\r
3 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
\r
5 * == BEGIN LICENSE ==
\r
7 * Licensed under the terms of any of the following licenses at your
\r
10 * - GNU General Public License Version 2 or later (the "GPL")
\r
11 * http://www.gnu.org/licenses/gpl.html
\r
13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
\r
14 * http://www.gnu.org/licenses/lgpl.html
\r
16 * - Mozilla Public License Version 1.1 or later (the "MPL")
\r
17 * http://www.mozilla.org/MPL/MPL-1.1.html
\r
21 * FCKToolbarPanelButton Class: Handles the Fonts combo selector.
\r
24 var FCKToolbarFontsCombo = function( tooltip, style )
\r
26 this.CommandName = 'FontName' ;
\r
27 this.Label = this.GetLabel() ;
\r
28 this.Tooltip = tooltip ? tooltip : this.Label ;
\r
29 this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
\r
31 this.DefaultLabel = FCKConfig.DefaultFontLabel || '' ;
\r
34 // Inherit from FCKToolbarSpecialCombo.
\r
35 FCKToolbarFontsCombo.prototype = new FCKToolbarFontFormatCombo( false ) ;
\r
37 FCKToolbarFontsCombo.prototype.GetLabel = function()
\r
39 return FCKLang.Font ;
\r
42 FCKToolbarFontsCombo.prototype.GetStyles = function()
\r
44 var baseStyle = FCKStyles.GetStyle( '_FCK_FontFace' ) ;
\r
48 alert( "The FCKConfig.CoreStyles['Size'] setting was not found. Please check the fckconfig.js file" ) ;
\r
54 var fonts = FCKConfig.FontNames.split(';') ;
\r
56 for ( var i = 0 ; i < fonts.length ; i++ )
\r
58 var fontParts = fonts[i].split('/') ;
\r
59 var font = fontParts[0] ;
\r
60 var caption = fontParts[1] || font ;
\r
62 var style = FCKTools.CloneObject( baseStyle ) ;
\r
64 style.SetVariable( 'Font', font ) ;
\r
65 style.Label = caption ;
\r
67 styles[ caption ] = style ;
\r
73 FCKToolbarFontsCombo.prototype.RefreshActiveItems = FCKToolbarStyleCombo.prototype.RefreshActiveItems ;
\r
75 FCKToolbarFontsCombo.prototype.StyleCombo_OnBeforeClick = function( targetSpecialCombo )
\r
77 // Clear the current selection.
\r
78 targetSpecialCombo.DeselectAll() ;
\r
80 var startElement = FCKSelection.GetBoundaryParentElement( true ) ;
\r
84 var path = new FCKElementPath( startElement ) ;
\r
86 for ( var i in targetSpecialCombo.Items )
\r
88 var item = targetSpecialCombo.Items[i] ;
\r
89 var style = item.Style ;
\r
91 if ( style.CheckActive( path ) )
\r
93 targetSpecialCombo.SelectItem( item ) ;
\r