home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c016 / 3.ddi / CORNEXT.PAK / NXTPPAPP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-08  |  4.4 KB  |  205 lines

  1. /*  Project nextapp
  2.     
  3.     Copyright ⌐ 1993. All Rights Reserved.
  4.  
  5.     SUBSYSTEM:    nextapp.exe Application
  6.     FILE:         nxtppapp.cpp
  7.     AUTHOR:       
  8.  
  9.  
  10.     OVERVIEW
  11.     ========
  12.     Source file for implementation of nextappApp (TApplication).      
  13. */
  14.  
  15.  
  16. #include <owl\owlpch.h>
  17. #pragma hdrstop
  18.  
  19. #include <owl\vbxctl.h>
  20.  
  21.  
  22. #include "nxtppapp.h"
  23. #include "nxtppabd.h"                        // Definition of about dialog.
  24. #include "..\..\INCLUDE\sqcmain.h"
  25.  
  26. //{{nextappApp Implementation}}
  27.  
  28.  
  29. //
  30. // Build a response table for all messages/commands handled
  31. // by the application.
  32. //
  33. DEFINE_RESPONSE_TABLE1(nextappApp, TApplication)
  34. //{{nextappAppRSP_TBL_BEGIN}}
  35.     EV_COMMAND(CM_FILENEW, CmFileNew),
  36.      EV_COMMAND(CM_FILEOPEN, CmFileOpen),
  37.     EV_COMMAND(CM_FILECLOSE, CmFileClose),
  38.     EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
  39.     EV_COMMAND(CM_EXIT, CmExit),
  40. //{{nextappAppRSP_TBL_END}}
  41. END_RESPONSE_TABLE;
  42.  
  43.  
  44. //
  45. // FrameWindow must be derived to override Paint for Preview and Print.
  46. //
  47. class SDIDecFrame : public TDecoratedFrame {
  48. public:
  49.     SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd, BOOL trackMenuSelection = FALSE, TModule *module = 0) :
  50.                 TDecoratedFrame(parent, title, clientWnd, trackMenuSelection, module)
  51.       {  }
  52.     ~SDIDecFrame ()
  53.       {  }
  54. };
  55.  
  56.  
  57. //////////////////////////////////////////////////////////
  58. // nextappApp
  59. // =====
  60. //
  61. nextappApp::nextappApp () : TApplication("FirstApp")
  62. {
  63.  
  64.     // Common file file flags and filters for Open/Save As dialogs.  Filename and directory are
  65.     // computed in the member functions CmFileOpen, and CmFileSaveAs.
  66.     FileData.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
  67.      FileData.SetFilter("All Files (*.*)|*.*|");
  68.  
  69.     // INSERT>> Your constructor code here.
  70.  
  71. }
  72.  
  73.  
  74. nextappApp::~nextappApp ()
  75. {
  76.      // INSERT>> Your destructor code here.
  77.  
  78. }
  79.  
  80.  
  81. //////////////////////////////////////////////////////////
  82. // nextappApp
  83. // =====
  84. // Application intialization.
  85. //
  86. void nextappApp::InitMainWindow ()
  87. {
  88.     Client = new TEditFile(0, 0, 0);
  89.      SDIDecFrame *frame = new SDIDecFrame(0, GetName(), Client, FALSE);
  90.  
  91.     nCmdShow = nCmdShow != SW_SHOWMINIMIZED ? SW_SHOWNORMAL : nCmdShow;
  92.  
  93.      //
  94.     // Assign ICON w/ this application.
  95.     //
  96.     frame->SetIcon(this, IDI_SDIAPPLICATION);
  97.  
  98.     //
  99.     // Menu associated with window and accelerator table associated with table.
  100.     //
  101.     frame->AssignMenu(SDI_MENU);
  102.  
  103.     //
  104.     // Associate with the accelerator table.
  105.     //
  106.      frame->Attr.AccelTable = SDI_MENU;
  107.  
  108.   
  109.     MainWindow = frame;
  110.  
  111. }
  112.  
  113.  
  114. //////////////////////////////////////////////////////////
  115. // nextappApp
  116. // ===========
  117. // Menu File New command
  118. void nextappApp::CmFileNew ()
  119. {
  120.     Client->NewFile();
  121. }
  122.  
  123.  
  124. //////////////////////////////////////////////////////////
  125. // nextappApp
  126. // ===========
  127. // Menu File Open command
  128. void nextappApp::CmFileOpen ()
  129. {
  130.     //
  131.     // Display standard Open dialog box to select a file name.
  132.      //
  133.     *FileData.FileName = 0;
  134.     if (Client->CanClose())
  135.         if (TFileOpenDialog(MainWindow, FileData).Execute() == IDOK)
  136.                 OpenFile();
  137. }
  138.  
  139.  
  140. void nextappApp::OpenFile (const char *fileName)
  141. {
  142.     if (fileName)
  143.         lstrcpy(FileData.FileName, fileName);
  144.  
  145.      Client->ReplaceWith(FileData.FileName);
  146. }
  147.  
  148.  
  149. //////////////////////////////////////////////////////////
  150. // nextappApp
  151. // =====
  152. // Menu File Close command
  153. void nextappApp::CmFileClose ()
  154. {
  155.      if (Client->CanClose())
  156.              Client->DeleteSubText(0, UINT(-1));
  157. }
  158.  
  159.  
  160. //////////////////////////////////////////////////////////
  161. // nextappApp
  162. // ===========
  163. // Menu Help About nextapp.exe command
  164. void nextappApp::CmHelpAbout ()
  165. {
  166.      //
  167.      // Show the modal dialog.
  168.      //
  169.      nextappAboutDlg(MainWindow).Execute();
  170. }
  171.  
  172.  
  173. int OwlMain (int , char* [])
  174. {
  175.      TBIVbxLibrary   vbxSupport;                 // This application has VBX controls.
  176.      nextappApp     App;
  177.      int             result;
  178.  
  179.      SQcConnect(&App.AppHand, &App.Revision);
  180.      result = App.Run();
  181.      SQcDisconnect(App.AppHand);
  182.  
  183.      return result;
  184. }
  185.  
  186. void nextappApp::InitInstance ()
  187. {
  188.      TApplication::InitInstance();
  189.      DocDlg = new TDocDlg(MainWindow, TResId(IDD_DOCTORS));
  190.      DocDlg->Create();
  191.     PatDlg = new TPatDlg(MainWindow, TResId(IDD_PATIENTS));
  192.     PatDlg->Create();
  193.      SQcGo(AppHand,0);
  194. }
  195.  
  196.  
  197. void nextappApp::CmExit ()
  198. {
  199.      delete DocDlg;
  200.      DocDlg = NULL;
  201.      delete PatDlg ;
  202.      PatDlg = NULL ;
  203. }
  204.  
  205.