home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / mfc / tutorial / contain / step1 / contrvw.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-27  |  2.6 KB  |  79 lines

  1. // ContrVw.h : interface of the CContainerView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. class CContainerItem;
  6.  
  7. class CContainerView : public CView
  8. {
  9. protected: // create from serialization only
  10.     CContainerView();
  11.     DECLARE_DYNCREATE(CContainerView)
  12.  
  13. // Attributes
  14. public:
  15.     CContainerDoc* GetDocument();
  16.     // m_pSelection holds the selection to the current CContainerItem.
  17.     // For many applications, such a member variable isn't adequate to
  18.     //  represent a selection, such as a multiple selection or a selection
  19.     //  of objects that are not CContainerItem objects.  This selection
  20.     //  mechanism is provided just to help you get started.
  21.  
  22.     // TODO: replace this selection mechanism with one appropriate to your app.
  23.     CContainerItem* m_pSelection;
  24.  
  25. // Operations
  26. public:
  27.     CContainerItem* HitTestItems(CPoint point);
  28.     void SetSelection(CContainerItem* pItem);
  29.     void SetupTracker(CContainerItem* pItem, CRectTracker* pTracker);
  30.  
  31. // Overrides
  32.     // ClassWizard generated virtual function overrides
  33.     //{{AFX_VIRTUAL(CContainerView)
  34.     public:
  35.     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  36.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  37.     protected:
  38.     virtual void OnInitialUpdate(); // called first time after construct
  39.     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  40.     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  41.     virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
  42.     virtual BOOL IsSelected(const CObject* pDocItem) const;// Container support
  43.     //}}AFX_VIRTUAL
  44.  
  45. // Implementation
  46. public:
  47.     virtual ~CContainerView();
  48. #ifdef _DEBUG
  49.     virtual void AssertValid() const;
  50.     virtual void Dump(CDumpContext& dc) const;
  51. #endif
  52.  
  53. protected:
  54.  
  55. // Generated message map functions
  56. protected:
  57.     //{{AFX_MSG(CContainerView)
  58.         // NOTE - the ClassWizard will add and remove member functions here.
  59.         //    DO NOT EDIT what you see in these blocks of generated code !
  60.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  61.     afx_msg void OnSize(UINT nType, int cx, int cy);
  62.     afx_msg void OnInsertObject();
  63.     afx_msg void OnCancelEditCntr();
  64.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  65.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  66.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  67.     afx_msg void OnEditClear();
  68.     afx_msg void OnUpdateEditClear(CCmdUI* pCmdUI);
  69.     //}}AFX_MSG
  70.     DECLARE_MESSAGE_MAP()
  71. };
  72.  
  73. #ifndef _DEBUG  // debug version in ContrVw.cpp
  74. inline CContainerDoc* CContainerView::GetDocument()
  75.    { return (CContainerDoc*)m_pDocument; }
  76. #endif
  77.  
  78. /////////////////////////////////////////////////////////////////////////////
  79.