/**************************************************
 *   File:     Selection.cpp
 *   Author:   Dr. Dalton R. Hunkins     
 *   Date:     February 2009
 * 
 *   The Selection Class provides a very basic
 *   subwindow without any graphical content.
 *   The purpose of the window is for displaying
 *   the GLUI controls that are established in 
 *   the main program.
**************************************************/
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

#include "Selection.h"


  Selection::Selection() {  }
 
  void Selection::createSubWindow(int parentHandle,
                                 int parentWidth, int parentHeight,
                                 int cornerX,     int cornerY,
                                 int width,        int height) {
      windowHandle = glutCreateSubWindow(parentHandle, 
                                         cornerX*parentWidth/100, cornerY*parentHeight/100,
                                         width*parentWidth/100,   height*parentHeight/100);
      Selection::cornerX = cornerX;
      Selection::cornerY = cornerY;
      Selection::width   = width;
      Selection::height  = height;                                         
  }

  void Selection::init(float clearColor[]) {
      glClearColor(clearColor[0], clearColor[1], clearColor[2], 1.0);
  }
  
  void Selection::display() {
    glClear(GL_COLOR_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
  	glutSwapBuffers();
  }

  int Selection::getWindowHandle() {
   	  return windowHandle;
  }

  int Selection::getCornerX() { return cornerX;}
 
  int Selection::getCornerY() { return cornerY;}
  
  int Selection::getWidth() { return width; }
  
  int Selection::getHeight() { return height; }