GME  13
TreeCtrlEx.h
Go to the documentation of this file.
00001 
00002 // 
00003 // CTreeCtrlEx - Multiple selection tree control for MFC
00004 // 
00005 // Bendik Engebretsen (c) 1997-1999
00006 // bendik@techsoft.no
00007 // http://www.techsoft.no/bendik/
00008 //
00009 //
00010 
00011 #ifndef __TREECTRLEX_H_ACT_BRW
00012 #define __TREECTRLEX_H_ACT_BRW
00013 // this file is used in several other projects, 
00014 // let's avoid complications by using different
00015 // #defines in each case
00016 
00017 #define TVGN_EX_ALL                     0x000F
00018 
00019 // Tihamer Levendovszky 12/07/2001
00020 #include "StringArrayEx.h"
00021 
00023 // CTreeCtrlEx window
00024 
00025 class CTreeCtrlEx : public CTreeCtrl
00026 {
00027         DECLARE_DYNAMIC(CTreeCtrlEx)
00028 
00029 // Construction
00030 public:
00031         CTreeCtrlEx();
00032     virtual ~CTreeCtrlEx();
00033         BOOL Create(DWORD dwStyle, DWORD dwExStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00034         BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00035 
00036 // Attributes
00037 public:
00038         UINT GetSelectedCount() const;
00039         HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode);
00040         HTREEITEM GetFirstSelectedItem();
00041         HTREEITEM GetNextSelectedItem(HTREEITEM hItem);
00042         HTREEITEM GetPrevSelectedItem(HTREEITEM hItem);
00043         HTREEITEM ItemFromData(DWORD_PTR dwData, HTREEITEM hStartAtItem=NULL) const;
00044 
00045         BOOL SelectItemEx(HTREEITEM hItem, BOOL bSelect=TRUE);
00046 
00047         BOOL SelectItems(HTREEITEM hFromItem, HTREEITEM hToItem);
00048         void ClearSelection(BOOL bMultiOnly=FALSE);
00049 
00050         // Tihamer Levendovszky 12/07/2001
00051         int FindTextInItems(CString &strText, HTREEITEM hStartAtItem,
00052                                         CStringArrayEx &strResults, CArray<HTREEITEM,HTREEITEM>& hResults);
00053         BOOL CreateDragImageEx(CPoint ptDragPoint);
00055 
00056 protected:
00057         void SelectMultiple( HTREEITEM hClickedItem, UINT nFlags, CPoint point );
00058 
00059 private:
00060         BOOL            m_bSelectPending;
00061         CPoint          m_ptClick;
00062         HTREEITEM       m_hClickedItem;
00063         HTREEITEM       m_hFirstSelectedItem;
00064         BOOL            m_bSelectionComplete;
00065         BOOL            m_bEditLabelPending;
00066         UINT_PTR                m_idTimer;
00067     //TCHAR *     m_pchTip ;
00068         //WCHAR *     m_pwchTip;
00069 
00070 // Operations
00071 public:
00072 
00073 // Overrides
00074         // ClassWizard generated virtual function overrides
00075         //{{AFX_VIRTUAL(CTreeCtrlEx)
00076         //}}AFX_VIRTUAL
00077 
00078 // Implementation
00079 public:
00080         void ScrollUp();
00081         void DeleteDragImageEx();
00082         CPoint m_ptHotSpot;
00083         CImageList m_CurrentDragImage;  
00084 
00085         // Generated message map functions
00086 protected:
00087     //{{AFX_VIRTUAL(CTreeCtrlCh)
00088    virtual void PreSubclassWindow();
00089    //}}AFX_VIRTUAL
00090 
00091         //{{AFX_MSG(CTreeCtrlEx)
00092     //virtual int OnToolHitTest(CPoint point, TOOLINFO * pTI) const;
00093     //afx_msg BOOL OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult );
00094         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00095         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00096         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00097         afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00098         afx_msg BOOL OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
00099         afx_msg BOOL OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult);
00100         afx_msg BOOL OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult);
00101         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00102         afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
00103         afx_msg BOOL OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
00104         afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00105         afx_msg void OnTimer(UINT_PTR nIDEvent);
00106         //}}AFX_MSG
00107 
00108         DECLARE_MESSAGE_MAP()
00109 
00110 private:
00111         CTreeCtrlEx(const CTreeCtrlEx&);
00112 };
00113 
00114 
00115 HTREEITEM GetTreeItemFromData(CTreeCtrl& treeCtrl, DWORD_PTR dwData, HTREEITEM hStartAtItem=NULL);
00116 
00117 #endif