home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / mobjm260 / smchild.cp_ / smchild.cp
Encoding:
Text File  |  1994-09-06  |  1.9 KB  |  82 lines

  1. //    Microworks ObjectMate  2.6
  2. //
  3. //  "SFX Class Library"
  4. //
  5. //    An ObjectWindows 2.0 extension for Borland C++ 4.0
  6. //
  7. //    Copyright 1992-94 Microworks Sydney, Australia.
  8. //
  9. //  SMCHILD.CPP
  10.  
  11. #include <owl\owlpch.h>
  12. #include <sfx\sfx200.h>
  13. #include <sfx\smchild.h>
  14.  
  15. DEFINE_RESPONSE_TABLE1(TSFXMDIChild, TMDIChild)
  16.   EV_WM_CTLCOLOR,
  17. END_RESPONSE_TABLE;
  18.  
  19. // constructor for a TSFXMDIChild object
  20.  
  21. TSFXMDIChild::TSFXMDIChild(TMDIClient&     parent,
  22.                                     const char far* title,
  23.                                     TWindow*        clientWnd,
  24.                                     BOOL            sfxFrame,
  25.                                     BOOL            sfxCaption,
  26.                                     BOOL            shrinkToClient,
  27.                                  TModule*        module)
  28.     :TMDIChild(parent, title, clientWnd, shrinkToClient, module)
  29. {
  30.     if (sfxFrame)
  31.         Attr.Style |= MWS_SFXFRAME;
  32.     else
  33.         Attr.Style |= MWS_3DFRAME;
  34.     if (sfxCaption)
  35.         Attr.Style |= MWS_SFXCAPTION;
  36. }
  37.  
  38. void
  39. TSFXMDIChild::SetupWindow()
  40. {
  41.     TMDIChild::SetupWindow();
  42.     if (Attr.Style & MWS_SFXFRAME)
  43.     {
  44.         ::SetClassWord((HWND) ClientWnd->HWindow, GCW_HBRBACKGROUND,
  45.                        (UINT) GetStockObject(LTGRAY_BRUSH));
  46.     }
  47. }
  48.  
  49. HBRUSH
  50. TSFXMDIChild::EvCtlColor(HDC hdc, HWND hWndChild, UINT ctlType)
  51. {
  52.     if (Attr.Style & MWS_SFXFRAME && ctlType == CTLCOLOR_EDIT)
  53.     {
  54.         SetBkColor(hdc, RGB(192, 192, 192));
  55.         SetBkMode(hdc, OPAQUE);
  56.         return (HBRUSH)::GetStockObject(LTGRAY_BRUSH);
  57.     }
  58.     return TMDIChild::EvCtlColor(hdc, hWndChild, ctlType);
  59. }
  60.  
  61. LRESULT
  62. TSFXMDIChild::DefWindowProc(UINT msg, WPARAM wParam, LPARAM lParam)
  63. {
  64.     return SFXDefMDIChildProc(HWindow, msg, wParam, lParam);
  65. }
  66.  
  67. IMPLEMENT_STREAMABLE3(TSFXMDIChild, TMDIChild, TFrameWindow, TWindow);
  68.  
  69. void*
  70. TSFXMDIChild::Streamer::Read(ipstream& is, uint32 /*version*/) const
  71. {
  72.   ReadVirtualBase((TMDIChild*)GetObject(), is);
  73.   return GetObject();
  74. }
  75.  
  76. void
  77. TSFXMDIChild::Streamer::Write(opstream& os) const
  78. {
  79.   WriteVirtualBase((TMDIChild*)GetObject(), os);
  80. }
  81.  
  82.