home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vos2-121.zip / v / vopengl / gears / gearcmdw.cpp < prev    next >
C/C++ Source or Header  |  1998-07-07  |  5KB  |  213 lines

  1. //=======================================================================
  2. //@V@:Note: This file generated by vgen V1.04 (10:25:37 22 Jun 1998).
  3. //    gearcmdw.cpp:    Source for gearCmdWindow class
  4. //=======================================================================
  5.  
  6. #include <v/vnotice.h>    // for vNoticeDialog
  7. #include <v/vkeys.h>    // to map keysi
  8. #include <v/vutil.h>
  9.  
  10. #include "gearcmdw.h"    // our header
  11.  
  12. //    Start defines for the main window with 100
  13.  
  14. //@V@:BeginIDs
  15.     enum {
  16.     m_FirstCmd = 100, // Dummy Command
  17.     cmdAuxTimer,    // AuxTimer
  18.     blkLast        // Last item
  19.       };
  20. //@V@:EndIDs
  21.  
  22. //@V@:BeginPulldownMenu FileMenu
  23.     static vMenu FileMenu[] =
  24.       {
  25.     {"&New", M_New, isSens, notChk, noKeyLbl, noKey, noSub},
  26.     {"&Open...", M_Open, isSens, notChk, noKeyLbl, noKey, noSub},
  27.     {"&Save", M_Save, isSens, notChk, noKeyLbl, noKey, noSub},
  28.     {"Save &as...", M_SaveAs, isSens, notChk, noKeyLbl, noKey, noSub},
  29.     {"&Close...", M_CloseFile, isSens, notChk, noKeyLbl, noKey, noSub},
  30.     {"-", M_Line, notSens, notChk, noKeyLbl, noKey, noSub},
  31.     {"E&xit", M_Exit, isSens, notChk, noKeyLbl, noKey, noSub},
  32.     {NULL}
  33.       };
  34. //@V@:EndPulldownMenu
  35.  
  36. //@V@:BeginPulldownMenu EditMenu
  37.     static vMenu EditMenu[] =
  38.       {
  39.     {"Cut  ", M_Cut, isSens, notChk, "Ctrl-X", 'X'-'@', noSub},
  40.     {"Copy ", M_Copy, isSens, notChk, "Ctrl-C", 'C'-'@', noSub},
  41.     {"Paste", M_Paste, isSens, notChk, "Ctrl-V", 'V'-'@', noSub},
  42.     {NULL}
  43.       };
  44. //@V@:EndPulldownMenu
  45.  
  46. //@V@:BeginMenu StandardMenu
  47.     static vMenu StandardMenu[] =
  48.       {
  49.     {"&File", M_File, isSens, notUsed, notUsed, noKey, &FileMenu[0]},
  50.     {"&Edit", M_Edit, isSens, notUsed, notUsed, noKey, &EditMenu[0]},
  51.     {NULL}
  52.       };
  53. //@V@:EndMenu
  54.  
  55. //@V@:BeginCmdPane ToolBar
  56.     static CommandObject ToolBar[] =
  57.       {
  58.     {C_Button,M_Exit,0,"Exit",NoList,CA_None,isSens,NoFrame,0,0},
  59.     {C_EndOfList,0,0,0,0,CA_None,0,0,0}
  60.       };
  61. //@V@:EndCmdPane
  62.  
  63. //====================>>> gearAuxTimer::TimerTick <<<====================
  64.   void gearAuxTimer::TimerTick()
  65.   {
  66.     cmdw->WindowCommand(cmdAuxTimer, cmdAuxTimer, C_Button); // update clock
  67.   }
  68.  
  69. //====================>>> gearCmdWindow::gearCmdWindow <<<====================
  70.   gearCmdWindow::gearCmdWindow(char* name, int width, int height) :
  71.     vCmdWindow(name, width, height)
  72.   {
  73.     UserDebug1(Constructor,"gearCmdWindow::gearCmdWindow(%s) Constructor\n",name)
  74.  
  75.     // The Menu Bar
  76.     gearMenu = new vMenuPane(StandardMenu);
  77.     AddPane(gearMenu);
  78.  
  79.     // The Command Pane
  80.     gearCmdPane = new vCommandPane(ToolBar);
  81.     AddPane(gearCmdPane);
  82.  
  83.     // The Canvas
  84.     gearCanvas = new gearOGLCanvasPane;
  85.     AddPane(gearCanvas);
  86.  
  87.     _auxTimer = new gearAuxTimer(this);    // create aux timer
  88.     _auxTimer->TimerSet(30);        // 30 ms second intervals
  89.     // Associated dialogs
  90.  
  91.     
  92.     // Show Window
  93.  
  94.     ShowWindow();
  95.     WindowCommand(cmdAuxTimer,cmdAuxTimer,C_Button);    // update clock
  96.   }
  97.  
  98. //====================>>> gearCmdWindow::~gearCmdWindow <<<====================
  99.   gearCmdWindow::~gearCmdWindow()
  100.   {
  101.     UserDebug(Destructor,"gearCmdWindow::~gearCmdWindow() destructor\n")
  102.  
  103.     // Now put a delete for each new in the constructor.
  104.  
  105.     delete gearMenu;
  106.     delete gearCanvas;
  107.     delete gearCmdPane;
  108.     _auxTimer->TimerStop();    // end it
  109.     delete _auxTimer;    // free it
  110.   }
  111.  
  112. //====================>>> gearCmdWindow::KeyIn <<<====================
  113.   void gearCmdWindow::KeyIn(vKey keysym, unsigned int shift)
  114.   {
  115.     vBeep();
  116.     vCmdWindow::KeyIn(keysym, shift);
  117.   }
  118.  
  119. //====================>>> gearCmdWindow::WindowCommand <<<====================
  120.   void gearCmdWindow::WindowCommand(ItemVal id, ItemVal val, CmdType cType)
  121.   {
  122.     // Default: route menu and toolbar commands here
  123.  
  124.  
  125.     UserDebug1(CmdEvents,"gearCmdWindow:WindowCommand(%d)\n",id)
  126.  
  127.     switch (id)
  128.       {
  129.     //@V@:Case M_New
  130.     case M_New:
  131.       {
  132.         vNoticeDialog note(this);
  133.         note.Notice("New");
  134.         break;
  135.       }    //@V@:EndCase
  136.  
  137.     //@V@:Case M_Open
  138.     case M_Open:
  139.       {
  140.         vNoticeDialog note(this);
  141.         note.Notice("Open");
  142.         break;
  143.       }    //@V@:EndCase
  144.  
  145.     //@V@:Case M_Save
  146.     case M_Save:
  147.       {
  148.         vNoticeDialog note(this);
  149.         note.Notice("Save");
  150.         break;
  151.       }    //@V@:EndCase
  152.  
  153.     //@V@:Case M_SaveAs
  154.     case M_SaveAs:
  155.       {
  156.         vNoticeDialog note(this);
  157.         note.Notice("Save As");
  158.         break;
  159.       }    //@V@:EndCase
  160.  
  161.     //@V@:Case M_CloseFile
  162.     case M_CloseFile:
  163.       {
  164.         vNoticeDialog note(this);
  165.         note.Notice("Close File");
  166.         break;
  167.       }    //@V@:EndCase
  168.  
  169.     //@V@:Case M_Exit
  170.     case M_Exit:
  171.       {
  172.         theApp->Exit();
  173.         break;
  174.       }    //@V@:EndCase
  175.  
  176.     //@V@:Case M_Cut
  177.     case M_Cut:
  178.       {
  179.         vNoticeDialog note(this);
  180.         note.Notice("Cut");
  181.         break;
  182.       }    //@V@:EndCase
  183.  
  184.     //@V@:Case M_Copy
  185.     case M_Copy:
  186.       {
  187.         vNoticeDialog note(this);
  188.         note.Notice("Copy");
  189.         break;
  190.       }    //@V@:EndCase
  191.  
  192.     //@V@:Case M_Paste
  193.     case M_Paste:
  194.       {
  195.         vNoticeDialog note(this);
  196.         note.Notice("Paste");
  197.         break;
  198.       }    //@V@:EndCase
  199.  
  200.     //@V@:Case auxTimer
  201.     case cmdAuxTimer:    // Event from aux timer
  202.       {
  203.         gearCanvas->TimerAnimate();
  204.         break;
  205.       }    //@V@:EndCase
  206.     default:        // route unhandled commands up
  207.       {
  208.         vCmdWindow::WindowCommand(id, val, cType);
  209.         break;
  210.       }
  211.       }
  212.   }
  213.