// ▼ コメント BGN 2003.03.27 (moralog)
// 拾ってきたコード。
// CTreeViewEx
// http://www5.wisnet.ne.jp/~mercury/program/windows/lib/treeviewex.html
// ▲ コメント END

#if !defined(AFX_TREEVIEWEXT_H__99D8F6F8_79F0_11D1_8DC6_0000E8125FE5__INCLUDED_)
#define AFX_TREEVIEWEXT_H__99D8F6F8_79F0_11D1_8DC6_0000E8125FE5__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// TreeViewExt.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CTreeViewEx view

class CTreeViewEx : public CTreeView
{
protected:
	CTreeViewEx();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CTreeViewEx)

// Attributes
public:
	void	SetKeepIndentLevel( BOOL bKeep ){ m_bKeepIndentLevel = bKeep; };

// Operations
public:
	// アイテムのコピーハンドラ
	virtual	BOOL OnCopyItem(
			HTREEITEM	hSrcNode,
			HTREEITEM	hNewParent,
			HTREEITEM	hAfter
	){ return( TRUE ); };

	// アイテムのコピーハンドラ
	virtual BOOL OnCopiedItem(
		HTREEITEM	hNewNode,
		HTREEITEM	hSrcNode,
		HTREEITEM	hNewParent,
		HTREEITEM	hAfter
	){ return( TRUE ); };

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTreeViewEx)
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	//}}AFX_VIRTUAL

// Implementation
protected:
	CImageList		*m_pDragImage;
	HTREEITEM		m_hDragItem, m_hDropItem, m_hOldDropItem;
	bool			m_bLDragging;
	UINT			m_idTimer;
	BOOL			m_bKeepIndentLevel;

	virtual ~CTreeViewEx();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
protected:
			int			GetIndentLevel(HTREEITEM);
	virtual	void		SelectItem(HTREEITEM);
	virtual	void		DeleteItem(HTREEITEM);
	virtual	HTREEITEM	CopyItem(HTREEITEM, HTREEITEM, HTREEITEM = TVI_LAST);
	virtual	HTREEITEM	CopyBranch(HTREEITEM, HTREEITEM, HTREEITEM = TVI_LAST);
	virtual	HTREEITEM	MoveBranch(HTREEITEM, HTREEITEM, HTREEITEM = TVI_LAST);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	//{{AFX_MSG(CTreeViewEx)
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBeginLabelEdit(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnEndLabelEdit(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnDestroy();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TREEVIEWEXT_H__99D8F6F8_79F0_11D1_8DC6_0000E8125FE5__INCLUDED_)
