| 40 | } |
| 41 | |
| 42 | bool ChannelView::InitTreeView() |
| 43 | { |
| 44 | HWND hwndTV = m_treeHwnd; |
| 45 | |
| 46 | HIMAGELIST himl; // handle to image list |
| 47 | |
| 48 | // Create the image list. |
| 49 | int flag = 0; |
| 50 | if (Supports32BitIcons()) |
| 51 | flag = ILC_COLOR32 | ILC_MASK; |
| 52 | else |
| 53 | flag = ILC_COLOR4 | ILC_MASK; |
| 54 | |
| 55 | if ((himl = ri::ImageList_Create(ScaleByDPI(CX_BITMAP), |
| 56 | ScaleByDPI(CY_BITMAP), |
| 57 | flag, |
| 58 | NUM_BITMAPS, 0)) == NULL) { |
| 59 | DbgPrintW("Cannot create image list!"); |
| 60 | return FALSE; |
| 61 | } |
| 62 | |
| 63 | // Add the open file, closed file, and document bitmaps. |
| 64 | m_nCategoryExpandIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_CATEGORY_EXPAND)))); |
| 65 | m_nCategoryCollapseIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_CATEGORY_COLLAPSE)))); |
| 66 | m_nChannelIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_CHANNEL)))); |
| 67 | m_nForumIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_GROUPDM)))); |
| 68 | m_nVoiceIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_VOICE)))); |
| 69 | m_nDmIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_DM)))); |
| 70 | m_nGroupDmIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_GROUPDM)))); |
| 71 | m_nChannelDotIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_CHANNEL_UNREAD)))); |
| 72 | m_nChannelRedIcon = ri::ImageList_AddIcon(himl, LoadIcon(g_hInstance, MAKEINTRESOURCE(DMIC(IDI_CHANNEL_MENTIONED)))); |
| 73 | |
| 74 | // Fail if not all of the images were added. |
| 75 | int ic = ri::ImageList_GetImageCount(himl); |
| 76 | if (ic < 8) { |
| 77 | DbgPrintW("Cannot add all icons!"); |
| 78 | ri::ImageList_Destroy(himl); |
| 79 | return FALSE; |
| 80 | } |
| 81 | |
| 82 | // Associate the image list with the tree-view control. |
| 83 | // It will be destroyed when the window is destroyed. |
| 84 | TreeView_SetImageList(hwndTV, himl, TVSIL_NORMAL); |
| 85 | |
| 86 | SetWindowFont(hwndTV, g_MessageTextFont, TRUE); |
| 87 | |
| 88 | return TRUE; |
| 89 | } |
| 90 | |
| 91 | bool ChannelView::InitListView() |
| 92 | { |
no test coverage detected