home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c07 / lab03 / ex01 / textview.h < prev   
Encoding:
C/C++ Source or Header  |  1997-02-20  |  2.0 KB  |  71 lines

  1. // TextView.h : interface of the CTextView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. class CTextView : public CScrollView
  6. {
  7. protected: // create from serialization only
  8.     CTextView();
  9.     DECLARE_DYNCREATE(CTextView)
  10.  
  11. // Attributes
  12. public:
  13.     CTextDoc*    GetDocument();
  14.     CFont*        GetFont();
  15.     CSize        GetDocSize() const { return m_DocSize; }
  16.     CSize        GetCharSize() const { return m_ViewCharSize; }
  17.  
  18. // Operations
  19. public:
  20.  
  21. // Overrides
  22.     // ClassWizard generated virtual function overrides
  23.     //{{AFX_VIRTUAL(CTextView)
  24.     public:
  25.     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  26.     virtual void OnDraw(CDC* pDC, int nFirstLn, int nLastLn, int nXPos = 0, int nYPos = 0);   
  27.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  28.     protected:
  29.     //virtual void OnInitialUpdate(); // called first time after construct
  30.     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  31.     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  32.     virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  33.     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  34.     //}}AFX_VIRTUAL
  35.  
  36. // Implementation
  37. public:
  38.     virtual ~CTextView();
  39. #ifdef _DEBUG
  40.     virtual void AssertValid() const;
  41.     virtual void Dump(CDumpContext& dc) const;
  42. #endif
  43.  
  44. protected:
  45.     CSize     m_ViewCharSize;        //    Dimensions of screen character
  46.                                 //    in device units
  47.     CSize    m_DocSize;            //    Document size in device units
  48.     CFont*    m_pFont;            //    Current font
  49.  
  50.  
  51.  
  52.     void ComputeViewMetrics();
  53.     void ComputeVisibleLines(CDC* pDC, int& nFirst, int& nLast);
  54.  
  55.  
  56. // Generated message map functions
  57. protected:
  58.     //{{AFX_MSG(CTextView)
  59.         // NOTE - the ClassWizard will add and remove member functions here.
  60.         //    DO NOT EDIT what you see in these blocks of generated code !
  61.     //}}AFX_MSG
  62.     DECLARE_MESSAGE_MAP()
  63. };
  64.  
  65. #ifndef _DEBUG  // debug version in TextView.cpp
  66. inline CTextDoc* CTextView::GetDocument()
  67.    { return (CTextDoc*)m_pDocument; }
  68. #endif
  69.  
  70. /////////////////////////////////////////////////////////////////////////////
  71.