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

  1. //----------------------------------------------------------------------------
  2. //  Project Shell
  3. //  Borland International
  4. //  Copyright ⌐ 1995, 1996 Borland International. All Rights Reserved.
  5. //
  6. //  SUBSYSTEM:    shell.exe Application
  7. //  FILE:         mdiclien.cpp
  8. //  AUTHOR:       The OWL Team
  9. //
  10. //  OVERVIEW
  11. //  ~~~~~~~~
  12. //  Source file for implementation of TShellMDIClient (TMDIClient).
  13. //
  14. //----------------------------------------------------------------------------
  15.  
  16. #include <owl/pch.h>
  17. #include <stdio.h>
  18.  
  19. #include "shellapp.h"
  20. #include "shellwin.h"
  21. #include "mdichild.h"
  22. #include "mdiclien.h"
  23.  
  24.  
  25. //{{TShellMDIClient Implementation}}
  26.  
  27.  
  28. //
  29. // Build a response table for all messages/commands handled
  30. // by TShellMDIClient derived from TMDIClient.
  31. //
  32. DEFINE_RESPONSE_TABLE1(TShellMDIClient, TMDIClient)
  33. //{{ShellMDIClientRSP_TBL_BEGIN}}
  34.   EV_COMMAND(CM_MDIFILENEW, CmFileNew),
  35. //{{ShellMDIClientRSP_TBL_END}}
  36. END_RESPONSE_TABLE;
  37.  
  38.  
  39. //--------------------------------------------------------
  40. // TShellMDIClient
  41. // ~~~~~~~~~~~
  42. // Construction/Destruction handling.
  43. //
  44. TShellMDIClient::TShellMDIClient(TModule* module)
  45. :
  46.   TMDIClient(module)
  47. {
  48.   // Change the window's background color
  49.   //
  50.   SetBkgndColor(GetSysColor(COLOR_WINDOW));
  51.  
  52.   ChildCount = 0;
  53.  
  54.   // INSERT>> Your constructor code here.
  55.  
  56. }
  57.  
  58.  
  59. TShellMDIClient::~TShellMDIClient()
  60. {
  61.   Destroy();
  62.  
  63.   // INSERT>> Your destructor code here.
  64.  
  65. }
  66.  
  67.  
  68. //--------------------------------------------------------
  69. // TShellMDIClient
  70. // ~~~~~~~~~~~
  71. // MDIClient site initialization.
  72. //
  73. void TShellMDIClient::SetupWindow()
  74. {
  75.   TMDIClient::SetupWindow();
  76. }
  77.  
  78.  
  79. //--------------------------------------------------------
  80. // TShellMDIClient
  81. // ~~~~~~~~~~~
  82. // Menu File New command
  83. //
  84. void TShellMDIClient::CmFileNew()
  85. {
  86.   MyFileNew();
  87. }
  88.  
  89.  
  90. void TShellMDIClient::MyFileNew(TShellItem* item)
  91. {
  92.   char    title[255];
  93.  
  94.   // Generate a title for the MDI child window.
  95.   //
  96.   title[0] = '\0';
  97.  
  98.   TShellMDIChild* child = new TShellMDIChild(*this, title, 0, item);
  99.  
  100.   // If the current active MDI child is maximize then this one should be also.
  101.   //
  102.   TShellMDIChild* curChild = (TShellMDIChild *)GetActiveMDIChild();
  103.   if (curChild && (curChild->GetWindowLong(GWL_STYLE) & WS_MAXIMIZE))
  104.     child->Attr.Style |= WS_MAXIMIZE;
  105.  
  106.   child->Create();
  107. }
  108.  
  109.