Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
75b21771
Commit
75b21771
authored
Jun 13, 1999
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbeyj@wpi.edu>
Implemented LISTVIEW_SortItems() and LISTVIEW_CallBackCompare()
parent
a79cc39f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
2 deletions
+73
-2
listview.c
dlls/comctl32/listview.c
+71
-2
listview.h
include/listview.h
+2
-0
No files found.
dlls/comctl32/listview.c
View file @
75b21771
...
...
@@ -15,7 +15,6 @@
* LISTVIEW_Notify : most notifications from children (editbox and header)
*
* Data structure:
* LISTVIEW_SortItems : empty stub
* LISTVIEW_SetItemCount : empty stub
*
* Unicode:
...
...
@@ -5068,12 +5067,44 @@ static LRESULT LISTVIEW_SetTextColor (HWND hwnd, COLORREF clrText)
return
TRUE
;
}
/***
* DESCRIPTION:
* Callback internally used by LISTVIEW_SortItems()
*
* PARAMETER(S):
* [I] LPVOID : first LISTVIEW_ITEM to compare
* [I] LPVOID : second LISTVIEW_ITEM 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_CallBackCompare
(
LPVOID
first
,
LPVOID
second
,
LPARAM
lParam
)
{
/* Forward the call to the client defined callback */
HWND
hwnd
=
(
HWND
)
lParam
;
LISTVIEW_INFO
*
infoPtr
=
(
LISTVIEW_INFO
*
)
GetWindowLongA
(
hwnd
,
0
);
return
(
infoPtr
->
pfnCompare
)(
((
LISTVIEW_ITEM
*
)
first
)
->
lParam
,
((
LISTVIEW_ITEM
*
)
second
)
->
lParam
,
infoPtr
->
lParamSort
);
}
/***
* DESCRIPTION:
* Sorts the listview items.
*
* PARAMETER(S):
* [I] HWND : window handle
* [I] WPARAM : application-defined value
* [I] LPARAM : pointer to comparision callback
*
* RETURN:
* SUCCESS : TRUE
...
...
@@ -5081,7 +5112,45 @@ static LRESULT LISTVIEW_SetTextColor (HWND hwnd, COLORREF clrText)
*/
static
LRESULT
LISTVIEW_SortItems
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
FIXME
(
"empty stub!
\n
"
);
LISTVIEW_INFO
*
infoPtr
=
(
LISTVIEW_INFO
*
)
GetWindowLongA
(
hwnd
,
0
);
HDPA
hdpaSubItems
;
LISTVIEW_ITEM
*
lpItem
;
int
nCount
,
i
;
HDPA
sortList
;
if
(
!
infoPtr
||
!
infoPtr
->
hdpaItems
)
return
FALSE
;
nCount
=
GETITEMCOUNT
(
infoPtr
);
// if there are 0 or 1 items, there is no need to sort
if
(
nCount
>
1
)
{
sortList
=
DPA_Create
(
nCount
);
infoPtr
->
pfnCompare
=
(
PFNLVCOMPARE
)
lParam
;
infoPtr
->
lParamSort
=
(
LPARAM
)
wParam
;
// append pointers one by one to sortList
for
(
i
=
0
;
i
<
nCount
;
i
++
)
{
if
((
hdpaSubItems
=
(
HDPA
)
DPA_GetPtr
(
infoPtr
->
hdpaItems
,
i
)))
if
((
lpItem
=
(
LISTVIEW_ITEM
*
)
DPA_GetPtr
(
hdpaSubItems
,
0
)))
DPA_InsertPtr
(
sortList
,
nCount
+
1
,
lpItem
);
}
// sort the sortList
DPA_Sort
(
sortList
,
LISTVIEW_CallBackCompare
,
hwnd
);
// copy the pointers back
for
(
i
=
0
;
i
<
nCount
;
i
++
)
{
if
((
hdpaSubItems
=
(
HDPA
)
DPA_GetPtr
(
infoPtr
->
hdpaItems
,
i
))
&&
(
lpItem
=
(
LISTVIEW_ITEM
*
)
DPA_GetPtr
(
sortList
,
i
)))
DPA_SetPtr
(
hdpaSubItems
,
0
,
lpItem
);
}
DPA_Destroy
(
sortList
);
}
return
TRUE
;
}
...
...
include/listview.h
View file @
75b21771
...
...
@@ -53,6 +53,8 @@ typedef struct tagLISTVIEW_INFO
BOOL
bFocus
;
DWORD
dwExStyle
;
/* extended listview style */
HDPA
hdpaItems
;
PFNLVCOMPARE
pfnCompare
;
LPARAM
lParamSort
;
}
LISTVIEW_INFO
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment