home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Utils / Livebrush / Install-LivebrushLite.air / livebrush.swf / scripts / com / livebrush / ui / ToolPropsView.as < prev    next >
Encoding:
Text File  |  2009-10-26  |  3.4 KB  |  117 lines

  1. package com.livebrush.ui
  2. {
  3.    import com.livebrush.events.UpdateEvent;
  4.    import com.livebrush.utils.Update;
  5.    import flash.display.Sprite;
  6.    
  7.    public class ToolPropsView extends UIView
  8.    {
  9.       public static var IDEAL_HEIGHT:int = 508;
  10.       
  11.       public var panel:Sprite;
  12.       
  13.       private var titlebarMask:PanelTitlebarMask;
  14.       
  15.       public var panelAsset:PanelAsset;
  16.       
  17.       public var state:int;
  18.       
  19.       public var content:Sprite;
  20.       
  21.       public function ToolPropsView(ui:com.livebrush.ui.UI)
  22.       {
  23.          this.state = com.livebrush.ui.UI.OPEN;
  24.          super(ui);
  25.          helpID = "toolProps";
  26.          init();
  27.       }
  28.       
  29.       override protected function createView() : void
  30.       {
  31.          this.panel = new Sprite();
  32.          this.content = new Sprite();
  33.          this.titlebarMask = new PanelTitlebarMask();
  34.          this.titlebarMask.visible = false;
  35.          this.panelAsset = new PanelAsset();
  36.          this.panelAsset.cacheAsBitmap = true;
  37.          this.panel.addChild(this.panelAsset);
  38.          this.panel.addChild(this.content);
  39.          this.panel.addChild(this.titlebarMask);
  40.          com.livebrush.ui.UI.UI_HOLDER.addChild(this.panel);
  41.          this.panelAsset.title.htmlText = "<b>Tool Settings</b>";
  42.          this.panel.y = 32;
  43.          this.panelAsset.bg.height = IDEAL_HEIGHT;
  44.          this.content.y = 30;
  45.       }
  46.       
  47.       private function get _height() : Number
  48.       {
  49.          return com.livebrush.ui.UI.HEIGHT - 32 - ui.layersView.height - ui.styleListView.height - 1;
  50.       }
  51.       
  52.       override public function update(update:Update = null) : void
  53.       {
  54.          if(update.type == UpdateEvent.WINDOW || update.type == UpdateEvent.UI)
  55.          {
  56.             this.panel.x = com.livebrush.ui.UI.WIDTH - this.panelAsset.width - 42 - 6;
  57.             this.panel.y = ui.styleListView.maxY;
  58.             if(this.state != com.livebrush.ui.UI.CLOSED)
  59.             {
  60.                this.panelAsset.bg.height = this._height;
  61.             }
  62.          }
  63.          else if(update.type == UpdateEvent.UI)
  64.          {
  65.          }
  66.       }
  67.       
  68.       public function set visible(b:Boolean) : void
  69.       {
  70.          this.panel.visible = b;
  71.       }
  72.       
  73.       public function get width() : Number
  74.       {
  75.          return this.panelAsset.bg.width;
  76.       }
  77.       
  78.       public function toggle(force:Boolean = false) : void
  79.       {
  80.          this.state = this.state == com.livebrush.ui.UI.CLOSED || force ? com.livebrush.ui.UI.OPEN : com.livebrush.ui.UI.CLOSED;
  81.          if(this.state == com.livebrush.ui.UI.CLOSED)
  82.          {
  83.             this.panelAsset.bg.height = 22;
  84.             this.content.mask = this.titlebarMask;
  85.          }
  86.          else
  87.          {
  88.             this.panelAsset.bg.height = this._height;
  89.             this.content.mask = null;
  90.          }
  91.       }
  92.       
  93.       public function get maxY() : Number
  94.       {
  95.          return this.panelAsset.height + this.panel.y;
  96.       }
  97.       
  98.       public function setContent(propsContent:Sprite) : void
  99.       {
  100.          try
  101.          {
  102.             this.content.removeChildAt(0);
  103.          }
  104.          catch(e:Error)
  105.          {
  106.          }
  107.          this.content.addChild(propsContent);
  108.       }
  109.       
  110.       override protected function createController() : void
  111.       {
  112.          controller = new ToolPropsController(this);
  113.       }
  114.    }
  115. }
  116.  
  117.