void CJabberDlgBookmarks::OnInitDialog() { CSuper::OnInitDialog(); WindowSetIcon(m_hwnd, m_proto, "bookmarks"); m_btnAdd.Disable(); m_btnEdit.Disable(); m_btnRemove.Disable(); m_lvBookmarks.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_HEADERDRAGDROP | LVS_EX_DOUBLEBUFFER); HIMAGELIST hIml = m_lvBookmarks.CreateImageList(LVSIL_SMALL); ImageList_AddIcon_Icolib(hIml, m_proto->LoadIconEx("group")); ImageList_AddIcon_Icolib(hIml, Skin_LoadIcon(SKINICON_EVENT_URL)); m_lvBookmarks.AddColumn(0, TranslateT("Bookmark Name"), m_proto->getWord("bookmarksWnd_cx0", 120)); m_lvBookmarks.AddColumn(1, TranslateT("Address (JID or URL)"), m_proto->getWord("bookmarksWnd_cx1", 210)); m_lvBookmarks.AddColumn(2, TranslateT("Nickname"), m_proto->getWord("bookmarksWnd_cx2", 90)); m_lvBookmarks.EnableGroupView(TRUE); m_lvBookmarks.AddGroup(0, TranslateT("Conferences")); m_lvBookmarks.AddGroup(1, TranslateT("Links")); Utils_RestoreWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "bookmarksWnd_"); }
void TreeList_Create(HWND hwnd) { TTreeList_Data *data = new TTreeList_Data; data->root = new TTreeList_ItemInfo; data->root->flags = TLIF_EXPANDED|TLIF_VISIBLE|TLIF_ROOT; data->root->indent = -1; data->hItemSelected = data->root; sttTreeList_SeWindowData(hwnd, data); ListView_SetExtendedListViewStyle(hwnd, LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER | LVS_EX_GRIDLINES | LVS_EX_INFOTIP); HIMAGELIST hIml; hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1); ListView_SetImageList (hwnd, hIml, LVSIL_SMALL); hIml = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 2, 1); ImageList_AddIcon_Icolib(hIml, (HICON)CallService(MS_SKIN_LOADICON, SKINICON_OTHER_GROUPOPEN, 0)); ImageList_AddIcon_Icolib(hIml, (HICON)CallService(MS_SKIN_LOADICON, SKINICON_OTHER_GROUPSHUT, 0)); ImageList_AddIcon_Icolib(hIml, (HICON)CallService(MS_SKIN_LOADICON, SKINICON_OTHER_DOWNARROW, 0)); ListView_SetImageList (hwnd, hIml, LVSIL_STATE); }
void CCtrlTreeOpts::OnInit() { CCtrlTreeView::OnInit(); TCHAR itemName[1024]; HIMAGELIST hImgLst; SelectItem(NULL); DeleteAllItems(); hImgLst = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR|ILC_COLOR32|ILC_MASK, 5, 1); ImageList_AddIcon_Icolib(hImgLst, LoadSkinnedIcon(SKINICON_OTHER_MIRANDA)); ImageList_AddIcon_Icolib(hImgLst, LoadSkinnedIcon(SKINICON_OTHER_TICK)); // check on ImageList_AddIcon_Icolib(hImgLst, LoadSkinnedIcon(SKINICON_OTHER_NOTICK)); // check off ImageList_AddIcon_Icolib(hImgLst, LoadSkinnedIcon(SKINICON_OTHER_TICK)); // radio on ImageList_AddIcon_Icolib(hImgLst, LoadSkinnedIcon(SKINICON_OTHER_NOTICK)); // radio on ImageList_AddIcon_Icolib(hImgLst, LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN)); ImageList_AddIcon_Icolib(hImgLst, LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT)); SetImageList(hImgLst, TVSIL_NORMAL); /* build options tree. based on code from IcoLib */ for (int i = 0; i < m_options.getCount(); i++) { TCHAR* sectionName; int sectionLevel = 0; HTREEITEM hSection = NULL; lstrcpy(itemName, m_options[i]->m_szOptionName); sectionName = itemName; while (sectionName) { // allow multi-level tree TCHAR* pItemName = sectionName; HTREEITEM hItem; if (sectionName = _tcschr(sectionName, '/')) { // one level deeper *sectionName = 0; sectionName++; } hItem = FindNamedItem(hSection, pItemName); if (!sectionName || !hItem) { if (!hItem) { TVINSERTSTRUCT tvis = {0}; tvis.hParent = hSection; tvis.hInsertAfter = TVI_LAST;//TVI_SORT; tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_STATE|TVIF_IMAGE|TVIF_SELECTEDIMAGE; tvis.item.pszText = pItemName; tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED; if (sectionName) { tvis.item.lParam = -1; tvis.item.state |= TVIS_BOLD; tvis.item.stateMask |= TVIS_BOLD; tvis.item.iImage = tvis.item.iSelectedImage = IMG_GRPOPEN; } else { tvis.item.lParam = i; BYTE val = *m_options[i]->m_option; if (m_options[i]->m_groupId == OPTTREE_CHECK) { tvis.item.iImage = tvis.item.iSelectedImage = val ? IMG_CHECK : IMG_NOCHECK; } else { tvis.item.iImage = tvis.item.iSelectedImage = val ? IMG_RCHECK : IMG_NORCHECK; } } hItem = InsertItem(&tvis); if (!sectionName) m_options[i]->m_hItem = hItem; } } sectionLevel++; hSection = hItem; } } TranslateTree(); ShowWindow(m_hwnd, SW_SHOW); SelectItem(FindNamedItem(0, NULL)); }