WTL::CTreeViewCtrl

WTL (Windows Template Libraries) 7.0 に含まれている CTreeViewCtrl クラスのメンバ関数一覧です。

WTL::CTreeViewCtrl

    template <class TBase>
    class   CTreeViewCtrlT : public TBase
    typedef CTreeViewCtrlT<CWindow>    CTreeViewCtrl;


    // Constructors
    CTreeViewCtrlT(HWND hWnd = NULL)
    CTreeViewCtrlT< TBase >& operator=(HWND hWnd)
    HWND Create(HWND hWndParent, _U_RECT rect = NULL, LPCTSTR szWindowName = NULL, 
        DWORD dwStyle = 0, DWORD dwExStyle = 0, 
        _U_MENUorID MenuOrID = 0U, LPVOID lpCreateParam = NULL)

    // Attributes
    static LPCTSTR GetWndClassName()
    UINT GetCount() const
    UINT GetIndent() const
    void SetIndent(UINT nIndent)
    CImageList GetImageList(UINT nImageList) const
    CImageList SetImageList(HIMAGELIST hImageList, int nImageListType)
    BOOL GetItem(LPTVITEM pItem) const
    BOOL SetItem(LPTVITEM pItem)
    BOOL SetItem(HTREEITEM hItem, UINT nMask, LPCTSTR lpszItem, int nImage,
    	int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam)
    BOOL GetItemText(HTREEITEM hItem, LPTSTR lpstrText, int nLen) const
    BOOL GetItemText(HTREEITEM hItem, BSTR& bstrText) const
    BOOL GetItemText(HTREEITEM hItem, CString& strText) const
    BOOL SetItemText(HTREEITEM hItem, LPCTSTR lpszItem)
    BOOL GetItemImage(HTREEITEM hItem, int& nImage, int& nSelectedImage) const
    BOOL SetItemImage(HTREEITEM hItem, int nImage, int nSelectedImage)
    UINT GetItemState(HTREEITEM hItem, UINT nStateMask) const
    BOOL SetItemState(HTREEITEM hItem, UINT nState, UINT nStateMask)
    DWORD_PTR GetItemData(HTREEITEM hItem) const
    BOOL SetItemData(HTREEITEM hItem, DWORD_PTR dwData)
    CEdit GetEditControl() const
    UINT GetVisibleCount() const
    BOOL GetItemRect(HTREEITEM hItem, LPRECT lpRect, BOOL bTextOnly) const
    BOOL ItemHasChildren(HTREEITEM hItem) const
    CToolTipCtrl GetToolTips() const
    CToolTipCtrl SetToolTips(HWND hWndTT)
    int GetISearchString(LPTSTR lpstr) const
    
    // checkboxes only
    BOOL GetCheckState(HTREEITEM hItem) const
    BOOL SetCheckState(HTREEITEM hItem, BOOL bCheck)
    
    COLORREF GetBkColor() const
    COLORREF SetBkColor(COLORREF clr)
    COLORREF GetInsertMarkColor() const
    COLORREF SetInsertMarkColor(COLORREF clr)
    int GetItemHeight() const
    int SetItemHeight(int cyHeight)
    int GetScrollTime() const
    int SetScrollTime(int nScrollTime)
    COLORREF GetTextColor() const
    COLORREF SetTextColor(COLORREF clr)
    BOOL GetUnicodeFormat() const
    BOOL SetUnicodeFormat(BOOL bUnicode = TRUE)

    COLORREF GetLineColor() const
    COLORREF SetLineColor(COLORREF clrNew /*= CLR_DEFAULT*/)

    // Operations
    HTREEITEM InsertItem(LPTV_INSERTSTRUCT lpInsertStruct)
    HTREEITEM InsertItem(LPCTSTR lpszItem, int nImage, 
        int nSelectedImage, HTREEITEM hParent, HTREEITEM hInsertAfter)
    HTREEITEM InsertItem(LPCTSTR lpszItem, HTREEITEM hParent, HTREEITEM hInsertAfter)
    HTREEITEM InsertItem(UINT nMask, LPCTSTR lpszItem, int nImage, 
        int nSelectedImage, UINT nState, UINT nStateMask, LPARAM lParam, 
        HTREEITEM hParent, HTREEITEM hInsertAfter)
    BOOL DeleteItem(HTREEITEM hItem)
    BOOL DeleteAllItems()
    BOOL Expand(HTREEITEM hItem, UINT nCode = TVE_EXPAND)
    HTREEITEM GetNextItem(HTREEITEM hItem, UINT nCode) const
    HTREEITEM GetChildItem(HTREEITEM hItem) const
    HTREEITEM GetNextSiblingItem(HTREEITEM hItem) const
    HTREEITEM GetPrevSiblingItem(HTREEITEM hItem) const
    HTREEITEM GetParentItem(HTREEITEM hItem) const
    HTREEITEM GetFirstVisibleItem() const
    HTREEITEM GetNextVisibleItem(HTREEITEM hItem) const
    HTREEITEM GetPrevVisibleItem(HTREEITEM hItem) const
    HTREEITEM GetSelectedItem() const
    HTREEITEM GetDropHilightItem() const
    HTREEITEM GetRootItem() const
    BOOL Select(HTREEITEM hItem, UINT nCode)
    BOOL SelectItem(HTREEITEM hItem)
    BOOL SelectDropTarget(HTREEITEM hItem)
    BOOL SelectSetFirstVisible(HTREEITEM hItem)
    CEdit EditLabel(HTREEITEM hItem)
    BOOL EndEditLabelNow(BOOL bCancel)
    HTREEITEM HitTest(TV_HITTESTINFO* pHitTestInfo)
    HTREEITEM HitTest(POINT pt, UINT* pFlags)
    BOOL SortChildren(HTREEITEM hItem)
    BOOL EnsureVisible(HTREEITEM hItem)
    BOOL SortChildrenCB(LPTV_SORTCB pSort)
    CImageList RemoveImageList(int nImageList)
    CImageList CreateDragImage(HTREEITEM hItem)

    BOOL SetInsertMark(HTREEITEM hTreeItem, BOOL bAfter)
    BOOL RemoveInsertMark()

    HTREEITEM MapAccIDToHTREEITEM(UINT uID) const
    UINT MapHTREEITEMToAccID(HTREEITEM hTreeItem) const

