home *** CD-ROM | disk | FTP | other *** search
- package com.livebrush.ui
- {
- import com.livebrush.events.UpdateEvent;
- import com.livebrush.utils.Update;
- import flash.display.Sprite;
-
- public class ToolPropsView extends UIView
- {
- public static var IDEAL_HEIGHT:int = 508;
-
- public var panel:Sprite;
-
- private var titlebarMask:PanelTitlebarMask;
-
- public var panelAsset:PanelAsset;
-
- public var state:int;
-
- public var content:Sprite;
-
- public function ToolPropsView(ui:com.livebrush.ui.UI)
- {
- this.state = com.livebrush.ui.UI.OPEN;
- super(ui);
- helpID = "toolProps";
- init();
- }
-
- override protected function createView() : void
- {
- this.panel = new Sprite();
- this.content = new Sprite();
- this.titlebarMask = new PanelTitlebarMask();
- this.titlebarMask.visible = false;
- this.panelAsset = new PanelAsset();
- this.panelAsset.cacheAsBitmap = true;
- this.panel.addChild(this.panelAsset);
- this.panel.addChild(this.content);
- this.panel.addChild(this.titlebarMask);
- com.livebrush.ui.UI.UI_HOLDER.addChild(this.panel);
- this.panelAsset.title.htmlText = "<b>Tool Settings</b>";
- this.panel.y = 32;
- this.panelAsset.bg.height = IDEAL_HEIGHT;
- this.content.y = 30;
- }
-
- private function get _height() : Number
- {
- return com.livebrush.ui.UI.HEIGHT - 32 - ui.layersView.height - ui.styleListView.height - 1;
- }
-
- override public function update(update:Update = null) : void
- {
- if(update.type == UpdateEvent.WINDOW || update.type == UpdateEvent.UI)
- {
- this.panel.x = com.livebrush.ui.UI.WIDTH - this.panelAsset.width - 42 - 6;
- this.panel.y = ui.styleListView.maxY;
- if(this.state != com.livebrush.ui.UI.CLOSED)
- {
- this.panelAsset.bg.height = this._height;
- }
- }
- else if(update.type == UpdateEvent.UI)
- {
- }
- }
-
- public function set visible(b:Boolean) : void
- {
- this.panel.visible = b;
- }
-
- public function get width() : Number
- {
- return this.panelAsset.bg.width;
- }
-
- public function toggle(force:Boolean = false) : void
- {
- this.state = this.state == com.livebrush.ui.UI.CLOSED || force ? com.livebrush.ui.UI.OPEN : com.livebrush.ui.UI.CLOSED;
- if(this.state == com.livebrush.ui.UI.CLOSED)
- {
- this.panelAsset.bg.height = 22;
- this.content.mask = this.titlebarMask;
- }
- else
- {
- this.panelAsset.bg.height = this._height;
- this.content.mask = null;
- }
- }
-
- public function get maxY() : Number
- {
- return this.panelAsset.height + this.panel.y;
- }
-
- public function setContent(propsContent:Sprite) : void
- {
- try
- {
- this.content.removeChildAt(0);
- }
- catch(e:Error)
- {
- }
- this.content.addChild(propsContent);
- }
-
- override protected function createController() : void
- {
- controller = new ToolPropsController(this);
- }
- }
- }
-
-