Exemple #1
0
static BOOL
ViewDlg_ToggleCheckItem(HWND hwndDlg, HTREEITEM hItem)
{
    HWND hwndTreeView = GetDlgItem(hwndDlg, IDC_VIEW_TREEVIEW);

    // get the item
    TV_ITEM Item;
    INT i;
    ZeroMemory(&Item, sizeof(Item));
    Item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_PARAM;
    Item.hItem = hItem;
    if (!TreeView_GetItem(hwndTreeView, &Item))
        return FALSE;       // no such item

    VIEWTREE_ENTRY *pEntry = ViewTree_GetItem(Item.lParam);
    if (pEntry == NULL)
        return FALSE;       // no such item
    if (pEntry->bGrayed)
        return FALSE;       // disabled

    // toggle check mark
    Item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
    switch (pEntry->dwType)
    {
        case AETYPE_CHECKBOX:
            pEntry->bChecked = !pEntry->bChecked;
            break;

        case AETYPE_RADIO:
            // reset all the entries of the same parent
            for (i = 0; i < s_ViewTreeEntryCount; ++i)
            {
                VIEWTREE_ENTRY *pEntry2 = &s_ViewTreeEntries[i];
                if (pEntry->dwParentID == pEntry2->dwParentID)
                {
                    pEntry2->bChecked = FALSE;

                    Item.hItem = pEntry2->hItem;
                    INT iImage = ViewTree_GetImage(pEntry2);
                    Item.iImage = Item.iSelectedImage = iImage;
                    TreeView_SetItem(hwndTreeView, &Item);
                }
            }
            pEntry->bChecked = TRUE;
            break;

        default:
            return FALSE;   // failure
    }
    Item.iImage = Item.iSelectedImage = ViewTree_GetImage(pEntry);
    Item.hItem = hItem;
    TreeView_SetItem(hwndTreeView, &Item);

    // redraw the item
    RECT rcItem;
    TreeView_GetItemRect(hwndTreeView, hItem, &rcItem, FALSE);
    InvalidateRect(hwndTreeView, &rcItem, TRUE);
    return TRUE;    // success
}
BOOL KUIMulStatusTree::SetCheck(
    HTREEITEM hItem, 
    int  nCheck, 
    BOOL bUpdate /* = TRUE */)
{
    ATLASSERT(hItem  != NULL);
    ATLASSERT(m_hWnd != NULL);

    TV_ITEM tvi;
    ZeroMemory(&tvi, sizeof(tvi));

    tvi.hItem = hItem;
    tvi.mask  = TVIF_STATE;
    tvi.stateMask = TVIS_STATEIMAGEMASK;

    ATLASSERT((nCheck >= EM_TVIS_NONE) && (nCheck <= EM_TVIS_CHECK));

    tvi.state = INDEXTOSTATEIMAGEMASK(nCheck);

    if (!TreeView_SetItem(m_hWnd, &tvi))
        return FALSE;

    if (nCheck != EM_TVIS_NONE)
    {    
        if (bUpdate)
            TravelChild(hItem, nCheck);

        TravelSiblingAndParent(hItem, nCheck);
    } // if (nCheck != EM_TVIS_NONE)    

    return TRUE;
}
BBTreeViewNode *Win32TreeViewNode::insert( int index,BBString *str,int icon ){

	HTREEITEM p;

	if( index<=0 ){
		p=TVI_FIRST;
	}else if( index>=countKids() ){
		p=TVI_LAST;
	}else{
		p=TreeView_GetChild( _tree,_item );
		while( --index ){
			p=TreeView_GetNextSibling( _tree,p ); 
		}
	}

	TVINSERTSTRUCT it;
	it.hParent=_item;
	it.hInsertAfter=p;
	it.item.mask=TVIF_TEXT;
	it.item.pszText=(char*)str->c_str();

	HTREEITEM item=TreeView_InsertItem( _tree,&it );
	if( !item ) return 0;

	Win32TreeViewNode *node=new Win32TreeViewNode( _tree,item,this );

	TVITEM tv={TVIF_PARAM};
	tv.hItem=item;
	tv.lParam=(LPARAM)node;
	if (icon>-1) {tv.mask|=TVIF_IMAGE|TVIF_SELECTEDIMAGE;tv.iImage=icon;tv.iSelectedImage=icon+0;}
	TreeView_SetItem( _tree,&tv );

	return node;
}
Exemple #4
0
void TraverseChildren(const HTREEITEM hParent, TString &buf, TString &res, LPTVITEMEX pitem)
{
	ZeroMemory(pitem, sizeof(TVITEMEX));
	for (HTREEITEM ptvitem = TreeView_GetChild(Dcx::mIRC.getTreeview(), hParent); ptvitem != NULL; ptvitem = TreeView_GetNextSibling(Dcx::mIRC.getTreeview(), ptvitem)) {
		pitem->hItem = ptvitem;
		pitem->pszText = buf.to_chr();
		pitem->cchTextMax = MIRC_BUFFER_SIZE_CCH;
		pitem->mask = TVIF_TEXT|TVIF_PARAM;
		if (TreeView_GetItem(Dcx::mIRC.getTreeview(), pitem))
		{
			{
				TString tsType;
				DcxDock::getTreebarItemType(tsType, pitem->lParam);
				Dcx::mIRC.execex("/!set -nu1 %%dcx_%d %s", pitem->lParam, pitem->pszText );
				Dcx::mIRC.tsEvalex(res, "$xtreebar_callback(geticons,%s,%%dcx_%d)", tsType.to_chr(), pitem->lParam);
			}
			pitem->mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE;
			int i = res.gettok( 1 ).to_int() -1;
			if (i < 0)
				i = 0;
			pitem->iImage = i;
			i = res.gettok( 2 ).to_int() -1;
			if (i < 0)
				i = 0;
			pitem->iSelectedImage = i;
			TreeView_SetItem(Dcx::mIRC.getTreeview(), pitem);
		}
		TraverseChildren(ptvitem, buf, res, pitem);
	}
}
Exemple #5
0
void OptTree_SetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, DWORD dwOptions, char *szSettingName)
{
    enum { IMG_GROUP, IMG_CHECK, IMG_NOCHECK, IMG_RCHECK, IMG_NORCHECK, IMG_GRPOPEN, IMG_GRPCLOSED };

    HWND hwndTree = GetDlgItem(hwnd, idcTree);
    int i;
    for (i = 0; i < optionCount; ++i)
    {
        if ((!options[i].szSettingName && !szSettingName) ||
                (options[i].szSettingName && szSettingName && !lstrcmpA(options[i].szSettingName, szSettingName)))
        {
            TVITEM tvi;
            tvi.mask = TVIF_HANDLE|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
            tvi.hItem = options[i].hItem;
            if (options[i].groupId == OPTTREE_CHECK)
            {
                tvi.iImage = tvi.iSelectedImage = (dwOptions & options[i].dwFlag) ? IMG_CHECK : IMG_NOCHECK;
            } else
            {
                tvi.iImage = tvi.iSelectedImage = (dwOptions & options[i].dwFlag) ? IMG_RCHECK : IMG_NORCHECK;
            }
            TreeView_SetItem(hwndTree, &tvi);
        }
    }
}
void ProjectPanel::openSelectFile()
{
    TVITEM tvItem;
    tvItem.mask = TVIF_PARAM;
    tvItem.hItem = _treeView.getSelection();
    ::SendMessage(_treeView.getHSelf(), TVM_GETITEM, 0,(LPARAM)&tvItem);

    NodeType nType = getNodeType(tvItem.hItem);
    generic_string *fn = (generic_string *)tvItem.lParam;
    if (nType == nodeType_file && fn)
    {
        tvItem.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
        if (::PathFileExists(fn->c_str()))
        {
            ::SendMessage(_hParent, NPPM_DOOPEN, 0, (LPARAM)(fn->c_str()));
            tvItem.iImage = INDEX_LEAF;
            tvItem.iSelectedImage = INDEX_LEAF;
        }
        else
        {
            tvItem.iImage = INDEX_LEAF_INVALID;
            tvItem.iSelectedImage = INDEX_LEAF_INVALID;
        }
        TreeView_SetItem(_treeView.getHSelf(), &tvItem);
    }
}
BOOL wbSetTreeViewItemText(PWBOBJ pwbo, HTREEITEM hItem, LPTSTR lpszItem)
{
	TV_ITEM tvi;

	if(!pwbo || !pwbo->hwnd || !IsWindow(pwbo->hwnd))
		return FALSE;

	if(!hItem)
		return FALSE;

	// Change the item

	tvi.hItem = hItem;
	tvi.mask = TVIF_HANDLE | TVIF_TEXT;

	if(lpszItem && *lpszItem) {
		tvi.pszText = lpszItem;
		tvi.cchTextMax = wcslen(lpszItem);
	} else {
		tvi.pszText = TEXT("");
		tvi.cchTextMax = 0;
	}

	// UPDATED IN API: Returns a non-zero value if successful, or zero otherwise

	return TreeView_SetItem(pwbo->hwnd, &tvi) != 0 ? TRUE : FALSE;
}
Exemple #8
0
/**
 * name:	EndLabelEdit
 * class:	CPsTree
 * desc:	exits the labeledit mode
 *			bSave		- tell whether to save changes or not
 * return:	0
 **/
