Commit a4c22a14 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/header: Implement HDF_FIXEDWIDTH format flag.

parent 5e1f5ebf
......@@ -624,6 +624,13 @@ HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFl
rcTest = rect;
rcTest.right = rcTest.left + DIVIDER_WIDTH;
if (PtInRect (&rcTest, *lpPt)) {
if (infoPtr->items[HEADER_PrevItem(infoPtr, iCount)].fmt & HDF_FIXEDWIDTH)
{
*pFlags |= HHT_ONHEADER;
*pItem = iCount;
TRACE("ON HEADER %d\n", *pItem);
return;
}
if (bNoWidth) {
*pFlags |= HHT_ONDIVOPEN;
*pItem = HEADER_PrevItem(infoPtr, iCount);
......@@ -640,7 +647,9 @@ HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFl
}
rcTest = rect;
rcTest.left = rcTest.right - DIVIDER_WIDTH;
if (PtInRect (&rcTest, *lpPt)) {
if (!(infoPtr->items[iCount].fmt & HDF_FIXEDWIDTH) &&
PtInRect (&rcTest, *lpPt))
{
*pFlags |= HHT_ONDIVIDER;
*pItem = iCount;
TRACE("ON DIVIDER %d\n", *pItem);
......@@ -655,21 +664,24 @@ HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFl
}
/* check for last divider part (on nowhere) */
rect = infoPtr->items[infoPtr->uNumItem-1].rect;
rect.left = rect.right;
rect.right += DIVIDER_WIDTH;
if (PtInRect (&rect, *lpPt)) {
if (bNoWidth) {
*pFlags |= HHT_ONDIVOPEN;
*pItem = infoPtr->uNumItem - 1;
TRACE("ON DIVOPEN %d\n", *pItem);
return;
}
else {
*pFlags |= HHT_ONDIVIDER;
*pItem = infoPtr->uNumItem-1;
TRACE("ON DIVIDER %d\n", *pItem);
return;
if (!(infoPtr->items[infoPtr->uNumItem-1].fmt & HDF_FIXEDWIDTH))
{
rect = infoPtr->items[infoPtr->uNumItem-1].rect;
rect.left = rect.right;
rect.right += DIVIDER_WIDTH;
if (PtInRect (&rect, *lpPt)) {
if (bNoWidth) {
*pFlags |= HHT_ONDIVOPEN;
*pItem = infoPtr->uNumItem - 1;
TRACE("ON DIVOPEN %d\n", *pItem);
return;
}
else {
*pFlags |= HHT_ONDIVIDER;
*pItem = infoPtr->uNumItem-1;
TRACE("ON DIVIDER %d\n", *pItem);
return;
}
}
}
......
......@@ -24,6 +24,7 @@
#include <assert.h>
#include "wine/test.h"
#include "v6util.h"
#include "msg.h"
typedef struct tagEXPECTEDNOTIFY
......@@ -1083,7 +1084,6 @@ static void test_hdm_bitmapmarginMessages(HWND hParent)
static void test_hdm_index_messages(HWND hParent)
{
HWND hChild;
int retVal;
int loopcnt;
......@@ -1196,6 +1196,74 @@ static void test_hdm_index_messages(HWND hParent)
DestroyWindow(hChild);
}
static void test_hdf_fixedwidth(HWND hParent)
{
HWND hChild;
HDITEM hdItem;
DWORD ret;
RECT rect;
HDHITTESTINFO ht;
hChild = create_custom_header_control(hParent, FALSE);
hdItem.mask = HDI_WIDTH | HDI_FORMAT;
hdItem.fmt = HDF_FIXEDWIDTH;
hdItem.cxy = 80;
ret = SendMessage(hChild, HDM_INSERTITEM, 0, (LPARAM)&hdItem);
expect(0, ret);
/* try to change width */
rect.right = rect.bottom = 0;
SendMessage(hChild, HDM_GETITEMRECT, 0, (LPARAM)&rect);
ok(rect.right != 0, "Expected not zero width\n");
ok(rect.bottom != 0, "Expected not zero height\n");
SendMessage(hChild, WM_LBUTTONDOWN, 0, MAKELPARAM(rect.right, rect.bottom / 2));
SendMessage(hChild, WM_MOUSEMOVE, 0, MAKELPARAM(rect.right + 20, rect.bottom / 2));
SendMessage(hChild, WM_LBUTTONUP, 0, MAKELPARAM(rect.right + 20, rect.bottom / 2));
SendMessage(hChild, HDM_GETITEMRECT, 0, (LPARAM)&rect);
if (hdItem.cxy != rect.right)
{
win_skip("HDF_FIXEDWIDTH format not supported\n");
DestroyWindow(hChild);
return;
}
/* try to adjust with message */
hdItem.mask = HDI_WIDTH;
hdItem.cxy = 90;
ret = SendMessage(hChild, HDM_SETITEM, 0, (LPARAM)&hdItem);
expect(TRUE, ret);
rect.right = 0;
SendMessage(hChild, HDM_GETITEMRECT, 0, (LPARAM)&rect);
expect(90, rect.right);
/* hittesting doesn't report ondivider flag for HDF_FIXEDWIDTH */
ht.pt.x = rect.right - 1;
ht.pt.y = rect.bottom / 2;
SendMessage(hChild, HDM_HITTEST, 0, (LPARAM)&ht);
expect(HHT_ONHEADER, ht.flags);
/* try to adjust with message */
hdItem.mask = HDI_FORMAT;
hdItem.fmt = 0;
ret = SendMessage(hChild, HDM_SETITEM, 0, (LPARAM)&hdItem);
expect(TRUE, ret);
ht.pt.x = 90;
ht.pt.y = rect.bottom / 2;
SendMessage(hChild, HDM_HITTEST, 0, (LPARAM)&ht);
expect(HHT_ONDIVIDER, ht.flags);
DestroyWindow(hChild);
}
#define TEST_NMCUSTOMDRAW(draw_stage, item_spec, lparam, _left, _top, _right, _bottom) \
ok(nm->dwDrawStage == draw_stage, "Invalid dwDrawStage %d vs %d\n", draw_stage, nm->dwDrawStage); \
if (item_spec != -1) \
......@@ -1558,6 +1626,7 @@ static int init(void)
START_TEST(header)
{
HWND parent_hwnd;
ULONG_PTR ctx_cookie;
if (!init())
return;
......@@ -1583,6 +1652,16 @@ START_TEST(header)
test_hdm_unicodeformatMessages(parent_hwnd);
test_hdm_bitmapmarginMessages(parent_hwnd);
DestroyWindow(parent_hwnd);
if (!load_v6_module(&ctx_cookie))
{
DestroyWindow(parent_hwnd);
return;
}
/* comctl32 version 6 tests start here */
test_hdf_fixedwidth(parent_hwnd);
unload_v6_module(ctx_cookie);
DestroyWindow(parent_hwnd);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment