/*
 * RectFrame.java      v1.0    Oct 18, 1996
 *
 * Copyright (c) 1996-7 H.J. Tsai, Inc. All Rights Reserved.
 *
 * Permission to use, copy, modify, and distribute this software
 * and its documentation for any purposes and without
 * fee is hereby granted provided that this copyright notice
 * appears in all copies. 
 *
 * H.J. Tsai MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
 * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
 * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 * PURPOSE, OR NON-INFRINGEMENT. H.J. Tsai SHALL NOT BE LIABLE FOR
 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
 *
 * Version 1.0  Oct 18 1996
 *              Initial version
 */

import java.awt.*;
import ColorValue;

/**
 * A class to represent a 3D rectangle frame.
 * A Rectframe object has 3 parts:
 *   an outer bevel area,
 *   a frame area 
 *   an inner bevel area
 * Each part is a Rect object.
 *
 * The frame has a primary color and can be painted with various styles.
 *
 */
public class RectFrame {
    private Rect    rectOutBevel;
    private Rect    rectFrame;
    private Rect    rectInBevel;
    private int     style;
    private Color   color;
    private Color   highLight;
    private Color   shadow;
    
    public RectFrame(Rectangle r,
                    int outBevel,
                    int outBevelStyle,
                    int    frameThickness,
                    int frameStyle,
                    Color frameColor,
                    int inBevel,
                    int inBevelStyle) {
        
        rectOutBevel = new Rect(r,
                            outBevel,
                            outBevelStyle,
                            frameColor);
        
        rectFrame = new Rect(rectOutBevel.getInsideRect(),
                            frameThickness,
                            frameStyle,
                            frameColor);
        
        rectInBevel = new Rect(rectFrame.getInsideRect(),
                            inBevel,
                            inBevelStyle,
                            frameColor);
    }

    public Rectangle getOutsideRect() {
        return rectOutBevel.getOutsideRect();
    }
    
    public Rect getInsideRect() {
        return rectInBevel.getInsideRect();
    }
 
    
    public void setColor(Color c) {
        this.color = c;
        highLight = ColorValue.getHighLightColor(c);
        shadow = ColorValue.getShadowColor(c);
    }


    public void setStyle(int style) {
        this.style = style;
    }
        

    public void paint(Graphics g) {
        rectOutBevel.paint(g);
        rectFrame.paint(g);
        rectInBevel.paint(g);
    }
}
