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 / svrview.h < prev    next >
C/C++ Source or Header  |  1998-03-05  |  5KB  |  146 lines

  1. // svrview.h : interface of the CServerView class
  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 "svritem.h"
  14.  
  15. class CServerView : public CScrollView
  16. {
  17. protected: // create from serialization only
  18.     CServerView();
  19.     DECLARE_DYNCREATE(CServerView)
  20.  
  21. // Attributes
  22. public:
  23.     CServerDoc* GetDocument()
  24.     {
  25.         ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CServerDoc)));
  26.         ASSERT_VALID(m_pDocument);
  27.         return (CServerDoc*)m_pDocument;
  28.     }
  29.     void SetSelection(CServerNode* pNewSel, CDC* pDC);
  30.     void SetSelection(CServerNode* pNewSel);
  31.  
  32. // Operations
  33. public:
  34.     void SetScrollInfo();
  35.     BOOL SetZoomFactor(CSize zoomNum, CSize zoomDenom);
  36.     void UpdateServerView();
  37.     CSize CalcActualViewSize(CDC *pDC);
  38.     CSize CalcActualItemSize(CServerNode* pItem, CDC *pDC);
  39.     CSize CalcScaledViewSize();
  40.     CSize CalcScaledItemSize(CServerNode* pItem);
  41.     CServerNode* DoPasteItem(COleDataObject* pDataObject);
  42.     void DoPasteNative(COleDataObject* pDataObject, CServerNode* pItem);
  43.     void DoPasteText(COleDataObject* pDataObject, CServerNode* pItem);
  44.     void DoImportText(CArchive &ar);
  45.     void ScrollToItem(CServerNode* pItem, BOOL bScrollUp);
  46.     void Locate(int cnt, BOOL bScrollUp);
  47.     void InvalidateItem(CServerNode* pItem, CDC* pDC);
  48.     void InvalidateItem(CServerNode* pItem);
  49.     void ToggleSelectedItem();
  50.     void OpenTextFile(CString Name) ;
  51. $$IF(WANTS_TEXTVIEW)
  52.     void CreateTextView() ;
  53. $$ENDIF
  54. // Implementation
  55. public:
  56.     virtual ~CServerView();
  57.     virtual void OnDraw(CDC* pDC);
  58.     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  59.     virtual void OnInitialUpdate();
  60.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
  61. #ifdef _DEBUG
  62.     virtual void AssertValid() const;
  63.     virtual void Dump(CDumpContext& dc) const;
  64. #endif
  65.  
  66.  
  67. protected:
  68.     // drag/drop stuff
  69.     COleDropTarget m_dropTarget;
  70.     DROPEFFECT m_prevDropEffect;
  71.  
  72.     // current selection - store the node and the last drawn rect
  73.     CServerNode* m_pSelectedNode;
  74.     static CServerNode* NEAR m_pDragNode;
  75.  
  76.     // upper left of drawing
  77.     CPoint m_ptStart;
  78.  
  79.     // zoom factor
  80.     CSize m_zoomNum;
  81.     CSize m_zoomDenom;
  82.  
  83.     // implementation helpers
  84.     void SelectAtPoint(CPoint point, CPoint& pointHit);
  85.     void DoBranch(CServerNode *pItem, BOOL bHide);
  86.  
  87.     virtual BOOL OnDrop(COleDataObject* pDataObject,
  88.         DROPEFFECT dropEffect, CPoint point);
  89.     virtual DROPEFFECT OnDragEnter(COleDataObject* pDataObject,
  90.         DWORD grfKeyState, CPoint point);
  91.     virtual DROPEFFECT OnDragOver(COleDataObject* pDataObject,
  92.         DWORD grfKeyState, CPoint point);
  93.     virtual void OnDragLeave();
  94.  
  95. // Generated message map functions
  96. protected:
  97.     //{{AFX_MSG(CServerView)
  98.     afx_msg void OnChangeName();
  99.     afx_msg void OnAddNode();
  100.     afx_msg void OnUpdateHasSel(CCmdUI* pCmdUI);
  101.     afx_msg void OnEditCopy();
  102.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  103.     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  104.     afx_msg void OnImportText();
  105.     afx_msg void OnViewZoomCustom();
  106.     afx_msg void OnEditCut();
  107.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  108.     afx_msg void OnEditPaste();
  109.     afx_msg void OnUpdateEditPaste(CCmdUI* pCmdUI);
  110.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  111.     afx_msg void OnEditClear();
  112.     afx_msg void OnTreeCollapsebranch();
  113.     afx_msg void OnTreeExpandall();
  114.     afx_msg void OnTreeExpandbranch();
  115.     afx_msg void OnTreeExpandonelevel();
  116.     afx_msg void OnUpdateTreeCollapsebranch(CCmdUI* pCmdUI);
  117.     afx_msg void OnUpdateTreeExpandonelevel(CCmdUI* pCmdUI);
  118.     afx_msg void OnUpdateTreeExpandall(CCmdUI* pCmdUI);
  119.     afx_msg void OnUpdateTreeExpandbranch(CCmdUI* pCmdUI);
  120.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  121.     afx_msg void OnSize(UINT nType, int cx, int cy);
  122. $$IF(WANTS_TEXTVIEW)
  123.     afx_msg void OnViewTextView();
  124. $$ENDIF
  125.     //}}AFX_MSG
  126.  
  127.     // special message handling
  128.     afx_msg void OnZoom(UINT nID);
  129.     afx_msg void OnUpdateZoom(CCmdUI* pCmdUI);
  130.  
  131.     DECLARE_MESSAGE_MAP()
  132.     friend class CServerViewDC;
  133. };
  134.  
  135. class CServerDC : public CClientDC
  136. {
  137.     CFont font;
  138.     CFont *pOldFont;
  139.  
  140. public:
  141.     CServerDC(CServerView *pView);
  142.     ~CServerDC();
  143. };
  144.  
  145. /////////////////////////////////////////////////////////////////////////////
  146.