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
e5ea09c1
Commit
e5ea09c1
authored
Jul 10, 1999
by
Alex Priem
Committed by
Alexandre Julliard
Jul 10, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implementation of TVM_SORTCHILDREN. Massaged TVM_SORTCHILDRENCB a bit
to use the same code path.
parent
a3afeef3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
14 deletions
+86
-14
treeview.c
dlls/comctl32/treeview.c
+86
-14
No files found.
dlls/comctl32/treeview.c
View file @
e5ea09c1
...
...
@@ -1377,29 +1377,66 @@ static INT WINAPI TREEVIEW_CallBackCompare(
}
/***************************************************************************
* 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
"
);
...
...
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