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
b563ea01
Commit
b563ea01
authored
Nov 26, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/combo: Simplify rectangles sizing helper.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c5bceecb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
108 deletions
+55
-108
combo.c
dlls/user32/combo.c
+55
-108
No files found.
dlls/user32/combo.c
View file @
b563ea01
...
...
@@ -319,111 +319,70 @@ static void CBForceDummyResize(
*
* Set up component coordinates given valid lphc->RectCombo.
*/
static
void
CBCalcPlacement
(
HWND
hwnd
,
LPHEADCOMBO
lphc
,
LPRECT
lprEdit
,
LPRECT
lprButton
,
LPRECT
lprLB
)
static
void
CBCalcPlacement
(
HEADCOMBO
*
combo
)
{
/*
* Again, start with the client rectangle.
*/
GetClientRect
(
hwnd
,
lprEdit
);
/* Start with the client rectangle. */
GetClientRect
(
combo
->
self
,
&
combo
->
textRect
);
/*
* Remove the borders
*/
InflateRect
(
lprEdit
,
-
COMBO_XBORDERSIZE
(),
-
COMBO_YBORDERSIZE
());
/* Remove the borders */
InflateRect
(
&
combo
->
textRect
,
-
COMBO_XBORDERSIZE
(),
-
COMBO_YBORDERSIZE
());
/*
* Chop off the bottom part to fit with the height of the text area.
*/
lprEdit
->
bottom
=
lprEdit
->
top
+
CBGetTextAreaHeight
(
hwnd
,
lphc
);
/*
* The button starts the same vertical position as the text area.
*/
CopyRect
(
lprButton
,
lprEdit
);
/* Chop off the bottom part to fit with the height of the text area. */
combo
->
textRect
.
bottom
=
combo
->
textRect
.
top
+
CBGetTextAreaHeight
(
combo
->
self
,
combo
);
/*
* If the combobox is "simple" there is no button.
*/
if
(
CB_GETTYPE
(
lphc
)
==
CBS_SIMPLE
)
lprButton
->
left
=
lprButton
->
right
=
lprButton
->
bottom
=
0
;
else
{
/*
* Let's assume the combobox button is the same width as the
* scrollbar button.
* size the button horizontally and cut-off the text area.
*/
lprButton
->
left
=
lprButton
->
right
-
GetSystemMetrics
(
SM_CXVSCROLL
);
lprEdit
->
right
=
lprButton
->
left
;
}
/* The button starts the same vertical position as the text area. */
combo
->
buttonRect
=
combo
->
textRect
;
/*
* In the case of a dropdown, there is an additional spacing between the
* text area and the button.
*/
if
(
CB_GETTYPE
(
lphc
)
==
CBS_DROPDOWN
)
{
lprEdit
->
right
-=
COMBO_EDITBUTTONSPACE
();
}
/* If the combobox is "simple" there is no button. */
if
(
CB_GETTYPE
(
combo
)
==
CBS_SIMPLE
)
combo
->
buttonRect
.
left
=
combo
->
buttonRect
.
right
=
combo
->
buttonRect
.
bottom
=
0
;
else
{
/*
* Let's assume the combobox button is the same width as the
* scrollbar button.
* size the button horizontally and cut-off the text area.
*/
combo
->
buttonRect
.
left
=
combo
->
buttonRect
.
right
-
GetSystemMetrics
(
SM_CXVSCROLL
);
combo
->
textRect
.
right
=
combo
->
buttonRect
.
left
;
}
/*
* If we have an edit control, we space it away from the borders slightly.
*/
if
(
CB_GETTYPE
(
lphc
)
!=
CBS_DROPDOWNLIST
)
{
InflateRect
(
lprEdit
,
-
EDIT_CONTROL_PADDING
(),
-
EDIT_CONTROL_PADDING
());
}
/* In the case of a dropdown, there is an additional spacing between the text area and the button. */
if
(
CB_GETTYPE
(
combo
)
==
CBS_DROPDOWN
)
combo
->
textRect
.
right
-=
COMBO_EDITBUTTONSPACE
();
/*
* Adjust the size of the listbox popup.
*/
if
(
CB_GETTYPE
(
lphc
)
==
CBS_SIMPLE
)
{
/*
* Use the client rectangle to initialize the listbox rectangle
*/
GetClientRect
(
hwnd
,
lprLB
);
/* If we have an edit control, we space it away from the borders slightly. */
if
(
CB_GETTYPE
(
combo
)
!=
CBS_DROPDOWNLIST
)
InflateRect
(
&
combo
->
textRect
,
-
EDIT_CONTROL_PADDING
(),
-
EDIT_CONTROL_PADDING
());
/*
* Then, chop-off the top part.
*/
lprLB
->
top
=
lprEdit
->
bottom
+
COMBO_YBORDERSIZE
();
}
else
{
/*
* Make sure the dropped width is as large as the combobox itself.
*/
if
(
lphc
->
droppedWidth
<
(
lprButton
->
right
+
COMBO_XBORDERSIZE
()))
/* Adjust the size of the listbox popup. */
if
(
CB_GETTYPE
(
combo
)
==
CBS_SIMPLE
)
{
lprLB
->
right
=
lprLB
->
left
+
(
lprButton
->
right
+
COMBO_XBORDERSIZE
());
/*
* In the case of a dropdown, the popup listbox is offset to the right.
* so, we want to make sure it's flush with the right side of the
* combobox
*/
if
(
CB_GETTYPE
(
lphc
)
==
CBS_DROPDOWN
)
lprLB
->
right
-=
COMBO_EDITBUTTONSPACE
();
GetClientRect
(
combo
->
self
,
&
combo
->
droppedRect
);
combo
->
droppedRect
.
top
=
combo
->
textRect
.
bottom
+
COMBO_YBORDERSIZE
();
}
else
lprLB
->
right
=
lprLB
->
left
+
lphc
->
droppedWidth
;
}
/* don't allow negative window width */
if
(
lprEdit
->
right
<
lprEdit
->
left
)
lprEdit
->
right
=
lprEdit
->
left
;
{
/* Make sure the dropped width is as large as the combobox itself. */
if
(
combo
->
droppedWidth
<
(
combo
->
buttonRect
.
right
+
COMBO_XBORDERSIZE
()))
{
combo
->
droppedRect
.
right
=
combo
->
droppedRect
.
left
+
(
combo
->
buttonRect
.
right
+
COMBO_XBORDERSIZE
());
TRACE
(
"
\t
text
\t
= (%s)
\n
"
,
wine_dbgstr_rect
(
lprEdit
));
/* In the case of a dropdown, the popup listbox is offset to the right. We want to make sure it's flush
with the right side of the combobox. */
if
(
CB_GETTYPE
(
combo
)
==
CBS_DROPDOWN
)
combo
->
droppedRect
.
right
-=
COMBO_EDITBUTTONSPACE
();
}
else
combo
->
droppedRect
.
right
=
combo
->
droppedRect
.
left
+
combo
->
droppedWidth
;
}
TRACE
(
"
\t
button
\t
= (%s)
\n
"
,
wine_dbgstr_rect
(
lprButton
));
/* Disallow negative window width */
if
(
combo
->
textRect
.
right
<
combo
->
textRect
.
left
)
combo
->
textRect
.
right
=
combo
->
textRect
.
left
;
TRACE
(
"
\t
lbox
\t
= (%s)
\n
"
,
wine_dbgstr_rect
(
lprLB
));
TRACE
(
"text %s, button %s, lbox %s.
\n
"
,
wine_dbgstr_rect
(
&
combo
->
textRect
),
wine_dbgstr_rect
(
&
combo
->
buttonRect
),
wine_dbgstr_rect
(
&
combo
->
droppedRect
));
}
/***********************************************************************
...
...
@@ -479,7 +438,7 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
* recalculated.
*/
GetClientRect
(
hwnd
,
&
lphc
->
droppedRect
);
CBCalcPlacement
(
hwnd
,
lphc
,
&
lphc
->
textRect
,
&
lphc
->
buttonRect
,
&
lphc
->
droppedRect
);
CBCalcPlacement
(
lphc
);
/*
* Adjust the position of the popup listbox if it's necessary
...
...
@@ -1530,11 +1489,7 @@ static void COMBO_Size( LPHEADCOMBO lphc )
SWP_NOZORDER
|
SWP_NOMOVE
|
SWP_NOACTIVATE
|
SWP_NOREDRAW
);
}
CBCalcPlacement
(
lphc
->
self
,
lphc
,
&
lphc
->
textRect
,
&
lphc
->
buttonRect
,
&
lphc
->
droppedRect
);
CBCalcPlacement
(
lphc
);
CBResetPos
(
lphc
,
&
lphc
->
textRect
,
&
lphc
->
droppedRect
,
FALSE
);
}
...
...
@@ -1562,11 +1517,7 @@ static void COMBO_Font( LPHEADCOMBO lphc, HFONT hFont, BOOL bRedraw )
*/
if
(
CB_GETTYPE
(
lphc
)
==
CBS_SIMPLE
)
{
CBCalcPlacement
(
lphc
->
self
,
lphc
,
&
lphc
->
textRect
,
&
lphc
->
buttonRect
,
&
lphc
->
droppedRect
);
CBCalcPlacement
(
lphc
);
CBResetPos
(
lphc
,
&
lphc
->
textRect
,
&
lphc
->
droppedRect
,
TRUE
);
}
...
...
@@ -1595,11 +1546,7 @@ static LRESULT COMBO_SetItemHeight( LPHEADCOMBO lphc, INT index, INT height )
*/
if
(
CB_GETTYPE
(
lphc
)
==
CBS_SIMPLE
)
{
CBCalcPlacement
(
lphc
->
self
,
lphc
,
&
lphc
->
textRect
,
&
lphc
->
buttonRect
,
&
lphc
->
droppedRect
);
CBCalcPlacement
(
lphc
);
CBResetPos
(
lphc
,
&
lphc
->
textRect
,
&
lphc
->
droppedRect
,
TRUE
);
}
...
...
@@ -2100,7 +2047,7 @@ LRESULT ComboWndProc_common( HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
lphc
->
droppedWidth
=
0
;
/* recalculate the combobox area */
CBCalcPlacement
(
hwnd
,
lphc
,
&
lphc
->
textRect
,
&
lphc
->
buttonRect
,
&
lphc
->
droppedRect
);
CBCalcPlacement
(
lphc
);
/* fall through */
case
CB_GETDROPPEDWIDTH
:
...
...
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