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
d9ac53f1
Commit
d9ac53f1
authored
Jun 07, 2000
by
Aric Stewart
Committed by
Alexandre Julliard
Jun 07, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added handling of TBSTYLE_AUTOSIZE.
parent
c94e0861
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
34 deletions
+81
-34
toolbar.c
dlls/comctl32/toolbar.c
+81
-34
No files found.
dlls/comctl32/toolbar.c
View file @
d9ac53f1
...
@@ -46,6 +46,15 @@ DEFAULT_DEBUG_CHANNEL(toolbar)
...
@@ -46,6 +46,15 @@ DEFAULT_DEBUG_CHANNEL(toolbar)
#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0))
#define TOOLBAR_GetInfoPtr(hwnd) ((TOOLBAR_INFO *)GetWindowLongA(hwnd,0))
static
BOOL
TOOLBAR_IsValidBitmapIndex
(
TOOLBAR_INFO
*
infoPtr
,
INT
index
)
{
if
((
index
>=
0
)
&&
(
index
<
infoPtr
->
nNumBitmaps
))
return
TRUE
;
else
return
FALSE
;
}
static
void
static
void
TOOLBAR_DrawFlatSeparator
(
LPRECT
lpRect
,
HDC
hdc
)
TOOLBAR_DrawFlatSeparator
(
LPRECT
lpRect
,
HDC
hdc
)
...
@@ -96,7 +105,7 @@ TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
...
@@ -96,7 +105,7 @@ TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
InflateRect
(
&
rcText
,
-
3
,
-
3
);
InflateRect
(
&
rcText
,
-
3
,
-
3
);
if
(
himl
&&
btnPtr
->
iBitmap
>=
0
)
{
if
(
himl
&&
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
)
)
{
if
((
dwStyle
&
TBSTYLE_LIST
)
&&
if
((
dwStyle
&
TBSTYLE_LIST
)
&&
((
btnPtr
->
fsStyle
&
TBSTYLE_AUTOSIZE
)
==
0
)
&&
((
btnPtr
->
fsStyle
&
TBSTYLE_AUTOSIZE
)
==
0
)
&&
(
btnPtr
->
iBitmap
!=
I_IMAGENONE
))
{
(
btnPtr
->
iBitmap
!=
I_IMAGENONE
))
{
...
@@ -228,7 +237,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
...
@@ -228,7 +237,8 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
DrawEdge
(
hdc
,
&
rc
,
EDGE_RAISED
,
DrawEdge
(
hdc
,
&
rc
,
EDGE_RAISED
,
BF_SOFT
|
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
BF_SOFT
|
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
if
(
infoPtr
->
himlDis
&&
btnPtr
->
iBitmap
>=
0
)
if
(
infoPtr
->
himlDis
&&
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
))
ImageList_Draw
(
infoPtr
->
himlDis
,
btnPtr
->
iBitmap
,
hdc
,
ImageList_Draw
(
infoPtr
->
himlDis
,
btnPtr
->
iBitmap
,
hdc
,
rc
.
left
+
1
,
rc
.
top
+
1
,
ILD_NORMAL
);
rc
.
left
+
1
,
rc
.
top
+
1
,
ILD_NORMAL
);
else
else
...
@@ -245,7 +255,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
...
@@ -245,7 +255,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
DrawEdge
(
hdc
,
&
rc
,
BDR_SUNKENOUTER
,
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
DrawEdge
(
hdc
,
&
rc
,
BDR_SUNKENOUTER
,
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
else
else
DrawEdge
(
hdc
,
&
rc
,
EDGE_SUNKEN
,
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
DrawEdge
(
hdc
,
&
rc
,
EDGE_SUNKEN
,
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
if
(
btnPtr
->
iBitmap
>=
0
)
if
(
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
)
)
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
TOOLBAR_DrawString
(
infoPtr
,
btnPtr
,
hdc
,
btnPtr
->
fsState
,
dwStyle
,
TOOLBAR_DrawString
(
infoPtr
,
btnPtr
,
hdc
,
btnPtr
->
fsState
,
dwStyle
,
...
@@ -265,7 +275,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
...
@@ -265,7 +275,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
TOOLBAR_DrawPattern
(
hdc
,
&
rc
);
TOOLBAR_DrawPattern
(
hdc
,
&
rc
);
if
(
btnPtr
->
iBitmap
>=
0
)
if
(
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
)
)
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
...
@@ -291,10 +301,11 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
...
@@ -291,10 +301,11 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
{
{
if
(
btnPtr
->
bHot
)
if
(
btnPtr
->
bHot
)
DrawEdge
(
hdc
,
&
rc
,
BDR_RAISEDINNER
,
BF_RECT
|
BF_MIDDLE
);
DrawEdge
(
hdc
,
&
rc
,
BDR_RAISEDINNER
,
BF_RECT
|
BF_MIDDLE
);
if
(
btnPtr
->
bHot
&&
infoPtr
->
himlHot
&&
btnPtr
->
iBitmap
>=
0
)
if
(
btnPtr
->
bHot
&&
infoPtr
->
himlHot
&&
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
))
ImageList_Draw
(
infoPtr
->
himlHot
,
btnPtr
->
iBitmap
,
hdc
,
ImageList_Draw
(
infoPtr
->
himlHot
,
btnPtr
->
iBitmap
,
hdc
,
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
else
if
(
btnPtr
->
iBitmap
>=
0
)
else
if
(
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
)
)
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
rc
.
left
+
2
,
rc
.
top
+
2
,
ILD_NORMAL
);
}
}
...
@@ -303,7 +314,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
...
@@ -303,7 +314,7 @@ TOOLBAR_DrawButton (HWND hwnd, TBUTTON_INFO *btnPtr, HDC hdc)
DrawEdge
(
hdc
,
&
rc
,
EDGE_RAISED
,
DrawEdge
(
hdc
,
&
rc
,
EDGE_RAISED
,
BF_SOFT
|
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
BF_SOFT
|
BF_RECT
|
BF_MIDDLE
|
BF_ADJUST
);
if
(
btnPtr
->
iBitmap
>=
0
)
if
(
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
btnPtr
->
iBitmap
)
)
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
ImageList_Draw
(
infoPtr
->
himlDef
,
btnPtr
->
iBitmap
,
hdc
,
rc
.
left
+
1
,
rc
.
top
+
1
,
ILD_NORMAL
);
rc
.
left
+
1
,
rc
.
top
+
1
,
ILD_NORMAL
);
}
}
...
@@ -330,41 +341,27 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
...
@@ -330,41 +341,27 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
}
}
}
}
static
void
static
void
TOOLBAR_
CalcStrings
(
HWND
hwnd
,
LPSIZE
lpSize
)
TOOLBAR_
MeasureString
(
HWND
hwnd
,
INT
index
,
LPSIZE
lpSize
)
{
{
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
TBUTTON_INFO
*
btnPtr
;
TBUTTON_INFO
*
btnPtr
;
INT
i
;
HDC
hdc
;
HDC
hdc
;
HFONT
hOldFont
;
HFONT
hOldFont
;
SIZE
sz
;
LPWSTR
lpText
=
NULL
;
lpSize
->
cx
=
0
;
lpSize
->
cx
=
0
;
lpSize
->
cy
=
0
;
lpSize
->
cy
=
0
;
hdc
=
GetDC
(
0
);
hdc
=
GetDC
(
0
);
hOldFont
=
SelectObject
(
hdc
,
infoPtr
->
hFont
);
hOldFont
=
SelectObject
(
hdc
,
infoPtr
->
hFont
);
btnPtr
=
infoPtr
->
buttons
;
btnPtr
=
&
infoPtr
->
buttons
[
index
];
for
(
i
=
0
;
i
<
infoPtr
->
nNumButtons
;
i
++
,
btnPtr
++
)
{
if
(
!
(
btnPtr
->
fsState
&
TBSTATE_HIDDEN
)
&&
if
(
!
(
btnPtr
->
fsState
&
TBSTATE_HIDDEN
)
&&
(
btnPtr
->
iString
>
-
1
)
&&
(
btnPtr
->
iString
>
-
1
)
&&
(
btnPtr
->
iString
<
infoPtr
->
nNumStrings
))
{
(
btnPtr
->
iString
<
infoPtr
->
nNumStrings
))
/* get a pointer to the text */
{
if
(
HIWORD
(
btnPtr
->
iString
)
!=
0
)
LPWSTR
lpText
=
infoPtr
->
strings
[
btnPtr
->
iString
];
lpText
=
(
LPWSTR
)
btnPtr
->
iString
;
GetTextExtentPoint32W
(
hdc
,
lpText
,
lstrlenW
(
lpText
),
lpSize
);
else
if
((
btnPtr
->
iString
>=
0
)
&&
(
btnPtr
->
iString
<
infoPtr
->
nNumStrings
))
lpText
=
infoPtr
->
strings
[
btnPtr
->
iString
];
GetTextExtentPoint32W
(
hdc
,
lpText
,
lstrlenW
(
lpText
),
&
sz
);
if
(
sz
.
cx
>
lpSize
->
cx
)
lpSize
->
cx
=
sz
.
cx
;
if
(
sz
.
cy
>
lpSize
->
cy
)
lpSize
->
cy
=
sz
.
cy
;
}
}
}
SelectObject
(
hdc
,
hOldFont
);
SelectObject
(
hdc
,
hOldFont
);
...
@@ -373,6 +370,30 @@ TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
...
@@ -373,6 +370,30 @@ TOOLBAR_CalcStrings (HWND hwnd, LPSIZE lpSize)
TRACE
(
"string size %d x %d!
\n
"
,
lpSize
->
cx
,
lpSize
->
cy
);
TRACE
(
"string size %d x %d!
\n
"
,
lpSize
->
cx
,
lpSize
->
cy
);
}
}
static
void
TOOLBAR_CalcStrings
(
HWND
hwnd
,
LPSIZE
lpSize
)
{
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
TBUTTON_INFO
*
btnPtr
;
INT
i
;
SIZE
sz
;
lpSize
->
cx
=
0
;
lpSize
->
cy
=
0
;
btnPtr
=
infoPtr
->
buttons
;
for
(
i
=
0
;
i
<
infoPtr
->
nNumButtons
;
i
++
,
btnPtr
++
)
{
TOOLBAR_MeasureString
(
hwnd
,
i
,
&
sz
);
if
(
sz
.
cx
>
lpSize
->
cx
)
lpSize
->
cx
=
sz
.
cx
;
if
(
sz
.
cy
>
lpSize
->
cy
)
lpSize
->
cy
=
sz
.
cy
;
}
TRACE
(
"string size %d x %d!
\n
"
,
lpSize
->
cx
,
lpSize
->
cy
);
}
/***********************************************************************
/***********************************************************************
* TOOLBAR_WrapToolbar
* TOOLBAR_WrapToolbar
*
*
...
@@ -556,7 +577,7 @@ TOOLBAR_CalcToolbar (HWND hwnd)
...
@@ -556,7 +577,7 @@ TOOLBAR_CalcToolbar (HWND hwnd)
INT
i
;
INT
i
;
for
(
i
=
0
;
i
<
infoPtr
->
nNumButtons
&&
!
usesBitmaps
;
i
++
)
for
(
i
=
0
;
i
<
infoPtr
->
nNumButtons
&&
!
usesBitmaps
;
i
++
)
if
(
infoPtr
->
buttons
[
i
].
iBitmap
>=
0
)
if
(
TOOLBAR_IsValidBitmapIndex
(
infoPtr
,
infoPtr
->
buttons
[
i
].
iBitmap
)
)
usesBitmaps
=
TRUE
;
usesBitmaps
=
TRUE
;
if
(
sizeString
.
cy
>
0
)
{
if
(
sizeString
.
cy
>
0
)
{
...
@@ -633,7 +654,14 @@ TOOLBAR_CalcToolbar (HWND hwnd)
...
@@ -633,7 +654,14 @@ TOOLBAR_CalcToolbar (HWND hwnd)
cx
=
(
btnPtr
->
iBitmap
>
0
)
?
cx
=
(
btnPtr
->
iBitmap
>
0
)
?
btnPtr
->
iBitmap
:
SEPARATOR_WIDTH
;
btnPtr
->
iBitmap
:
SEPARATOR_WIDTH
;
else
{
else
{
cx
=
infoPtr
->
nButtonWidth
;
if
(
btnPtr
->
fsStyle
&
TBSTYLE_AUTOSIZE
)
{
SIZE
sz
;
TOOLBAR_MeasureString
(
hwnd
,
i
,
&
sz
);
cx
=
sz
.
cx
+
6
;
}
else
cx
=
infoPtr
->
nButtonWidth
;
}
}
cy
=
infoPtr
->
nHeight
;
cy
=
infoPtr
->
nHeight
;
...
@@ -986,7 +1014,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -986,7 +1014,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
{
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
TOOLBAR_INFO
*
infoPtr
=
TOOLBAR_GetInfoPtr
(
hwnd
);
LPTBADDBITMAP
lpAddBmp
=
(
LPTBADDBITMAP
)
lParam
;
LPTBADDBITMAP
lpAddBmp
=
(
LPTBADDBITMAP
)
lParam
;
INT
nIndex
=
0
,
nButtons
;
INT
nIndex
=
0
,
nButtons
,
nCount
;
HBITMAP
hbmLoad
;
HBITMAP
hbmLoad
;
if
(
!
lpAddBmp
)
if
(
!
lpAddBmp
)
...
@@ -1044,6 +1072,8 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -1044,6 +1072,8 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr
->
himlInt
=
infoPtr
->
himlDef
;
infoPtr
->
himlInt
=
infoPtr
->
himlDef
;
}
}
nCount
=
ImageList_GetImageCount
(
infoPtr
->
himlDef
);
/* Add bitmaps to the default image list */
/* Add bitmaps to the default image list */
if
(
lpAddBmp
->
hInst
==
(
HINSTANCE
)
0
)
if
(
lpAddBmp
->
hInst
==
(
HINSTANCE
)
0
)
{
{
...
@@ -1117,7 +1147,21 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -1117,7 +1147,21 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
DeleteObject
(
hbmLoad
);
DeleteObject
(
hbmLoad
);
}
}
infoPtr
->
nNumBitmaps
+=
nButtons
;
if
(
nIndex
!=
-
1
)
{
INT
imagecount
=
ImageList_GetImageCount
(
infoPtr
->
himlDef
);
if
(
infoPtr
->
nNumBitmaps
+
nButtons
!=
imagecount
)
{
WARN
(
"Desired images do not match recieved images : Previous image number %s Previous images in list %i added %i expecting total %i, Images in list %i
\n
"
,
infoPtr
->
nNumBitmaps
,
nCount
,
imagecount
-
nCount
,
infoPtr
->
nNumBitmaps
+
nButtons
,
imagecount
);
infoPtr
->
nNumBitmaps
=
imagecount
;
}
else
infoPtr
->
nNumBitmaps
+=
nButtons
;
}
return
nIndex
;
return
nIndex
;
}
}
...
@@ -2817,6 +2861,7 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -2817,6 +2861,7 @@ TOOLBAR_SetImageList (HWND hwnd, WPARAM wParam, LPARAM lParam)
himlTemp
=
infoPtr
->
himlDef
;
himlTemp
=
infoPtr
->
himlDef
;
infoPtr
->
himlDef
=
(
HIMAGELIST
)
lParam
;
infoPtr
->
himlDef
=
(
HIMAGELIST
)
lParam
;
infoPtr
->
nNumBitmaps
=
ImageList_GetImageCount
(
infoPtr
->
himlDef
);
/* FIXME: redraw ? */
/* FIXME: redraw ? */
return
(
LRESULT
)
himlTemp
;
return
(
LRESULT
)
himlTemp
;
...
@@ -3022,6 +3067,8 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
...
@@ -3022,6 +3067,8 @@ TOOLBAR_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
infoPtr
->
nMaxTextRows
=
1
;
infoPtr
->
nMaxTextRows
=
1
;
infoPtr
->
cxMin
=
-
1
;
infoPtr
->
cxMin
=
-
1
;
infoPtr
->
cxMax
=
-
1
;
infoPtr
->
cxMax
=
-
1
;
infoPtr
->
nNumBitmaps
=
0
;
infoPtr
->
nNumStrings
=
0
;
infoPtr
->
bCaptured
=
FALSE
;
infoPtr
->
bCaptured
=
FALSE
;
infoPtr
->
bUnicode
=
IsWindowUnicode
(
hwnd
);
infoPtr
->
bUnicode
=
IsWindowUnicode
(
hwnd
);
...
...
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