1  /*
     2   Copyright aswing.org, see the LICENCE.txt.
     3  */
     4   
     5  import org.aswing.*;
     6  import org.aswing.geom.*;
     7  import org.aswing.border.*;
     8  import org.aswing.graphices.*;
     9  import org.aswing.plaf.*;
    10  
    11   
    12  /**
    13   *
    14   * @author Firdosh
    15   */
    16  
    17  
    18  
    19  class org.aswing.plaf.winxp.border.ButtonBorder implements Border, UIResource{
    20  		
    21      private var darkShadow:ASColor;
    22      private var highlight:ASColor;	
    23  	
    24  	private static var winxpInstance:Border;
    25  	/**
    26  	 * this make shared instance and construct when use.
    27  	 */	
    28  	public static function createInstance():Border{
    29  		if(winxpInstance == null){
    30  			winxpInstance = new ButtonBorder();
    31  		}
    32  		return winxpInstance;
    33  	}
    34  	
    35  	private function ButtonBorder(){
    36  		var table:UIDefaults = UIManager.getLookAndFeelDefaults();		
    37  		this.darkShadow = table.getColor("Button.darkShadow");
    38  		this.highlight = table.getColor("Button.highlight");		
    39  	}
    40  	
    41  	public function paintBorder(c:Component, g:Graphics, bounds:Rectangle):Void{
    42      	
    43      	var x1:Number = bounds.x;
    44  		var y1:Number = bounds.y;
    45  		var x2:Number = x1 + bounds.width;
    46  		var y2:Number = y1 + bounds.height;
    47      	
    48      	var brush:SolidBrush=new SolidBrush(highlight);
    49  		g.fillRoundRect(brush,x1, y1, x2, y2,3,3,3,3);		
    50  	   
    51      	var isPressed:Boolean = false;
    52  		if(c instanceof AbstractButton){
    53  			isPressed = (AbstractButton(c)).getModel().isPressed();
    54  		}
    55  		
    56  		if(isPressed){
    57  				
    58  		}
    59  		
    60          
    61      }
    62  	
    63  	public function getBorderInsets(c:Component, bounds:Rectangle):Insets{
    64      	return new Insets(1, 1, 1, 1);
    65      }
    66      
    67      public function uninstallBorder(c:Component):Void{
    68      }
    69  	
    70  }
    71