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
00012 #define __TREECTRLEX_H
00013 
00014 #define TVGN_EX_ALL                     0x000F
00015 
00016 // Tihamer Levendovszky 12/07/2001
00017 //#include "StringArrayEx.h" // Commented By PAKA
00018 
00020 // CTreeCtrlEx window
00021 
00022 class CTreeCtrlEx : public CTreeCtrl
00023 {
00024         DECLARE_DYNAMIC(CTreeCtrlEx)
00025 
00026 // Construction
00027 public:
00028         CTreeCtrlEx() : m_bSelectPending(FALSE), m_hClickedItem(NULL), m_hFirstSelectedItem(NULL), m_bSelectionComplete(TRUE), m_bEditLabelPending(FALSE) {}
00029         BOOL Create(DWORD dwStyle, DWORD dwExStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00030         BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID);
00031 
00032 // Attributes
00033 public:
00034         UINT GetSelectedCount() const;
00035         HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode);
00036         HTREEITEM GetFirstSelectedItem();
00037         HTREEITEM GetNextSelectedItem(HTREEITEM hItem);
00038         HTREEITEM GetPrevSelectedItem(HTREEITEM hItem);
00039         HTREEITEM ItemFromData(DWORD dwData, HTREEITEM hStartAtItem=NULL) const;
00040 
00041         BOOL SelectItemEx(HTREEITEM hItem, BOOL bSelect=TRUE);
00042 
00043         BOOL SelectItems(HTREEITEM hFromItem, HTREEITEM hToItem);
00044         void ClearSelection(BOOL bMultiOnly=FALSE);
00045 
00046         // Tihamer Levendovszky 12/07/2001
00047 //      int FindTextInItems(CString &strText, HTREEITEM hStartAtItem, //PAKA Comment
00048 //                                      CStringArrayEx &strResults, CArray<HTREEITEM,HTREEITEM>& hResults); // PAKA Comment
00049         BOOL CreateDragImageEx(CPoint ptDragPoint);
00051 
00052 protected:
00053         void SelectMultiple( HTREEITEM hClickedItem, UINT nFlags, CPoint point );
00054 
00055 private:
00056         BOOL            m_bSelectPending;
00057         CPoint          m_ptClick;
00058         HTREEITEM       m_hClickedItem;
00059         HTREEITEM       m_hFirstSelectedItem;
00060         BOOL            m_bSelectionComplete;
00061         BOOL            m_bEditLabelPending;
00062         UINT_PTR        m_idTimer;
00063 
00064 // Operations
00065 public:
00066 
00067 // Overrides
00068         // ClassWizard generated virtual function overrides
00069         //{{AFX_VIRTUAL(CTreeCtrlEx)
00070         //}}AFX_VIRTUAL
00071 
00072 // Implementation
00073 public:
00074         void ScrollUp();
00075         void DeleteDragImageEx();
00076         CPoint m_ptHotSpot;
00077         CImageList m_CurrentDragImage;
00078         virtual ~CTreeCtrlEx() {}
00079 
00080         // Generated message map functions
00081 protected:
00082         //{{AFX_MSG(CTreeCtrlEx)
00083         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00084         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00085         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00086         afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00087         afx_msg BOOL OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult);
00088         afx_msg BOOL OnSetfocus(NMHDR* pNMHDR, LRESULT* pResult);
00089         afx_msg BOOL OnKillfocus(NMHDR* pNMHDR, LRESULT* pResult);
00090         afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00091         afx_msg BOOL OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult);
00092         afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00093         afx_msg void OnTimer(UINT_PTR nIDEvent);
00094         //}}AFX_MSG
00095 
00096         DECLARE_MESSAGE_MAP()
00097 };
00098 
00099 
00100 HTREEITEM GetTreeItemFromData(CTreeCtrl& treeCtrl, DWORD dwData, HTREEITEM hStartAtItem=NULL);
00101 
00102 #endif