home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / owlsrc.pak / CLIPVIEW.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-24  |  1.9 KB  |  94 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // (C) Copyright 1992, 1994 by Borland International, All Rights Reserved
  4. //
  5. //   implementation of class TClipboardViewer
  6. //----------------------------------------------------------------------------
  7. #include <owl/owlpch.h>
  8. #include <owl/clipview.h>
  9.  
  10. //
  11. // We only want to search this mixin for events, so don't include any base
  12. // classes in Find()
  13. //
  14. DEFINE_RESPONSE_TABLE(TClipboardViewer)
  15.   EV_WM_CHANGECBCHAIN,
  16.   EV_WM_DESTROY,
  17.   EV_WM_DRAWCLIPBOARD,
  18. END_RESPONSE_TABLE;
  19.  
  20. IMPLEMENT_CASTABLE(TClipboardViewer);
  21.  
  22. //
  23. // Rely on TWindow's default ctor since we will always be mixed-in and another
  24. // window will perform Init()
  25. //
  26. TClipboardViewer::TClipboardViewer()
  27. {
  28.   HWndNext = 0;
  29. }
  30.  
  31. TClipboardViewer::TClipboardViewer(HWND hWnd, TModule*   module)
  32. :
  33.   TWindow(hWnd, module)
  34. {
  35. }
  36.  
  37. TEventStatus
  38. TClipboardViewer::DoChangeCBChain(HWND hWndRemoved, HWND hWndNext)
  39. {
  40.   if (hWndRemoved == HWndNext)
  41.     HWndNext = hWndNext;
  42.  
  43.   else
  44.     ForwardMessage(HWndNext);
  45.   return esComplete;
  46. }
  47.  
  48. TEventStatus
  49. TClipboardViewer::DoDrawClipboard()
  50. {
  51.   if (HWndNext)
  52.     ForwardMessage(HWndNext);
  53.   return esPartial;
  54. }
  55.  
  56. TEventStatus
  57. TClipboardViewer::DoDestroy()
  58. {
  59.   ::ChangeClipboardChain(HWindow, HWndNext);
  60.   return esPartial;
  61. }
  62.  
  63. void
  64. TClipboardViewer::SetupWindow()
  65. {
  66.   HWndNext = ::SetClipboardViewer(HWindow);
  67. }
  68.  
  69. void
  70. TClipboardViewer::EvChangeCBChain(HWND hWndRemoved, HWND hWndNext)
  71. {
  72.   if (hWndRemoved == HWndNext)
  73.     HWndNext = hWndNext;
  74.  
  75.   else
  76.     ForwardMessage(HWndNext);
  77. }
  78.  
  79. void
  80. TClipboardViewer::EvDrawClipboard()
  81. {
  82.   if (DoDrawClipboard() == esComplete)
  83.     return;
  84.   TWindow::EvDrawClipboard();
  85. }
  86.  
  87. void
  88. TClipboardViewer::EvDestroy()
  89. {
  90.   if (DoDestroy() == esComplete)
  91.     return;
  92.   TWindow::EvDestroy();
  93. }
  94.