home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / mdi.pak / MDI.CPP < prev    next >
C/C++ Source or Header  |  1997-07-23  |  1KB  |  54 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //----------------------------------------------------------------------------
  4. #include <owl\owlpch.h>
  5. #include <owl\applicat.h>
  6. #include <owl\mdi.h>
  7. #include <owl\mdichild.h>
  8. #include <stdio.h>
  9.  
  10. class TMyMDIClient : public TMDIClient {
  11.   public:
  12.     TMyMDIClient() : TMDIClient() {ChildNum = 0;}
  13.   
  14.     TMDIChild* InitChild();
  15.  
  16.   private:
  17.     WORD ChildNum;
  18.     
  19.   DECLARE_RESPONSE_TABLE (TMyMDIClient);
  20. };
  21.  
  22. DEFINE_RESPONSE_TABLE1(TMyMDIClient, TMDIClient)
  23. END_RESPONSE_TABLE;
  24.  
  25. TMDIChild*
  26. TMyMDIClient::InitChild()
  27. {
  28.   char childName[15];
  29.   sprintf(childName, "MDI Child %d", ChildNum++);
  30.   return new TMDIChild(*this, childName);
  31. }
  32.  
  33. //----------------------------------------------------------------------------
  34.  
  35. class TMDIApp : public TApplication {
  36.   public:
  37.     TMDIApp() : TApplication("MDI Conformist") {}
  38.     void InitMainWindow();
  39. };
  40.  
  41. // Construct the TMDIApp's MainWindow object, loading its menu
  42. //
  43. void
  44. TMDIApp::InitMainWindow()
  45. {
  46.   MainWindow = new TMDIFrame(GetName(), "MDIMenu", *new TMyMDIClient);
  47. }
  48.  
  49. int
  50. OwlMain(int /*argc*/, char* /*argv*/ [])
  51. {
  52.   return TMDIApp().Run();
  53. }
  54.