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
2fa45673
Commit
2fa45673
authored
Sep 20, 2006
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Sep 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: toolbar: Fix the return code of TB_ADDBITMAP.
parent
12d3235e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
11 deletions
+22
-11
toolbar.c
dlls/comctl32/tests/toolbar.c
+10
-10
toolbar.c
dlls/comctl32/toolbar.c
+12
-1
No files found.
dlls/comctl32/tests/toolbar.c
View file @
2fa45673
...
...
@@ -173,22 +173,22 @@ static void test_add_bitmap(void)
CHECK_IMAGELIST
(
13
,
16
,
15
);
/* adding the same bitmap will simply return the index of the already loaded block */
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
8
,
(
LPARAM
)
&
bmp128
);
todo_wine
ok
(
ret
==
0
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
_TODO_COUNT
(
13
,
16
,
15
);
ok
(
ret
==
0
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
15
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp80
);
todo_wine
ok
(
ret
==
8
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
_TODO_COUNT
(
13
,
16
,
15
);
ok
(
ret
==
8
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
15
);
/* even if we increase the wParam */
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
55
,
(
LPARAM
)
&
bmp80
);
todo_wine
ok
(
ret
==
8
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
_TODO_COUNT
(
13
,
16
,
15
);
ok
(
ret
==
8
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
15
);
/* when the wParam is smaller than the bitmaps count but non-zero, all the bitmaps will be added*/
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
3
,
(
LPARAM
)
&
bmp128
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
8
,
16
,
15
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp80
);
todo_wine
ok
(
ret
==
3
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
ok
(
ret
==
3
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
/* the returned value is misleading - id 8 is the id of the first icon from bmp80 */
CHECK_IMAGELIST
(
13
,
16
,
15
);
...
...
@@ -198,7 +198,7 @@ static void test_add_bitmap(void)
ok
(
ret
==
0
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
8
,
16
,
15
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
bmp80
);
todo_wine
ok
(
ret
==
-
143
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
ok
(
ret
==
-
143
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
15
);
/* for zero only one bitmap will be added */
...
...
@@ -230,14 +230,14 @@ static void test_add_bitmap(void)
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
bmp128
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
6
,
20
,
20
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
bmp80
);
todo_wine
ok
(
ret
==
1
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
ok
(
ret
==
1
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
10
,
20
,
20
);
/* the icons can be resized - an UpdateWindow is needed as this probably happens during WM_PAINT */
ok
(
SendMessageA
(
hToolbar
,
TB_SETBITMAPSIZE
,
0
,
MAKELONG
(
8
,
8
))
==
TRUE
,
"TB_SETBITMAPSIZE failed
\n
"
);
UpdateWindow
(
hToolbar
);
CHECK_IMAGELIST_TODO_COUNT_SIZE
(
26
,
8
,
8
);
/* loading a standard bitmaps automatically resizes the icons */
todo_wine
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
stdsmall
)
==
2
,
"TB_ADDBITMAP - unexpected return
\n
"
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
stdsmall
)
==
2
,
"TB_ADDBITMAP - unexpected return
\n
"
);
UpdateWindow
(
hToolbar
);
CHECK_IMAGELIST_TODO_COUNT_SIZE
(
28
,
16
,
15
);
...
...
dlls/comctl32/toolbar.c
View file @
2fa45673
...
...
@@ -2580,6 +2580,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
LPTBADDBITMAP
lpAddBmp
=
(
LPTBADDBITMAP
)
lParam
;
TBITMAP_INFO
info
;
INT
nIndex
=
0
,
nCount
;
INT
iSumButtons
,
i
;
HBITMAP
hbmLoad
;
HIMAGELIST
himlDef
;
...
...
@@ -2652,6 +2653,16 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
info
.
nID
=
lpAddBmp
->
nID
;
TRACE
(
"adding %d bitmaps!
\n
"
,
info
.
nButtons
);
}
/* check if the bitmap is already loaded and compute iSumButtons */
iSumButtons
=
0
;
for
(
i
=
0
;
i
<
infoPtr
->
nNumBitmapInfos
;
i
++
)
{
if
(
infoPtr
->
bitmaps
[
i
].
hInst
==
info
.
hInst
&&
infoPtr
->
bitmaps
[
i
].
nID
==
info
.
nID
)
return
iSumButtons
;
iSumButtons
+=
infoPtr
->
bitmaps
[
i
].
nButtons
;
}
if
(
!
infoPtr
->
cimlDef
)
{
/* create new default image list */
...
...
@@ -2733,7 +2744,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
InvalidateRect
(
hwnd
,
NULL
,
TRUE
);
return
nIndex
;
return
iSumButtons
;
}
...
...
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