Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: trobimpl.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // trobimpl.h : header file
  11. //
  12. #ifndef _TROBIMPL_H_
  13. #define _TROBIMPL_H_
  14. #include "treeobsv.h"
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CTreeObserverTreeImpl
  17. class CTreeObserverTreeImpl : public CTreeCtrl, public CTreeObserver
  18. {
  19. // Construction
  20. public:
  21. CTreeObserverTreeImpl();
  22. virtual ~CTreeObserverTreeImpl();
  23. // Attributes
  24. public:
  25. // Operations
  26. public:
  27. STDMETHOD(SetStyle) (DWORD dwStyle);
  28. STDMETHOD(SetTreeSource) (CTreeSource* pTreeSrc);
  29. STDMETHOD_(TREEITEMID, GetSelection) ();
  30. STDMETHOD_(HTREEITEM, FindHTI)(TREEITEMID tid, BOOL bAutoExpand = FALSE);
  31. STDMETHOD_(void, SetSelection) (TREEITEMID tid);
  32. STDMETHOD_(void, ExpandItem) (TREEITEMID tid);
  33. STDMETHOD_(BOOL, IsItemExpanded) (TREEITEMID tid);
  34. // CTreeObserver methods
  35. STDMETHOD_(void, ItemAdded) (TREEITEMID tid);
  36. STDMETHOD_(void, ItemRemoved) (TREEITEMID tidParent, TREEITEMID tidRemoved);
  37. STDMETHOD_(void, ItemChanged) (TREEITEMID tid, DWORD dwAttrib);
  38. // Implementation
  39. private:
  40. HTREEITEM FindChildHTI(HTREEITEM hitParent, TREEITEMID tid);
  41. HTREEITEM AddOneItem(HTREEITEM hti, HTREEITEM htiAfter, TREEITEMID tid);
  42. void AddChildren(HTREEITEM hti);
  43. bool WasItemExpanded(HTREEITEM hti)
  44. {
  45. return (hti == TVI_ROOT) ||
  46. (hti != NULL && (GetItemState(hti, TVIS_EXPANDEDONCE) & TVIS_EXPANDEDONCE));
  47. }
  48. BOOL IsItemExpanded(HTREEITEM hti)
  49. {
  50. return (hti == TVI_ROOT) ||
  51. (hti != NULL && (GetItemState(hti, TVIS_EXPANDED) & TVIS_EXPANDED));
  52. }
  53. // Generated message map functions
  54. protected:
  55. afx_msg void OnItemExpanding(NMHDR* pNMHDR, LRESULT* pResult);
  56. afx_msg void OnSingleExpand(NMHDR* pNMHDR, LRESULT* pResult);
  57. BOOL RootHidden() { return m_dwStyle & TOBSRV_HIDEROOT; }
  58. BOOL ShowFoldersOnly() { return m_dwStyle & TOBSRV_FOLDERSONLY; }
  59. DECLARE_MESSAGE_MAP()
  60. CTreeSource* m_pTreeSrc;
  61. DWORD m_dwStyle;
  62. TREEITEMID m_tidRoot; // tid of hidden root
  63. };
  64. #endif // _TROBIMPL_H_