1  import org.aswing.ASColor;
     2  import org.aswing.border.Border;
     3  import org.aswing.Component;
     4  import org.aswing.geom.Rectangle;
     5  import org.aswing.graphices.Graphics;
     6  import org.aswing.graphices.Pen;
     7  import org.aswing.graphices.SolidBrush;
     8  import org.aswing.Insets;
     9  import org.aswing.JFrame;
    10  import org.aswing.plaf.UIResource;
    11  import org.aswing.UIManager;
    12  
    13  /**
    14   * @author iiley
    15   */
    16  class org.aswing.plaf.asw.border.FrameBorder implements Border, UIResource {
    17  		
    18  	private static var GLASS:Number = 4;
    19  	
    20  	private var activeColor:ASColor;
    21  	private var inactiveColor:ASColor;
    22  	
    23  	public function FrameBorder(){
    24  		activeColor   = UIManager.getColor("Frame.activeCaptionBorder");
    25  		inactiveColor = UIManager.getColor("Frame.inactiveCaptionBorder");   
    26  	}
    27  	
    28  	public function paintBorder(c : Component, g : Graphics, b : Rectangle) : Void {
    29  		var frame:JFrame = JFrame(c);
    30  		var color:ASColor = frame.isActive() ? activeColor : inactiveColor;
    31  		
    32  		//fill alpha rect
    33  		g.drawRoundRect(
    34  			new Pen(color, 1), 
    35  			b.x+0.5, b.y+0.5, b.width-1, b.height-1, 
    36  			GLASS + 4);
    37  		g.drawRoundRect(
    38  			new Pen(ASColor.WHITE, 1), 
    39  			b.x+1.5, b.y+1.5, b.width-3, b.height-3, 
    40  			GLASS + 3);
    41  		g.fillRoundRectRingWithThickness(
    42  			new SolidBrush(0, frame.isActive() ? 10 : 30),
    43  			b.x + 2, b.y + 2, b.width - 4, b.height - 4,
    44  			GLASS+2, GLASS, GLASS+1);
    45  		g.drawRoundRect(
    46  			new Pen(color, 1), 
    47  			b.x+2.5+GLASS, b.y+2.5+GLASS, b.width-5-GLASS*2, b.height-5-GLASS*2, 
    48  			GLASS, GLASS, 0, 0);
    49  	}
    50  	
    51  	public function getBorderInsets(c : Component, bounds : Rectangle) : Insets {
    52  		var w:Number = GLASS + 3;
    53  		return new Insets(w, w, w, w);
    54  	}
    55  
    56  	public function uninstallBorder(c : Component) : Void {
    57  	}
    58  }