int CPsTree::EndLabelEdit(const BYTE bSave)
{
	TCHAR szEdit[MAX_TINAME];
	TVITEM tvi;
	WORD cchEdit;

	if (bSave && (cchEdit = Edit_GetText(_hLabelEdit, szEdit, MAX_TINAME)) > 0)
	{
		tvi.hItem = _hDragItem;
		tvi.mask = TVIF_TEXT|TVIF_HANDLE;
		tvi.pszText = szEdit;
		if (TreeView_SetItem(_hWndTree, &tvi))
		{
			CPsTreeItem* pti;
			if (pti = FindItemByHandle(_hDragItem))
			{
				pti->Rename(szEdit);
			}
			_dwFlags |= PSTVF_LABEL_CHANGED;
		}
	}
	DestroyWindow(_hLabelEdit);
	_hLabelEdit = NULL;
	_hDragItem = NULL;
	return 0;
}
Exemple #9
0
void CMsgTree::UpdateItem(int ID) // updates item title, and expanded/collapsed state for groups
{
	COptItem_TreeCtrl *TreeCtrl = GetTreeCtrl();
	int Order = TreeCtrl->IDToOrder(ID);
	if (Order != -1) {
		CBaseTreeItem* TreeItem = (Order <= TREECTRL_ROOTORDEROFFS) ? (CBaseTreeItem*)&TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)] : (CBaseTreeItem*)&TreeCtrl->Value[Order];
		TCString NewTitle;
		TVITEM tvi;
		tvi.mask = TVIF_HANDLE | TVIF_TEXT;
		tvi.hItem = TreeItem->hItem;
		tvi.pszText = NewTitle.GetBuffer(TREEITEMTITLE_MAXLEN);
		tvi.cchTextMax = TREEITEMTITLE_MAXLEN;
		TreeView_GetItem(hTreeView, &tvi);
		if (TreeItem->Title != (const TCHAR*)tvi.pszText) {
			TreeCtrl->SetModified(true);
			NMMSGTREE nm = { 0 };
			nm.ItemNew = TreeItem;
			nm.hdr.code = MTN_ITEMRENAMED;
			nm.hdr.hwndFrom = hTreeView;
			nm.hdr.idFrom = GetDlgCtrlID(hTreeView);
			SendMessage(GetParent(hTreeView), WM_NOTIFY, 0, (LPARAM)&nm);
		}
		tvi.mask = TVIF_HANDLE | TVIF_TEXT;
		tvi.pszText = TreeItem->Title;
		TreeView_SetItem(hTreeView, &tvi);
		TreeView_Expand(hTreeView, tvi.hItem, (TreeItem->Flags & TIF_EXPANDED) ? TVE_EXPAND : TVE_COLLAPSE);
	}
}
Exemple #10
0
void TraverseTreebarItems(void)
{
	SetWindowRedraw(Dcx::mIRC.getTreeview(), FALSE);
	TString buf((UINT)MIRC_BUFFER_SIZE_CCH);
	TString res;
	TVITEMEX item;
	ZeroMemory(&item, sizeof(item));
	for (HTREEITEM ptvitem = TreeView_GetRoot(Dcx::mIRC.getTreeview()); ptvitem != NULL; ptvitem = TreeView_GetNextSibling(Dcx::mIRC.getTreeview(), ptvitem)) {
		item.hItem = ptvitem;
		item.pszText = buf.to_chr();
		item.cchTextMax = MIRC_BUFFER_SIZE_CCH;
		item.mask = TVIF_TEXT|TVIF_PARAM;
		if (TreeView_GetItem(Dcx::mIRC.getTreeview(), &item))
		{
			{
				TString tsType;
				DcxDock::getTreebarItemType(tsType, item.lParam);
				Dcx::mIRC.execex("/!set -nu1 %%dcx_%d %s", item.lParam, item.pszText );
				Dcx::mIRC.tsEvalex(res, "$xtreebar_callback(geticons,%s,%%dcx_%d)", tsType.to_chr(), item.lParam);
			}
			item.mask = TVIF_IMAGE|TVIF_SELECTEDIMAGE;
			int i = res.gettok( 1 ).to_int() -1;
			if (i < 0)
				i = 0;
			item.iImage = i;
			i = res.gettok( 2 ).to_int() -1;
			if (i < 0)
				i = 0;
			item.iSelectedImage = i;
			TreeView_SetItem(Dcx::mIRC.getTreeview(), &item);
		}
		TraverseChildren(ptvitem, buf, res, &item);
	}
	SetWindowRedraw(Dcx::mIRC.getTreeview(), TRUE);
}
Exemple #11
0
	void SetTreeItem( HTREEITEM hItem, const std::wstring& text ) {
		TVITEM tvitem;
		ZeroMemory( &tvitem, sizeof(tvitem) );
		tvitem.mask = TVIF_TEXT;
		tvitem.pszText = (wchar_t*)text.c_str();
		tvitem.hItem = hItem;
		TreeView_SetItem( TreeControl, &tvitem );
	}
