//-------------------- DrawShape (Step 3) ---------------------//

import javabook.*;

 /**
 * This class is the top-level controller object for managing
 * all other objects in the program.
 *
 * @author Dr. Caffeine
 *
 */
class DrawShape
{

//--------------------------------
//  Data Members
//--------------------------------

    /**
     * Constant for a line
     */
    private final int LINE        = 0;
    
    /**
     * Constant for a circle
     */
    private final int CIRCLE      = 1;
    
    /**
     * Constant for a rectangle
     */
    private final int RECTANGLE   = 2;
    
    /**
     * Constant for color magenta
     */
    private final int MAGENTA     = 0;
    
    /**
     * Constant for color cyan
     */
    private final int CYAN        = 1;
    
    /**
     * Constant for color red
     */
    private final int RED         = 2;
    
    /**
     * Constant for color blue
     */
    private final int BLUE        = 3;
    
    /**
     * Constant for color green
     */
    private final int GREEN       = 4;
    
    /**
     * The main window of the program
     */
    private MainWindow mainWindow;
         
    /**
     * OutputBox for displaying the test messages
     */
    private OutputBox  outputBox;
   
    /**
     * ListBox for listing shapes
     */
    private ListBox    shapeListBox;

    /**
     * The shape selected by the user
     */
    private int        selectedShape;
    
    /**
     * ListBox for listing colors
     */
    private ListBox    colorListBox;

    /**
     * The color selected by the user
     */
    private int        selectedColor;
      
//--------------------------------
//  Constructors
//--------------------------------

    /**
     * Default constructor. The default window title is "Drawing Shape".
     */
    public DrawShape( )
    {
        mainWindow  = new MainWindow( "Drawing Shape" );
        outputBox   = new OutputBox( mainWindow );
  
        shapeListBox = new ListBox( mainWindow, "Select Shape:" );
        shapeListBox.addItem( "Line"      );
        shapeListBox.addItem( "Circle"    );
        shapeListBox.addItem( "Rectangle" );
        
        colorListBox = new ListBox(mainWindow, "Select Color:" );
        colorListBox.addItem( "Magenta" );
        colorListBox.addItem( "Cyan"    );
        colorListBox.addItem( "Red"     );
        colorListBox.addItem( "Blue"    );
        colorListBox.addItem( "Green"   );
        
        mainWindow.setVisible( true );
         outputBox.setVisible( true );
    }

//-------------------------------------------------
//    Public Methods:
// 
//      void    start    (    )
//
//------------------------------------------------
    
    /**
     * Top-level method that calls other private methods
     * to draw the selected shape in user-specified
     * position, size, and color.   
     */
    public void start( )
    {
        describeProgram();
        selectShape();
        selectColor();
        selectDimension();
        draw();
    }

//-------------------------------------------------
//    Private Methods:
// 
//    void    describeProgram   (      )
//    void    draw              (      )
//    void    selectColor       (      )
//    void    selectDimension   (      )
//    void    selectShape       (      )
//
//------------------------------------------------

    /**
     * Provides a brief explanation of the program to the user.   
     *
     */    
    private void describeProgram( )
    {
        outputBox.printLine("Inside describeProgram");
    }


    /**  
     * Draws the selected shape in a chosen position, size,
     * and color.
     *
     */
    private void draw( )
    {
        outputBox.printLine("Inside draw");
    }
    
    
    /**
     * Lets the user select the color from a ListBox.   
     */
    private void selectColor( )
    {
        outputBox.printLine("Inside selectColor");               //TEMP
       
        selectedColor = colorListBox.getSelectedIndex();
        
        outputBox.printLine("Selected Color: " + selectedColor);  //TEMP
    }
    
  
    /**
     * Lets the user select the size and position using an InputBox.   
     *
     */
    private void selectDimension( )
    {
        outputBox.printLine("Inside selectDimension");
    }
    
    /**
     * Lets the user select the shape from a ListBox.   
     *
     */
    private void selectShape( )
    {
        outputBox.printLine("Inside selectShape");                //TEMP
        
        selectedShape = shapeListBox.getSelectedIndex();
        
        outputBox.printLine("Selected Shape: " + selectedShape);  //TEMP
    }
  
}


