From 2b51c94674a528375eadeebf8e3c3e34c2a818e9 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Tue, 23 Nov 1999 23:32:03 +0000 Subject: [PATCH] - implemented simple column order array functionality - implemented some virtual listview notifications --- dlls/comctl32/listview.c | 82 ++++++++++++++++++++++++++++++++++------ include/commctrl.h | 57 +++++++++++++++++++++------- 2 files changed, 115 insertions(+), 24 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 325e31e3d91..5d8af567c88 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -16,7 +16,7 @@ * LISTVIEW_Notify : most notifications from children (editbox and header) * * Data structure: - * LISTVIEW_SetItemCount : empty stub + * LISTVIEW_SetItemCount : not completed * * Unicode: * LISTVIEW_SetItemW : no unicode support @@ -31,8 +31,8 @@ * LISTVIEW_GetHoverTime : not implemented * LISTVIEW_GetISearchString : not implemented * LISTVIEW_GetBkImage : not implemented - * LISTVIEW_GetColumnOrderArray : not implemented - * LISTVIEW_SetColumnOrderArray : not implemented + * LISTVIEW_GetColumnOrderArray : simple hack only + * LISTVIEW_SetColumnOrderArray : simple hack only * LISTVIEW_Arrange : empty stub * LISTVIEW_ApproximateViewRect : incomplete * LISTVIEW_Scroll : not implemented @@ -2034,6 +2034,22 @@ static VOID LISTVIEW_RefreshReport(HWND hwnd, HDC hdc) /* add 1 for displaying a partial item at the bottom */ nLast = nItem + LISTVIEW_GetCountPerColumn(hwnd) + 1; nLast = min(nLast, GETITEMCOUNT(infoPtr)); + + /* send cache hint notification */ + if (GetWindowLongA(hwnd,GWL_STYLE) & LVS_OWNERDATA) + { + NMLVCACHEHINT nmlv; + + nmlv.hdr.hwndFrom = hwnd; + nmlv.hdr.idFrom = GetWindowLongA(hwnd,GWL_ID); + nmlv.hdr.code = LVN_ODCACHEHINT; + nmlv.iFrom = nItem; + nmlv.iTo = nLast; + + SendMessageA(GetParent(hwnd), WM_NOTIFY, (WPARAM)nmlv.hdr.idFrom, + (LPARAM)&nmlv); + } + for (; nItem < nLast; nItem++) { nColumnCount = Header_GetItemCount(infoPtr->hwndHeader); @@ -3335,7 +3351,22 @@ static LRESULT LISTVIEW_GetColumnA(HWND hwnd, INT nItem, LPLVCOLUMNA lpColumn) } /* LISTVIEW_GetColumnW */ -/* LISTVIEW_GetColumnOrderArray */ + + +static LRESULT LISTVIEW_GetColumnOrderArray(HWND hwnd, INT iCount, LPINT lpiArray) +{ +/* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); */ + INT i; + + if (!lpiArray) + return FALSE; + + /* little hack */ + for (i = 0; i < iCount; i++) + lpiArray[i] = i; + + return TRUE; +} /*** * DESCRIPTION: @@ -5144,7 +5175,32 @@ static LRESULT LISTVIEW_SetColumnA(HWND hwnd, INT nColumn, } /* LISTVIEW_SetColumnW */ -/* LISTVIEW_SetColumnOrderArray */ + +/*** + * DESCRIPTION: + * Sets the column order array + * + * PARAMETERS: + * [I] HWND : window handle + * [I] INT : number of elements in column order array + * [I] INT : pointer to column order array + * + * RETURN: + * SUCCESS : TRUE + * FAILURE : FALSE + */ +static LRESULT LISTVIEW_SetColumnOrderArray(HWND hwnd, INT iCount, LPINT lpiArray) +{ +/* LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)GetWindowLongA(hwnd, 0); */ + + FIXME("iCount %d lpiArray %p\n", iCount, lpiArray); + + if (!lpiArray) + return FALSE; + + return TRUE; +} + /*** * DESCRIPTION: @@ -5346,7 +5402,7 @@ static LRESULT LISTVIEW_SetItemA(HWND hwnd, LPLVITEMA lpLVItem) * * PARAMETER(S): * [I] HWND : window handle - * [I] INT : item count (prjected number of items) + * [I] INT : item count (projected number of items) * [I] DWORD : update flags * * RETURN: @@ -5362,6 +5418,12 @@ static BOOL LISTVIEW_SetItemCount(HWND hwnd, INT nItems, DWORD dwFlags) if (nItems == 0) return LISTVIEW_DeleteAllItems (hwnd); + if (GetWindowLongA(hwnd, GWL_STYLE) & LVS_OWNERDATA) + { + FIXME("LVS_OWNERDATA is set!\n"); + } + else + { if (nItems > GETITEMCOUNT(infoPtr)) { /* append items */ @@ -5374,6 +5436,7 @@ static BOOL LISTVIEW_SetItemCount(HWND hwnd, INT nItems, DWORD dwFlags) FIXME("remove items\n"); } + } return TRUE; } @@ -5901,7 +5964,6 @@ static LRESULT LISTVIEW_VScroll(HWND hwnd, INT nScrollCode, SHORT nCurrentPos, case SB_PAGEUP: if (scrollInfo.nPos > scrollInfo.nMin) { - if (scrollInfo.nPos >= scrollInfo.nPage) { scrollInfo.nPos -= scrollInfo.nPage; @@ -6989,8 +7051,7 @@ static LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, /* case LVM_GETCOLUMNW: */ case LVM_GETCOLUMNORDERARRAY: - FIXME("Unimplemented msg LVM_GETCOLUMNORDERARRAY\n"); - return 0; + return LISTVIEW_GetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam); case LVM_GETCOLUMNWIDTH: return LISTVIEW_GetColumnWidth(hwnd, (INT)wParam); @@ -7120,8 +7181,7 @@ static LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, return 0; case LVM_SETCOLUMNORDERARRAY: - FIXME("Unimplemented msg LVM_SETCOLUMNORDERARRAY\n"); - return 0; + return LISTVIEW_SetColumnOrderArray(hwnd, (INT)wParam, (LPINT)lParam); case LVM_SETCOLUMNWIDTH: return LISTVIEW_SetColumnWidth(hwnd, (INT)wParam, (INT)lParam); diff --git a/include/commctrl.h b/include/commctrl.h index 71d03319cee..9e047c90b6c 100644 --- a/include/commctrl.h +++ b/include/commctrl.h @@ -26,6 +26,8 @@ typedef struct tagINITCOMMONCONTROLSEX { BOOL WINAPI InitCommonControlsEx (LPINITCOMMONCONTROLSEX); +#define COMCTL32_VERSION 5 /* dll version */ + #define ICC_LISTVIEW_CLASSES 0x00000001 /* listview, header */ #define ICC_TREEVIEW_CLASSES 0x00000002 /* treeview, tooltips */ #define ICC_BAR_CLASSES 0x00000004 /* toolbar, statusbar, trackbar, tooltips */ @@ -66,6 +68,9 @@ BOOL WINAPI InitCommonControlsEx (LPINITCOMMONCONTROLSEX); #define CCM_GETDROPTARGET (CCM_FIRST+4) #define CCM_SETUNICODEFORMAT (CCM_FIRST+5) #define CCM_GETUNICODEFORMAT (CCM_FIRST+6) +#define CCM_SETVERSION (CCM_FIRST+7) +#define CCM_GETVERSION (CCM_FIRST+8) +#define CCM_SETNOTIFYWINDOW (CCM_FIRST+9) /* wParam = hwndParent */ /* common notification codes (WM_NOTIFY)*/ @@ -941,20 +946,13 @@ typedef struct _TBBUTTON { } TBBUTTON, *PTBBUTTON, *LPTBBUTTON; typedef const TBBUTTON *LPCTBBUTTON; -typedef struct tagNMTOOLBAR { - NMHDR hdr; - int iItem; - TBBUTTON tbButton; - int cchText; - LPWSTR pszText; - RECT rcButton; /*Version 5.80*/ -} NMTOOLBARW, * LPNMTOOLBARW; typedef struct _COLORMAP { COLORREF from; COLORREF to; } COLORMAP, *LPCOLORMAP; + typedef struct tagTBADDBITMAP { HINSTANCE hInst; UINT nID; @@ -1064,6 +1062,29 @@ typedef struct tagNMTBGETINFOTIPW #define NMTBGETINFOTIP WINELIB_NAME_AW(NMTBGETINFOFTIP) #define LPNMTBGETINFOTIP WINELIB_NAME_AW(LPNMTBGETINFOTIP) +typedef struct tagNMTOOLBARA +{ + NMHDR hdr; + INT iItem; + TBBUTTON tbButton; + INT cchText; + LPSTR pszText; + RECT rcButton; /* Version 5.80 */ +} NMTOOLBARA, *LPNMTOOLBARA; + +typedef struct tagNMTOOLBARW +{ + NMHDR hdr; + INT iItem; + TBBUTTON tbButton; + INT cchText; + LPWSTR pszText; + RECT rcButton; /* Version 5.80 */ +} NMTOOLBARW, *LPNMTOOLBARW; + +#define NMTOOLBAR WINELIB_NAME_AW(NMTOOLBAR) +#define LPNMTOOLBAR WINELIB_NAME_AW(LPNMTOOLBAR) + typedef struct { HINSTANCE hInstOld; @@ -2379,18 +2400,19 @@ typedef struct tagNMTVGETINFOTIPW #define LVN_BEGINDRAG (LVN_FIRST-9) #define LVN_BEGINRDRAG (LVN_FIRST-11) #define LVN_ODCACHEHINT (LVN_FIRST-13) -#define LVN_ODFINDITEMA (LVN_FIRST-52) -#define LVN_ODFINDITEMW (LVN_FIRST-79) -#define LVN_ODFINDITEM WINELIB_NAME_AW(LVN_ODFINDITEM) #define LVN_ITEMACTIVATE (LVN_FIRST-14) #define LVN_ODSTATECHANGED (LVN_FIRST-15) #define LVN_HOTTRACK (LVN_FIRST-21) +#define LVN_ODFINDITEMA (LVN_FIRST-52) +#define LVN_ODFINDITEMW (LVN_FIRST-79) +#define LVN_ODFINDITEM WINELIB_NAME_AW(LVN_ODFINDITEM) #define LVN_GETDISPINFOA (LVN_FIRST-50) #define LVN_GETDISPINFOW (LVN_FIRST-77) #define LVN_GETDISPINFO WINELIB_NAME_AW(LVN_GETDISPINFO) #define LVN_SETDISPINFOA (LVN_FIRST-51) #define LVN_SETDISPINFOW (LVN_FIRST-78) #define LVN_SETDISPINFO WINELIB_NAME_AW(LVN_SETDISPINFO) +#define LVN_KEYDOWN (LVN_FIRST-55) #define LVA_ALIGNLEFT 0x0000 #define LVA_DEFAULT 0x0001 @@ -2501,8 +2523,6 @@ typedef struct tagLVDISPINFOW #define LV_DISPINFO NMLVDISPINFO -#define LVN_KEYDOWN (LVN_FIRST-55) - typedef struct tagLVKEYDOWN { NMHDR hdr; @@ -2545,6 +2565,17 @@ typedef struct tagTCHITTESTINFO typedef INT (CALLBACK *PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM); +typedef struct tagNMLVCACHEHINT +{ + NMHDR hdr; + INT iFrom; + INT iTo; +} NMLVCACHEHINT, *LPNMLVCACHEHINT; + +#define LPNM_CACHEHINT LPNMLVCACHEHINT +#define PNM_CACHEHINT LPNMLVCACHEHINT +#define NM_CACHEHINT NMLVCACHEHINT + #define ListView_GetNextItem(hwnd,nItem,flags) \ (INT)SendMessageA((hwnd),LVM_GETNEXTITEM,(WPARAM)(INT)(nItem),(LPARAM)(MAKELPARAM(flags,0))) #define ListView_FindItem(hwnd,nItem,plvfi) \