2
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
3
* Copyright (C) 2003-2007 Frederico Caldeira Knabben
7
* Licensed under the terms of any of the following licenses at your
10
* - GNU General Public License Version 2 or later (the "GPL")
11
* http://www.gnu.org/licenses/gpl.html
13
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
14
* http://www.gnu.org/licenses/lgpl.html
16
* - Mozilla Public License Version 1.1 or later (the "MPL")
17
* http://www.mozilla.org/MPL/MPL-1.1.html
21
* FCKToolbarPanelButton Class: represents a special button in the toolbar
22
* that shows a panel when pressed.
25
var FCKToolbarPanelButton = function( commandName, label, tooltip, style, icon )
27
this.CommandName = commandName ;
32
oIcon = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
33
else if ( typeof( icon ) == 'number' )
34
oIcon = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ;
36
var oUIButton = this._UIButton = new FCKToolbarButtonUI( commandName, label, tooltip, oIcon, style ) ;
37
oUIButton._FCKToolbarPanelButton = this ;
38
oUIButton.ShowArrow = true ;
39
oUIButton.OnClick = FCKToolbarPanelButton_OnButtonClick ;
42
FCKToolbarPanelButton.prototype.TypeName = 'FCKToolbarPanelButton' ;
44
FCKToolbarPanelButton.prototype.Create = function( parentElement )
46
parentElement.className += 'Menu' ;
48
this._UIButton.Create( parentElement ) ;
50
var oPanel = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName )._Panel ;
51
oPanel._FCKToolbarPanelButton = this ;
53
var eLineDiv = oPanel.Document.body.appendChild( oPanel.Document.createElement( 'div' ) ) ;
54
eLineDiv.style.position = 'absolute' ;
55
eLineDiv.style.top = '0px' ;
57
var eLine = this.LineImg = eLineDiv.appendChild( oPanel.Document.createElement( 'IMG' ) ) ;
58
eLine.className = 'TB_ConnectionLine' ;
59
// eLine.style.backgroundColor = 'Red' ;
60
eLine.src = FCK_SPACER_PATH ;
62
oPanel.OnHide = FCKToolbarPanelButton_OnPanelHide ;
69
function FCKToolbarPanelButton_OnButtonClick( toolbarButton )
71
var oButton = this._FCKToolbarPanelButton ;
72
var e = oButton._UIButton.MainElement ;
74
oButton._UIButton.ChangeState( FCK_TRISTATE_ON ) ;
76
oButton.LineImg.style.width = ( e.offsetWidth - 2 ) + 'px' ;
78
FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oButton.CommandName ).Execute( 0, e.offsetHeight - 1, e ) ; // -1 to be over the border
81
function FCKToolbarPanelButton_OnPanelHide()
83
var oMenuButton = this._FCKToolbarPanelButton ;
84
oMenuButton._UIButton.ChangeState( FCK_TRISTATE_OFF ) ;
87
// The Panel Button works like a normal button so the refresh state functions
88
// defined for the normal button can be reused here.
89
FCKToolbarPanelButton.prototype.RefreshState = FCKToolbarButton.prototype.RefreshState ;
90
FCKToolbarPanelButton.prototype.Enable = FCKToolbarButton.prototype.Enable ;
91
FCKToolbarPanelButton.prototype.Disable = FCKToolbarButton.prototype.Disable ;