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

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