| 270 | } |
| 271 | |
| 272 | int Treeview::UpdateDirectory(FileObject * dir) { |
| 273 | void* dat = dir->GetData(); |
| 274 | if (!dat) |
| 275 | return 0; |
| 276 | |
| 277 | HTREEITEM hti = (HTREEITEM)dat; |
| 278 | |
| 279 | TV_ITEM tvi{}; |
| 280 | tvi.hItem = hti; |
| 281 | tvi.mask = TVIF_STATE; |
| 282 | tvi.stateMask = TVIS_EXPANDED; |
| 283 | BOOL res = TreeView_GetItem(m_hwnd, &tvi); |
| 284 | if (res == FALSE) |
| 285 | return -1; |
| 286 | |
| 287 | bool expanded = (tvi.state & TVIS_EXPANDED); |
| 288 | if (expanded) { |
| 289 | RemoveAllChildItems(hti); |
| 290 | FillTreeDirectory(dir); |
| 291 | TreeView_Expand(m_hwnd, hti, TVE_EXPAND); |
| 292 | } |
| 293 | return 0; |
| 294 | } |
| 295 | |
| 296 | int Treeview::CollapseDirectory(FileObject* dir) |
| 297 | { |