PluginProbe
Wp-Insert / 1.2
Wp-Insert v1.2
trunk 1.0 1.1 1.2 1.2.1 1.2.2 1.3.0 1.3.1 1.3.3 1.4 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 2.0 All 63 releases
wp-insert / fckeditor / editor / _source / classes / fcktoolbarbutton.js

fcktoolbarbutton.js in Wp-Insert 1.2, at fckeditor/editor/_source/classes/fcktoolbarbutton.js

163 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2
3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
4
5 * Copyright (C) 2003-2009 Frederico Caldeira Knabben
6
7 *
8
9 * == BEGIN LICENSE ==
10
11 *
12
13 * Licensed under the terms of any of the following licenses at your
14
15 * choice:
16
17 *
18
19 * - GNU General Public License Version 2 or later (the "GPL")
20
21 * http://www.gnu.org/licenses/gpl.html
22
23 *
24
25 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
26
27 * http://www.gnu.org/licenses/lgpl.html
28
29 *
30
31 * - Mozilla Public License Version 1.1 or later (the "MPL")
32
33 * http://www.mozilla.org/MPL/MPL-1.1.html
34
35 *
36
37 * == END LICENSE ==
38
39 *
40
41 * FCKToolbarButton Class: represents a button in the toolbar.
42
43 */
44
45
46
47 var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive, icon )
48
49 {
50
51 this.CommandName = commandName ;
52
53 this.Label = label ;
54
55 this.Tooltip = tooltip ;
56
57 this.Style = style ;
58
59 this.SourceView = sourceView ? true : false ;
60
61 this.ContextSensitive = contextSensitive ? true : false ;
62
63
64
65 if ( icon == null )
66
67 this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
68
69 else if ( typeof( icon ) == 'number' )
70
71 this.IconPath = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ;
72
73 else
74
75 this.IconPath = icon ;
76
77 }
78
79
80
81 FCKToolbarButton.prototype.Create = function( targetElement )
82
83 {
84
85 this._UIButton = new FCKToolbarButtonUI( this.CommandName, this.Label, this.Tooltip, this.IconPath, this.Style ) ;
86
87 this._UIButton.OnClick = this.Click ;
88
89 this._UIButton._ToolbarButton = this ;
90
91 this._UIButton.Create( targetElement ) ;
92
93 }
94
95
96
97 FCKToolbarButton.prototype.RefreshState = function()
98
99 {
100
101 var uiButton = this._UIButton ;
102
103
104
105 if ( !uiButton )
106
107 return ;
108
109
110
111 // Gets the actual state.
112
113 var eState = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ;
114
115
116
117 // If there are no state changes than do nothing and return.
118
119 if ( eState == uiButton.State ) return ;
120
121
122
123 // Sets the actual state.
124
125 uiButton.ChangeState( eState ) ;
126
127 }
128
129
130
131 FCKToolbarButton.prototype.Click = function()
132
133 {
134
135 var oToolbarButton = this._ToolbarButton || this ;
136
137 FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oToolbarButton.CommandName ).Execute() ;
138
139 }
140
141
142
143 FCKToolbarButton.prototype.Enable = function()
144
145 {
146
147 this.RefreshState() ;
148
149 }
150
151
152
153 FCKToolbarButton.prototype.Disable = function()
154
155 {
156
157 // Sets the actual state.
158
159 this._UIButton.ChangeState( FCK_TRISTATE_DISABLED ) ;
160
161 }
162
163