2
* FCKeditor - The text editor for internet
3
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
5
* Licensed under the terms of the GNU Lesser General Public License:
6
* http://www.opensource.org/licenses/lgpl-license.php
8
* For further information visit:
9
* http://www.fckeditor.net/
11
* "Support Open Source software. What about a donation today?"
13
* File Name: fcktoolbarspecialcombo.js
14
* FCKToolbarSpecialCombo Class: This is a "abstract" base class to be used
15
* by the special combo toolbar elements like font name, font size, paragraph format, etc...
17
* The following properties and methods must be implemented when inheriting from
19
* - Property: Command [ The command to be executed ]
20
* - Method: GetLabel() [ Returns the label ]
21
* - CreateItems( targetSpecialCombo ) [ Add all items in the special combo ]
24
* Frederico Caldeira Knabben (fredck@fckeditor.net)
27
var FCKToolbarSpecialCombo = function()
29
this.SourceView = false ;
30
this.ContextSensitive = true ;
33
function FCKToolbarSpecialCombo_OnSelect( itemId, item )
35
this.Command.Execute( itemId, item ) ;
38
FCKToolbarSpecialCombo.prototype.CreateInstance = function( parentToolbar )
40
this._Combo = new FCKSpecialCombo( this.GetLabel(), this.FieldWidth, this.PanelWidth, this.PanelMaxHeight ) ;
43
this._Combo.FieldWidth = this.FieldWidth != null ? this.FieldWidth : 100 ;
44
this._Combo.PanelWidth = this.PanelWidth != null ? this.PanelWidth : 150 ;
45
this._Combo.PanelMaxHeight = this.PanelMaxHeight != null ? this.PanelMaxHeight : 150 ;
48
//this._Combo.Command.Name = this.Command.Name;
49
// this._Combo.Label = this.Label ;
50
this._Combo.Tooltip = this.Tooltip ;
51
this._Combo.Style = this.Style ;
53
this.CreateItems( this._Combo ) ;
55
this._Combo.Create( parentToolbar.DOMRow.insertCell(-1) ) ;
57
this._Combo.Command = this.Command ;
59
this._Combo.OnSelect = FCKToolbarSpecialCombo_OnSelect ;
62
function FCKToolbarSpecialCombo_RefreshActiveItems( combo, value )
65
combo.SelectItem( value ) ;
66
combo.SetLabelById( value ) ;
69
FCKToolbarSpecialCombo.prototype.RefreshState = function()
71
// Gets the actual state.
74
// if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
75
// eState = FCK_TRISTATE_DISABLED ;
78
var sValue = this.Command.GetState() ;
80
if ( sValue != FCK_TRISTATE_DISABLED )
82
eState = FCK_TRISTATE_ON ;
84
if ( this.RefreshActiveItems )
85
this.RefreshActiveItems( this._Combo, sValue ) ;
88
if ( this._LastValue == sValue )
91
this._LastValue = sValue ;
93
FCKToolbarSpecialCombo_RefreshActiveItems( this._Combo, sValue ) ;
97
eState = FCK_TRISTATE_DISABLED ;
100
// If there are no state changes then do nothing and return.
101
if ( eState == this.State ) return ;
103
if ( eState == FCK_TRISTATE_DISABLED )
105
this._Combo.DeselectAll() ;
106
this._Combo.SetLabel( '' ) ;
109
// Sets the actual state.
110
this.State = eState ;
112
// Updates the graphical state.
113
this._Combo.SetEnabled( eState != FCK_TRISTATE_DISABLED ) ;
116
FCKToolbarSpecialCombo.prototype.Enable = function()
118
this.RefreshState() ;
121
FCKToolbarSpecialCombo.prototype.Disable = function()
123
this.State = FCK_TRISTATE_DISABLED ;
124
this._Combo.DeselectAll() ;
125
this._Combo.SetLabel( '' ) ;
126
this._Combo.SetEnabled( false ) ;
b'\\ No newline at end of file'