home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 11.ddi / OWLSRC.PAK / CLIPVIEW.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  1.9 KB  |  92 lines

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