home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch08 / oserver / oserve~2.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-16  |  2.5 KB  |  103 lines

  1. // OServerView.cpp : implementation of the COServerView class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "OServer.h"
  6.  
  7. #include "OServerDoc.h"
  8. #include "OServerView.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // COServerView
  18.  
  19. IMPLEMENT_DYNCREATE(COServerView, CView)
  20.  
  21. BEGIN_MESSAGE_MAP(COServerView, CView)
  22.     //{{AFX_MSG_MAP(COServerView)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     ON_COMMAND(ID_CANCEL_EDIT_SRVR, OnCancelEditSrvr)
  26.     //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30. // COServerView construction/destruction
  31.  
  32. COServerView::COServerView()
  33. {
  34.     // TODO: add construction code here
  35.  
  36. }
  37.  
  38. COServerView::~COServerView()
  39. {
  40. }
  41.  
  42. BOOL COServerView::PreCreateWindow(CREATESTRUCT& cs)
  43. {
  44.     // TODO: Modify the Window class or styles here by modifying
  45.     //  the CREATESTRUCT cs
  46.  
  47.     return CView::PreCreateWindow(cs);
  48. }
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // COServerView drawing
  52.  
  53. void COServerView::OnDraw(CDC* pDC)
  54. {
  55.     COServerDoc* pDoc = GetDocument();
  56.     ASSERT_VALID(pDoc);
  57.  
  58.     CRect r;
  59.     GetClientRect(&r);
  60.  
  61.  
  62.     // By adding code here, you can control what type of information
  63.     //  is viewed in the server while it is being editted.
  64.     pDC->DrawText("Using Visual C++ 4.0, Special Edition",
  65.                   &r, DT_CENTER | DT_WORDBREAK);
  66.  
  67. }
  68.  
  69. /////////////////////////////////////////////////////////////////////////////
  70. // OLE Server support
  71.  
  72. // The following command handler provides the standard keyboard
  73. //  user interface to cancel an in-place editing session.  Here,
  74. //  the server (not the container) causes the deactivation.
  75. void COServerView::OnCancelEditSrvr()
  76. {
  77.     GetDocument()->OnDeactivateUI(FALSE);
  78. }
  79.  
  80. /////////////////////////////////////////////////////////////////////////////
  81. // COServerView diagnostics
  82.  
  83. #ifdef _DEBUG
  84. void COServerView::AssertValid() const
  85. {
  86.     CView::AssertValid();
  87. }
  88.  
  89. void COServerView::Dump(CDumpContext& dc) const
  90. {
  91.     CView::Dump(dc);
  92. }
  93.  
  94. COServerDoc* COServerView::GetDocument() // non-debug version is inline
  95. {
  96.     ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(COServerDoc)));
  97.     return (COServerDoc*)m_pDocument;
  98. }
  99. #endif //_DEBUG
  100.  
  101. /////////////////////////////////////////////////////////////////////////////
  102. // COServerView message handlers
  103.