package {
    import com.arpitonline.openPyroExample.PhotoModule;
    import com.cimians.openPyro.aurora.AuroraContainerSkin;
    import com.cimians.openPyro.controls.Label;
    import com.cimians.openPyro.controls.Spacer;
    import com.cimians.openPyro.core.Padding;
    import com.cimians.openPyro.core.UIContainer;
    import com.cimians.openPyro.core.UIControl;
    import com.cimians.openPyro.layout.VLayout;
    import com.cimians.openPyro.painters.GradientFillPainter;
    
    import flash.display.Sprite;
    import flash.filters.DropShadowFilter;
    import flash.text.TextFormat;

    [SWF(backgroundColor="0xdcdcdc")]
    public class ImageBrowser extends Sprite
    {
        public function ImageBrowser()
        {
            stage.scaleMode = "noScale"
            stage.align = "TL"
            
             //Create a background painter for the main container 
            var bgPainter:GradientFillPainter = new GradientFillPainter([0,0x333333]);
            bgPainter.cornerRadius = 10;
            bgPainter.rotation = Math.PI/2
            
            // create the main container
            var shell:UIContainer = new UIContainer();
            shell.backgroundPainter = bgPainter;
            shell.width = 800;
            shell.height = 600;
            shell.skin = new AuroraContainerSkin()
            shell.layout = new VLayout(10)
            shell.padding = new Padding(5,5,5,5)
            addChild(shell)
            
            var header:UIControl = new UIControl();
            header.percentUnusedWidth=100
            header.height=25;
            
            var label:Label = new Label();
            label.height = 20;
            label.textFormat = new TextFormat("Arial", 14, 0x60A5D8, true)
            label.text = "Image Browser"
            header.addChild(label);
            
            //create fill for the img:
            var painter:GradientFillPainter = new GradientFillPainter([0x222222, 0x000000])
            painter.rotation = Math.PI/2
            header.backgroundPainter = painter
            shell.addChild(header);
            
            var photoModule:PhotoModule = new PhotoModule();
            photoModule.percentUnusedWidth = 100
            photoModule.percentUnusedHeight = 100;
            shell.addChild(photoModule)
            
            shell.x = shell.y = 40
            
            var spacer:Spacer = new Spacer();
            spacer.percentWidth = 100;
            spacer.height = 20;
            shell.addChild(spacer);
        
            shell.x = (stage.stageWidth-shell.width)/2
            shell.y = (stage.stageHeight-shell.height)/2
            shell.filters = [new DropShadowFilter(4,90)];
        }
    }
}