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

  1. //=======================================================================
  2. //      vgapp.cpp:      Source for vgApp class
  3. //=======================================================================
  4.  
  5. #include "vgapp.h"              // Header file
  6.  
  7. //=========================>>> vgApp::vgApp <<<==========================
  8.   vgApp::vgApp(char* name, int sdi) : vApp(name, sdi)
  9.   {
  10.     // Constructor
  11.  
  12.    _vgCmdWin = 0;
  13.  
  14.   }
  15.  
  16. //=========================>>> vgApp::vgApp <<<==========================
  17.   vgApp::~vgApp()
  18.   {
  19.     // Desstructor
  20.    
  21.  
  22.   }
  23.  
  24. //=====================>>> vgApp::NewAppWin <<<==========================
  25.   vWindow* vgApp::NewAppWin(vWindow* win, char* name, 
  26.     int w, int h, vAppWinInfo* winInfo)
  27.   {
  28.     vAppWinInfo* awinfo = winInfo;
  29.     char *vgname = name;
  30.  
  31.     if (!*name)
  32.       {
  33.         vgname = "V Shell App Generator";               // Default name
  34.       }
  35.         
  36.     UserDebug1(Build,"vgApp::NewAppWin(%s)\n",vgname);
  37.  
  38.     // Create the first window using provided CmdWindow
  39.  
  40.     _vgCmdWin = (vgCmdWindow*) win;
  41.     if (!_vgCmdWin)
  42.       {
  43.         _vgCmdWin = new vgCmdWindow(vgname, w, h);
  44.       }
  45.  
  46.     if (!awinfo)
  47.         awinfo = new vAppWinInfo(vgname);
  48.  
  49.     return vApp::NewAppWin(_vgCmdWin, vgname, w, h, awinfo);
  50.   }
  51.  
  52. //============================>>> vgApp::Exit <<<===========================
  53.   void vgApp::Exit(void)
  54.   {
  55.     // This is called to close all windows.
  56.  
  57.     UserDebug(Build,"vgApp::Exit()\n");
  58.  
  59.     vApp::Exit();               // Default behavior
  60.   }
  61.  
  62. //======================>>> vgApp::CloseAppWin <<<===========================
  63.   int vgApp::CloseAppWin(vWindow* win)
  64.   {
  65.     // This will be called BEFORE a window has been unregistered or
  66.     // closed.  Default behavior: unregister and close the window.
  67.  
  68.     UserDebug(Build,"vgApp::CloseAppWin()\n");
  69.  
  70.     return vApp::CloseAppWin(win);
  71.   }
  72.  
  73. //=====================>>> vgApp::AppCommand <<<==============================
  74.   void vgApp::AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType)
  75.   {
  76.     // Commands not processed by the window will be passed here
  77.  
  78.     UserDebug1(Build,"vgApp::AppCmd(ID: %d)\n",id);
  79.     vApp::AppCommand(win, id, val, cType);
  80.   }
  81.  
  82. //=========================>>> vgApp::KeyIn <<<==============================
  83.   void vgApp::KeyIn(vWindow* win, vKey key, unsigned int shift)
  84.   {
  85.     // Key strokes not processed by the window will be passed here
  86.  
  87.     vApp::KeyIn(win, key, shift);
  88.   }
  89.  
  90. //###########################################################################
  91.  
  92.   static vgApp vg_App("V Shell App Generator",1);       // The instance of the app
  93.  
  94. //============================>>> AppMain <<<==============================
  95.   int AppMain(int argc, char** argv)
  96.   {
  97.     // Use AppMain to create the main window
  98.  
  99.     (void) theApp->NewAppWin(0, "V Shell App Generator",600, 300);
  100.  
  101.     return 0;
  102.   }
  103.