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

  1. //================================================================
  2. //  viedapp.cxx:     Source file for V Icon Editor application
  3. //
  4. //    Copyright (C) 1995,1996  Bruce E. Wampler
  5. //
  6. //    This program is free software; you can redistribute it and/or modify
  7. //    it under the terms of the GNU General Public License as published by
  8. //    the Free Software Foundation; either version 2 of the License, or
  9. //    (at your option) any later version.
  10. //
  11. //    This program is distributed in the hope that it will be useful,
  12. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. //    GNU General Public License for more details.
  15. //
  16. //    You should have received a copy of the GNU General Public License
  17. //    along with this program; if not, write to the Free Software
  18. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. //
  20. //================================================================
  21.  
  22. #include "viedapp.h"    // our header
  23.  
  24. //==================>>> drawApp::NewAppWin <<<====================
  25.   vWindow* drawApp::NewAppWin(vWindow* win, char* name, int w, int h,
  26.                               vAppWinInfo* winInfo)
  27.   {
  28.     // Create a new Icon Editor window
  29.     vWindow* thisWin = win;             // local copy to use
  30.     vAppWinInfo* awinfo = winInfo;
  31.  
  32.     if (!thisWin)                       // need to new a window
  33.       {
  34.         thisWin = new myCmdWindow(name, w, h);
  35.       }
  36.  
  37.     if (!awinfo)
  38.         awinfo = new vAppWinInfo(name);
  39.  
  40.     return vApp::NewAppWin(thisWin, name, w, h, awinfo);
  41.   }
  42.  
  43. //======================>>> drawApp::AppCommand <<<=====================
  44.   void drawApp::AppCommand(vWindow* win, ItemVal id, ItemVal val, CmdType cType)
  45.   {
  46.     // Any commands not processed by the window will be passed along to here for
  47.     // default treatment.
  48.  
  49.     UserDebug1(Build,"drawApp::AppCommand(ID: %d)\n",id);
  50.  
  51.     vApp::AppCommand(win, id, val, cType);
  52.   }
  53.  
  54. //======================>>> drawApp::Exit <<<=====================
  55.   void drawApp::Exit(void)
  56.   {
  57.     // This is called to close all windows.
  58.  
  59.     vApp::Exit();       // easy default behavior
  60.   }
  61.  
  62. //====================>>> drawApp::CloseAppWin <<<================
  63.   int drawApp::CloseAppWin(vWindow* win)
  64.   {
  65.     // Closes the application window 
  66.  
  67.     myCmdWindow* cw = (myCmdWindow*)win;
  68.     if (cw->CheckClose())
  69.         return vApp::CloseAppWin(win);
  70.     else
  71.         return 0;
  72.   }
  73.  
  74.  
  75. //***** EVERY V application needs to declare an app instance *****
  76. static drawApp draw_App("Icon Edit");    // The instance of the app
  77.  
  78.  
  79. //========================>>> AppMain <<<=========================
  80.   int AppMain(int argc, char** argv)
  81.   {
  82.     // Use AppMain to create the main window
  83.  
  84.     myCmdWindow* cw =           // open new window, remember it
  85.         (myCmdWindow*) theApp->NewAppWin(0, "V Icon Edit - No Name",400,200);
  86.     if (argc > 1)
  87.       {
  88.         theApp->CheckEvents();  // make sure events done before opening
  89.         cw->OpenFile(argv[1]);  // open a file
  90.       }
  91.  
  92.     return 0;           // 0 means OK
  93.   }
  94.