Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jason Beetham
wine
Commits
e5ea09c1
Commit
e5ea09c1
authored
25 years ago
by
Alex Priem
Committed by
Alexandre Julliard
25 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implementation of TVM_SORTCHILDREN. Massaged TVM_SORTCHILDRENCB a bit
to use the same code path.
parent
a3afeef3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/comctl32/treeview.c
+86
-14
86 additions, 14 deletions
dlls/comctl32/treeview.c
with
86 additions
and
14 deletions
dlls/comctl32/treeview.c
+
86
−
14
View file @
e5ea09c1
...
...
@@ -1376,30 +1376,67 @@ static INT WINAPI TREEVIEW_CallBackCompare(
infoPtr
->
pCallBackSort
->
lParam
);
}
/***************************************************************************
* Treeview native sort routine: sort on item text.
*/
static
INT
WINAPI
TREEVIEW_SortOnName
(
LPVOID
first
,
LPVOID
second
,
LPARAM
tvInfoPtr
)
{
HWND
hwnd
=
(
HWND
)
tvInfoPtr
;
char
*
txt1
,
*
txt2
;
TREEVIEW_ITEM
*
item
;
item
=
(
TREEVIEW_ITEM
*
)
first
;
if
(
item
->
pszText
==
LPSTR_TEXTCALLBACKA
)
{
TREEVIEW_SendDispInfoNotify
(
hwnd
,
item
,
TVN_GETDISPINFO
,
TVIF_TEXT
);
}
txt1
=
item
->
pszText
;
item
=
(
TREEVIEW_ITEM
*
)
second
;
if
(
item
->
pszText
==
LPSTR_TEXTCALLBACKA
)
{
TREEVIEW_SendDispInfoNotify
(
hwnd
,
item
,
TVN_GETDISPINFO
,
TVIF_TEXT
);
}
txt2
=
item
->
pszText
;
return
-
strcmp
(
txt1
,
txt2
);
}
/***************************************************************************
* Setup the treeview structure with regards of the sort method
* and sort the children of the TV item specified in lParam
* fRecurse: currently unused. Should be zero.
* parent: if pSort!=NULL, should equal pSort->hParent.
* otherwise, item which child items are to be sorted.
* pSort: sort method info. if NULL, sort on item text.
* if non-NULL, sort on item's lParam content, and let the
* application decide what that means. See also TVM_SORTCHILDRENCB.
*/
LRESULT
WINAPI
TREEVIEW_SortChildrenCB
(
LRESULT
WINAPI
TREEVIEW_Sort
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
BOOL
fRecurse
,
HTREEITEM
parent
,
LPTVSORTCB
pSort
)
{
TREEVIEW_INFO
*
infoPtr
=
TREEVIEW_GetInfoPtr
(
hwnd
);
TREEVIEW_ITEM
*
sortMe
=
NULL
;
/* Node for which we sort the children */
/* Obtain the TVSORTBC struct */
infoPtr
->
pCallBackSort
=
(
LPTVSORTCB
)
lParam
;
infoPtr
->
pCallBackSort
=
pSort
;
/* Check for a valid handle to the parent item */
if
(
!
TREEVIEW_ValidItem
(
infoPtr
,
infoPtr
->
pCallBackSort
->
hP
arent
))
if
(
!
TREEVIEW_ValidItem
(
infoPtr
,
p
arent
))
{
ERR
(
"invalid item hParent=%d
\n
"
,
(
INT
)
infoPtr
->
pCallBackSort
->
hP
arent
);
ERR
(
"invalid item hParent=%d
\n
"
,
(
INT
)
p
arent
);
return
FALSE
;
}
/* Obtain the parent node to sort */
sortMe
=
&
infoPtr
->
items
[
(
INT
)
infoPtr
->
pCallBackSort
->
hP
arent
];
sortMe
=
&
infoPtr
->
items
[
(
INT
)
p
arent
];
/* Make sure there is something to sort */
if
(
sortMe
->
cChildren
>
1
)
...
...
@@ -1429,10 +1466,16 @@ LRESULT WINAPI TREEVIEW_SortChildrenCB(
}
while
(
itemHandle
!=
NULL
);
/* let DPA perform the sort activity */
DPA_Sort
(
sortList
,
/* what */
TREEVIEW_CallBackCompare
,
/* how */
hwnd
);
/* owner */
if
(
pSort
)
DPA_Sort
(
sortList
,
/* what */
TREEVIEW_CallBackCompare
,
/* how */
hwnd
);
/* owner */
else
DPA_Sort
(
sortList
,
/* what */
TREEVIEW_SortOnName
,
/* how */
hwnd
);
/* owner */
/*
* Reorganized TREEVIEW_ITEM structures.
...
...
@@ -1473,6 +1516,35 @@ LRESULT WINAPI TREEVIEW_SortChildrenCB(
}
/***************************************************************************
* Setup the treeview structure with regards of the sort method
* and sort the children of the TV item specified in lParam
*/
LRESULT
WINAPI
TREEVIEW_SortChildrenCB
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
LPTVSORTCB
pSort
=
(
LPTVSORTCB
)
lParam
;
return
TREEVIEW_Sort
(
hwnd
,
wParam
,
pSort
->
hParent
,
pSort
);
}
/***************************************************************************
* Sort the children of the TV item specified in lParam.
*/
LRESULT
WINAPI
TREEVIEW_SortChildren
(
HWND
hwnd
,
WPARAM
wParam
,
LPARAM
lParam
)
{
return
TREEVIEW_Sort
(
hwnd
,
(
BOOL
)
wParam
,
(
HTREEITEM
)
lParam
,
NULL
);
}
/* the method used below isn't the most memory-friendly, but it avoids
a lot of memory reallocations */
...
...
@@ -1702,7 +1774,8 @@ TREEVIEW_InsertItemA (HWND hwnd, WPARAM wParam, LPARAM lParam)
sibItem
=&
infoPtr
->
items
[(
INT
)
sibItem
->
sibling
];
}
if
(
sibItem
->
hItem
!=
ptdi
->
hInsertAfter
)
{
ERR
(
"tried to insert item after nonexisting handle.
\n
"
);
ERR
(
"tried to insert item after nonexisting handle %d.
\n
"
,
(
INT
)
ptdi
->
hInsertAfter
);
break
;
}
prevsib
=
sibItem
;
...
...
@@ -3420,8 +3493,7 @@ TREEVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return
TREEVIEW_CreateDragImage
(
hwnd
,
wParam
,
lParam
);
case
TVM_SORTCHILDREN
:
FIXME
(
"Unimplemented msg TVM_SORTCHILDREN
\n
"
);
return
0
;
return
TREEVIEW_SortChildren
(
hwnd
,
wParam
,
lParam
);
case
TVM_ENSUREVISIBLE
:
FIXME
(
"Unimplemented msg TVM_ENSUREVISIBLE
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment