home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / po7_win / object10 / bltstapp.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-15  |  3.0 KB  |  141 lines

  1. /*  Project bltest
  2.     
  3.     Copyright ⌐ 1994. All Rights Reserved.
  4.  
  5.     SUBSYSTEM:    bltest.exe Application
  6.     FILE:         bltstapp.cpp
  7.     AUTHOR:       
  8.  
  9.  
  10.     OVERVIEW
  11.     ========
  12.     Source file for implementation of bltestApp (TApplication).      
  13. */
  14.  
  15.  
  16. #include <owl\owlpch.h>
  17. #pragma hdrstop
  18.  
  19.  
  20. #include "bltstapp.h"
  21. #include "bltstabd.h"                        // Definition of about dialog.       
  22. #include "bltstdlg.h"
  23. #include <oracl.h> 
  24.  
  25. //{{bltestApp Implementation}}
  26.  
  27.  
  28. //
  29. // Build a response table for all messages/commands handled
  30. // by the application.
  31. //
  32. DEFINE_RESPONSE_TABLE1(bltestApp, TApplication)
  33. //{{bltestAppRSP_TBL_BEGIN}}
  34.     EV_COMMAND(CM_FILENEW, CmFileNew),
  35.      EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
  36. //{{bltestAppRSP_TBL_END}}
  37. END_RESPONSE_TABLE;
  38.  
  39.  
  40. //
  41. // FrameWindow must be derived to override Paint for Preview and Print.
  42. //
  43. class SDIDecFrame : public TDecoratedFrame {
  44. public:
  45.      SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd, BOOL trackMenuSelection = FALSE, TModule *module = 0) :
  46.                 TDecoratedFrame(parent, title, clientWnd, trackMenuSelection, module)
  47.         {  }
  48.      ~SDIDecFrame ()
  49.         {  }
  50. };
  51.  
  52.  
  53. //////////////////////////////////////////////////////////
  54. // bltestApp
  55. // =====
  56. //
  57. bltestApp::bltestApp () : TApplication("bltest")
  58. {
  59.  
  60.      // Common file file flags and filters for Open/Save As dialogs.  Filename and directory are
  61.      // computed in the member functions CmFileOpen, and CmFileSaveAs.
  62.      FileData.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
  63.      FileData.SetFilter("All Files (*.*)|*.*|");
  64.  
  65.      // INSERT>> Your constructor code here.
  66.      OStartup();
  67. }
  68.  
  69.  
  70. bltestApp::~bltestApp ()
  71. {
  72.      // INSERT>> Your destructor code here.
  73.          OShutdown();
  74. }
  75.  
  76.  
  77. //////////////////////////////////////////////////////////
  78. // bltestApp
  79. // =====
  80. // Application intialization.
  81. //
  82. void bltestApp::InitMainWindow ()
  83. {
  84.      Client = new TWindow(0, "");
  85.      SDIDecFrame *frame = new SDIDecFrame(0, GetName(), Client, FALSE);
  86.  
  87.      nCmdShow = nCmdShow != SW_SHOWMINIMIZED ? SW_SHOWNORMAL : nCmdShow;
  88.  
  89.      //
  90.      // Assign ICON w/ this application.
  91.      //
  92.      frame->SetIcon(this, IDI_SDIAPPLICATION);
  93.  
  94.      //
  95.      // Menu associated with window and accelerator table associated with table.
  96.     //
  97.      frame->AssignMenu(SDI_MENU);
  98.     
  99.      //
  100.     // Associate with the accelerator table.
  101.      //
  102.     frame->Attr.AccelTable = SDI_MENU;
  103.  
  104.   
  105.      MainWindow = frame;
  106.  
  107. }
  108.  
  109.  
  110. //////////////////////////////////////////////////////////
  111. // bltestApp
  112. // ===========
  113. // Menu File New command
  114. void bltestApp::CmFileNew ()
  115. {
  116.     bltestDlg(MainWindow).Execute();
  117. }
  118.  
  119. //////////////////////////////////////////////////////////
  120. // bltestApp
  121. // ===========
  122. // Menu Help About bltest.exe command
  123. void bltestApp::CmHelpAbout ()
  124. {
  125.      //
  126.      // Show the modal dialog.
  127.      //
  128.      bltestAboutDlg(MainWindow).Execute();
  129. }
  130.  
  131.  
  132. int OwlMain (int , char* [])
  133. {
  134.      bltestApp     App;
  135.      int             result;
  136.  
  137.      result = App.Run();
  138.  
  139.      return result;
  140. }
  141.