home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / appwiz / hierwiz / template / textview.cpp < prev    next >
C/C++ Source or Header  |  1998-03-05  |  2KB  |  93 lines

  1. // TextView.cpp : implementation file
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp and/or WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "$$root$$.h"
  15. #include "textview.h"
  16. #include "svrdoc.h"
  17.  
  18. #ifdef _DEBUG
  19. #undef THIS_FILE
  20. static char BASED_CODE THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CTextView
  25.  
  26. IMPLEMENT_DYNCREATE(CTextView, CEditView)
  27.  
  28. CTextView::CTextView()
  29. {
  30. }
  31.  
  32. CTextView::~CTextView()
  33. {
  34. }
  35.  
  36.  
  37. BEGIN_MESSAGE_MAP(CTextView, CEditView)
  38.     //{{AFX_MSG_MAP(CTextView)
  39.         // NOTE - the ClassWizard will add and remove mapping macros here.
  40.     //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42.  
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CTextView drawing
  46.  
  47. void CTextView::OnDraw(CDC* pDC)
  48. {
  49.     CDocument* pDoc = GetDocument();
  50.     // TODO: add draw code here
  51. }
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CTextView diagnostics
  55.  
  56. #ifdef _DEBUG
  57. void CTextView::AssertValid() const
  58. {
  59.     CEditView::AssertValid();
  60. }
  61.  
  62. void CTextView::Dump(CDumpContext& dc) const
  63. {
  64.     CEditView::Dump(dc);
  65. }
  66. #endif //_DEBUG
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CTextView message handlers
  70.  
  71. void CTextView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
  72. {
  73.     RedrawText() ;
  74. }
  75.  
  76. void CTextView::RedrawText()
  77. {
  78.     CString TextBuf ;
  79.     // Get the text from the hierView
  80.     CServerDoc* pServerDoc = (CServerDoc * ) GetDocument();
  81.     pServerDoc->GetTreeText(&TextBuf,NULL) ;
  82.     GetEditCtrl().SetTabStops(10) ;
  83.     GetEditCtrl().SetWindowText(TextBuf) ;
  84.     GetEditCtrl().SetReadOnly(TRUE) ;
  85. }
  86.  
  87. void CTextView::OnInitialUpdate()
  88. {
  89.     // TODO: Add your specialized code here and/or call the base class
  90.  
  91.     CEditView::OnInitialUpdate();
  92. }
  93.