void UpdateTocExpansionState(TabInfo *tab, HWND hwndTocTree, HTREEITEM hItem)
{
    while (hItem) {
        TVITEM item;
        item.hItem = hItem;
        item.mask = TVIF_PARAM | TVIF_STATE;
        item.stateMask = TVIS_EXPANDED;
        TreeView_GetItem(hwndTocTree, &item);

        DocTocItem *tocItem = item.lParam ? (DocTocItem *)item.lParam : nullptr;
        if (tocItem && tocItem->child) {
            // add the ids of toggled items to tocState
            bool wasToggled = !(item.state & TVIS_EXPANDED) == tocItem->open;
            if (wasToggled)
                tab->tocState.Append(tocItem->id);
            UpdateTocExpansionState(tab, hwndTocTree, TreeView_GetChild(hwndTocTree, hItem));
        }

        hItem = TreeView_GetNextSibling(hwndTocTree, hItem);
    }
}
CATTREEINFO* CATTreeCtrl::OSGetCurSel()
{
    HTREEITEM itemHndl = TreeView_GetSelection(fControlWnd);
    if (itemHndl == 0)
    {
        return 0;
    }
    TVITEM item;
    memset(&item,0,sizeof(item));
    item.hItem = itemHndl;
    item.mask = TVIF_PARAM;

    if (TreeView_GetItem(fControlWnd,&item))
    {
        CATTREEINFO* treeInfo = (CATTREEINFO*)item.lParam;
        return treeInfo;
    }

    CATASSERT(false,"Get selection failed, but something seems to be selected!");
    return 0;
}
static void GoToTocLinkForTVItem(WindowInfo* win, HWND hTV, HTREEITEM hItem=nullptr, bool allowExternal=true)
{
    if (!hItem)
        hItem = TreeView_GetSelection(hTV);

    TVITEM item;
    item.hItem = hItem;
    item.mask = TVIF_PARAM;
    TreeView_GetItem(hTV, &item);
    DocTocItem *tocItem = (DocTocItem *)item.lParam;
    if (!tocItem || !win->IsDocLoaded())
        return;
    if ((allowExternal || tocItem->GetLink() && Dest_ScrollTo == tocItem->GetLink()->GetDestType()) || tocItem->pageNo) {
        // delay changing the page until the tree messages have been handled
        TabInfo *tab = win->currentTab;
        Controller *ctrl = win->ctrl;
        uitask::Post([=] {
            GoToTocLinkTask(win, tocItem, tab, ctrl);
        });
    }
}
Example #4
0
static void SaveBranch(HWND hwndTree, branch_t *branch, int nValues)
{
    TVITEM tvi = { 0 };
    BYTE bChecked;
    DWORD iState = 0;

    for (int i = 0; i < nValues; i++) {
        tvi.mask = TVIF_HANDLE | TVIF_IMAGE;
        tvi.hItem = branch[i].hItem;
        TreeView_GetItem(hwndTree, &tvi);
        bChecked = ((tvi.iImage == IMG_CHECK) ? 1 : 0);
        if (branch[i].iMode) {
            if (bChecked)
                iState |= branch[i].iMode;
            if (iState & GC_EVENT_ADDSTATUS)
                iState |= GC_EVENT_REMOVESTATUS;
            db_set_dw(0, CHAT_MODULE, branch[i].szDBName, iState);
        }
        else db_set_b(0, CHAT_MODULE, branch[i].szDBName, bChecked);
    }
}
Example #5
0
int LoadItemText(HWND hwnd, HTREEITEM htreeItem, char *buf, int indent)
{
    TV_ITEM item;
    TCData *td;
    memset(&item, 0, sizeof(item));
    item.hItem = htreeItem;
    item.mask = TVIF_PARAM;
    TreeView_GetItem(hwnd, &item);
    td = (TCData*)item.lParam;
    if (td)
    {
        int size = strlen(td->col1Text) + indent;
        int n = 40 - size, i;
        if (n < 0)
            n = 0;
        if (td->col2Text)
        {
            size += n+1;
            size += strlen(td->col2Text);
        }
        size ++;
        if (buf)
        {
            for (i=0; i < indent; i++)
                strcat(buf, " ");
            strcat(buf, td->col1Text);
            if (td->col2Text)
            {
                for (i=0; i < n; i++)
                    strcat(buf, " ");
                    
                strcat(buf, " ");
                strcat(buf, td->col2Text);
            }
            strcat(buf, "\n");
        }
        return size;
    }
    return 0;
}
Example #6
0
void replaceTreeItem(HWND hwnd, MCONTACT hContact, const char *module, const char *newModule)
{
	int hItem = findItemInTree(hwnd, hContact, (char *)module);
	HTREEITEM hParent;

	if (hItem == -1)
		return;

	hParent = TreeView_GetParent(hwnd, (HTREEITEM)hItem);

	{
		TVITEM item;
		item.mask = TVIF_PARAM;
		item.hItem = (HTREEITEM)hItem;

		if (TreeView_GetItem(hwnd, &item))
			mir_free((ModuleTreeInfoStruct *)item.lParam);
		TreeView_DeleteItem(hwnd, item.hItem);
	}

	if (hParent && newModule) {
		TVINSERTSTRUCT tvi = {0};
		ModuleTreeInfoStruct *lParam;

		tvi.hParent = hParent;
		tvi.hInsertAfter = TVI_SORT;
		tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
		tvi.item.pszText = (char *)newModule;

		lParam = (ModuleTreeInfoStruct *)mir_calloc(sizeof(ModuleTreeInfoStruct));
		lParam->hContact = hContact;
		lParam->type = KNOWN_MODULE;
		tvi.item.iImage = 1;
		tvi.item.iSelectedImage = 2;

		tvi.item.lParam = (LPARAM)lParam;

		TreeView_InsertItem(hwnd, &tvi);
	}
}
Example #7
0
HTREEITEM plComponentDlg::IFindTreeItem(HWND hTree, const char *name, HTREEITEM hParent)
{
    HTREEITEM hChild = TreeView_GetChild(hTree, hParent);

    while (hChild)
    {
        char buf[256];
        TVITEM tvi;
        tvi.mask  = TVIF_TEXT;
        tvi.hItem = hChild;
        tvi.pszText = buf;
        tvi.cchTextMax = sizeof(buf);
        TreeView_GetItem(hTree, &tvi);

        if (!strcmp(name, tvi.pszText))
            return hChild;

        hChild = TreeView_GetNextSibling(hTree, hChild);
    }

    return nil;
}
Example #8
0
DWORD OptTree_GetOptions(HWND hwnd, int idcTree, OPTTREE_OPTION *options, int optionCount, char *szSettingName)
{
    enum { IMG_GROUP, IMG_CHECK, IMG_NOCHECK, IMG_RCHECK, IMG_NORCHECK, IMG_GRPOPEN, IMG_GRPCLOSED };

    HWND hwndTree = GetDlgItem(hwnd, idcTree);
    DWORD result = 0;
    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;
            tvi.hItem = options[i].hItem;
            TreeView_GetItem(hwndTree, &tvi);
            if ((tvi.iImage == IMG_CHECK) || (tvi.iImage == IMG_RCHECK))
                result |= options[i].dwFlag;
        }
    }
    return result;
}
Example #9
0
HTREEITEM BuildTree::FindChildItem(HTREEITEM hParent,const char *szItemText)
{
	HTREEITEM hItem = TreeView_GetChild(s_hWndTV,hParent);

	char szTemp[256];
	while(hItem != NULL)
	{
		TV_ITEM tvi = {0};
		tvi.mask = TVIF_TEXT;
		tvi.pszText = szTemp;
		tvi.cchTextMax = 255;
		tvi.hItem = hItem;
		TreeView_GetItem(s_hWndTV,&tvi);

		if (stricmp(tvi.pszText,szItemText) == 0)
		{
			return hItem;
		}
		hItem = TreeView_GetNextSibling(s_hWndTV,hItem);
	}
	return hItem;
}
void CMyTreeView::UpdateParent(HTREEITEM hParent)
{
	if(hParent != NULL)
	{
		TVITEM tvItem;
		SFGAOF Attributes = SFGAO_HASSUBFOLDER;
		BOOL bRes;
		HRESULT hr;

		tvItem.mask		= TVIF_PARAM|TVIF_HANDLE;
		tvItem.hItem	= hParent;
		bRes = TreeView_GetItem(m_hTreeView,&tvItem);

		if(bRes)
		{
			hr = GetItemAttributes(m_pItemInfo[static_cast<int>(tvItem.lParam)].pidl,
				&Attributes);

			if(SUCCEEDED(hr))
			{
				/* If the parent folder no longer has any sub-folders,
				set its number of children to 0. */
				if((Attributes & SFGAO_HASSUBFOLDER) != SFGAO_HASSUBFOLDER)
				{
					tvItem.cChildren = 0;
					TreeView_Expand(m_hTreeView,hParent,TVE_COLLAPSE);
				}
				else
				{
					tvItem.cChildren = 1;
				}

				tvItem.mask		= TVIF_CHILDREN;
				tvItem.hItem	= hParent;
				TreeView_SetItem(m_hTreeView,&tvItem);
			}
		}
	}
}
Example #11
0
BOOL KUIMulStatusTree::GetCheck(HTREEITEM hItem, int& nCheck)
{
    ATLASSERT(m_hWnd != NULL);

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

    tvi.hItem = hItem;
    tvi.mask = TVIF_STATE;
    tvi.stateMask = TVIS_STATEIMAGEMASK;
    if (!TreeView_GetItem(m_hWnd, &tvi))
        return FALSE;

    nCheck = tvi.state >> 12;

    if (nCheck < 0)
        return FALSE;

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

    return TRUE;
}
Example #12
0
void UndoSubItemChanges(HWND htv, HTREEITEM hItem, int cmd)
{
	TVITEM tvi = {0};
	tvi.mask = TVIF_HANDLE | TVIF_PARAM;
	tvi.hItem = hItem;
	TreeView_GetItem(htv, &tvi);

	TreeItem *treeItem = (TreeItem *)tvi.lParam;
	if (SECTIONPARAM_FLAGS(treeItem->value) & SECTIONPARAM_HAVEPAGE) {
		mir_cslock lck(csIconList);

		for (int indx = 0; indx < iconList.getCount(); indx++)
			if (iconList[ indx ]->section == sectionList[ SECTIONPARAM_INDEX(treeItem->value) ])
				UndoChanges(indx, cmd);
	}

	tvi.hItem = TreeView_GetChild(htv, tvi.hItem);
	while (tvi.hItem) {
		UndoSubItemChanges(htv, tvi.hItem, cmd);
		tvi.hItem = TreeView_GetNextSibling(htv, tvi.hItem);
	}
}
Example #13
0
//---------------------------------------------------//
// GetTVitemSelList
//---------------------------------------------------//
BOOL GetTVitemSelList(HWND hWndTV,HTREEITEM hItmStart,int StrIndex)
{	HTREEITEM hItm=hItmStart;
	TVITEM pitem;
	int index=0;
	char lpItmTxt[MAX_RS_SIZE]={0};
	pitem.pszText=lpItmTxt;
    pitem.mask=TVIF_TEXT;
	if(GetmHpVarStruct()->CourantTask->GetMultiIndex(StrIndex)==NULL) return TRUE;
	while(hItm!=NULL)
	{	GetmHpVarStruct()->SelItemListe->AddItemIndex(index);
		pitem.cchTextMax=MAX_RS_SIZE;
		pitem.hItem=hItm;
		TreeView_GetItem(hWndTV,&pitem);
		if(!strncmp(pitem.pszText,GetmHpVarStruct()->CourantTask->GetMultiIndex(StrIndex),MAX_RS_SIZE))
		{	if(GetTVitemSelList(hWndTV,TreeView_GetNextItem(hWndTV,hItm,TVGN_CHILD),(StrIndex+1))) return TRUE;
		}
		hItm=TreeView_GetNextItem(hWndTV,hItm,TVGN_NEXT);
		index++;
		GetmHpVarStruct()->SelItemListe->RemoveLastIndexItem();
	}
	return FALSE;
}
Example #14
0
void CPpcFolderDlg::OnBtnDown(HWND hDlg, WPARAM wParam)
{
	TV_ITEM tvi;
	HWND hWnd = GetDlgItem(hDlg, IDC_TREE_FOLDER);
	HTREEITEM hItem = TreeView_GetSelection(hWnd);
	if (!hItem)
		return;

	memset(&tvi, 0, sizeof(tvi));
	tvi.mask = TVIF_CHILDREN | TVIF_STATE;
	tvi.hItem = hItem;
	TreeView_GetItem(hWnd, &tvi);

	if (tvi.cChildren) {
		if (wParam == VK_RIGHT) {
			if (!(tvi.state & TVIS_EXPANDED))
				TreeView_Expand(hWnd, hItem, TVE_EXPAND);
			else {
				hItem = TreeView_GetChild(hWnd, hItem);
				TreeView_SelectItem(hWnd, hItem);
			}
		}
		else {
			if (tvi.state & TVIS_EXPANDED)
				TreeView_Expand(hWnd, hItem, TVE_COLLAPSE);
			else {
				hItem = TreeView_GetParent(hWnd, hItem);
				TreeView_SelectItem(hWnd, hItem);
			}
		}
	}
	else {
		if (wParam == VK_LEFT) {
			hItem = TreeView_GetParent(hWnd, hItem);
			TreeView_SelectItem(hWnd, hItem);
		}
	}
}
Example #15
0
VOID
CDeviceView::DisplayPropertySheet()
{
#ifndef __REACTOS__
    pDevicePropertiesExW DevicePropertiesExW;
    HMODULE hModule;

    hModule = LoadLibraryW(L"devmgr.dll");
    if (hModule == NULL) return;

    DevicePropertiesExW = (pDevicePropertiesExW)GetProcAddress(hModule,
                                                               "DevicePropertiesExW");
    if (DevicePropertiesExW == NULL)
    {
        FreeLibrary(hModule);
        return;
    }
#endif

    TV_ITEM tvItem;

    tvItem.hItem = TreeView_GetSelection(m_hTreeView);
    tvItem.mask = TVIF_PARAM;

    if (TreeView_GetItem(m_hTreeView, &tvItem) &&
        (LPTSTR)tvItem.lParam != NULL)
    {
        DevicePropertiesExW(m_hTreeView,
                            NULL,
                            (LPTSTR)tvItem.lParam,
                            1,//DPF_EXTENDED,
                            FALSE);
    }

#ifndef __REACTOS__
    FreeLibrary(hModule);
#endif
}
Example #16
0
void 
FileTransfer::GetTVPath(HWND hwnd, HTREEITEM hTItem, char *path)
{
	char szText[rfbMAX_PATH];
	TVITEM _tvi;
	path[0] = '\0';
	do {
		_tvi.mask = TVIF_TEXT | TVIF_HANDLE;
		_tvi.hItem = hTItem;
		_tvi.pszText = szText;
		_tvi.cchTextMax = rfbMAX_PATH;
		TreeView_GetItem(hwnd, &_tvi);
		strcat(path, "\\");
		strcat(path, _tvi.pszText);
		hTItem = TreeView_GetParent(hwnd, hTItem);
	}
	while(hTItem != NULL);
	char path_tmp[rfbMAX_PATH], path_out[rfbMAX_PATH];
	path_tmp[0] = '\0';
	path_out[0] = '\0';
	int len = strlen(path);
	int ii = 0;
	for (int i = (len-1); i>=0; i--) {
		if (path[i] == '\\') {
			StrInvert(path_tmp);
			strcat(path_out, path_tmp);
			strcat(path_out, "\\");
			path_tmp[0] = '\0';
			ii = 0;
		} else {
			path_tmp[ii] = path[i];
			path_tmp[ii+1] = '\0';
			ii++;
		}
	}
	if (path_out[strlen(path_out)-1] == '\\') path_out[strlen(path_out)-1] = '\0';
	strcpy(path, path_out);
}
Example #17
0
void    IDeleteRecurse( HWND tree, HTREEITEM item )
{
    while( item != nil )
    {
        HTREEITEM   child = TreeView_GetChild( tree, item );
        if( child != nil )
            IDeleteRecurse( tree, child );

        TVITEM  itemInfo;
        itemInfo.mask = TVIF_PARAM | TVIF_HANDLE;
        itemInfo.hItem = item;
        TreeView_GetItem( tree, &itemInfo );
        plKeyInfo *keyInfo = (plKeyInfo *)itemInfo.lParam;
        if( keyInfo != nil )
        {
            delete keyInfo;
            itemInfo.lParam = 0;
            TreeView_SetItem( tree, &itemInfo );
        }

        item = TreeView_GetNextSibling( tree, item );
    }
}
Example #18
0
char *GetItemPath(HTREEITEM hti)
{
	char *s; int i;
	s = pathbuf + 383;
	pathbuf[383] = 0;
	fdbuf[255] = 0;
	fti.mask = TVIF_TEXT;
	fti.pszText = fdbuf;
	fti.cchTextMax = 255;

	do
	{
		fti.hItem = hti;
		TreeView_GetItem(htree, &fti);
		i = strnlen(fdbuf, 255);
		s -= i+1;
		if(s < pathbuf) return 0;
		memcpy(s+1, fdbuf, i);
		s[0] = '\\';
	} while(hti = TreeView_GetParent(htree, hti));

	return s + 1;
}
Example #19
0
void ExpandNode( Document * doc, NMTREEVIEW * info )
{
	if (!doc || !info->itemNew.hItem)
		return;

	/* blatant hack. if we didnt get spurious messages, we wouldnt need this. */
	/* thanks, commctrl guys! */

	if (TreeView_GetChild( outlineHwnd, info->itemNew.hItem ))
		return;	// already populated

	// grab the fields we actually care about (value ptr, whether we should have children)
	TVITEM item;
	memset( &item, 0, sizeof( item ) );
	item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_CHILDREN;
	item.hItem = info->itemNew.hItem;

	TreeView_GetItem( outlineHwnd, &item );

	// it's possible that lParam = 0 here, since the tree has a builtin root node
	if (item.lParam && item.cChildren)
		BuildOutline( (Dictionary *)item.lParam, item.hItem, doc->xrefTable );
}
void XuLy_LV_NMDBLCLK(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	NMITEMACTIVATE *lpnmitem = (LPNMITEMACTIVATE) lParam;
	// Neu khong co item nao duoc chon thi thoat
	if (lpnmitem->iItem == -1)
		return;

	LVITEM kq;
	TCHAR szFileName[PATHFILE_MAX_LEN];

	kq.mask = LVIF_TEXT;
	kq.iItem = lpnmitem->iItem;
	kq.iSubItem = 0;
	kq.pszText = szFileName;
	kq.cchTextMax = PATHFILE_MAX_LEN;

	ListView_GetItem(hwndListView, &kq);

	HTREEITEM hParent = TreeView_GetSelection(hwndTreeView);
	HTREEITEM hItem = TV_FindItem(hParent, kq.pszText);

	if (hItem == NULL) // Item la tap tin
	{
		// Lay duong dan cua thu muc cha roi noi voi ten tap tin de co duoc duong
		// dan thuc su cua file
		TVITEM k;
		k.hItem = hParent;
		k.mask = TVIF_PARAM;
		TreeView_GetItem(hwndTreeView, &k);		
		TCHAR szFile[PATHFILE_MAX_LEN];
		wsprintf(szFile, _T("%s\\%s"), (TCHAR*) k.lParam, kq.pszText);
		// Thuc thi file
		ShellExecute(NULL , _T("open"), szFile, NULL, NULL, SW_SHOWNORMAL);
	}
	else
		TreeView_SelectItem(hwndTreeView, hItem);	
}
Example #21
0
VOID
FullStackCleanUp(
    __in PDIALOG_OBJECT Object
    )
{
    PFULLSTACK_CONTEXT Context;
	PTREELIST_OBJECT TreeList;
    HWND hWndTree;
    HTREEITEM hItem, hChildItem;
	TVITEM tvi = {0};

    Context = SdkGetContext(Object, FULLSTACK_CONTEXT);
    TreeList = Context->Base.TreeList;
    ASSERT(TreeList != NULL);

    hWndTree = TreeList->hWndTree;
    hItem = TreeView_GetChild(TreeList->hWndTree, TVI_ROOT);

	while (hItem != NULL) {
        
        hChildItem = TreeView_GetChild(TreeList->hWndTree, hItem);

        while (hChildItem) {
            tvi.mask = TVIF_PARAM;
            tvi.hItem = hChildItem;
            TreeView_GetItem(TreeList->hWndTree, &tvi);
            
            if (tvi.lParam) {
                SdkFree((PVOID)tvi.lParam);
            }

            hChildItem = TreeView_GetNextSibling(TreeList->hWndTree, hChildItem);
        }

		hItem = TreeView_GetNextSibling(TreeList->hWndTree, hItem);
	}
}
Example #22
0
static void
cfgui_free_node(HWND hwtv, HTREEITEM hItem) {
    TVITEMEX iex;
    HTREEITEM hChItem;

    ZeroMemory(&iex, sizeof(iex));

    iex.mask = TVIF_PARAM;
    iex.hItem = hItem;

    if (TreeView_GetItem(hwtv, &iex)) {
        khui_config_node node;

        node = (khui_config_node) iex.lParam;
        khui_cfg_release(node);
    }

    hChItem = TreeView_GetChild(hwtv, hItem);
    while(hChItem) {
        cfgui_free_node(hwtv, hChItem);

        hChItem = TreeView_GetNextSibling(hwtv, hChItem);
    }
}
Example #23
0
const char*
mxTreeView::getLabel (mxTreeViewItem *item) const
{
    static char label[256];
    strcpy (label, "");

    if (!d_this)
        return label;

    if (item)
    {
        TV_ITEM tvItem;
        tvItem.mask = TVIF_HANDLE | TVIF_TEXT;
        tvItem.hItem = (HTREEITEM) item;
        tvItem.pszText = (LPSTR) label;
        tvItem.cchTextMax = 256;

        TreeView_GetItem (d_this->d_hwnd, &tvItem);

        return tvItem.pszText;
    }

    return label;
}
Example #24
0
static void SaveTree(HWND hwndDlg)
{
	HWND hTree = GetDlgItem(hwndDlg, IDC_BUTTONORDERTREE);

	TVITEM tvi = { 0 };
	tvi.hItem = TreeView_GetRoot(hTree);
	tvi.stateMask = TVIS_STATEIMAGEMASK;
	tvi.mask = TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;

	LIST<TopButtonInt> tmpList(8);

	while(tvi.hItem != NULL) {
		TreeView_GetItem(hTree, &tvi);

		TopButtonInt* btn = (TopButtonInt*)tvi.lParam;
		Buttons.remove(btn);

		if (TreeView_GetCheckState(hTree,tvi.hItem))
			btn->dwFlags |= TTBBF_VISIBLE;
		else
			btn->dwFlags &= ~TTBBF_VISIBLE;
		btn->dwFlags &= ~TTBBF_OPTIONAL;
		btn->arrangedpos = tmpList.getCount();

		tmpList.insert(btn);
		tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
	}
	{
		mir_cslock lck(csButtonsHook);
		for (int i=0; i < Buttons.getCount(); i++)
			delete Buttons[i];

		Buttons = tmpList;
	}
	SaveAllButtonsOptions();
}
Example #25
0
void RemoveFromOptions(int id)
{
	if (OptionshWnd) {
		HWND hTree = GetDlgItem(OptionshWnd, IDC_BUTTONORDERTREE);
		TVITEM tvi = { 0 };
		tvi.hItem = TreeView_GetRoot(hTree);
		tvi.mask = TVIF_PARAM | TVIF_HANDLE;

		TopButtonInt* btn;
		while(tvi.hItem != NULL) {
			TreeView_GetItem(hTree, &tvi);
			btn = (TopButtonInt*)tvi.lParam;
			if (btn->id == id) {
			  // delete if was changed
				if (btn->dwFlags & TTBBF_OPTIONAL)
					delete btn;
				TreeView_DeleteItem(hTree,tvi.hItem);
				break;
			}

			tvi.hItem = TreeView_GetNextSibling(hTree, tvi.hItem);
		}
	}
}
Example #26
0
LRESULT
FilterOnWmItemChanged(
	IN HWND hWnd, 
	IN UINT uMsg, 
	IN WPARAM wp, 
	IN LPARAM lp
	)
{
	PSDK_TV_STATE State;
	HWND hWndTree;
	TVITEMEX Item = {0};

	State = (PSDK_TV_STATE)lp;
	hWndTree = GetDlgItem(hWnd, IDC_TREE_FILTER);

	//
	// Get the current state of treeview item
	//

	Item.mask = TVIF_STATE | TVIF_PARAM;
	Item.stateMask = TVIS_STATEIMAGEMASK ;
	Item.hItem = State->hItem;
	TreeView_GetItem(hWndTree, &Item);

	State->NewState = Item.state;
	State->lParam = Item.lParam;

	//
	// Delegate to FastOnItemChanged()
	//

	FilterOnItemChanged(hWnd, hWndTree, State->hItem, State->NewState, State->OldState, State->lParam);
	SdkFree(State);

	return 0L;
}
Example #27
0
ConfigTreeData *PrefsTreeCtrl::FindModuleConfig( ConfigTreeData *config_data )
{
    /* We need this complexity because submodules don't have their own config
     * options. They use the parent module ones. */

    if( !config_data || !config_data->b_submodule )
    {
        return config_data;
    }

    /*long cookie, cookie2;*/
    ConfigTreeData *config_new;
    HTREEITEM item = TreeView_GetChild( hwndTV, plugins_item );
    while( item != 0 )
    {
        HTREEITEM item2 = TreeView_GetChild( hwndTV, item );
        while( item2 != 0 )
        {       
            TVITEM tvi = {0};
            tvi.mask = TVIF_PARAM;
            tvi.hItem = item2;
            TreeView_GetItem( hwndTV, &tvi );
            config_new = (ConfigTreeData *)tvi.lParam;
            if( config_new && !config_new->b_submodule &&
                config_new->i_object_id == config_data->i_object_id )
            {
                return config_new;
            }
            item2 = TreeView_GetNextSibling( hwndTV, item2 );
        }
        item = TreeView_GetNextSibling( hwndTV, item );
    }

    /* Found nothing */
    return NULL;
}
Example #28
0
void PrefsTreeCtrl::OnSelectTreeItem( LPNM_TREEVIEW pnmtv, HWND parent,
                                      HINSTANCE hInst )
{
    ConfigTreeData *config_data = NULL;

    if( pnmtv->itemOld.hItem )
        config_data = FindModuleConfig( (ConfigTreeData *)pnmtv->itemOld.lParam );

    if( config_data && config_data->panel )
    {
        config_data->panel->Hide();
    }

    /* Don't use event.GetItem() because we also send fake events */
    TVITEM tvi = {0};
    tvi.mask = TVIF_PARAM;
    tvi.hItem = TreeView_GetSelection( hwndTV );
    TreeView_GetItem( hwndTV, &tvi );
    config_data = FindModuleConfig( (ConfigTreeData *)tvi.lParam );
    if( config_data )
    {
        if( !config_data->panel )
        {
            /* The panel hasn't been created yet. Let's do it. */
            config_data->panel =
                new PrefsPanel( parent, hInst, p_intf, p_prefs_dialog,
                                config_data->i_object_id,
                                config_data->psz_section,
                                config_data->psz_help );
        }
        else
        {
            config_data->panel->Show();
        }
    }
}
Example #29
0
BOOL wbGetTreeViewItemText(PWBOBJ pwbo, HTREEITEM hItem, LPTSTR pszText, int nChar)
{
	TV_ITEM tvi;

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

	if(!pszText || !nChar)
		return FALSE;

	if(!hItem)
		return FALSE;

	// Change the item

	tvi.hItem = hItem;
	tvi.mask = TVIF_HANDLE | TVIF_TEXT;
	tvi.pszText = pszText;
	tvi.cchTextMax = nChar;

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

	return TreeView_GetItem(pwbo->hwnd, &tvi);
}
Example #30
0
void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
{
	if (root) {
		TCHAR title[2048] = {0};

		TVITEM item = {0};
		item.mask = TVIF_TEXT;
		item.hItem = root;
		item.pszText = title;
		item.cchTextMax = _countof(title);

		if (TreeView_GetItem(hWndDlg, &item))
			if (mir_tstrlen(title) > 0)
				AddFilterString(key, title);

		HTREEITEM child = root;
		while (child) {
			child = TreeView_GetNextItem(hWndDlg, child, TVGN_CHILD);
			AddTreeViewNodes(hWndDlg, key, child);
		}

		AddTreeViewNodes(hWndDlg, key, TreeView_GetNextSibling(hWndDlg, root));
	}
}