static BOOL AddIndexTab(HHInfo *info) { char hidden_column[] = "Column"; LVCOLUMNA lvc; if(info->tabs[TAB_INDEX].id == -1) return TRUE; /* No "Index" tab */ info->tabs[TAB_INDEX].hwnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEWW, szEmpty, WS_CHILD | WS_BORDER | LVS_SINGLESEL | LVS_REPORT | LVS_NOCOLUMNHEADER, 50, 50, 100, 100, info->WinType.hwndNavigation, NULL, hhctrl_hinstance, NULL); if(!info->tabs[TAB_INDEX].hwnd) { ERR("Could not create ListView control\n"); return FALSE; } memset(&lvc, 0, sizeof(lvc)); lvc.mask = LVCF_TEXT; lvc.pszText = hidden_column; if(SendMessageW(info->tabs[TAB_INDEX].hwnd, LVM_INSERTCOLUMNA, 0, (LPARAM) &lvc) == -1) { ERR("Could not create ListView column\n"); return FALSE; } ResizeTabChild(info, TAB_INDEX); ShowWindow(info->tabs[TAB_INDEX].hwnd, SW_HIDE); return TRUE; }
static LRESULT Child_OnSize(HWND hwnd) { HHInfo *info = (HHInfo*)GetWindowLongPtrW(hwnd, GWLP_USERDATA); RECT rect; if(!info || hwnd != info->WinType.hwndNavigation) return 0; GetClientRect(hwnd, &rect); SetWindowPos(info->hwndTabCtrl, HWND_TOP, 0, 0, rect.right - TAB_RIGHT_PADDING, rect.bottom - TAB_TOP_PADDING, SWP_NOMOVE); ResizeTabChild(info, TAB_CONTENTS); ResizeTabChild(info, TAB_INDEX); return 0; }
static BOOL AddContentTab(HHInfo *info) { if(info->tabs[TAB_CONTENTS].id == -1) return TRUE; /* No "Contents" tab */ info->tabs[TAB_CONTENTS].hwnd = CreateWindowExW(WS_EX_CLIENTEDGE, WC_TREEVIEWW, szEmpty, WS_CHILD | WS_BORDER | 0x25, 50, 50, 100, 100, info->WinType.hwndNavigation, NULL, hhctrl_hinstance, NULL); if(!info->tabs[TAB_CONTENTS].hwnd) { ERR("Could not create treeview control\n"); return FALSE; } ResizeTabChild(info, TAB_CONTENTS); ShowWindow(info->tabs[TAB_CONTENTS].hwnd, SW_SHOW); return TRUE; }
static BOOL AddSearchTab(HHInfo *info) { HWND hwndList, hwndEdit, hwndContainer; char hidden_column[] = "Column"; WNDPROC editWndProc; LVCOLUMNA lvc; if(info->tabs[TAB_SEARCH].id == -1) return TRUE; /* No "Search" tab */ hwndContainer = CreateWindowExW(WS_EX_CONTROLPARENT, szChildClass, szEmpty, WS_CHILD, 0, 0, 0, 0, info->WinType.hwndNavigation, NULL, hhctrl_hinstance, NULL); if(!hwndContainer) { ERR("Could not create search window container control.\n"); return FALSE; } hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE, WC_EDITW, szEmpty, WS_CHILD | WS_VISIBLE | ES_LEFT | SS_NOTIFY, 0, 0, 0, 0, hwndContainer, NULL, hhctrl_hinstance, NULL); if(!hwndEdit) { ERR("Could not create search ListView control.\n"); return FALSE; } if(SendMessageW(hwndEdit, WM_SETFONT, (WPARAM) info->hFont, (LPARAM) FALSE) == -1) { ERR("Could not set font for edit control.\n"); return FALSE; } editWndProc = (WNDPROC) SetWindowLongPtrW(hwndEdit, GWLP_WNDPROC, (LONG_PTR)EditChild_WndProc); if(!editWndProc) { ERR("Could not redirect messages for edit control.\n"); return FALSE; } SetWindowLongPtrW(hwndEdit, GWLP_USERDATA, (LONG_PTR)editWndProc); hwndList = CreateWindowExW(WS_EX_CLIENTEDGE, WC_LISTVIEWW, szEmpty, WS_CHILD | WS_VISIBLE | WS_BORDER | LVS_SINGLESEL | LVS_REPORT | LVS_NOCOLUMNHEADER, 0, 0, 0, 0, hwndContainer, NULL, hhctrl_hinstance, NULL); if(!hwndList) { ERR("Could not create search ListView control.\n"); return FALSE; } memset(&lvc, 0, sizeof(lvc)); lvc.mask = LVCF_TEXT; lvc.pszText = hidden_column; if(SendMessageW(hwndList, LVM_INSERTCOLUMNA, 0, (LPARAM) &lvc) == -1) { ERR("Could not create ListView column\n"); return FALSE; } info->search.hwndEdit = hwndEdit; info->search.hwndList = hwndList; info->search.hwndContainer = hwndContainer; info->tabs[TAB_SEARCH].hwnd = hwndContainer; SetWindowLongPtrW(hwndContainer, GWLP_USERDATA, (LONG_PTR)info); ResizeTabChild(info, TAB_SEARCH); return TRUE; }