1  /*
     2   Copyright aswing.org, see the LICENCE.txt.
     3  */
     4   
     5  import org.aswing.*;
     6  import org.aswing.graphices.*;
     7  import org.aswing.geom.*;
     8  import org.aswing.plaf.*;
     9   
    10  /**
    11   * Basic Arrow Icon for scrollbar buttons
    12   * @author iiley
    13   */
    14  class org.aswing.plaf.basic.icon.ArrowIcon implements Icon, UIResource{
    15  	private var arrow:Number;
    16  	private var width:Number;
    17  	private var height:Number;
    18  	private var background:ASColor;
    19  	private var shadow:ASColor;
    20  	private var darkShadow:ASColor;
    21  	private var highlight:ASColor;
    22  	
    23  	public function ArrowIcon(arrow:Number, size:Number, background:ASColor, shadow:ASColor,
    24  			 darkShadow:ASColor, highlight:ASColor){
    25  		this.arrow = arrow;
    26  		this.width = size;
    27  		this.height = size;
    28  		this.background = background;
    29  		this.shadow = shadow;
    30  		this.darkShadow = darkShadow;
    31  		this.highlight = highlight;
    32  	}
    33  
    34  	/**
    35  	 * Return the icon's width.
    36  	 */
    37  	public function getIconWidth():Number{
    38  		return width;
    39  	}
    40  	
    41  	/**
    42  	 * Return the icon's height.
    43  	 */
    44  	public function getIconHeight():Number{
    45  		return height;
    46  	}
    47  	
    48  	/**
    49  	 * Draw the icon at the specified location.
    50  	 */
    51  	public function paintIcon(com:Component, g:Graphics, x:Number, y:Number):Void{
    52  		var center:Point = new Point(com.getWidth()/2, com.getHeight()/2);
    53  		var w:Number = width;
    54  		var ps1:Array = new Array();
    55  		ps1.push(center.nextPoint(0 + arrow, w/3*2));
    56  		ps1.push(center.nextPoint(Math.PI*2/3 + arrow, w/3*2));
    57  		ps1.push(center.nextPoint(Math.PI*4/3 + arrow, w/3*2));
    58  		
    59  		w--;
    60  		var ps2:Array = new Array();
    61  		ps2.push(center.nextPoint(0 + arrow, w/3*2));
    62  		ps2.push(center.nextPoint(Math.PI*2/3 + arrow, w/3*2));
    63  		ps2.push(center.nextPoint(Math.PI*4/3 + arrow, w/3*2));		
    64  		
    65  		g.fillPolygon(new SolidBrush(darkShadow), ps1);
    66  		g.fillPolygon(new SolidBrush(shadow), ps2);
    67  	}
    68  	
    69  	public function uninstallIcon(com:Component):Void{
    70  	}	
    71  }
    72