UINT TreeView::SetCheckState(HTREEITEM item, BOOL check) {
  TVITEM tvi = {0};
  tvi.mask = TVIF_HANDLE | TVIF_STATE;
  tvi.hItem = item;
  tvi.stateMask = TVIS_STATEIMAGEMASK;
  tvi.state = INDEXTOSTATEIMAGEMASK(check + 1);

  return TreeView_SetItem(window_, &tvi);
}
Exemple #13
0
void TreeView::setItemImage(HTREEITEM hTreeItem, int iImage, int iSelectedImage)
{
	TVITEM tvItem;
	tvItem.hItem = hTreeItem;
	tvItem.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
	tvItem.iImage = iImage;
	tvItem.iSelectedImage = iSelectedImage;
	TreeView_SetItem(_hSelf, &tvItem);
}
void TreeViewFrame::setItemText(HTREEITEM item, WideString text)
{
  TVITEM tvi;
  memset(&tvi, 0, sizeof tvi);
  tvi.hItem = item;
  tvi.mask = TVIF_TEXT;
  tvi.pszText = text.getBuffer();
  TreeView_SetItem(hWnd, &tvi);
}
void Win32TreeViewNode::modify( BBString *str,int icon ){

	TVITEM it;
	it.mask=TVIF_TEXT;
	it.pszText=(char*)str->c_str();
	it.hItem=_item;
	if (icon>-1) {it.mask|=TVIF_IMAGE|TVIF_SELECTEDIMAGE;it.iImage=icon;it.iSelectedImage=icon+0;}
//	if (icon>-1) {it.mask|=TVIF_IMAGE;it.iImage=icon;}
	TreeView_SetItem( _tree,&it );
}
Exemple #16
0
void CTreeItem::setImage(int newImage)
{
	UINT mask = TVIF_IMAGE;
	TVITEMEX itemex;
	itemex.mask = mask;
	itemex.hItem = handle;
	itemex.iImage = newImage;

	TreeView_SetItem(tree->getHandle(), &itemex);
}
Exemple #17
0
void CTreeItem::setText(LPWSTR text)
{
	UINT mask = TVIF_TEXT;
	TVITEMEX itemex;
	itemex.mask = mask;
	itemex.hItem = handle;
	itemex.pszText = text;

	TreeView_SetItem(tree->getHandle(), &itemex);
}
Exemple #18
0
void TreeNode::SetText(const std::string& text)
{
	mText = text;
	TVITEMEX tvi;
	ZeroMemory(&tvi, sizeof(TVITEMEX));
	tvi.mask = TVIF_TEXT;
	tvi.hItem = mHandle;
	tvi.pszText = const_cast<LPSTR>(mText.c_str());
	TreeView_SetItem(mTreeView->GetHandle(), &tvi);
}
Exemple #19
0
void CCList::SetInfoIcon(HTREEITEM hItem, HICON hIcon)
{
	_ASSERT(hItem && hIcon && GetItemType(hItem) == MCLCIT_INFO);
	TVITEM tvi = { 0 };
	tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
	tvi.hItem = hItem;
	HIMAGELIST iml = TreeView_GetImageList(hTreeView, TVSIL_NORMAL);
	tvi.iImage = tvi.iSelectedImage = ImageList_AddIcon(iml, hIcon); // again, we don't check for duplicate icons
	TreeView_SetImageList(hTreeView, iml, TVSIL_NORMAL);
	TreeView_SetItem(hTreeView, &tvi);
}
Exemple #20
0
BOOL TreeView::SetItem(HTREEITEM hItem, LPCWSTR pszText) {
  TVITEM tvi = {0};
  tvi.mask   = TVIF_HANDLE;
  tvi.hItem  = hItem;

  if (!TreeView_GetItem(m_hWindow, &tvi))
    return FALSE;

  tvi.mask |= TVIF_TEXT;
  tvi.pszText = (LPWSTR)pszText;
  return TreeView_SetItem(m_hWindow, &tvi);
}
Exemple #21
0
void CTreeItem::boldIt()
{
UINT state = TVIS_BOLD;
UINT mask = TVIF_STATE;
TVITEMEX itemex;
	itemex.mask = TVIF_STATE | TVIF_HANDLE;
	itemex.state = state;
	itemex.hItem = handle;
	itemex.stateMask = state;

	TreeView_SetItem(tree->getHandle(), &itemex);
}
BOOL TreeView::SetItem(HTREEITEM item, LPCWSTR text) {
  TVITEM tvi = {0};
  tvi.mask = TVIF_HANDLE;
  tvi.hItem = item;

  if (!TreeView_GetItem(window_, &tvi))
    return FALSE;

  tvi.mask |= TVIF_TEXT;
  tvi.pszText = const_cast<LPWSTR>(text);
  return TreeView_SetItem(window_, &tvi);
}
void FileBrowser::openSelectFile()
{
	// Get the selected item
	HTREEITEM selectedNode = _treeView.getSelection();
	if (not selectedNode) return;

	vector<generic_string> fullPathArray;
	generic_string fullPath;

	// go up until to root, then get the full path
	HTREEITEM parent = selectedNode;
	for (; parent != nullptr;)
	{
		generic_string folderName = _treeView.getItemDisplayName(parent);
	
		HTREEITEM temp = _treeView.getParent(parent);
		if (temp == nullptr)
		{
			LPARAM param = _treeView.getItemParam(parent);
			folderName = (param == 0) ? TEXT("") : *((generic_string *)param);
		}
		parent = temp;
		fullPathArray.push_back(folderName);
	}


	for (long i = fullPathArray.size() - 1; i >= 0; --i)
	{
		fullPath += fullPathArray[i];
		if (i != 0)
			fullPath += TEXT("\\");
	}

	// test the path - if it's a file, open it, otherwise just fold or unfold it
	if (not ::PathFileExists(fullPath.c_str()))
		return;

	TVITEM tvItem;
	tvItem.mask = TVIF_IMAGE | TVIF_SELECTEDIMAGE;
	if (::PathIsDirectory(fullPath.c_str()))
	{
		tvItem.iImage = INDEX_LEAF_INVALID;
		tvItem.iSelectedImage = INDEX_LEAF_INVALID;
	}
	else
	{
		::SendMessage(_hParent, NPPM_DOOPEN, 0, (LPARAM)(fullPath.c_str()));
		tvItem.iImage = INDEX_LEAF;
		tvItem.iSelectedImage = INDEX_LEAF;
	}
	TreeView_SetItem(_treeView.getHSelf(), &tvItem);
}
Exemple #24
0
void Manager::TreeItem::setState(UINT state)
{
	TVITEM item = { 0 };
	item.mask = TVIF_HANDLE | TVIF_STATE;
	item.stateMask = TVIS_STATEIMAGEMASK;
	item.hItem = m_handle;
	TreeView_GetItem(manDlg->m_hwndFileTree, &item);

	if (TreeItem::_GETSTATE(item.state) != 0) {
		item.state = state;
		TreeView_SetItem(manDlg->m_hwndFileTree, &item);
	}
}
Exemple #25
0
void plComponentDlg::IUpdateNodeName(plMaxNode *node)
{
    if (!fhDlg)
        return;

    // Update the name in the tree too
    HWND hTree = GetDlgItem(fhDlg, IDC_TREE);
    TVITEM tvi = {0};
    tvi.hItem = ISearchTree(hTree, (LPARAM)node);
    tvi.mask = TVIF_TEXT;
    tvi.pszText = node->GetName();
    TreeView_SetItem(hTree, &tvi);
}
void Explorerplusplus::OnTreeViewCopy(BOOL bCopy)
{
	IDataObject		*pClipboardDataObject = NULL;
	HTREEITEM		hItem;
	TVITEM			tvItem;
	HRESULT			hr;

	hItem = TreeView_GetSelection(m_hTreeView);

	if(hItem != NULL)
	{
		LPITEMIDLIST pidl = m_pMyTreeView->BuildPath(hItem);

		std::list<std::wstring> FileNameList;
		TCHAR szFullFileName[MAX_PATH];

		GetDisplayName(pidl,szFullFileName,SIZEOF_ARRAY(szFullFileName),SHGDN_FORPARSING);

		std::wstring stringFileName(szFullFileName);
		FileNameList.push_back(stringFileName);

		if(bCopy)
		{
			hr = CopyFiles(FileNameList,&pClipboardDataObject);
		}
		else
		{
			hr = CutFiles(FileNameList,&pClipboardDataObject);

			if(SUCCEEDED(hr))
			{
				m_hCutTreeViewItem = hItem;
				m_iCutTabInternal = m_iObjectIndex;

				tvItem.mask			= TVIF_HANDLE|TVIF_STATE;
				tvItem.hItem		= hItem;
				tvItem.state		= TVIS_CUT;
				tvItem.stateMask	= TVIS_CUT;
				TreeView_SetItem(m_hTreeView,&tvItem);
			}
		}

		if(SUCCEEDED(hr))
		{
			m_pClipboardDataObject = pClipboardDataObject;
		}

		CoTaskMemFree(pidl);
	}
}
Exemple #27
0
static int NSISCALL SetChildrenStates(HWND hwTree, HTREEITEM hItem, int iChecked)
{
  int iCheckedChildren = 0, iChildren = 0, *pFlags, iState = 1;
  HTREEITEM hItrItem;
  TVITEM tvItem;
  
  hItrItem = TreeView_GetChild(hwTree, hItem);
  while (hItrItem)
  {
    iCheckedChildren += SetChildrenStates(hwTree, hItrItem, iChecked);
    iChildren++;
    hItrItem = TreeView_GetNextSibling(hwTree, hItrItem);
  }
  
  tvItem.hItem = hItem;
  tvItem.mask = TVIF_PARAM | TVIF_STATE;
  tvItem.stateMask = TVIS_STATEIMAGEMASK;
  TreeView_GetItem(hwTree, &tvItem);
  
  pFlags = &(g_sections[tvItem.lParam].flags);

  if (*pFlags & SF_RO)
  {
    iState = 4;
    iChecked = *pFlags & SF_SELECTED;
  }

  *pFlags &= ~(SF_SELECTED|SF_PSELECTED);

  if (iCheckedChildren || iChecked)
  {
    iState++;
    if (iChildren == iCheckedChildren)
    {
      *pFlags |= SF_SELECTED;
    }
    else
    {
      iState++;
      *pFlags |= SF_PSELECTED;
    }
    iChecked = 1;
  }

  tvItem.state = INDEXTOSTATEIMAGEMASK(iState);

  TreeView_SetItem(hwTree, &tvItem);

  return iChecked;
}
Exemple #28
0
void TreeItem::SetChecked(bool check)
{
    TVITEM tvItem;

    tvItem.mask = TVIF_HANDLE | TVIF_STATE;
    tvItem.hItem = handle;
    tvItem.stateMask = TVIS_STATEIMAGEMASK;

    //Since state images are one-based, 1 in this macro turns the check off, and 
    //2 turns it on.

    tvItem.state = INDEXTOSTATEIMAGEMASK((check ? 2 : 1));

    TreeView_SetItem(hTree, &tvItem);
}
BOOL TreeView_SetCheckState(HWND hwndTreeView, HTREEITEM hItem, BOOL fCheck)
{
    TVITEM tvItem;

    tvItem.mask = TVIF_HANDLE | TVIF_STATE;
    tvItem.hItem = hItem;
    tvItem.stateMask = TVIS_STATEIMAGEMASK;

    // Image 1 in the tree-view check box image list is the
    // unchecked box. Image 2 is the checked box.

    tvItem.state = INDEXTOSTATEIMAGEMASK((fCheck ? 2 : 1));

    return TreeView_SetItem(hwndTreeView, &tvItem);
}
Exemple #30
0
void
mxTreeView::setUserData (mxTreeViewItem *item, void *userData)
{
    if (!d_this)
        return;

    if (item)
    {
        TV_ITEM tvItem;
        tvItem.mask = TVIF_HANDLE | TVIF_PARAM;
        tvItem.hItem = (HTREEITEM) item;
        tvItem.lParam = (LPARAM) userData;

        TreeView_SetItem (d_this->d_hwnd, &tvItem);
    }
}