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

« back to all changes in this revision

Viewing changes to wiki/htdocs/applets/FCKeditor/editor/_source/classes/fcktoolbarpanelbutton.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: fcktoolbarpanelbutton.js
 
14
 *      FCKToolbarPanelButton Class: represents a special button in the toolbar
 
15
 *      that shows a panel when pressed.
 
16
 * 
 
17
 * File Authors:
 
18
 *              Frederico Caldeira Knabben (fredck@fckeditor.net)
 
19
 */
 
20
 
 
21
var FCKToolbarPanelButton = function( commandName, label, tooltip, style )
 
22
{
 
23
        this.Command    = FCKCommands.GetCommand( commandName ) ;
 
24
        this.Label              = label ? label : commandName ;
 
25
        this.Tooltip    = tooltip ? tooltip : ( label ? label : commandName) ;
 
26
        this.Style              = style ? style : FCK_TOOLBARITEM_ONLYICON ;
 
27
        this.State              = FCK_UNKNOWN ;
 
28
        this.IconPath   = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
 
29
}
 
30
 
 
31
FCKToolbarPanelButton.prototype.Click = function(e)
 
32
{
 
33
        // For Mozilla we must stop the event propagation to avoid it hiding 
 
34
        // the panel because of a click outside of it.
 
35
//      if ( e )
 
36
//      {
 
37
//              e.stopPropagation() ;
 
38
//              FCKPanelEventHandlers.OnDocumentClick( e ) ;
 
39
//      }
 
40
 
 
41
        if ( this.State != FCK_TRISTATE_DISABLED )
 
42
        {
 
43
                this.Command.Execute(0, this.DOMDiv.offsetHeight, this.DOMDiv) ;
 
44
//                      this.FCKToolbarButton.HandleOnClick( this, e ) ;
 
45
        }
 
46
                
 
47
        return false ;
 
48
}
 
49
 
 
50
FCKToolbarPanelButton.prototype.CreateInstance = function( parentToolbar )
 
51
{
 
52
        this.DOMDiv = document.createElement( 'div' ) ;
 
53
        this.DOMDiv.className = 'TB_Button_Off' ;
 
54
 
 
55
        this.DOMDiv.FCKToolbarButton = this ;
 
56
        
 
57
        var sHtml =
 
58
                '<table title="' + this.Tooltip + '" cellspacing="0" cellpadding="0" border="0">' +
 
59
                        '<tr>' ;
 
60
                        
 
61
        if ( this.Style != FCK_TOOLBARITEM_ONLYTEXT ) 
 
62
                sHtml += '<td class="TB_Icon"><img src="' + this.IconPath + '" width="21" height="21"></td>' ;
 
63
                
 
64
        if ( this.Style != FCK_TOOLBARITEM_ONLYICON ) 
 
65
                sHtml += '<td class="TB_Text" nowrap>' + this.Label + '</td>' ;
 
66
        
 
67
        sHtml +=
 
68
                                '<td class="TB_ButtonArrow"><img src="' + FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif" width="5" height="3"></td>' +
 
69
                        '</tr>' +
 
70
                '</table>' ;
 
71
        
 
72
        this.DOMDiv.innerHTML = sHtml ;
 
73
 
 
74
        var oCell = parentToolbar.DOMRow.insertCell(-1) ;
 
75
        oCell.appendChild( this.DOMDiv ) ;
 
76
        
 
77
        this.RefreshState() ;
 
78
}
 
79
 
 
80
// The Panel Button works like a normal button so the refresh state functions
 
81
// defined for the normal button can be reused here.
 
82
FCKToolbarPanelButton.prototype.RefreshState    = FCKToolbarButton.prototype.RefreshState ;
 
83
FCKToolbarPanelButton.prototype.Enable                  = FCKToolbarButton.prototype.Enable ;
 
84
FCKToolbarPanelButton.prototype.Disable                 = FCKToolbarButton.prototype.Disable ;
 
 
b'\\ No newline at end of file'