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
d4a67c43
Commit
d4a67c43
authored
Mar 19, 2007
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Mar 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: toolbar: The default button size is 16x16.
parent
3487da71
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
41 deletions
+32
-41
toolbar.c
dlls/comctl32/tests/toolbar.c
+27
-26
toolbar.c
dlls/comctl32/toolbar.c
+5
-15
No files found.
dlls/comctl32/tests/toolbar.c
View file @
d4a67c43
/* Unit tests for treeview.
*
* Copyright 2005 Krzysztof Foltman
* Copyright 2007 Mikolaj Zalewski
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -185,7 +186,7 @@ static void rebuild_toolbar_with_buttons(HWND *hToolbar)
if (himl != NULL) {\
ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
ImageList_GetIconSize(himl, &cx, &cy); \
ok(cx == dx && cy ==
c
y, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
ok(cx == dx && cy ==
d
y, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
} \
}
...
...
@@ -196,7 +197,7 @@ static void rebuild_toolbar_with_buttons(HWND *hToolbar)
if (himl != NULL) {\
todo_wine ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
ImageList_GetIconSize(himl, &cx, &cy); \
ok(cx == dx && cy ==
c
y, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
ok(cx == dx && cy ==
d
y, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
} \
}
...
...
@@ -207,7 +208,7 @@ static void rebuild_toolbar_with_buttons(HWND *hToolbar)
if (himl != NULL) {\
todo_wine ok(ImageList_GetImageCount(himl) == count, "Images count mismatch - %d vs %d\n", count, ImageList_GetImageCount(himl)); \
ImageList_GetIconSize(himl, &cx, &cy); \
todo_wine ok(cx == dx && cy ==
c
y, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
todo_wine ok(cx == dx && cy ==
d
y, "Icon size mismatch - %dx%d vs %dx%d\n", dx, dy, cx, cy); \
} \
}
...
...
@@ -235,63 +236,63 @@ static void test_add_bitmap(void)
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
8
,
(
LPARAM
)
&
bmp128
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
8
,
16
,
1
5
);
CHECK_IMAGELIST
(
8
,
16
,
1
6
);
/* adding more bitmaps */
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp80
)
==
8
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
13
,
16
,
1
5
);
CHECK_IMAGELIST
(
13
,
16
,
1
6
);
/* adding the same bitmap will simply return the index of the already loaded block */
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
8
,
(
LPARAM
)
&
bmp128
);
ok
(
ret
==
0
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
1
5
);
CHECK_IMAGELIST
(
13
,
16
,
1
6
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp80
);
ok
(
ret
==
8
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
1
5
);
CHECK_IMAGELIST
(
13
,
16
,
1
6
);
/* even if we increase the wParam */
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
55
,
(
LPARAM
)
&
bmp80
);
ok
(
ret
==
8
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
1
5
);
CHECK_IMAGELIST
(
13
,
16
,
1
6
);
/* 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
,
1
5
);
CHECK_IMAGELIST
(
8
,
16
,
1
6
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp80
);
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
,
1
5
);
CHECK_IMAGELIST
(
13
,
16
,
1
6
);
/* the same for negative wParam */
rebuild_toolbar
(
&
hToolbar
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
-
143
,
(
LPARAM
)
&
bmp128
);
ok
(
ret
==
0
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
8
,
16
,
1
5
);
CHECK_IMAGELIST
(
8
,
16
,
1
6
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
bmp80
);
ok
(
ret
==
-
143
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
13
,
16
,
1
5
);
CHECK_IMAGELIST
(
13
,
16
,
1
6
);
/* for zero only one bitmap will be added */
rebuild_toolbar
(
&
hToolbar
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
0
,
(
LPARAM
)
&
bmp80
);
ok
(
ret
==
0
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
1
,
16
,
1
5
);
CHECK_IMAGELIST
(
1
,
16
,
1
6
);
/* if wParam is larger than the amount of icons, the list is grown */
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
100
,
(
LPARAM
)
&
bmp80
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
100
,
16
,
1
5
);
CHECK_IMAGELIST
(
100
,
16
,
1
6
);
ret
=
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
100
,
(
LPARAM
)
&
bmp128
);
ok
(
ret
==
100
,
"TB_ADDBITMAP - unexpected return %d
\n
"
,
ret
);
CHECK_IMAGELIST
(
200
,
16
,
1
5
);
CHECK_IMAGELIST
(
200
,
16
,
1
6
);
/* adding built-in items - the wParam is ignored */
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp80
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
5
,
16
,
1
5
);
CHECK_IMAGELIST
(
5
,
16
,
1
6
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
0
,
(
LPARAM
)
&
stdsmall
)
==
5
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
20
,
16
,
1
5
);
CHECK_IMAGELIST
(
20
,
16
,
1
6
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp128
)
==
20
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
28
,
16
,
1
5
);
CHECK_IMAGELIST
(
28
,
16
,
1
6
);
/* when we increase the bitmap size, less icons will be created */
rebuild_toolbar
(
&
hToolbar
);
...
...
@@ -308,14 +309,14 @@ static void test_add_bitmap(void)
/* loading a standard bitmaps automatically resizes the icons */
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
stdsmall
)
==
2
,
"TB_ADDBITMAP - unexpected return
\n
"
);
UpdateWindow
(
hToolbar
);
CHECK_IMAGELIST
(
28
,
16
,
1
5
);
CHECK_IMAGELIST
(
28
,
16
,
1
6
);
/* two more SETBITMAPSIZE tests */
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
100
,
(
LPARAM
)
&
bmp128
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
100
,
16
,
1
5
);
CHECK_IMAGELIST
(
100
,
16
,
1
6
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
100
,
(
LPARAM
)
&
bmp80
)
==
100
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
200
,
16
,
1
5
);
CHECK_IMAGELIST
(
200
,
16
,
1
6
);
ok
(
SendMessageA
(
hToolbar
,
TB_SETBITMAPSIZE
,
0
,
MAKELONG
(
8
,
8
))
==
TRUE
,
"TB_SETBITMAPSIZE failed
\n
"
);
UpdateWindow
(
hToolbar
);
CHECK_IMAGELIST
(
200
,
8
,
8
);
...
...
@@ -324,9 +325,9 @@ static void test_add_bitmap(void)
CHECK_IMAGELIST
(
200
,
30
,
30
);
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
5
,
(
LPARAM
)
&
bmp128
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
8
,
16
,
1
5
);
CHECK_IMAGELIST
(
8
,
16
,
1
6
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
3
,
(
LPARAM
)
&
bmp80
)
==
5
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
13
,
16
,
1
5
);
CHECK_IMAGELIST
(
13
,
16
,
1
6
);
ok
(
SendMessageA
(
hToolbar
,
TB_SETBITMAPSIZE
,
0
,
MAKELONG
(
30
,
30
))
==
TRUE
,
"TB_SETBITMAPSIZE failed
\n
"
);
UpdateWindow
(
hToolbar
);
CHECK_IMAGELIST
(
8
,
30
,
30
);
...
...
@@ -362,7 +363,7 @@ static void test_add_bitmap(void)
addbmp
.
nID
=
IDB_STD_SMALL_COLOR
;
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
addbmp
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
15
,
16
,
1
5
);
CHECK_IMAGELIST
(
15
,
16
,
1
6
);
addbmp
.
nID
=
IDB_STD_LARGE_COLOR
;
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
addbmp
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
...
...
@@ -371,7 +372,7 @@ static void test_add_bitmap(void)
addbmp
.
nID
=
IDB_VIEW_SMALL_COLOR
;
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
addbmp
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
12
,
16
,
1
5
);
CHECK_IMAGELIST
(
12
,
16
,
1
6
);
addbmp
.
nID
=
IDB_VIEW_LARGE_COLOR
;
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
addbmp
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
...
...
@@ -380,7 +381,7 @@ static void test_add_bitmap(void)
addbmp
.
nID
=
IDB_HIST_SMALL_COLOR
;
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
addbmp
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
CHECK_IMAGELIST
(
5
,
16
,
1
5
);
CHECK_IMAGELIST
(
5
,
16
,
1
6
);
addbmp
.
nID
=
IDB_HIST_LARGE_COLOR
;
rebuild_toolbar
(
&
hToolbar
);
ok
(
SendMessageA
(
hToolbar
,
TB_ADDBITMAP
,
1
,
(
LPARAM
)
&
addbmp
)
==
0
,
"TB_ADDBITMAP - unexpected return
\n
"
);
...
...
dlls/comctl32/toolbar.c
View file @
d4a67c43
...
...
@@ -125,7 +125,6 @@ typedef struct
INT
nButtonHeight
;
INT
nButtonWidth
;
INT
nBitmapHeight
;
INT
nVBitmapHeight
;
/* see TOOLBAR_Create for an explanation */
INT
nBitmapWidth
;
INT
nIndent
;
INT
nRows
;
/* number of button rows */
...
...
@@ -1560,7 +1559,7 @@ static inline SIZE TOOLBAR_MeasureButton(TOOLBAR_INFO *infoPtr, SIZE sizeString,
if
(
infoPtr
->
dwStyle
&
TBSTYLE_LIST
)
{
/* set button height from bitmap / text height... */
sizeButton
.
cy
=
max
((
bHasBitmap
?
infoPtr
->
n
V
BitmapHeight
:
0
),
sizeButton
.
cy
=
max
((
bHasBitmap
?
infoPtr
->
nBitmapHeight
:
0
),
sizeString
.
cy
);
/* ... add on the necessary padding */
...
...
@@ -1589,7 +1588,7 @@ static inline SIZE TOOLBAR_MeasureButton(TOOLBAR_INFO *infoPtr, SIZE sizeString,
{
if
(
bHasBitmap
)
{
sizeButton
.
cy
=
infoPtr
->
n
V
BitmapHeight
+
DEFPAD_CY
;
sizeButton
.
cy
=
infoPtr
->
nBitmapHeight
+
DEFPAD_CY
;
if
(
sizeString
.
cy
>
0
)
sizeButton
.
cy
+=
1
+
sizeString
.
cy
;
sizeButton
.
cx
=
infoPtr
->
szPadding
.
cx
+
...
...
@@ -2777,9 +2776,6 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
lpAddBmp
->
nID
&
1
)
{
/* large icons */
/* FIXME: on windows the size of the images is 25x24 but the size of the bitmap
* in rsrc is only 24x24. Fix the bitmap (how?) and then fix this
*/
SendMessageW
(
hwnd
,
TB_SETBITMAPSIZE
,
0
,
MAKELPARAM
((
WORD
)
24
,
(
WORD
)
24
));
SendMessageW
(
hwnd
,
TB_SETBUTTONSIZE
,
0
,
...
...
@@ -4442,7 +4438,7 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
LOWORD
(
lParam
),
HIWORD
(
lParam
));
infoPtr
->
nBitmapWidth
=
(
INT
)
LOWORD
(
lParam
);
infoPtr
->
n
VBitmapHeight
=
infoPtr
->
n
BitmapHeight
=
(
INT
)
HIWORD
(
lParam
);
infoPtr
->
nBitmapHeight
=
(
INT
)
HIWORD
(
lParam
);
if
((
himlDef
==
infoPtr
->
himlInt
)
&&
(
ImageList_GetImageCount
(
infoPtr
->
himlInt
)
==
0
))
...
...
@@ -4593,7 +4589,7 @@ TOOLBAR_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
if
(
cy
==
0
)
cx
=
22
;
cx
=
max
(
cx
,
infoPtr
->
szPadding
.
cx
+
infoPtr
->
nBitmapWidth
);
cy
=
max
(
cy
,
infoPtr
->
szPadding
.
cy
+
infoPtr
->
n
V
BitmapHeight
);
cy
=
max
(
cy
,
infoPtr
->
szPadding
.
cy
+
infoPtr
->
nBitmapHeight
);
infoPtr
->
nButtonWidth
=
cx
;
infoPtr
->
nButtonHeight
=
cy
;
...
...
@@ -4852,7 +4848,6 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr
->
nBitmapWidth
=
1
;
infoPtr
->
nBitmapHeight
=
1
;
}
infoPtr
->
nVBitmapHeight
=
infoPtr
->
nBitmapHeight
;
TOOLBAR_CalcToolbar
(
hwnd
);
TRACE
(
"hwnd %p, new himl=%p, id = %d, count=%d, bitmap w=%d, h=%d
\n
"
,
...
...
@@ -5321,13 +5316,8 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
/* initialize info structure */
infoPtr
->
nButtonWidth
=
23
;
infoPtr
->
nButtonHeight
=
22
;
infoPtr
->
nBitmapHeight
=
1
5
;
infoPtr
->
nBitmapHeight
=
1
6
;
infoPtr
->
nBitmapWidth
=
16
;
/* By default Windows creates an image list with 16x15 icons but computes the button size as
* if the icons were 16x16. That's why we keep infoPtr->nVBitmapHeight. After a call to
* TB_SETBITMAPSIZE or TB_SETIMAGELIST the nVBitmapHeight = nBitmapHeight.
*/
infoPtr
->
nVBitmapHeight
=
16
;
infoPtr
->
nMaxTextRows
=
1
;
infoPtr
->
cxMin
=
-
1
;
...
...
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