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
8cbca5dc
Commit
8cbca5dc
authored
Sep 21, 2006
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Sep 26, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: toolbar: If wParam in TB_ADDBUTTON is large, enlarge the
bitmap before ImageList_AddMasked rather then call ImageList_SetImagesCount after.
parent
c77890d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
2 deletions
+67
-2
comctl32.h
dlls/comctl32/comctl32.h
+1
-0
commctrl.c
dlls/comctl32/commctrl.c
+61
-0
toolbar.c
dlls/comctl32/toolbar.c
+5
-2
No files found.
dlls/comctl32/comctl32.h
View file @
8cbca5dc
...
...
@@ -143,6 +143,7 @@ extern COMCTL32_SysColor comctl32_color;
HWND
COMCTL32_CreateToolTip
(
HWND
);
VOID
COMCTL32_RefreshSysColors
(
void
);
void
COMCTL32_DrawInsertMark
(
HDC
hDC
,
const
RECT
*
lpRect
,
COLORREF
clrInsertMark
,
BOOL
bHorizontal
);
void
COMCTL32_EnsureBitmapSize
(
HBITMAP
*
pBitmap
,
int
cxMinWidth
,
int
cyMinHeight
,
COLORREF
crBackground
);
INT
Str_GetPtrWtoA
(
LPCWSTR
lpSrc
,
LPSTR
lpDest
,
INT
nMaxLen
);
BOOL
Str_SetPtrAtoW
(
LPWSTR
*
lppDest
,
LPCSTR
lpSrc
);
BOOL
Str_SetPtrWtoA
(
LPSTR
*
lppDest
,
LPCWSTR
lpSrc
);
...
...
dlls/comctl32/commctrl.c
View file @
8cbca5dc
...
...
@@ -1449,6 +1449,67 @@ void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark
}
/***********************************************************************
* COMCTL32_EnsureBitmapSize [internal]
*
* If needed enlarge the bitmap so that the width is at least cxMinWidth
* the height is at least cyMinHeight. If the bitmap already have these
* dimensions nothing changes.
*
* PARAMS
* hBitmap [I/O] Bitmap to modify. The handle may change
* cxMinWidth [I] If the width of the bitmap is smaller then it will
* be enlarged to this value
* cyMinHeight [I] If the height of the bitmap is smaller then it will
* be enlarged to this value
* cyBackground [I] The color with which the new area will be filled
*
* RETURNS
* none
*/
void
COMCTL32_EnsureBitmapSize
(
HBITMAP
*
pBitmap
,
int
cxMinWidth
,
int
cyMinHeight
,
COLORREF
crBackground
)
{
int
cxNew
,
cyNew
;
BITMAP
bmp
;
HBITMAP
hNewBitmap
;
HBITMAP
hNewDCBitmap
,
hOldDCBitmap
;
HBRUSH
hNewDCBrush
;
HDC
hdcNew
,
hdcOld
;
if
(
!
GetObjectW
(
*
pBitmap
,
sizeof
(
BITMAP
),
&
bmp
))
return
;
cxNew
=
(
cxMinWidth
>
bmp
.
bmWidth
?
cxMinWidth
:
bmp
.
bmWidth
);
cyNew
=
(
cyMinHeight
>
bmp
.
bmHeight
?
cyMinHeight
:
bmp
.
bmHeight
);
if
(
cxNew
==
bmp
.
bmWidth
&&
cyNew
==
bmp
.
bmHeight
)
return
;
hdcNew
=
CreateCompatibleDC
(
NULL
);
hNewBitmap
=
CreateBitmap
(
cxNew
,
cyNew
,
bmp
.
bmPlanes
,
bmp
.
bmBitsPixel
,
NULL
);
hNewDCBitmap
=
SelectObject
(
hdcNew
,
hNewBitmap
);
hNewDCBrush
=
SelectObject
(
hdcNew
,
CreateSolidBrush
(
crBackground
));
hdcOld
=
CreateCompatibleDC
(
NULL
);
hOldDCBitmap
=
SelectObject
(
hdcOld
,
*
pBitmap
);
BitBlt
(
hdcNew
,
0
,
0
,
bmp
.
bmWidth
,
bmp
.
bmHeight
,
hdcOld
,
0
,
0
,
SRCCOPY
);
if
(
bmp
.
bmWidth
<
cxMinWidth
)
PatBlt
(
hdcNew
,
bmp
.
bmWidth
,
0
,
cxNew
,
bmp
.
bmHeight
,
PATCOPY
);
if
(
bmp
.
bmHeight
<
cyMinHeight
)
PatBlt
(
hdcNew
,
0
,
bmp
.
bmHeight
,
bmp
.
bmWidth
,
cyNew
,
PATCOPY
);
if
(
bmp
.
bmWidth
<
cxMinWidth
&&
bmp
.
bmHeight
<
cyMinHeight
)
PatBlt
(
hdcNew
,
bmp
.
bmWidth
,
bmp
.
bmHeight
,
cxNew
,
cyNew
,
PATCOPY
);
SelectObject
(
hdcNew
,
hNewDCBitmap
);
DeleteObject
(
SelectObject
(
hdcNew
,
hNewDCBrush
));
DeleteDC
(
hdcNew
);
SelectObject
(
hdcOld
,
hOldDCBitmap
);
DeleteDC
(
hdcOld
);
DeleteObject
(
*
pBitmap
);
*
pBitmap
=
hNewBitmap
;
return
;
}
/***********************************************************************
* MirrorIcon [COMCTL32.414]
*
* Mirrors an icon so that it will appear correctly on a mirrored DC.
...
...
dlls/comctl32/toolbar.c
View file @
8cbca5dc
...
...
@@ -2578,6 +2578,7 @@ TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TB
HBITMAP
hbmLoad
;
INT
nCountBefore
=
ImageList_GetImageCount
(
himlDef
);
INT
nCountAfter
;
INT
cxIcon
,
cyIcon
;
INT
nAdded
;
INT
nIndex
;
...
...
@@ -2613,6 +2614,10 @@ TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TB
}
else
hbmLoad
=
CreateMappedBitmap
(
bitmap
->
hInst
,
bitmap
->
nID
,
0
,
NULL
,
0
);
/* enlarge the bitmap if needed */
ImageList_GetIconSize
(
himlDef
,
&
cxIcon
,
&
cyIcon
);
COMCTL32_EnsureBitmapSize
(
&
hbmLoad
,
cxIcon
*
(
INT
)
bitmap
->
nButtons
,
cyIcon
,
comctl32_color
.
clrBtnFace
);
nIndex
=
ImageList_AddMasked
(
himlDef
,
hbmLoad
,
comctl32_color
.
clrBtnFace
);
DeleteObject
(
hbmLoad
);
...
...
@@ -2624,8 +2629,6 @@ TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TB
if
(
bitmap
->
nButtons
==
0
)
/* wParam == 0 is special and means add only one image */
{
ImageList_SetImageCount
(
himlDef
,
nCountBefore
+
1
);
}
else
if
(
nAdded
<
(
INT
)
bitmap
->
nButtons
)
{
/* if not enough buttons, grow the list */
ImageList_SetImageCount
(
himlDef
,
nCountBefore
+
bitmap
->
nButtons
);
}
else
if
(
nAdded
>
(
INT
)
bitmap
->
nButtons
)
{
TRACE
(
"Added more images than wParam: Previous image number %i added %i while wParam %i. Images in list %i
\n
"
,
nCountBefore
,
nAdded
,
bitmap
->
nButtons
,
nCountAfter
);
...
...
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