home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / SDIFILE.PAK / SDIFILE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  1.4 KB  |  61 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1991, 1995 by Borland International, All Rights Reserved
  4. //----------------------------------------------------------------------------
  5. #include <owl/pch.h>
  6. #include <owl/applicat.h>
  7. #include <owl/framewin.h>
  8. #include <owl/editfile.h>
  9. #include <services/cstring.h>
  10.  
  11. class TFileApp : public TApplication {
  12.   public:
  13.     TFileApp() : TApplication("File Window") {}
  14.  
  15.   protected:
  16.     void   InitMainWindow();
  17.     void   CmFileNew();
  18.     void   CmFileOpen();
  19.  
  20.   DECLARE_RESPONSE_TABLE(TFileApp);
  21. };
  22.  
  23. DEFINE_RESPONSE_TABLE1(TFileApp, TApplication)
  24.   EV_COMMAND(CM_FILENEW, CmFileNew),
  25.   EV_COMMAND(CM_FILEOPEN, CmFileOpen),
  26. END_RESPONSE_TABLE;
  27.  
  28. //
  29. // Construct the TFileApp's MainWindow's client of type TEditFile
  30. //
  31. void
  32. TFileApp::InitMainWindow()
  33. {
  34.   MainWindow = new TFrameWindow(0, Name, new TEditFile);
  35.   MainWindow->AssignMenu(IDM_EDITFILE);
  36.   MainWindow->Attr.AccelTable = IDA_EDITFILE;
  37.   MainWindow->SetIcon(this, 201);
  38. }
  39.  
  40. void
  41. TFileApp::CmFileNew()
  42. {
  43.   TEditFile* ef = TYPESAFE_DOWNCAST(MainWindow->GetClientWindow(), TEditFile);
  44.   CHECK(ef);
  45.   ef->NewFile();
  46. }
  47.  
  48. void
  49. TFileApp::CmFileOpen()
  50. {
  51.   TEditFile* ef = TYPESAFE_DOWNCAST(MainWindow->GetClientWindow(), TEditFile);
  52.   CHECK(ef);
  53.   ef->Open();
  54. }
  55.  
  56. int
  57. OwlMain(int /*argc*/, char* /*argv*/ [])
  58. {
  59.   return TFileApp().Run();
  60. }
  61.