[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/editor/_source/classes/ -> fcktoolbarspecialcombo.js (source)

   1  /*
   2   * FCKeditor - The text editor for Internet - http://www.fckeditor.net
   3   * Copyright (C) 2003-2007 Frederico Caldeira Knabben
   4   * 
   5   * == BEGIN LICENSE ==
   6   * 
   7   * Licensed under the terms of any of the following licenses at your
   8   * choice:
   9   * 
  10   *  - GNU General Public License Version 2 or later (the "GPL")
  11   *    http://www.gnu.org/licenses/gpl.html
  12   * 
  13   *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  14   *    http://www.gnu.org/licenses/lgpl.html
  15   * 
  16   *  - Mozilla Public License Version 1.1 or later (the "MPL")
  17   *    http://www.mozilla.org/MPL/MPL-1.1.html
  18   * 
  19   * == END LICENSE ==
  20   * 
  21   * File Name: fcktoolbarspecialcombo.js
  22   *     FCKToolbarSpecialCombo Class: This is a "abstract" base class to be used
  23   *     by the special combo toolbar elements like font name, font size, paragraph format, etc...
  24   *     
  25   *     The following properties and methods must be implemented when inheriting from
  26   *     this class:
  27   *         - Property:    CommandName                            [ The command name to be executed ]
  28   *         - Method:    GetLabel()                            [ Returns the label ]
  29   *         -            CreateItems( targetSpecialCombo )    [ Add all items in the special combo ]
  30   * 
  31   * File Authors:
  32   *         Frederico Caldeira Knabben (www.fckeditor.net)
  33   */
  34  
  35  var FCKToolbarSpecialCombo = function()
  36  {
  37      this.SourceView            = false ;
  38      this.ContextSensitive    = true ;
  39      this._LastValue            = null ;
  40  }
  41  
  42  
  43  function FCKToolbarSpecialCombo_OnSelect( itemId, item )
  44  {
  45      FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).Execute( itemId, item ) ;
  46  }
  47  
  48  FCKToolbarSpecialCombo.prototype.Create = function( targetElement )
  49  {
  50      this._Combo = new FCKSpecialCombo( this.GetLabel(), this.FieldWidth, this.PanelWidth, this.PanelMaxHeight, FCKBrowserInfo.IsIE ? window : FCKTools.GetElementWindow( targetElement ).parent ) ;
  51      
  52      /*
  53      this._Combo.FieldWidth        = this.FieldWidth        != null ? this.FieldWidth        : 100 ;
  54      this._Combo.PanelWidth        = this.PanelWidth        != null ? this.PanelWidth        : 150 ;
  55      this._Combo.PanelMaxHeight    = this.PanelMaxHeight    != null ? this.PanelMaxHeight    : 150 ;
  56      */
  57      
  58      //this._Combo.Command.Name = this.Command.Name;
  59  //    this._Combo.Label    = this.Label ;
  60      this._Combo.Tooltip    = this.Tooltip ;
  61      this._Combo.Style    = this.Style ;
  62      
  63      this.CreateItems( this._Combo ) ;
  64  
  65      this._Combo.Create( targetElement ) ;
  66  
  67      this._Combo.CommandName = this.CommandName ;
  68      
  69      this._Combo.OnSelect = FCKToolbarSpecialCombo_OnSelect ;
  70  }
  71  
  72  function FCKToolbarSpecialCombo_RefreshActiveItems( combo, value )
  73  {
  74      combo.DeselectAll() ;
  75      combo.SelectItem( value ) ;
  76      combo.SetLabelById( value ) ;
  77  }
  78  
  79  FCKToolbarSpecialCombo.prototype.RefreshState = function()
  80  {
  81      // Gets the actual state.
  82      var eState ;
  83      
  84  //    if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
  85  //        eState = FCK_TRISTATE_DISABLED ;
  86  //    else
  87  //    {
  88          var sValue = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ;
  89  
  90  //        FCKDebug.Output( 'RefreshState of Special Combo "' + this.TypeOf + '" - State: ' + sValue ) ;
  91  
  92          if ( sValue != FCK_TRISTATE_DISABLED )
  93          {
  94              eState = FCK_TRISTATE_ON ;
  95              
  96              if ( this.RefreshActiveItems )
  97                  this.RefreshActiveItems( this._Combo, sValue ) ;
  98              else
  99              {
 100                  if ( this._LastValue != sValue )
 101                  {
 102                      this._LastValue = sValue ;
 103                      FCKToolbarSpecialCombo_RefreshActiveItems( this._Combo, sValue ) ;
 104                  }
 105              }
 106          }
 107          else
 108              eState = FCK_TRISTATE_DISABLED ;
 109  //    }
 110      
 111      // If there are no state changes then do nothing and return.
 112      if ( eState == this.State ) return ;
 113      
 114      if ( eState == FCK_TRISTATE_DISABLED )
 115      {
 116          this._Combo.DeselectAll() ;
 117          this._Combo.SetLabel( '' ) ;
 118      }
 119  
 120      // Sets the actual state.
 121      this.State = eState ;
 122  
 123      // Updates the graphical state.
 124      this._Combo.SetEnabled( eState != FCK_TRISTATE_DISABLED ) ;
 125  }
 126  
 127  FCKToolbarSpecialCombo.prototype.Enable = function()
 128  {
 129      this.RefreshState() ;
 130  }
 131  
 132  FCKToolbarSpecialCombo.prototype.Disable = function()
 133  {
 134      this.State = FCK_TRISTATE_DISABLED ;
 135      this._Combo.DeselectAll() ;
 136      this._Combo.SetLabel( '' ) ;
 137      this._Combo.SetEnabled( false ) ;
 138  }


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7