//=======================================================================
//@V@:Note: This file generated by vgen V1.00 (10:45:41 AM 12 Sep 1996).
//	tglapp.cpp:	Source for testGLApp class
//=======================================================================

#include "tglapp.h"		// Header file

//=========================>>> testGLApp::testGLApp <<<==========================
  testGLApp::testGLApp(char* name, int sdi, int h, int w) : vApp(name, sdi, h, w)
  {
    // Constructor

   _testGLCmdWin = 0;
  }

//=========================>>> testGLApp::testGLApp <<<==========================
  testGLApp::~testGLApp()
  {
    // Desstructor
  // if (_testGLCmdWin)
    //	delete _testGLCmdWin;
  }

//=====================>>> testGLApp::NewAppWin <<<==========================
  vWindow* testGLApp::NewAppWin(vWindow* win, char* name,
    int h, int w, vAppWinInfo* winInfo)
  {
    vAppWinInfo* awinfo = winInfo;
    char *appname = name;

    if (!*name)
      {
	 appname = "OpenGL Test";		// Default name
      }
	
    UserDebug1(Build,"testGLApp::NewAppWin(%s)\n",appname);

    // Create the first window using provided CmdWindow

    _testGLCmdWin = (testGLCmdWindow*) win;
    if (!_testGLCmdWin)
      {
	_testGLCmdWin = new testGLCmdWindow(appname,h, w);
      }

    if (!awinfo)
	awinfo = new vAppWinInfo(appname);

    return vApp::NewAppWin(_testGLCmdWin, appname, h, w, awinfo);
  }

//============================>>> testGLApp::Exit <<<===========================
  void testGLApp::Exit(void)
  {
    // This is called to close all windows.

    UserDebug(Build,"testGLApp::Exit()\n");

    vApp::Exit();		// Default behavior
  }

//======================>>> testGLApp::CloseAppWin <<<===========================
  int testGLApp::CloseAppWin(vWindow* win)
  {
    // This will be called BEFORE a window has been unregistered or
    // closed.  Default behavior: unregister and close the window.

    UserDebug(Build,"testGLApp::CloseAppWin()\n");

    return vApp::CloseAppWin(win);
  }

//=====================>>> testGLApp::AppCommand <<<==============================
  void testGLApp::AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType)
  {
    // Commands not processed by the window will be passed here

    UserDebug1(Build,"testGLApp::AppCmd(ID: %d)\n",id);
    vApp::AppCommand(win, id, val, cType);
  }

//=========================>>> testGLApp::KeyIn <<<==============================
  void testGLApp::KeyIn(vWindow* win, vKey key, unsigned int shift)
  {
    // Key strokes not processed by the window will be passed here

    vApp::KeyIn(win, key, shift);
  }

//###########################################################################

  static testGLApp testGL_App("OpenGL SHAPES Test",1);	// The instance of the app

//============================>>> AppMain <<<==============================
  int AppMain(int argc, char** argv)
  {
    // Use AppMain to create the main window

    (void) theApp->NewAppWin(0, "OpenGL SHAPES Test", 400, 400);

    return 0;
  }
