MCPcopy Create free account
hub / github.com/Chaoses-Ib/IbEverythingExt / quick_list_window_proc

Function quick_list_window_proc

EverythingExt/quick_select.cpp:709–859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

707
708WNDPROC quick_list_window_proc_prev;
709LRESULT CALLBACK quick_list_window_proc(
710 _In_ HWND hwnd,
711 _In_ UINT uMsg,
712 _In_ WPARAM wParam,
713 _In_ LPARAM lParam)
714{
715 switch (uMsg) {
716 case quick_list_msg_update: {
717 QuickListData* data = (QuickListData*)GetPropW(hwnd, quick_list_prop);
718 if (!data) {
719 DebugOStream() << L"quick_list prop is null\n";
720 break;
721 }
722
723 // adjust the height and width of items and the height of the header
724 RECT item_rect;
725 if (ListView_GetItemRect(data->list, 0, &item_rect, LVIR_BOUNDS)) {
726 if (int new_item_height = item_rect.bottom - item_rect.top;
727 new_item_height != data->item_height)
728 {
729 // adjust the height of items
730 data->item_height = new_item_height;
731 /*
732 // trigger WM_MEASUREITEM
733 RECT quick_rect;
734 GetWindowRect(quick_list, &quick_rect);
735 WINDOWPOS pos{
736 .hwnd = quick_list,
737 .cx = quick_rect.right - quick_rect.left,
738 .cy = quick_rect.bottom - quick_rect.top,
739 .flags = SWP_FRAMECHANGED | SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOZORDER // no SWP_NOSIZE
740 };
741 SendMessageW(quick_list, WM_WINDOWPOSCHANGED, 0, (WPARAM)&pos);
742 */
743
744 /*
745 if (!data->list_header)
746 data->try_get_header();
747 */
748 HFONT font = (HFONT)SendMessageW(data->list_header, WM_GETFONT, 0, 0);
749 //LRESULT r = SendMessageW(data->header, WM_SETFONT, (WPARAM)font, false);
750
751 // adjust the width
752 wchar_t header_text[] = L"键";
753 HDC dc = GetDC(data->header);
754 HGDIOBJ original_font = SelectObject(dc, font); // cannot just use the device context of list_header
755 SIZE size;
756 GetTextExtentPoint32W(dc, header_text, std::size(header_text) - 1, &size);
757 SelectObject(dc, original_font);
758 ReleaseDC(data->header, dc);
759 size.cx += data->left_padding + data->right_padding;
760
761 //ListView_SetColumnWidth(quick_list, 0, size.cx);
762
763 RECT quick_rect;
764 GetWindowRect(hwnd, &quick_rect);
765 SetWindowPos_real(hwnd, nullptr, 0, 0, size.cx, quick_rect.bottom - quick_rect.top, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
766

Callers

nothing calls this directly

Calls 1

DebugOStreamFunction · 0.85

Tested by

no test coverage detected