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

Method create_quick_list

EverythingExt/quick_select.cpp:861–943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

859}
860
861HWND quick::create_quick_list(HWND everything, HWND list, HWND edit, HINSTANCE instance) {
862 HWND quick_list = CreateWindowExW_real(
863 LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER, WC_LISTVIEWW, nullptr, WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_OWNERDATA | LVS_OWNERDRAWFIXED,
864 0, 0, 20, 0,
865 everything, nullptr, instance, nullptr);
866
867 QuickListData* data = new QuickListData{
868 .header = ListView_GetHeader(quick_list),
869 .list = list,
870 .list_header = nullptr, // ListView_GetHeader(list) returns 0
871 .item_height = 0,
872 .background_color = ListView_GetBkColor(list),
873 .text_color = ListView_GetTextColor(list)
874 };
875 data->background_brush = CreateSolidBrush(data->background_color);
876 //ListView_SetBkColor(quick_list, data->background_color); // not work
877 //ListView_SetTextBkColor(quick_list, data->background_color); // not work
878 SetPropW(quick_list, quick_list_prop, data);
879 quick_list_window_proc_prev = (WNDPROC)SetWindowLongPtrW_real(quick_list, GWLP_WNDPROC, (LONG_PTR)quick_list_window_proc);
880 /*
881 // We forget SetPropW for header for several years. Why it didn't crash before?
882 SetPropW(data->header, quick_list_prop, data);
883 */
884 quick_header_window_proc_prev = (WNDPROC)SetWindowLongPtrW_real(data->header, GWLP_WNDPROC, (LONG_PTR)quick_header_window_proc);
885
886 SetPropW(everything, everything_prop_quick_list, quick_list);
887 everything_window_proc_prev = (WNDPROC)SetWindowLongPtrW_real(everything, GWLP_WNDPROC, (LONG_PTR)everything_window_proc);
888
889 SetPropW(list, list_prop_quick_list, quick_list);
890
891 SetPropW(edit, edit_prop_list, list);
892
893
894 wchar_t header_text[] = L"键";
895 /*
896 HDC dc = GetDC(quick_list);
897 SIZE size;
898 GetTextExtentPoint32W(dc, header_text, std::size(header_text) - 1, &size);
899 ReleaseDC(quick_list, dc);
900 size.cx += 8; // padding
901 */
902
903 LVCOLUMNW column{
904 .mask = LVCF_WIDTH | LVCF_TEXT,
905 .cx = 0x7FFF,
906 .pszText = header_text,
907 .cchTextMax = std::size(header_text) - 1
908 };
909 ListView_InsertColumn(quick_list, 0, &column);
910 HDITEM header_item{
911 .mask = HDI_FORMAT,
912 .fmt = HDF_OWNERDRAW
913 };
914 Header_SetItem(data->header, 0, &header_item);
915
916 ListView_SetItemCount(quick_list, 100000000);
917
918 /*

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected