home *** CD-ROM | disk | FTP | other *** search
/ Canadian Forces: A World of Opportunities / CanadianForces-AWorldOfOpportunities-WinMac.bin / 03_WayLife_FR.swf / scripts / __Packages / mx / core / UIComponent.as next >
Text File  |  2006-07-20  |  4KB  |  166 lines

  1. class mx.core.UIComponent extends mx.core.UIObject
  2. {
  3.    static var symbolName = "UIComponent";
  4.    static var symbolOwner = mx.core.UIComponent;
  5.    static var version = "2.0.0.377";
  6.    static var kStretch = 5000;
  7.    var focusEnabled = true;
  8.    var tabEnabled = true;
  9.    var origBorderStyles = {themeColor:16711680};
  10.    var clipParameters = {};
  11.    static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.core.UIComponent.prototype.clipParameters,mx.core.UIObject.prototype.clipParameters);
  12.    function UIComponent()
  13.    {
  14.       super();
  15.    }
  16.    function get width()
  17.    {
  18.       return this.__width;
  19.    }
  20.    function get height()
  21.    {
  22.       return this.__height;
  23.    }
  24.    function setVisible(x, noEvent)
  25.    {
  26.       super.setVisible(x,noEvent);
  27.    }
  28.    function enabledChanged(id, oldValue, newValue)
  29.    {
  30.       this.setEnabled(newValue);
  31.       this.invalidate();
  32.       delete this.stylecache.tf;
  33.       return newValue;
  34.    }
  35.    function setEnabled(enabled)
  36.    {
  37.       this.invalidate();
  38.    }
  39.    function getFocus()
  40.    {
  41.       var selFocus = Selection.getFocus();
  42.       return selFocus !== null ? eval(selFocus) : null;
  43.    }
  44.    function setFocus()
  45.    {
  46.       Selection.setFocus(this);
  47.    }
  48.    function getFocusManager()
  49.    {
  50.       var _loc2_ = this;
  51.       while(_loc2_ != undefined)
  52.       {
  53.          if(_loc2_.focusManager != undefined)
  54.          {
  55.             return _loc2_.focusManager;
  56.          }
  57.          _loc2_ = _loc2_._parent;
  58.       }
  59.       return undefined;
  60.    }
  61.    function onKillFocus(newFocus)
  62.    {
  63.       this.removeEventListener("keyDown",this);
  64.       this.removeEventListener("keyUp",this);
  65.       this.dispatchEvent({type:"focusOut"});
  66.       this.drawFocus(false);
  67.    }
  68.    function onSetFocus(oldFocus)
  69.    {
  70.       this.addEventListener("keyDown",this);
  71.       this.addEventListener("keyUp",this);
  72.       this.dispatchEvent({type:"focusIn"});
  73.       if(this.getFocusManager().bDrawFocus != false)
  74.       {
  75.          this.drawFocus(true);
  76.       }
  77.    }
  78.    function findFocusInChildren(o)
  79.    {
  80.       if(o.focusTextField != undefined)
  81.       {
  82.          return o.focusTextField;
  83.       }
  84.       if(o.tabEnabled == true)
  85.       {
  86.          return o;
  87.       }
  88.       return undefined;
  89.    }
  90.    function findFocusFromObject(o)
  91.    {
  92.       if(o.tabEnabled != true)
  93.       {
  94.          if(o._parent == undefined)
  95.          {
  96.             return undefined;
  97.          }
  98.          if(o._parent.tabEnabled == true)
  99.          {
  100.             o = o._parent;
  101.          }
  102.          else if(o._parent.tabChildren)
  103.          {
  104.             o = this.findFocusInChildren(o._parent);
  105.          }
  106.          else
  107.          {
  108.             o = this.findFocusFromObject(o._parent);
  109.          }
  110.       }
  111.       return o;
  112.    }
  113.    function pressFocus()
  114.    {
  115.       var _loc3_ = this.findFocusFromObject(this);
  116.       var _loc2_ = this.getFocus();
  117.       if(_loc3_ != _loc2_)
  118.       {
  119.          _loc2_.drawFocus(false);
  120.          if(this.getFocusManager().bDrawFocus != false)
  121.          {
  122.             _loc3_.drawFocus(true);
  123.          }
  124.       }
  125.    }
  126.    function releaseFocus()
  127.    {
  128.       var _loc2_ = this.findFocusFromObject(this);
  129.       if(_loc2_ != this.getFocus())
  130.       {
  131.          _loc2_.setFocus();
  132.       }
  133.    }
  134.    function isParent(o)
  135.    {
  136.       while(o != undefined)
  137.       {
  138.          if(o == this)
  139.          {
  140.             return true;
  141.          }
  142.          o = o._parent;
  143.       }
  144.       return false;
  145.    }
  146.    function size()
  147.    {
  148.    }
  149.    function init()
  150.    {
  151.       super.init();
  152.       this._xscale = 100;
  153.       this._yscale = 100;
  154.       this._focusrect = _global.useFocusRect == false;
  155.       this.watch("enabled",this.enabledChanged);
  156.       if(this.enabled == false)
  157.       {
  158.          this.setEnabled(false);
  159.       }
  160.    }
  161.    function dispatchValueChangedEvent(value)
  162.    {
  163.       this.dispatchEvent({type:"valueChanged",value:value});
  164.    }
  165. }
  166.