home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vos2-121.zip / v / vopengl / shapes / tglcmdw.cpp < prev    next >
C/C++ Source or Header  |  1996-09-24  |  4KB  |  157 lines

  1. //=======================================================================
  2. //@V@:Note: This file generated by vgen V1.00 (10:45:42 AM 12 Sep 1996).
  3. //    tglcmdw.cpp:    Source for testGLCmdWindow class
  4. //=======================================================================
  5.  
  6. #include <v/vnotice.h>    // for vNoticeDialog
  7. #include <v/vkeys.h>    // to map keys
  8.  
  9. #include "tglcmdw.h"    // our header
  10. #include "tglcnv.h"
  11.  
  12. //    Start defines for the main window with 100
  13.  
  14. //@V@:BeginIDs
  15.     enum {
  16.     m_FirstCmd = 100, // Dummy Command
  17.     lblSpin,    // label for spin
  18.     sldSpeed,    // speed of spin
  19.     lblTestStat,    // Status Bar test
  20.     blkLast        // Last item
  21.       };
  22. //@V@:EndIDs
  23.  
  24. //@V@:BeginPulldownMenu FileMenu
  25.     static vMenu FileMenu[] =
  26.       {
  27.     {"E&xit", M_Exit, isSens, notChk, noKeyLbl, noKey, noSub},
  28.     {NULL}
  29.       };
  30. //@V@:EndPulldownMenu
  31.  
  32.  
  33. //@V@:BeginMenu StandardMenu
  34.     static vMenu StandardMenu[] =
  35.       {
  36.     {"&File", M_File, isSens, notUsed, notUsed, noKey, &FileMenu[0]},
  37.     {NULL}
  38.       };
  39. //@V@:EndMenu
  40.  
  41. //@V@:BeginCmdPane ToolBar
  42.     static CommandObject ToolBar[] =
  43.       {
  44.     {C_Button,M_Exit,0,"Quit",NoList,CA_None,isSens,NoFrame,0,0},
  45.     {C_Label,lblSpin,0,"Spin Speed:",NoList,CA_None,isSens,NoFrame,0,0},
  46.     {C_Slider,sldSpeed,0,"",NoList,CA_Horizontal,isSens,NoFrame,0,0},
  47.     {C_EndOfList,0,0,0,0,CA_None,0,0,0}
  48.       };
  49. //@V@:EndCmdPane
  50.  
  51. //@V@:BeginStatPane StatBar
  52.     static vStatus StatBar[] =
  53.       {
  54.     {"OpenGL/V Demo Program", lblTestStat, CA_NoBorder, isSens, 0},
  55.     {0,0,0,0,0}
  56.       };
  57. //@V@:EndStatPane
  58.  
  59. //====================>>> testGLTimer::TimerTick <<<====================
  60.   void testGLTimer::TimerTick()
  61.   {
  62.     cmdw->testGLCanvas->Spin();
  63.   }
  64.  
  65. //====================>>> testGLCmdWindow::testGLCmdWindow <<<====================
  66.   testGLCmdWindow::testGLCmdWindow(char* name, int height, int width) :
  67.     vCmdWindow(name, height, width)
  68.   {
  69.     UserDebug1(Constructor,"testGLCmdWindow::testGLCmdWindow(%s) Constructor\n",name)
  70.  
  71.     // The Menu Bar
  72.     testGLMenu = new vMenuPane(StandardMenu);
  73.     AddPane(testGLMenu);
  74.  
  75.     // The Command Pane
  76.     testGLCmdPane = new vCommandPane(ToolBar);
  77.     AddPane(testGLCmdPane);
  78.  
  79.     // The Canvas
  80.     testGLCanvas = new testGLCanvasPane();
  81.     AddPane(testGLCanvas);
  82.  
  83.     // The Status Bar
  84.     testGLStatus = new vStatusPane(StatBar);
  85.     AddPane(testGLStatus);
  86.  
  87.     _timer = new testGLTimer(this);             // create timer
  88.     _spinSpeed = 0;
  89.  
  90.     // Show Window
  91.  
  92.     ShowWindow();
  93.  
  94.   }
  95.  
  96. //====================>>> testGLCmdWindow::~testGLCmdWindow <<<====================
  97.   testGLCmdWindow::~testGLCmdWindow()
  98.   {
  99.     UserDebug(Destructor,"testGLCmdWindow::~testGLCmdWindow() destructor\n")
  100.  
  101.     // Now put a delete for each new in the constructor.
  102.  
  103.     delete testGLMenu;
  104.     delete testGLCanvas;
  105.     delete testGLCmdPane;
  106.     delete testGLStatus;
  107.   }
  108.  
  109. //====================>>> testGLCmdWindow::KeyIn <<<====================
  110.   void testGLCmdWindow::KeyIn(vKey keysym, unsigned int shift)
  111.   {
  112.     vCmdWindow::KeyIn(keysym, shift);
  113.   }
  114.  
  115. //====================>>> testGLCmdWindow::WindowCommand <<<====================
  116.   void testGLCmdWindow::WindowCommand(ItemVal id, ItemVal val, CmdType cType)
  117.   {
  118.     // Default: route menu and toolbar commands here
  119.  
  120.  
  121.     UserDebug1(CmdEvents,"testGLCmdWindow:WindowCommand(%d)\n",id)
  122.  
  123.     switch (id)
  124.       {
  125.     //@V@:Case M_Exit
  126.     case M_Exit:
  127.       {
  128.         theApp->Exit();
  129.         break;
  130.       }    //@V@:EndCase
  131.  
  132.  
  133.     //@V@:Case btnTestTool
  134.     case sldSpeed:
  135.       {
  136.         if (val != 0)            // Start spinning
  137.           {
  138.         _timer->TimerStop();
  139.         _timer->TimerSet((100-val)*2);
  140.            }
  141.         else
  142.           {
  143.         _timer->TimerStop();
  144.           }
  145.  
  146.         break;
  147.       }    //@V@:EndCase
  148.  
  149.  
  150.     default:        // route unhandled commands up
  151.       {
  152.         vCmdWindow::WindowCommand(id, val, cType);
  153.         break;
  154.       }
  155.       }
  156.   }
  157.