構造体定義の一例です。
※非Unicode体系なので、LPCTSTRLPCSTRである環境での定義例です。

WTL::CTreeViewCtrl で使用される構造体定義

    #define LPTV_INSERTSTRUCT       LPTVINSERTSTRUCT

    #define  LPTVINSERTSTRUCT       LPTVINSERTSTRUCTA

    typedef struct tagTVINSERTSTRUCTA {
        HTREEITEM hParent;
        HTREEITEM hInsertAfter;
    #if (_WIN32_IE >= 0x0400)
        union
        {
            TVITEMEXA itemex;
            TV_ITEMA  item;
        } DUMMYUNIONNAME;
    #else
        TV_ITEMA item;
    #endif
    } TVINSERTSTRUCTA, *LPTVINSERTSTRUCTA;

    #define TV_ITEMA                TVITEMA

    typedef struct tagTVITEMA {
        UINT      mask;
        HTREEITEM hItem;
        UINT      state;
        UINT      stateMask;
        LPSTR     pszText;
        int       cchTextMax;
        int       iImage;
        int       iSelectedImage;
        int       cChildren;
        LPARAM    lParam;
    } TVITEMA, *LPTVITEMA;


    // only used for Get and Set messages.  no notifies
    typedef struct tagTVITEMEXA {
        UINT      mask;
        HTREEITEM hItem;
        UINT      state;
        UINT      stateMask;
        LPSTR     pszText;
        int       cchTextMax;
        int       iImage;
        int       iSelectedImage;
        int       cChildren;
        LPARAM    lParam;
        int       iIntegral;
    } TVITEMEXA, *LPTVITEMEXA;

GetNextItemUINT nCodeで使用する定数一覧です。

WTL::CTreeViewCtrl::GetNextItem で使用する定数定義

    #define TVGN_ROOT               0x0000
    #define TVGN_NEXT               0x0001
    #define TVGN_PREVIOUS           0x0002
    #define TVGN_PARENT             0x0003
    #define TVGN_CHILD              0x0004
    #define TVGN_FIRSTVISIBLE       0x0005
    #define TVGN_NEXTVISIBLE        0x0006
    #define TVGN_PREVIOUSVISIBLE    0x0007
    #define TVGN_DROPHILITE         0x0008
    #define TVGN_CARET              0x0009
    #define TVGN_LASTVISIBLE        0x000A

HTREEITEMには次の値も使用できます。

HTREEITEMの代替定数定義

    #define TVI_ROOT                ((HTREEITEM)(ULONG_PTR)-0x10000)
    #define TVI_FIRST               ((HTREEITEM)(ULONG_PTR)-0x0FFFF)
    #define TVI_LAST                ((HTREEITEM)(ULONG_PTR)-0x0FFFE)
    #define TVI_SORT                ((HTREEITEM)(ULONG_PTR)-0x0FFFD)

[HOME]-[RTL]
Copyright© 2005 RAPT.