📄 rtreview.h
字号:
////////////////////////////////////////////////////////////////////////////////
// RTreView.h : interface of the CRTreView class
// $Header: /USB/Util/EzMr/RTreView.h 3 8/08/00 2:26p Tpm $
// Copyright (c) 2000 Cypress Semiconductor. May not be reproduced without permission.
// See the EzUsb Developer's Kit license agreement for more details.
////////////////////////////////////////////////////////////////////////////////
typedef VOID(*LPFNTREECALLBACK) ( HWND hTreeWnd, HTREEITEM hTreeItem);
BOOL USBView_OnInitUsbD ( HWND hWnd, HWND hWndFocus, LPARAM lParam);
VOID WalkTree (HTREEITEM hTreeItem, LPFNTREECALLBACK lpfnTreeCallback, DWORD dwRefData);
VOID ExpandItem (HWND hTreeWnd, HTREEITEM hTreeItem);
class CRTreView : public CTreeView
{
protected: // create from serialization only
CRTreView();
DECLARE_DYNCREATE(CRTreView)
// Attributes
public:
CRTreDoc* GetDocument();
//_TREEITEM *m_pOldSel;
HTREEITEM m_pOldSel;
// Operations
public:
void ShowPopupMenu( CPoint& point );
// Get the HTREEITEM handle for the item in the CTreeView
// which has the specified TV_ITEM.lParam value. Start the
// recursion at the TV_ITEM whose HTREEITEM == startHandle.
HTREEITEM GetItemHandle (LPARAM lParam,
HTREEITEM startHandle = TVI_ROOT);
// Sorting callback function. This function will be
// be called from the global function CRTreCtrlViewCompare
// function which can be used as the LPTV_SORTCB.lpfnCompare
// value when calling the base class function SortChildrenCB().
virtual int SortCompare(LPARAM item1LParam,
LPARAM item2LParam);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRTreView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
//}}AFX_VIRTUAL
// Implementation
protected:
///////////////////////////////////////////////////////////////////////
// Typdefs for Predicate and Apply functions called by ApplyIfTrue_()
typedef BOOL (CRTreView::*TreePredicateFunction_)
(HTREEITEM, DWORD userParm);
typedef BOOL (CRTreView::*TreeApplyFunction_)
(HTREEITEM, DWORD userParm);
/////////////////////////////////////////////////////////////////////////
// ApplyIfTrue_()
// Recurse all items of the tree at and below the item
// with the "startHandle" handle, For each item, call the
// user-specified "predicate" function. If the predicate function
// returns TRUE then call the user-specified "apply" function.
// If the apply function returns TRUE, then keep recursing.
// If the apply function returns FALSE, it indicates
// that no more "apply" actions need to be made - causing
// the ApplyIfTrue_ function to finish.
BOOL ApplyIfTrue_ (TreePredicateFunction_ predicateFunction,
TreeApplyFunction_ applyFunction,
DWORD userParm = 0,
HTREEITEM startHandle = TVI_ROOT,
BOOL recurseRootSiblings = FALSE);
// Predicate Functions for ApplyIfTrue()
BOOL TruePredicate_ (HTREEITEM candidate, DWORD userParm);
BOOL ItemHasText_ (HTREEITEM candidate, DWORD userParm_SaveItemHandle);
BOOL ItemHasLparam_ (HTREEITEM candidate, DWORD userParm_SaveItemHandle);
// Apply Functions for ApplyIfTrue()
BOOL ShowHandleAndLParam_ (HTREEITEM candidate, DWORD bShow);
BOOL SaveItemHandle_ (HTREEITEM candidate, DWORD userParm);
BOOL SaveItemsLParams_ (HTREEITEM candidate, DWORD userParm);
// UserParms for ApplyIfTrue()
class SaveItemHandleUserParm_
{
public:
LPARAM m_lParam;
CString m_text;
HTREEITEM m_hTreeItem;
};
//////////////////////////////////////////////
// Populate the tree from the document
void Populate_(CTreeItem* item, HTREEITEM parent);
/////////////////////////////////////////////
// Images
enum { IMAGELIST_WWW, IMAGELIST_HOST, IMAGELIST_DOCUMENT };
CImageList m_imageList;
////////////////////////////////////////////
// Flags
BOOL m_bShowHandlesAndLParams;
public:
virtual ~CRTreView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CRTreView)
afx_msg int OnCreate ( LPCREATESTRUCT lpCreateStruct );
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in RTreView.cpp
inline CRTreDoc* CRTreView::GetDocument()
{ return (CRTreDoc*)m_pDocument; }
#endif
///////////////////////
// Global Functions
int CALLBACK CRTreCtrlViewCompare
(LPARAM item1Param, LPARAM item2Param, LPARAM pThis);
/////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -