| 154 | } |
| 155 | |
| 156 | HTREEITEM ChannelView::AddItemToTree(HWND hwndTV, LPTSTR lpszItem, HTREEITEM hParent, int nIndex, int nParentIndex, int nIcon) |
| 157 | { |
| 158 | assert(TreeMode()); |
| 159 | |
| 160 | TVITEM tvi; |
| 161 | TVINSERTSTRUCT tvins; |
| 162 | HTREEITEM hti; |
| 163 | |
| 164 | tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; |
| 165 | |
| 166 | // Set the text of the item. |
| 167 | tvi.pszText = lpszItem; |
| 168 | tvi.cchTextMax = sizeof(tvi.pszText) / sizeof(tvi.pszText[0]); |
| 169 | |
| 170 | // Assume the item is not a parent item, so give it a |
| 171 | // document image. |
| 172 | tvi.iImage = nIcon; |
| 173 | tvi.iSelectedImage = nIcon; |
| 174 | |
| 175 | // Save the heading level in the item's application-defined |
| 176 | // data area. |
| 177 | tvi.lParam = (LPARAM)nIndex; |
| 178 | tvins.item = tvi; |
| 179 | tvins.hInsertAfter = GetPrevious(nParentIndex); |
| 180 | |
| 181 | // Set the parent item based on the specified level. |
| 182 | tvins.hParent = hParent; |
| 183 | |
| 184 | // Add the item to the tree-view control. |
| 185 | HTREEITEM prev = (HTREEITEM)SendMessage(hwndTV, TVM_INSERTITEM, 0, (LPARAM)(LPTVINSERTSTRUCT)&tvins); |
| 186 | |
| 187 | if (prev == NULL) |
| 188 | return NULL; |
| 189 | |
| 190 | SetPrevious(nParentIndex, prev); |
| 191 | |
| 192 | // The new item is a child item. Give the parent item a |
| 193 | // closed folder bitmap to indicate it now has child items. |
| 194 | hti = TreeView_GetParent(hwndTV, prev); |
| 195 | TreeView_Expand(hwndTV, hti, TVM_EXPAND); |
| 196 | |
| 197 | return prev; |
| 198 | } |
| 199 | |
| 200 | void ChannelView::OnUpdateSelectedChannel(Snowflake newCh) |
| 201 | { |
nothing calls this directly
no outgoing calls
no test coverage detected