本文整理汇总了C++中TreeView_GetItem函数的典型用法代码示例。如果您正苦于以下问题:C++ TreeView_GetItem函数的具体用法?C++ TreeView_GetItem怎么用?C++ TreeView_GetItem使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TreeView_GetItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateTocExpansionState
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);
}
}
示例2: TreeView_GetSelection
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;
}
示例3: GoToTocLinkForTVItem
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);
});
}
}
示例4: SaveBranch
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);
}
}
示例5: LoadItemText
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;
}
示例6: replaceTreeItem
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);
}
}
示例7: OptTree_GetOptions
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;
}
示例8: TreeView_GetChild
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;
}
示例9: TreeView_GetItem
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);
}
}
}
}
示例10: ATLASSERT
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;
}
示例11: UndoSubItemChanges
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);
}
}
示例12: GetTVitemSelList
//---------------------------------------------------//
// 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;
}
示例13: GetDlgItem
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);
}
}
}
示例14: LoadLibraryW
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
}
示例15: TreeView_GetItem
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);
}