mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 11:01:29 +00:00
comctl32/updown: Make sure buttons rectangles are consistent with each other.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f3775ed2ac
commit
cfc323db26
|
@ -18,6 +18,7 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -170,13 +171,16 @@ static BOOL UPDOWN_HasBuddyBorder(const UPDOWN_INFO *infoPtr)
|
||||||
* rect - will hold the rectangle
|
* rect - will hold the rectangle
|
||||||
* arrow - FLAG_INCR to get the "increment" rect (up or right)
|
* arrow - FLAG_INCR to get the "increment" rect (up or right)
|
||||||
* FLAG_DECR to get the "decrement" rect (down or left)
|
* FLAG_DECR to get the "decrement" rect (down or left)
|
||||||
* If both flags are present, the envelope is returned.
|
|
||||||
*/
|
*/
|
||||||
static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, int arrow)
|
static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, unsigned int arrow)
|
||||||
{
|
{
|
||||||
HTHEME theme = GetWindowTheme (infoPtr->Self);
|
HTHEME theme = GetWindowTheme (infoPtr->Self);
|
||||||
const int border = theme ? DEFAULT_BUDDYBORDER_THEMED : DEFAULT_BUDDYBORDER;
|
const int border = theme ? DEFAULT_BUDDYBORDER_THEMED : DEFAULT_BUDDYBORDER;
|
||||||
const int spacer = theme ? DEFAULT_BUDDYSPACER_THEMED : DEFAULT_BUDDYSPACER;
|
const int spacer = theme ? DEFAULT_BUDDYSPACER_THEMED : DEFAULT_BUDDYSPACER;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
assert(arrow && (arrow & (FLAG_INCR | FLAG_DECR)) != (FLAG_INCR | FLAG_DECR));
|
||||||
|
|
||||||
GetClientRect (infoPtr->Self, rect);
|
GetClientRect (infoPtr->Self, rect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -200,21 +204,20 @@ static void UPDOWN_GetArrowRect (const UPDOWN_INFO* infoPtr, RECT *rect, int arr
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We're calculating the midpoint to figure-out where the
|
* We're calculating the midpoint to figure-out where the
|
||||||
* separation between the buttons will lay. We make sure that we
|
* separation between the buttons will lay.
|
||||||
* round the uneven numbers by adding 1.
|
|
||||||
*/
|
*/
|
||||||
if (infoPtr->dwStyle & UDS_HORZ) {
|
if (infoPtr->dwStyle & UDS_HORZ) {
|
||||||
int len = rect->right - rect->left + 1; /* compute the width */
|
size = (rect->right - rect->left) / 2;
|
||||||
if (arrow & FLAG_INCR)
|
if (arrow & FLAG_INCR)
|
||||||
rect->left = rect->left + len/2;
|
rect->left = rect->right - size;
|
||||||
if (arrow & FLAG_DECR)
|
else if (arrow & FLAG_DECR)
|
||||||
rect->right = rect->left + len/2 - (theme ? 0 : 1);
|
rect->right = rect->left + size;
|
||||||
} else {
|
} else {
|
||||||
int len = rect->bottom - rect->top + 1; /* compute the height */
|
size = (rect->bottom - rect->top) / 2;
|
||||||
if (arrow & FLAG_INCR)
|
if (arrow & FLAG_INCR)
|
||||||
rect->bottom = rect->top + len/2 - (theme ? 0 : 1);
|
rect->bottom = rect->top + size;
|
||||||
if (arrow & FLAG_DECR)
|
else if (arrow & FLAG_DECR)
|
||||||
rect->top = rect->top + len/2;
|
rect->top = rect->bottom - size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue