comctl32/listview: Implemented LVM_SORTITEMSEX.
This commit is contained in:
parent
961f175cc2
commit
b2486d41c7
|
@ -137,7 +137,6 @@
|
|||
* -- LVM_SETINFOTIP
|
||||
* -- LVM_SETTILEWIDTH
|
||||
* -- LVM_SORTGROUPS
|
||||
* -- LVM_SORTITEMSEX
|
||||
*
|
||||
* Macros:
|
||||
* -- ListView_GetCheckSate, ListView_SetCheckState
|
||||
|
@ -148,7 +147,6 @@
|
|||
* -- ListView_GetTextBkColor
|
||||
* -- ListView_GetUnicodeFormat, ListView_SetUnicodeFormat
|
||||
* -- ListView_GetWorkAreas, ListView_SetWorkAreas
|
||||
* -- ListView_SortItemsEx
|
||||
*
|
||||
* Functions:
|
||||
* -- LVGroupComparE
|
||||
|
@ -422,7 +420,6 @@ static void LISTVIEW_SetSelection(LISTVIEW_INFO *, INT);
|
|||
static void LISTVIEW_UpdateSize(LISTVIEW_INFO *);
|
||||
static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *, INT, BOOL);
|
||||
static LRESULT LISTVIEW_Command(const LISTVIEW_INFO *, WPARAM, LPARAM);
|
||||
static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *, PFNLVCOMPARE, LPARAM);
|
||||
static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *, LPCWSTR, BOOL);
|
||||
static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *, INT, BOOL);
|
||||
static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT);
|
||||
|
@ -7835,7 +7832,7 @@ static BOOL LISTVIEW_SetUnicodeFormat( LISTVIEW_INFO *infoPtr, BOOL fUnicode)
|
|||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
* Callback internally used by LISTVIEW_SortItems()
|
||||
* Callback internally used by LISTVIEW_SortItems() in response of LVM_SORTITEMS
|
||||
*
|
||||
* PARAMETER(S):
|
||||
* [I] first : pointer to first ITEM_INFO to compare
|
||||
|
@ -7857,6 +7854,30 @@ static INT WINAPI LISTVIEW_CallBackCompare(LPVOID first, LPVOID second, LPARAM l
|
|||
return (infoPtr->pfnCompare)( lv_first->lParam , lv_second->lParam, infoPtr->lParamSort );
|
||||
}
|
||||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
* Callback internally used by LISTVIEW_SortItems() in response of LVM_SORTITEMSEX
|
||||
*
|
||||
* PARAMETER(S):
|
||||
* [I] first : pointer to first ITEM_INFO to compare
|
||||
* [I] second : pointer to second ITEM_INFO to compare
|
||||
* [I] lParam : HWND of control
|
||||
*
|
||||
* RETURN:
|
||||
* if first comes before second : negative
|
||||
* if first comes after second : positive
|
||||
* if first and second are equivalent : zero
|
||||
*/
|
||||
static INT WINAPI LISTVIEW_CallBackCompareEx(LPVOID first, LPVOID second, LPARAM lParam)
|
||||
{
|
||||
LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
|
||||
INT first_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, first );
|
||||
INT second_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, second );
|
||||
|
||||
/* Forward the call to the client defined callback */
|
||||
return (infoPtr->pfnCompare)( first_idx, second_idx, infoPtr->lParamSort );
|
||||
}
|
||||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
* Sorts the listview items.
|
||||
|
@ -7865,12 +7886,14 @@ static INT WINAPI LISTVIEW_CallBackCompare(LPVOID first, LPVOID second, LPARAM l
|
|||
* [I] infoPtr : valid pointer to the listview structure
|
||||
* [I] pfnCompare : application-defined value
|
||||
* [I] lParamSort : pointer to comparison callback
|
||||
* [I] IsEx : TRUE when LVM_SORTITEMSEX used
|
||||
*
|
||||
* RETURN:
|
||||
* SUCCESS : TRUE
|
||||
* FAILURE : FALSE
|
||||
*/
|
||||
static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, LPARAM lParamSort)
|
||||
static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
|
||||
LPARAM lParamSort, BOOL IsEx)
|
||||
{
|
||||
UINT uView = infoPtr->dwStyle & LVS_TYPEMASK;
|
||||
HDPA hdpaSubItems;
|
||||
|
@ -7900,7 +7923,10 @@ static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare,
|
|||
|
||||
infoPtr->pfnCompare = pfnCompare;
|
||||
infoPtr->lParamSort = lParamSort;
|
||||
DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, (LPARAM)infoPtr);
|
||||
if (IsEx)
|
||||
DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompareEx, (LPARAM)infoPtr);
|
||||
else
|
||||
DPA_Sort(infoPtr->hdpaItems, LISTVIEW_CallBackCompare, (LPARAM)infoPtr);
|
||||
|
||||
/* restore selection ranges */
|
||||
for (i=0; i < infoPtr->nItemCount; i++)
|
||||
|
@ -10022,9 +10048,10 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
/* case LVM_SORTGROUPS: */
|
||||
|
||||
case LVM_SORTITEMS:
|
||||
return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, (LPARAM)wParam);
|
||||
return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, (LPARAM)wParam, FALSE);
|
||||
|
||||
/* LVM_SORTITEMSEX: */
|
||||
case LVM_SORTITEMSEX:
|
||||
return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, (LPARAM)wParam, TRUE);
|
||||
|
||||
case LVM_SUBITEMHITTEST:
|
||||
return LISTVIEW_HitTest(infoPtr, (LPLVHITTESTINFO)lParam, TRUE, FALSE);
|
||||
|
|
|
@ -3147,6 +3147,7 @@ static const WCHAR WC_LISTVIEWW[] = { 'S','y','s',
|
|||
#define LVM_SETITEMTEXT WINELIB_NAME_AW(LVM_SETITEMTEXT)
|
||||
#define LVM_SETITEMCOUNT (LVM_FIRST+47)
|
||||
#define LVM_SORTITEMS (LVM_FIRST+48)
|
||||
#define LVM_SORTITEMSEX (LVM_FIRST+81)
|
||||
#define LVM_SETITEMPOSITION32 (LVM_FIRST+49)
|
||||
#define LVM_GETSELECTEDCOUNT (LVM_FIRST+50)
|
||||
#define LVM_GETITEMSPACING (LVM_FIRST+51)
|
||||
|
@ -3772,6 +3773,9 @@ typedef struct NMLVSCROLL
|
|||
|
||||
#define ListView_SortItems(hwndLV,_pfnCompare,_lPrm) \
|
||||
(BOOL)SNDMSGA((hwndLV),LVM_SORTITEMS,(WPARAM)(LPARAM)_lPrm,(LPARAM)(PFNLVCOMPARE)_pfnCompare)
|
||||
#define ListView_SortItemsEx(hwndLV, _pfnCompare, _lPrm) \
|
||||
(BOOL)SNDMSGA((hwndLV), LVM_SORTITEMSEX, (WPARAM)(LPARAM)(_lPrm), (LPARAM)(PFNLVCOMPARE)(_pfnCompare))
|
||||
|
||||
#define ListView_SetItemPosition(hwndLV, i, x, y) \
|
||||
(BOOL)SNDMSGA((hwndLV),LVM_SETITEMPOSITION,(WPARAM)(INT)(i),MAKELPARAM((x),(y)))
|
||||
#define ListView_GetSelectedCount(hwndLV) \
|
||||
|
|
Loading…
Reference in New Issue