~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/_source/classes/fcktoolbarspecialcombo.js

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
Import upstream version 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * FCKeditor - The text editor for internet
 
3
 * Copyright (C) 2003-2005 Frederico Caldeira Knabben
 
4
 * 
 
5
 * Licensed under the terms of the GNU Lesser General Public License:
 
6
 *              http://www.opensource.org/licenses/lgpl-license.php
 
7
 * 
 
8
 * For further information visit:
 
9
 *              http://www.fckeditor.net/
 
10
 * 
 
11
 * "Support Open Source software. What about a donation today?"
 
12
 * 
 
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...
 
16
 *      
 
17
 *      The following properties and methods must be implemented when inheriting from
 
18
 *      this class:
 
19
 *              - Property:     Command                                                         [ The command to be executed ]
 
20
 *              - Method:       GetLabel()                                                      [ Returns the label ]
 
21
 *              -                       CreateItems( targetSpecialCombo )       [ Add all items in the special combo ]
 
22
 * 
 
23
 * File Authors:
 
24
 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
 
25
 */
 
26
 
 
27
var FCKToolbarSpecialCombo = function()
 
28
{
 
29
        this.SourceView                 = false ;
 
30
        this.ContextSensitive   = true ;
 
31
}
 
32
 
 
33
function FCKToolbarSpecialCombo_OnSelect( itemId, item )
 
34
{
 
35
        this.Command.Execute( itemId, item ) ;
 
36
}
 
37
 
 
38
FCKToolbarSpecialCombo.prototype.CreateInstance = function( parentToolbar )
 
39
{
 
40
        this._Combo = new FCKSpecialCombo( this.GetLabel(), this.FieldWidth, this.PanelWidth, this.PanelMaxHeight ) ;
 
41
        
 
42
        /*
 
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 ;
 
46
        */
 
47
        
 
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 ;
 
52
        
 
53
        this.CreateItems( this._Combo ) ;
 
54
 
 
55
        this._Combo.Create( parentToolbar.DOMRow.insertCell(-1) ) ;
 
56
 
 
57
        this._Combo.Command = this.Command ;
 
58
        
 
59
        this._Combo.OnSelect = FCKToolbarSpecialCombo_OnSelect ;
 
60
}
 
61
 
 
62
function FCKToolbarSpecialCombo_RefreshActiveItems( combo, value )
 
63
{
 
64
        combo.DeselectAll() ;
 
65
        combo.SelectItem( value ) ;
 
66
        combo.SetLabelById( value ) ;
 
67
}
 
68
 
 
69
FCKToolbarSpecialCombo.prototype.RefreshState = function()
 
70
{
 
71
        // Gets the actual state.
 
72
        var eState ;
 
73
        
 
74
//      if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
 
75
//              eState = FCK_TRISTATE_DISABLED ;
 
76
//      else
 
77
//      {
 
78
                var sValue = this.Command.GetState() ;
 
79
 
 
80
                if ( sValue != FCK_TRISTATE_DISABLED )
 
81
                {
 
82
                        eState = FCK_TRISTATE_ON ;
 
83
                        
 
84
                        if ( this.RefreshActiveItems )
 
85
                                this.RefreshActiveItems( this._Combo, sValue ) ;
 
86
                        else
 
87
                        {
 
88
                                if ( this._LastValue == sValue )
 
89
                                        return ;
 
90
        
 
91
                                this._LastValue = sValue ;
 
92
 
 
93
                                FCKToolbarSpecialCombo_RefreshActiveItems( this._Combo, sValue ) ;
 
94
                        }
 
95
                }
 
96
                else
 
97
                        eState = FCK_TRISTATE_DISABLED ;
 
98
//      }
 
99
        
 
100
        // If there are no state changes then do nothing and return.
 
101
        if ( eState == this.State ) return ;
 
102
        
 
103
        if ( eState == FCK_TRISTATE_DISABLED )
 
104
        {
 
105
                this._Combo.DeselectAll() ;
 
106
                this._Combo.SetLabel( '' ) ;
 
107
        }
 
108
 
 
109
        // Sets the actual state.
 
110
        this.State = eState ;
 
111
 
 
112
        // Updates the graphical state.
 
113
        this._Combo.SetEnabled( eState != FCK_TRISTATE_DISABLED ) ;
 
114
}
 
115
 
 
116
FCKToolbarSpecialCombo.prototype.Enable = function()
 
117
{
 
118
        this.RefreshState() ;
 
119
}
 
120
 
 
121
FCKToolbarSpecialCombo.prototype.Disable = function()
 
122
{
 
123
        this.State = FCK_TRISTATE_DISABLED ;
 
124
        this._Combo.DeselectAll() ;
 
125
        this._Combo.SetLabel( '' ) ;
 
126
        this._Combo.SetEnabled( false ) ;
 
127
}
 
 
b'\\ No newline at end of file'