ReactOS 0.4.16-dev-319-g6cf4263
header.c
Go to the documentation of this file.
1/*
2 * Header control
3 *
4 * Copyright 1998 Eric Kohl
5 * Copyright 2000 Eric Kohl for CodeWeavers
6 * Copyright 2003 Maxime Bellenge
7 * Copyright 2006 Mikolaj Zalewski
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 *
23 * TODO:
24 * - Imagelist support (completed?)
25 * - Hottrack support (completed?)
26 * - Filters support (HDS_FILTER, HDI_FILTER, HDM_*FILTER*, HDN_*FILTER*)
27 * - New Windows Vista features
28 */
29
30#include <stdarg.h>
31#include <stdlib.h>
32#include <string.h>
33
34#include "windef.h"
35#include "winbase.h"
36#include "wingdi.h"
37#include "winuser.h"
38#include "winnls.h"
39#include "commctrl.h"
40#include "comctl32.h"
41#include "vssym32.h"
42#include "uxtheme.h"
43#include "wine/debug.h"
44#include "wine/heap.h"
45
47
48typedef struct
49{
56 INT iOrder; /* see documentation of HD_ITEM */
57
58 BOOL bDown; /* is item pressed? (used for drawing) */
59 RECT rect; /* bounding rectangle of the item */
60 DWORD callbackMask; /* HDI_* flags for items that are callback */
62
63
64typedef struct
65{
66 HWND hwndSelf; /* Control window */
67 HWND hwndNotify; /* Owner window to send notifications to */
68 INT nNotifyFormat; /* format used for WM_NOTIFY messages */
69 UINT uNumItem; /* number of items (columns) */
70 INT nHeight; /* height of the header (pixels) */
71 HFONT hFont; /* handle to the current font */
72 HCURSOR hcurArrow; /* handle to the arrow cursor */
73 HCURSOR hcurDivider; /* handle to a cursor (used over dividers) <-|-> */
74 HCURSOR hcurDivopen; /* handle to a cursor (used over dividers) <-||-> */
75 BOOL bCaptured; /* Is the mouse captured? */
76 BOOL bPressed; /* Is a header item pressed (down)? */
77 BOOL bDragging; /* Are we dragging an item? */
78 BOOL bTracking; /* Is in tracking mode? */
79 POINT ptLButtonDown; /* The point where the left button was pressed */
80 DWORD dwStyle; /* the cached window GWL_STYLE */
81 INT iMoveItem; /* index of tracked item. (Tracking mode) */
82 INT xTrackOffset; /* distance between the right side of the tracked item and the cursor */
83 INT xOldTrack; /* track offset (see above) after the last WM_MOUSEMOVE */
84 INT iHotItem; /* index of hot item (cursor is over this item) */
85 INT iHotDivider; /* index of the hot divider (used while dragging an item or by HDM_SETHOTDIVIDER) */
86 INT iMargin; /* width of the margin that surrounds a bitmap */
87 INT filter_change_timeout; /* change timeout set with HDM_SETFILTERCHANGETIMEOUT */
88
89 HIMAGELIST himl; /* handle to an image list (may be 0) */
90 HEADER_ITEM *items; /* pointer to array of HEADER_ITEM's */
91 INT *order; /* array of item IDs indexed by order */
92 BOOL bRectsValid; /* validity flag for bounding rectangles */
94
95
96#define VERT_BORDER 4
97#define DIVIDER_WIDTH 10
98#define HOT_DIVIDER_WIDTH 2
99#define MAX_HEADER_TEXT_LEN 260
100#define HDN_UNICODE_OFFSET 20
101#define HDN_FIRST_UNICODE (HDN_FIRST-HDN_UNICODE_OFFSET)
102
103#define HDI_SUPPORTED_FIELDS (HDI_WIDTH|HDI_TEXT|HDI_FORMAT|HDI_LPARAM|HDI_BITMAP|HDI_IMAGE|HDI_ORDER)
104#define HDI_UNSUPPORTED_FIELDS (HDI_FILTER)
105#define HDI_UNKNOWN_FIELDS (~(HDI_SUPPORTED_FIELDS|HDI_UNSUPPORTED_FIELDS|HDI_DI_SETITEM))
106#define HDI_COMCTL32_4_0_FIELDS (HDI_WIDTH|HDI_TEXT|HDI_FORMAT|HDI_LPARAM|HDI_BITMAP)
107
108
109static BOOL HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask);
110static void HEADER_FreeCallbackItems(HEADER_ITEM *lpItem);
111static LRESULT HEADER_SendNotify(const HEADER_INFO *infoPtr, UINT code, NMHDR *hdr);
112static LRESULT HEADER_SendCtrlCustomDraw(const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect);
113
114static const WCHAR themeClass[] = {'H','e','a','d','e','r',0};
115
116static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDITEMW *phdi, BOOL fUnicode)
117{
119 FIXME("unsupported header fields %x\n", (mask & HDI_UNSUPPORTED_FIELDS));
120
121 if (mask & HDI_BITMAP)
122 lpItem->hbm = phdi->hbm;
123
124 if (mask & HDI_FORMAT)
125 lpItem->fmt = phdi->fmt;
126
127 if (mask & HDI_LPARAM)
128 lpItem->lParam = phdi->lParam;
129
130 if (mask & HDI_WIDTH)
131 lpItem->cxy = phdi->cxy;
132
133 if (mask & HDI_IMAGE)
134 {
135 lpItem->iImage = phdi->iImage;
136 if (phdi->iImage == I_IMAGECALLBACK)
137 lpItem->callbackMask |= HDI_IMAGE;
138 else
139 lpItem->callbackMask &= ~HDI_IMAGE;
140 }
141
142 if (mask & HDI_TEXT)
143 {
144 heap_free(lpItem->pszText);
145 lpItem->pszText = NULL;
146
147 if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
148 {
149 static const WCHAR emptyString[] = {0};
150
151 LPCWSTR pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString);
152 if (fUnicode)
153 Str_SetPtrW(&lpItem->pszText, pszText);
154 else
155 Str_SetPtrAtoW(&lpItem->pszText, (LPCSTR)pszText);
156 lpItem->callbackMask &= ~HDI_TEXT;
157 }
158 else
159 {
160 lpItem->pszText = NULL;
161 lpItem->callbackMask |= HDI_TEXT;
162 }
163 }
164}
165
166static inline LRESULT
167HEADER_IndexToOrder (const HEADER_INFO *infoPtr, INT iItem)
168{
169 HEADER_ITEM *lpItem = &infoPtr->items[iItem];
170 return lpItem->iOrder;
171}
172
173
174static INT
175HEADER_OrderToIndex(const HEADER_INFO *infoPtr, INT iorder)
176{
177 if ((iorder <0) || iorder >= infoPtr->uNumItem)
178 return iorder;
179 return infoPtr->order[iorder];
180}
181
182static void
183HEADER_ChangeItemOrder(const HEADER_INFO *infoPtr, INT iItem, INT iNewOrder)
184{
185 HEADER_ITEM *lpItem = &infoPtr->items[iItem];
186 INT i, nMin, nMax;
187
188 TRACE("%d: %d->%d\n", iItem, lpItem->iOrder, iNewOrder);
189 if (lpItem->iOrder < iNewOrder)
190 {
191 memmove(&infoPtr->order[lpItem->iOrder],
192 &infoPtr->order[lpItem->iOrder + 1],
193 (iNewOrder - lpItem->iOrder) * sizeof(INT));
194 }
195 if (iNewOrder < lpItem->iOrder)
196 {
197 memmove(&infoPtr->order[iNewOrder + 1],
198 &infoPtr->order[iNewOrder],
199 (lpItem->iOrder - iNewOrder) * sizeof(INT));
200 }
201 infoPtr->order[iNewOrder] = iItem;
202 nMin = min(lpItem->iOrder, iNewOrder);
203 nMax = max(lpItem->iOrder, iNewOrder);
204 for (i = nMin; i <= nMax; i++)
205 infoPtr->items[infoPtr->order[i]].iOrder = i;
206}
207
208/* Note: if iItem is the last item then this function returns infoPtr->uNumItem */
209static INT
210HEADER_NextItem(const HEADER_INFO *infoPtr, INT iItem)
211{
212 return HEADER_OrderToIndex(infoPtr, HEADER_IndexToOrder(infoPtr, iItem)+1);
213}
214
215static INT
216HEADER_PrevItem(const HEADER_INFO *infoPtr, INT iItem)
217{
218 return HEADER_OrderToIndex(infoPtr, HEADER_IndexToOrder(infoPtr, iItem)-1);
219}
220
221/* TRUE when item is not resizable with dividers,
222 note that valid index should be supplied */
223static inline BOOL
224HEADER_IsItemFixed(const HEADER_INFO *infoPtr, INT iItem)
225{
226 return (infoPtr->dwStyle & HDS_NOSIZING) || (infoPtr->items[iItem].fmt & HDF_FIXEDWIDTH);
227}
228
229static void
231{
232 HEADER_ITEM *phdi;
233 RECT rect;
234 unsigned int i;
235 int x;
236
237 infoPtr->bRectsValid = TRUE;
238
239 if (infoPtr->uNumItem == 0)
240 return;
241
242 GetClientRect (infoPtr->hwndSelf, &rect);
243
244 x = rect.left;
245 for (i = 0; i < infoPtr->uNumItem; i++) {
246 phdi = &infoPtr->items[HEADER_OrderToIndex(infoPtr,i)];
247 phdi->rect.top = rect.top;
248 phdi->rect.bottom = rect.bottom;
249 phdi->rect.left = x;
250 phdi->rect.right = phdi->rect.left + ((phdi->cxy>0)?phdi->cxy:0);
251 x = phdi->rect.right;
252 }
253}
254
255static LRESULT
257{
258 HEADER_SetItemBounds(infoPtr);
259 return 0;
260}
261
262static void HEADER_GetHotDividerRect(const HEADER_INFO *infoPtr, RECT *r)
263{
264 INT iDivider = infoPtr->iHotDivider;
265 if (infoPtr->uNumItem > 0)
266 {
267 HEADER_ITEM *lpItem;
268
269 if (iDivider < infoPtr->uNumItem)
270 {
271 lpItem = &infoPtr->items[iDivider];
272 r->left = lpItem->rect.left - HOT_DIVIDER_WIDTH/2;
273 r->right = lpItem->rect.left + HOT_DIVIDER_WIDTH/2;
274 }
275 else
276 {
277 lpItem = &infoPtr->items[HEADER_OrderToIndex(infoPtr, infoPtr->uNumItem-1)];
278 r->left = lpItem->rect.right - HOT_DIVIDER_WIDTH/2;
279 r->right = lpItem->rect.right + HOT_DIVIDER_WIDTH/2;
280 }
281 r->top = lpItem->rect.top;
282 r->bottom = lpItem->rect.bottom;
283 }
284 else
285 {
286 RECT clientRect;
287 GetClientRect(infoPtr->hwndSelf, &clientRect);
288 *r = clientRect;
289 r->right = r->left + HOT_DIVIDER_WIDTH/2;
290 }
291}
292
293static void
295{
296 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
297
298 if (theme) {
299 int state = (item->bDown) ? HIS_PRESSED : (hottrack ? HIS_HOT : HIS_NORMAL);
302 }
303 else
304 {
305 HBRUSH hbr = CreateSolidBrush(GetBkColor(hdc));
306 FillRect(hdc, r, hbr);
307 DeleteObject(hbr);
308 }
309}
310
311static void
313{
314 if (GetWindowTheme(infoPtr->hwndSelf)) return;
315
316 if (!(infoPtr->dwStyle & HDS_FLAT))
317 {
318 if (infoPtr->dwStyle & HDS_BUTTONS) {
319 if (item->bDown)
321 else
323 }
324 else
326 }
327}
328
329/* Create a region for the sort arrow with its bounding rect's top-left
330 co-ord x,y and its height h. */
331static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
332{
333 char buffer[256];
335 DWORD size = FIELD_OFFSET(RGNDATA, Buffer[h * sizeof(RECT)]);
336 INT i, yinc = 1;
337 HRGN rgn;
338
339 if (size > sizeof(buffer))
340 {
341 data = heap_alloc( size );
342 if (!data) return NULL;
343 }
344 data->rdh.dwSize = sizeof(data->rdh);
345 data->rdh.iType = RDH_RECTANGLES;
346 data->rdh.nCount = 0;
347 data->rdh.nRgnSize = h * sizeof(RECT);
348
349 if (!is_up)
350 {
351 y += h - 1;
352 yinc = -1;
353 }
354
355 x += h - 1; /* set x to the centre */
356
357 for (i = 0; i < h; i++, y += yinc)
358 {
359 RECT *rect = (RECT *)data->Buffer + data->rdh.nCount;
360 rect->left = x - i;
361 rect->top = y;
362 rect->right = x + i + 1;
363 rect->bottom = y + 1;
364 data->rdh.nCount++;
365 }
366 rgn = ExtCreateRegion( NULL, size, data );
367 if (data != (RGNDATA *)buffer) heap_free( data );
368 return rgn;
369}
370
371static INT
372HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags)
373{
374 HEADER_ITEM *phdi = &infoPtr->items[iItem];
375 RECT r;
376 INT oldBkMode;
377 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
378 NMCUSTOMDRAW nmcd;
379 int state = 0;
380
381 TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, (infoPtr->nNotifyFormat == NFR_UNICODE));
382
383 r = phdi->rect;
384 if (r.right - r.left == 0)
385 return phdi->rect.right;
386
387 if (theme)
388 state = (phdi->bDown) ? HIS_PRESSED : (bHotTrack ? HIS_HOT : HIS_NORMAL);
389
390 /* Set the colors before sending NM_CUSTOMDRAW so that it can change them */
393
394 if (lCDFlags & CDRF_NOTIFYITEMDRAW && !(phdi->fmt & HDF_OWNERDRAW))
395 {
396 LRESULT lCDItemFlags;
397
399 nmcd.hdc = hdc;
400 nmcd.dwItemSpec = iItem;
401 nmcd.rc = r;
402 nmcd.uItemState = phdi->bDown ? CDIS_SELECTED : 0;
403 nmcd.lItemlParam = phdi->lParam;
404
405 lCDItemFlags = HEADER_SendNotify(infoPtr, NM_CUSTOMDRAW, (NMHDR *)&nmcd);
406 if (lCDItemFlags & CDRF_SKIPDEFAULT)
407 return phdi->rect.right;
408 }
409
410 /* Fill background, owner could draw over it. */
411 HEADER_FillItemFrame(infoPtr, hdc, &r, phdi, bHotTrack);
412
413 if (phdi->fmt & HDF_OWNERDRAW)
414 {
415 DRAWITEMSTRUCT dis;
416 BOOL ret;
417
418 dis.CtlType = ODT_HEADER;
419 dis.CtlID = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
420 dis.itemID = iItem;
422 dis.itemState = phdi->bDown ? ODS_SELECTED : 0;
423 dis.hwndItem = infoPtr->hwndSelf;
424 dis.hDC = hdc;
425 dis.rcItem = phdi->rect;
426 dis.itemData = phdi->lParam;
427 oldBkMode = SetBkMode(hdc, TRANSPARENT);
428 ret = SendMessageW (infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
429 if (oldBkMode != TRANSPARENT)
430 SetBkMode(hdc, oldBkMode);
431
432 if (!ret)
433 HEADER_FillItemFrame(infoPtr, hdc, &r, phdi, bHotTrack);
434
435 /* Edges are always drawn if we don't have attached theme. */
436 HEADER_DrawItemFrame(infoPtr, hdc, &r, phdi);
437 /* If application processed WM_DRAWITEM we should skip label painting,
438 edges are drawn no matter what. */
439 if (ret) return phdi->rect.right;
440 }
441 else
442 HEADER_DrawItemFrame(infoPtr, hdc, &r, phdi);
443
444 if (phdi->bDown) {
445 r.left += 2;
446 r.top += 2;
447 }
448
449 /* Now text and image */
450 {
451 INT rw, rh; /* width and height of r */
452 INT *x = NULL; /* x and ... */
453 UINT *w = NULL; /* ... width of the pic (bmp or img) which is part of cnt */
454 /* cnt,txt,img,bmp */
455 INT cx, tx, ix, bx;
456 UINT cw, tw, iw, bw;
457 INT img_cx, img_cy;
458 INT sort_w, sort_x, sort_h;
459 BITMAP bmp;
460
462 cw = iw = bw = sort_w = sort_h = 0;
463 rw = r.right - r.left;
464 rh = r.bottom - r.top;
465
466 if (phdi->fmt & HDF_STRING) {
468
470
471 if (theme) {
474 } else {
475 DrawTextW (hdc, phdi->pszText, -1,
477 }
478 cw = textRect.right - textRect.left + 2 * infoPtr->iMargin;
479 }
480
481 if (phdi->fmt & (HDF_SORTUP | HDF_SORTDOWN)) {
482 sort_h = MulDiv( infoPtr->nHeight - VERT_BORDER, 4, 13 );
483 sort_w = 2 * sort_h - 1 + infoPtr->iMargin * 2;
484 cw += sort_w;
485 } else { /* sort arrows take precedent over images/bitmaps */
486 if ((phdi->fmt & HDF_IMAGE) && ImageList_GetIconSize( infoPtr->himl, &img_cx, &img_cy )) {
487 iw = img_cx + 2 * infoPtr->iMargin;
488 x = &ix;
489 w = &iw;
490 }
491
492 if ((phdi->fmt & HDF_BITMAP) && (phdi->hbm)) {
493 GetObjectW (phdi->hbm, sizeof(BITMAP), &bmp);
494 bw = bmp.bmWidth + 2 * infoPtr->iMargin;
495 if (!iw) {
496 x = &bx;
497 w = &bw;
498 }
499 }
500 if (bw || iw)
501 cw += *w;
502 }
503
504 /* align cx using the unclipped cw */
505 if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_LEFT)
506 cx = r.left;
507 else if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER)
508 cx = r.left + rw / 2 - cw / 2;
509 else /* HDF_RIGHT */
510 cx = r.right - cw;
511
512 /* clip cx & cw */
513 if (cx < r.left)
514 cx = r.left;
515 if (cx + cw > r.right)
516 cw = r.right - cx;
517
518 tx = cx + infoPtr->iMargin;
519 /* since cw might have changed we have to recalculate tw */
520 tw = cw - infoPtr->iMargin * 2;
521
522 tw -= sort_w;
523 sort_x = cx + tw + infoPtr->iMargin * 3;
524
525 if (iw || bw) {
526 tw -= *w;
527 if (phdi->fmt & HDF_BITMAP_ON_RIGHT) {
528 /* put pic behind text */
529 *x = cx + tw + infoPtr->iMargin * 3;
530 } else {
531 *x = cx + infoPtr->iMargin;
532 /* move text behind pic */
533 tx += *w;
534 }
535 }
536
537 if (iw && bw) {
538 /* since we're done with the layout we can
539 now calculate the position of bmp which
540 has no influence on alignment and layout
541 because of img */
542 if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_RIGHT)
543 bx = cx - bw + infoPtr->iMargin;
544 else
545 bx = cx + cw + infoPtr->iMargin;
546 }
547
548 if (sort_w || iw || bw) {
549 HDC hClipDC = GetDC(infoPtr->hwndSelf);
550 HRGN hClipRgn = CreateRectRgn(r.left, r.top, r.right, r.bottom);
551 SelectClipRgn(hClipDC, hClipRgn);
552
553 if (sort_w) {
554 HRGN arrow = create_sort_arrow( sort_x, r.top + (rh - sort_h) / 2,
555 sort_h, phdi->fmt & HDF_SORTUP );
556 if (arrow) {
557 FillRgn( hClipDC, arrow, GetSysColorBrush( COLOR_GRAYTEXT ) );
558 DeleteObject( arrow );
559 }
560 }
561
562 if (bw) {
563 HDC hdcBitmap = CreateCompatibleDC (hClipDC);
564 SelectObject (hdcBitmap, phdi->hbm);
565 BitBlt (hClipDC, bx, r.top + (rh - bmp.bmHeight) / 2,
566 bmp.bmWidth, bmp.bmHeight, hdcBitmap, 0, 0, SRCCOPY);
568 }
569
570 if (iw) {
571 ImageList_DrawEx (infoPtr->himl, phdi->iImage, hClipDC,
572 ix, r.top + (rh - img_cy) / 2,
573 img_cx, img_cy, CLR_DEFAULT, CLR_DEFAULT, 0);
574 }
575
576 DeleteObject(hClipRgn);
577 ReleaseDC(infoPtr->hwndSelf, hClipDC);
578 }
579
580 if (((phdi->fmt & HDF_STRING)
581 || (!(phdi->fmt & (HDF_OWNERDRAW|HDF_STRING|HDF_BITMAP|
582 HDF_BITMAP_ON_RIGHT|HDF_IMAGE)))) /* no explicit format specified? */
583 && (phdi->pszText)) {
584 oldBkMode = SetBkMode(hdc, TRANSPARENT);
585 r.left = tx;
586 r.right = tx + tw;
587 if (theme) {
590 0, &r);
591 } else {
592 DrawTextW (hdc, phdi->pszText, -1,
594 }
595 if (oldBkMode != TRANSPARENT)
596 SetBkMode(hdc, oldBkMode);
597 }
599 }
600
601 return phdi->rect.right;
602}
603
604static void
606{
607 HBRUSH brush;
608 RECT r;
609
610 HEADER_GetHotDividerRect(infoPtr, &r);
612 FillRect(hdc, &r, brush);
613 DeleteObject(brush);
614}
615
616static void
618{
619 HFONT hFont, hOldFont;
620 RECT rect, rcRest;
621 HBRUSH hbrBk;
622 UINT i;
623 INT x;
624 LRESULT lCDFlags;
625 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
626
627 if (!infoPtr->bRectsValid)
628 HEADER_SetItemBounds(infoPtr);
629
630 /* get rect for the bar, adjusted for the border */
631 GetClientRect (infoPtr->hwndSelf, &rect);
632 lCDFlags = HEADER_SendCtrlCustomDraw(infoPtr, CDDS_PREPAINT, hdc, &rect);
633
634 if (infoPtr->bDragging)
636
637 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT);
638 hOldFont = SelectObject (hdc, hFont);
639
640 /* draw Background */
641 if (infoPtr->uNumItem == 0 && theme == NULL) {
643 FillRect(hdc, &rect, hbrBk);
644 }
645
646 x = rect.left;
647 for (i = 0; x <= rect.right && i < infoPtr->uNumItem; i++) {
648 int idx = HEADER_OrderToIndex(infoPtr,i);
649 if (RectVisible(hdc, &infoPtr->items[idx].rect))
650 HEADER_DrawItem(infoPtr, hdc, idx, infoPtr->iHotItem == idx, lCDFlags);
651 x = infoPtr->items[idx].rect.right;
652 }
653
654 rcRest = rect;
655 rcRest.left = x;
656 if ((x <= rect.right) && RectVisible(hdc, &rcRest) && (infoPtr->uNumItem > 0)) {
657 if (theme != NULL) {
659 }
660 else if (infoPtr->dwStyle & HDS_FLAT) {
662 FillRect(hdc, &rcRest, hbrBk);
663 }
664 else
665 {
666 if (infoPtr->dwStyle & HDS_BUTTONS)
668 else
670 }
671 }
672
673 if (infoPtr->iHotDivider != -1)
674 HEADER_DrawHotDivider(infoPtr, hdc);
675
676 if (infoPtr->bDragging)
678 SelectObject (hdc, hOldFont);
679
680 if (lCDFlags & CDRF_NOTIFYPOSTPAINT)
682}
683
684
685static void
687{
688 if (!infoPtr->bRectsValid)
689 HEADER_SetItemBounds(infoPtr);
690
691 InvalidateRect(infoPtr->hwndSelf, &infoPtr->items[iItem].rect, FALSE);
692}
693
694
695static void
696HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pItem)
697{
698 RECT rect, rcTest;
699 UINT iCount;
700 INT width;
701 BOOL bNoWidth;
702
703 GetClientRect (infoPtr->hwndSelf, &rect);
704
705 *pFlags = 0;
706 bNoWidth = FALSE;
707 if (PtInRect (&rect, *lpPt))
708 {
709 if (infoPtr->uNumItem == 0) {
710 *pFlags |= HHT_NOWHERE;
711 *pItem = 1;
712 TRACE("NOWHERE\n");
713 return;
714 }
715 else {
716 /* somewhere inside */
717 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) {
718 rect = infoPtr->items[iCount].rect;
719 width = rect.right - rect.left;
720 if (width == 0) {
721 bNoWidth = TRUE;
722 continue;
723 }
724 if (PtInRect (&rect, *lpPt)) {
725 if (width <= 2 * DIVIDER_WIDTH) {
726 *pFlags |= HHT_ONHEADER;
727 *pItem = iCount;
728 TRACE("ON HEADER %d\n", iCount);
729 return;
730 }
731 if (HEADER_IndexToOrder(infoPtr, iCount) > 0) {
732 rcTest = rect;
733 rcTest.right = rcTest.left + DIVIDER_WIDTH;
734 if (PtInRect (&rcTest, *lpPt)) {
735 if (HEADER_IsItemFixed(infoPtr, HEADER_PrevItem(infoPtr, iCount)))
736 {
737 *pFlags |= HHT_ONHEADER;
738 *pItem = iCount;
739 TRACE("ON HEADER %d\n", *pItem);
740 return;
741 }
742 if (bNoWidth) {
743 *pFlags |= HHT_ONDIVOPEN;
744 *pItem = HEADER_PrevItem(infoPtr, iCount);
745 TRACE("ON DIVOPEN %d\n", *pItem);
746 return;
747 }
748 else {
749 *pFlags |= HHT_ONDIVIDER;
750 *pItem = HEADER_PrevItem(infoPtr, iCount);
751 TRACE("ON DIVIDER %d\n", *pItem);
752 return;
753 }
754 }
755 }
756 rcTest = rect;
757 rcTest.left = rcTest.right - DIVIDER_WIDTH;
758 if (!HEADER_IsItemFixed(infoPtr, iCount) && PtInRect (&rcTest, *lpPt))
759 {
760 *pFlags |= HHT_ONDIVIDER;
761 *pItem = iCount;
762 TRACE("ON DIVIDER %d\n", *pItem);
763 return;
764 }
765
766 *pFlags |= HHT_ONHEADER;
767 *pItem = iCount;
768 TRACE("ON HEADER %d\n", iCount);
769 return;
770 }
771 }
772
773 /* check for last divider part (on nowhere) */
774 if (!HEADER_IsItemFixed(infoPtr, infoPtr->uNumItem - 1))
775 {
776 rect = infoPtr->items[infoPtr->uNumItem-1].rect;
777 rect.left = rect.right;
778 rect.right += DIVIDER_WIDTH;
779 if (PtInRect (&rect, *lpPt)) {
780 if (bNoWidth) {
781 *pFlags |= HHT_ONDIVOPEN;
782 *pItem = infoPtr->uNumItem - 1;
783 TRACE("ON DIVOPEN %d\n", *pItem);
784 return;
785 }
786 else {
787 *pFlags |= HHT_ONDIVIDER;
788 *pItem = infoPtr->uNumItem - 1;
789 TRACE("ON DIVIDER %d\n", *pItem);
790 return;
791 }
792 }
793 }
794
795 *pFlags |= HHT_NOWHERE;
796 *pItem = 1;
797 TRACE("NOWHERE\n");
798 return;
799 }
800 }
801 else {
802 if (lpPt->x < rect.left) {
803 TRACE("TO LEFT\n");
804 *pFlags |= HHT_TOLEFT;
805 }
806 else if (lpPt->x > rect.right) {
807 TRACE("TO RIGHT\n");
808 *pFlags |= HHT_TORIGHT;
809 }
810
811 if (lpPt->y < rect.top) {
812 TRACE("ABOVE\n");
813 *pFlags |= HHT_ABOVE;
814 }
815 else if (lpPt->y > rect.bottom) {
816 TRACE("BELOW\n");
817 *pFlags |= HHT_BELOW;
818 }
819 }
820
821 *pItem = 1;
822 TRACE("flags=0x%X\n", *pFlags);
823 return;
824}
825
826
827static void
829{
830 RECT rect;
831
832 GetClientRect (infoPtr->hwndSelf, &rect);
833 PatBlt( hdc, x, rect.top, 1, rect.bottom - rect.top, DSTINVERT );
834}
835
836/***
837 * DESCRIPTION:
838 * Convert a HDITEM into the correct format (ANSI/Unicode) to send it in a notify
839 *
840 * PARAMETER(S):
841 * [I] infoPtr : the header that wants to send the notify
842 * [O] dest : The buffer to store the HDITEM for notify. It may be set to a HDITEMA of HDITEMW
843 * [I] src : The source HDITEM. It may be a HDITEMA or HDITEMW
844 * [I] fSourceUnicode : is src a HDITEMW or HDITEMA
845 * [O] ppvScratch : a pointer to a scratch buffer that needs to be freed after
846 * the HDITEM is no longer in use or NULL if none was needed
847 *
848 * NOTE: We depend on HDITEMA and HDITEMW having the same structure
849 */
851 const HDITEMW *src, BOOL fSourceUnicode, LPVOID *ppvScratch)
852{
853 *ppvScratch = NULL;
854 *dest = *src;
855
856 if (src->mask & HDI_TEXT && src->pszText != LPSTR_TEXTCALLBACKW) /* covers TEXTCALLBACKA as well */
857 {
858 if (fSourceUnicode && infoPtr->nNotifyFormat != NFR_UNICODE)
859 {
860 dest->pszText = NULL;
861 Str_SetPtrWtoA((LPSTR *)&dest->pszText, src->pszText);
862 *ppvScratch = dest->pszText;
863 }
864
865 if (!fSourceUnicode && infoPtr->nNotifyFormat == NFR_UNICODE)
866 {
867 dest->pszText = NULL;
868 Str_SetPtrAtoW(&dest->pszText, (LPSTR)src->pszText);
869 *ppvScratch = dest->pszText;
870 }
871 }
872}
873
875{
876 /* we use the fact that all the unicode messages are in HDN_FIRST_UNICODE..HDN_LAST*/
877 if (code >= HDN_LAST && code <= HDN_FIRST_UNICODE)
878 return code + HDN_UNICODE_OFFSET;
879 else
880 return code;
881}
882
883static LRESULT
885{
886 nmhdr->hwndFrom = infoPtr->hwndSelf;
887 nmhdr->idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
888 nmhdr->code = code;
889
890 return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
891 nmhdr->idFrom, (LPARAM)nmhdr);
892}
893
894static BOOL
896{
897 NMHDR nmhdr;
898 return (BOOL)HEADER_SendNotify(infoPtr, code, &nmhdr);
899}
900
901static LRESULT
902HEADER_SendCtrlCustomDraw(const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect)
903{
904 NMCUSTOMDRAW nm;
905 nm.dwDrawStage = dwDrawStage;
906 nm.hdc = hdc;
907 nm.rc = *rect;
908 nm.dwItemSpec = 0;
909 nm.uItemState = 0;
910 nm.lItemlParam = 0;
911
912 return HEADER_SendNotify(infoPtr, NM_CUSTOMDRAW, (NMHDR *)&nm);
913}
914
915static BOOL
917{
918 NMHEADERW nmhdr;
919
920 if (infoPtr->nNotifyFormat != NFR_UNICODE)
922 nmhdr.iItem = iItem;
923 nmhdr.iButton = 0;
924 nmhdr.pitem = lpItem;
925
926 return (BOOL)HEADER_SendNotify(infoPtr, code, (NMHDR *)&nmhdr);
927}
928
929static BOOL
931{
932 HDITEMW nmitem;
933
934 /* copying only the iValue should be ok but to make the code more robust we copy everything */
935 nmitem.cxy = infoPtr->items[iItem].cxy;
936 nmitem.hbm = infoPtr->items[iItem].hbm;
937 nmitem.pszText = NULL;
938 nmitem.cchTextMax = 0;
939 nmitem.fmt = infoPtr->items[iItem].fmt;
940 nmitem.lParam = infoPtr->items[iItem].lParam;
941 nmitem.iOrder = infoPtr->items[iItem].iOrder;
942 nmitem.iImage = infoPtr->items[iItem].iImage;
943
944 nmitem.mask = mask;
945 switch (mask)
946 {
947 case HDI_WIDTH:
948 nmitem.cxy = iValue;
949 break;
950 case HDI_ORDER:
951 nmitem.iOrder = iValue;
952 break;
953 default:
954 ERR("invalid mask value 0x%x\n", iValue);
955 }
956
957 return HEADER_SendNotifyWithHDItemT(infoPtr, code, iItem, &nmitem);
958}
959
975static BOOL
976HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
977{
978 HEADER_ITEM *lpItem = &infoPtr->items[iItem];
979 DWORD mask = reqMask & lpItem->callbackMask;
980 NMHDDISPINFOW dispInfo;
981 void *pvBuffer = NULL;
982
983 if (mask == 0)
984 return TRUE;
985 if (mask&HDI_TEXT && lpItem->pszText != NULL)
986 {
987 ERR("(): function called without a call to FreeCallbackItems\n");
988 heap_free(lpItem->pszText);
989 lpItem->pszText = NULL;
990 }
991
992 memset(&dispInfo, 0, sizeof(NMHDDISPINFOW));
993 dispInfo.hdr.hwndFrom = infoPtr->hwndSelf;
994 dispInfo.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
995 if (infoPtr->nNotifyFormat == NFR_UNICODE)
996 {
997 dispInfo.hdr.code = HDN_GETDISPINFOW;
998 if (mask & HDI_TEXT)
999 pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(WCHAR));
1000 }
1001 else
1002 {
1003 dispInfo.hdr.code = HDN_GETDISPINFOA;
1004 if (mask & HDI_TEXT)
1005 pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(CHAR));
1006 }
1007 dispInfo.pszText = pvBuffer;
1008 dispInfo.cchTextMax = (pvBuffer!=NULL?MAX_HEADER_TEXT_LEN:0);
1009 dispInfo.iItem = iItem;
1010 dispInfo.mask = mask;
1011 dispInfo.lParam = lpItem->lParam;
1012
1013 TRACE("Sending HDN_GETDISPINFO%c\n", infoPtr->nNotifyFormat == NFR_UNICODE?'W':'A');
1014 SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, dispInfo.hdr.idFrom, (LPARAM)&dispInfo);
1015
1016 TRACE("SendMessage returns(mask:0x%x,str:%s,lParam:%p)\n",
1017 dispInfo.mask,
1018 (infoPtr->nNotifyFormat == NFR_UNICODE ? debugstr_w(dispInfo.pszText) : (LPSTR) dispInfo.pszText),
1019 (void*) dispInfo.lParam);
1020
1021 if (mask & HDI_IMAGE)
1022 lpItem->iImage = dispInfo.iImage;
1023 if (mask & HDI_TEXT)
1024 {
1025 if (infoPtr->nNotifyFormat == NFR_UNICODE)
1026 {
1027 lpItem->pszText = pvBuffer;
1028
1029 /* the user might have used his own buffer */
1030 if (dispInfo.pszText != lpItem->pszText)
1031 Str_GetPtrW(dispInfo.pszText, lpItem->pszText, MAX_HEADER_TEXT_LEN);
1032 }
1033 else
1034 {
1035 Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)dispInfo.pszText);
1036 heap_free(pvBuffer);
1037 }
1038 }
1039
1040 if (dispInfo.mask & HDI_DI_SETITEM)
1041 {
1042 /* make the items permanent */
1043 lpItem->callbackMask &= ~dispInfo.mask;
1044 }
1045
1046 return TRUE;
1047}
1048
1049/***
1050 * DESCRIPTION:
1051 * Free the items that might be allocated with HEADER_PrepareCallbackItems
1052 *
1053 * PARAMETER(S):
1054 * [I] lpItem : the item to free the data
1055 *
1056 */
1057static void
1059{
1060 if (lpItem->callbackMask&HDI_TEXT)
1061 {
1062 heap_free(lpItem->pszText);
1063 lpItem->pszText = NULL;
1064 }
1065
1066 if (lpItem->callbackMask&HDI_IMAGE)
1067 lpItem->iImage = I_IMAGECALLBACK;
1068}
1069
1070static HIMAGELIST
1072{
1073 HEADER_ITEM *lpItem;
1075 HBITMAP hMemory, hOldBitmap;
1076 LRESULT lCDFlags;
1077 RECT rc;
1078 HDC hMemoryDC;
1079 HDC hDeviceDC;
1080 int height, width;
1081 HFONT hFont;
1082
1083 if (iItem >= infoPtr->uNumItem)
1084 return NULL;
1085
1086 if (!infoPtr->bRectsValid)
1087 HEADER_SetItemBounds(infoPtr);
1088
1089 lpItem = &infoPtr->items[iItem];
1090 width = lpItem->rect.right - lpItem->rect.left;
1091 height = lpItem->rect.bottom - lpItem->rect.top;
1092
1093 hDeviceDC = GetDC(NULL);
1094 hMemoryDC = CreateCompatibleDC(hDeviceDC);
1096 ReleaseDC(NULL, hDeviceDC);
1097 hOldBitmap = SelectObject(hMemoryDC, hMemory);
1098 SetViewportOrgEx(hMemoryDC, -lpItem->rect.left, -lpItem->rect.top, NULL);
1099 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject(SYSTEM_FONT);
1100 SelectObject(hMemoryDC, hFont);
1101
1102 GetClientRect(infoPtr->hwndSelf, &rc);
1103 lCDFlags = HEADER_SendCtrlCustomDraw(infoPtr, CDDS_PREPAINT, hMemoryDC, &rc);
1104 HEADER_DrawItem(infoPtr, hMemoryDC, iItem, FALSE, lCDFlags);
1105 if (lCDFlags & CDRF_NOTIFYPOSTPAINT)
1106 HEADER_SendCtrlCustomDraw(infoPtr, CDDS_POSTPAINT, hMemoryDC, &rc);
1107
1108 hMemory = SelectObject(hMemoryDC, hOldBitmap);
1109 DeleteDC(hMemoryDC);
1110
1111 if (hMemory == NULL) /* if anything failed */
1112 return NULL;
1113
1117 return himl;
1118}
1119
1120static LRESULT
1122{
1123 INT iDivider;
1124 RECT r;
1125
1126 if (wParam)
1127 {
1128 POINT pt;
1129 UINT flags;
1130 pt.x = (INT)(SHORT)LOWORD(lParam);
1131 pt.y = 0;
1132 HEADER_InternalHitTest (infoPtr, &pt, &flags, &iDivider);
1133
1134 if (flags & HHT_TOLEFT)
1135 iDivider = 0;
1136 else if (flags & HHT_NOWHERE || flags & HHT_TORIGHT)
1137 iDivider = infoPtr->uNumItem;
1138 else
1139 {
1140 HEADER_ITEM *lpItem = &infoPtr->items[iDivider];
1141 if (pt.x > (lpItem->rect.left+lpItem->rect.right)/2)
1142 iDivider = HEADER_NextItem(infoPtr, iDivider);
1143 }
1144 }
1145 else
1146 iDivider = (INT)lParam;
1147
1148 /* Note; wParam==FALSE, lParam==-1 is valid and is used to clear the hot divider */
1149 if (iDivider<-1 || iDivider>(int)infoPtr->uNumItem)
1150 return iDivider;
1151
1152 if (iDivider != infoPtr->iHotDivider)
1153 {
1154 if (infoPtr->iHotDivider != -1)
1155 {
1156 HEADER_GetHotDividerRect(infoPtr, &r);
1157 InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
1158 }
1159 infoPtr->iHotDivider = iDivider;
1160 if (iDivider != -1)
1161 {
1162 HEADER_GetHotDividerRect(infoPtr, &r);
1163 InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
1164 }
1165 }
1166 return iDivider;
1167}
1168
1169static LRESULT
1171{
1172 INT iOrder;
1173 UINT i;
1174
1175 TRACE("[iItem=%d]\n", iItem);
1176
1177 if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem))
1178 return FALSE;
1179
1180 for (i = 0; i < infoPtr->uNumItem; i++)
1181 TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
1182
1183 iOrder = infoPtr->items[iItem].iOrder;
1184 heap_free(infoPtr->items[iItem].pszText);
1185
1186 infoPtr->uNumItem--;
1187 memmove(&infoPtr->items[iItem], &infoPtr->items[iItem + 1],
1188 (infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM));
1189 memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1],
1190 (infoPtr->uNumItem - iOrder) * sizeof(INT));
1191 infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
1192 infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
1193
1194 /* Correct the orders */
1195 for (i = 0; i < infoPtr->uNumItem; i++)
1196 {
1197 if (infoPtr->order[i] > iItem)
1198 infoPtr->order[i]--;
1199 if (i >= iOrder)
1200 infoPtr->items[infoPtr->order[i]].iOrder = i;
1201 }
1202 for (i = 0; i < infoPtr->uNumItem; i++)
1203 TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
1204
1205 HEADER_SetItemBounds (infoPtr);
1206 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1207
1208 return TRUE;
1209}
1210
1211
1212static LRESULT
1214{
1215 return (LRESULT)infoPtr->himl;
1216}
1217
1218
1219static LRESULT
1220HEADER_GetItemT (const HEADER_INFO *infoPtr, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
1221{
1222 HEADER_ITEM *lpItem;
1223 UINT mask;
1224
1225 if (!phdi)
1226 return FALSE;
1227
1228 TRACE("[nItem=%d]\n", nItem);
1229
1230 mask = phdi->mask;
1231 if (mask == 0)
1232 return TRUE;
1233
1234 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem))
1235 return FALSE;
1236
1238 {
1239 TRACE("mask %x contains unknown fields. Using only comctl32 4.0 fields\n", mask);
1241 }
1242
1243 lpItem = &infoPtr->items[nItem];
1244 HEADER_PrepareCallbackItems(infoPtr, nItem, mask);
1245
1246 if (mask & HDI_BITMAP)
1247 phdi->hbm = lpItem->hbm;
1248
1249 if (mask & HDI_FORMAT)
1250 phdi->fmt = lpItem->fmt;
1251
1252 if (mask & HDI_WIDTH)
1253 phdi->cxy = lpItem->cxy;
1254
1255 if (mask & HDI_LPARAM)
1256 phdi->lParam = lpItem->lParam;
1257
1258 if (mask & HDI_IMAGE)
1259 phdi->iImage = lpItem->iImage;
1260
1261 if (mask & HDI_ORDER)
1262 phdi->iOrder = lpItem->iOrder;
1263
1264 if (mask & HDI_TEXT)
1265 {
1266 if (bUnicode)
1267 Str_GetPtrW (lpItem->pszText, phdi->pszText, phdi->cchTextMax);
1268 else
1269 Str_GetPtrWtoA (lpItem->pszText, (LPSTR)phdi->pszText, phdi->cchTextMax);
1270 }
1271
1273 return TRUE;
1274}
1275
1276
1277static inline LRESULT
1279{
1280 return infoPtr->uNumItem;
1281}
1282
1283
1284static LRESULT
1285HEADER_GetItemRect (const HEADER_INFO *infoPtr, INT iItem, LPRECT lpRect)
1286{
1287 if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem))
1288 return FALSE;
1289
1290 lpRect->left = infoPtr->items[iItem].rect.left;
1291 lpRect->right = infoPtr->items[iItem].rect.right;
1292 lpRect->top = infoPtr->items[iItem].rect.top;
1293 lpRect->bottom = infoPtr->items[iItem].rect.bottom;
1294
1295 return TRUE;
1296}
1297
1298
1299static LRESULT
1301{
1302 if ((UINT)size <infoPtr->uNumItem)
1303 return FALSE;
1304
1305 memcpy(order, infoPtr->order, infoPtr->uNumItem * sizeof(INT));
1306 return TRUE;
1307}
1308
1309/* Returns index of first duplicate 'value' from [0,to) range,
1310 or -1 if there isn't any */
1312{
1313 INT i;
1314 for(i = 0; i < to; i++)
1315 if (array[i] == value) return i;
1316 return -1;
1317}
1318
1319/* returns next available value from [0,max] not to duplicate in [0,to) */
1320static INT get_nextvalue(const INT *array, INT to, INT max)
1321{
1322 INT i;
1323 for(i = 0; i < max; i++)
1324 if (has_duplicate(array, to, i) == -1) return i;
1325 return 0;
1326}
1327
1328static LRESULT
1330{
1331 HEADER_ITEM *lpItem;
1332 INT i;
1333
1334 if ((UINT)size != infoPtr->uNumItem)
1335 return FALSE;
1336
1337 if (TRACE_ON(header))
1338 {
1339 TRACE("count=%d, order array={", size);
1340 for (i = 0; i < size; i++)
1341 TRACE("%d%c", order[i], i != size-1 ? ',' : '}');
1342 TRACE("\n");
1343 }
1344
1345 for (i=0; i<size; i++)
1346 {
1347 if (order[i] >= size || order[i] < 0)
1348 /* on invalid index get next available */
1349 /* FIXME: if i==0 array item is out of range behaviour is
1350 different, see tests */
1351 infoPtr->order[i] = get_nextvalue(infoPtr->order, i, size);
1352 else
1353 {
1354 INT j, dup;
1355
1356 infoPtr->order[i] = order[i];
1357 j = i;
1358 /* remove duplicates */
1359 while ((dup = has_duplicate(infoPtr->order, j, order[j])) != -1)
1360 {
1361 INT next;
1362
1363 next = get_nextvalue(infoPtr->order, j, size);
1364 infoPtr->order[dup] = next;
1365 j--;
1366 }
1367 }
1368 }
1369 /* sync with item data */
1370 for (i=0; i<size; i++)
1371 {
1372 lpItem = &infoPtr->items[infoPtr->order[i]];
1373 lpItem->iOrder = i;
1374 }
1375 HEADER_SetItemBounds(infoPtr);
1376 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1377 return TRUE;
1378}
1379
1380static inline LRESULT
1382{
1383 return (infoPtr->nNotifyFormat == NFR_UNICODE);
1384}
1385
1386
1387static LRESULT
1389{
1391
1392 HEADER_InternalHitTest (infoPtr, &phti->pt, &phti->flags, &phti->iItem);
1393
1394 if (phti->flags & outside)
1395 return phti->iItem = -1;
1396 else
1397 return phti->iItem;
1398}
1399
1400
1401static LRESULT
1402HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
1403{
1404 HEADER_ITEM *lpItem;
1405 INT iOrder;
1406 UINT i;
1407 UINT copyMask;
1408
1409 if ((phdi == NULL) || (nItem < 0) || (phdi->mask == 0))
1410 return -1;
1411
1412 if (nItem > infoPtr->uNumItem)
1413 nItem = infoPtr->uNumItem;
1414
1415 iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder : nItem;
1416 if (iOrder < 0)
1417 iOrder = 0;
1418 else if (infoPtr->uNumItem < iOrder)
1419 iOrder = infoPtr->uNumItem;
1420
1421 infoPtr->uNumItem++;
1422 infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
1423 infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
1424
1425 /* make space for the new item */
1426 memmove(&infoPtr->items[nItem + 1], &infoPtr->items[nItem],
1427 (infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM));
1428 memmove(&infoPtr->order[iOrder + 1], &infoPtr->order[iOrder],
1429 (infoPtr->uNumItem - iOrder - 1) * sizeof(INT));
1430
1431 /* update the order array */
1432 infoPtr->order[iOrder] = nItem;
1433 for (i = 0; i < infoPtr->uNumItem; i++)
1434 {
1435 if (i != iOrder && infoPtr->order[i] >= nItem)
1436 infoPtr->order[i]++;
1437 infoPtr->items[infoPtr->order[i]].iOrder = i;
1438 }
1439
1440 lpItem = &infoPtr->items[nItem];
1441 ZeroMemory(lpItem, sizeof(HEADER_ITEM));
1442 /* cxy, fmt and lParam are copied even if not in the HDITEM mask */
1443 copyMask = phdi->mask | HDI_WIDTH | HDI_FORMAT | HDI_LPARAM;
1444 HEADER_StoreHDItemInHeader(lpItem, copyMask, phdi, bUnicode);
1445 lpItem->iOrder = iOrder;
1446
1447 /* set automatically some format bits */
1448 if (phdi->mask & HDI_TEXT)
1449 lpItem->fmt |= HDF_STRING;
1450 else
1451 lpItem->fmt &= ~HDF_STRING;
1452
1453 if (lpItem->hbm != NULL)
1454 lpItem->fmt |= HDF_BITMAP;
1455 else
1456 lpItem->fmt &= ~HDF_BITMAP;
1457
1458 if (phdi->mask & HDI_IMAGE)
1459 lpItem->fmt |= HDF_IMAGE;
1460
1461 HEADER_SetItemBounds (infoPtr);
1462 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1463
1464 return nItem;
1465}
1466
1467
1468static LRESULT
1470{
1471 lpLayout->pwpos->hwnd = infoPtr->hwndSelf;
1472 lpLayout->pwpos->hwndInsertAfter = 0;
1473 lpLayout->pwpos->x = lpLayout->prc->left;
1474 lpLayout->pwpos->y = lpLayout->prc->top;
1475 lpLayout->pwpos->cx = lpLayout->prc->right - lpLayout->prc->left;
1476 if (infoPtr->dwStyle & HDS_HIDDEN)
1477 lpLayout->pwpos->cy = 0;
1478 else {
1479 lpLayout->pwpos->cy = infoPtr->nHeight;
1480 lpLayout->prc->top += infoPtr->nHeight;
1481 }
1482 lpLayout->pwpos->flags = SWP_NOZORDER;
1483
1484 TRACE("Layout x=%d y=%d cx=%d cy=%d\n",
1485 lpLayout->pwpos->x, lpLayout->pwpos->y,
1486 lpLayout->pwpos->cx, lpLayout->pwpos->cy);
1487
1488 infoPtr->bRectsValid = FALSE;
1489
1490 return TRUE;
1491}
1492
1493
1494static LRESULT
1496{
1497 HIMAGELIST himlOld;
1498
1499 TRACE("(himl %p)\n", himl);
1500 himlOld = infoPtr->himl;
1501 infoPtr->himl = himl;
1502
1503 /* FIXME: Refresh needed??? */
1504
1505 return (LRESULT)himlOld;
1506}
1507
1508
1509static LRESULT
1511{
1512 return infoPtr->iMargin;
1513}
1514
1515static LRESULT
1517{
1518 INT oldMargin = infoPtr->iMargin;
1519
1520 infoPtr->iMargin = iMargin;
1521
1522 return oldMargin;
1523}
1524
1525static LRESULT
1526HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
1527{
1528 HEADER_ITEM *lpItem;
1529 HDITEMW hdNotify;
1530 void *pvScratch;
1531
1532 if (phdi == NULL)
1533 return FALSE;
1534 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem))
1535 return FALSE;
1536
1537 TRACE("[nItem=%d]\n", nItem);
1538
1539 HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch);
1540 if (HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGINGW, nItem, &hdNotify))
1541 {
1542 heap_free(pvScratch);
1543 return FALSE;
1544 }
1545
1546 lpItem = &infoPtr->items[nItem];
1547 HEADER_StoreHDItemInHeader(lpItem, phdi->mask, phdi, bUnicode);
1548
1549 if (phdi->mask & HDI_ORDER)
1550 if (phdi->iOrder >= 0 && phdi->iOrder < infoPtr->uNumItem)
1551 HEADER_ChangeItemOrder(infoPtr, nItem, phdi->iOrder);
1552
1553 HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGEDW, nItem, &hdNotify);
1554
1555 HEADER_SetItemBounds (infoPtr);
1556
1557 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1558
1559 heap_free(pvScratch);
1560 return TRUE;
1561}
1562
1563static inline LRESULT
1565{
1566 BOOL bTemp = (infoPtr->nNotifyFormat == NFR_UNICODE);
1567
1568 infoPtr->nNotifyFormat = ((BOOL)wParam ? NFR_UNICODE : NFR_ANSI);
1569
1570 return bTemp;
1571}
1572
1573
1574static LRESULT
1576{
1577 HEADER_INFO *infoPtr;
1579 HFONT hOldFont;
1580 HDC hdc;
1581
1582 infoPtr = heap_alloc_zero (sizeof(*infoPtr));
1583 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
1584
1585 infoPtr->hwndSelf = hwnd;
1586 infoPtr->hwndNotify = lpcs->hwndParent;
1587 infoPtr->uNumItem = 0;
1588 infoPtr->hFont = 0;
1589 infoPtr->items = 0;
1590 infoPtr->order = 0;
1591 infoPtr->bRectsValid = FALSE;
1592 infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW);
1595 infoPtr->bPressed = FALSE;
1596 infoPtr->bTracking = FALSE;
1597 infoPtr->dwStyle = lpcs->style;
1598 infoPtr->iMoveItem = 0;
1599 infoPtr->himl = 0;
1600 infoPtr->iHotItem = -1;
1601 infoPtr->iHotDivider = -1;
1602 infoPtr->iMargin = 3*GetSystemMetrics(SM_CXEDGE);
1603 infoPtr->nNotifyFormat =
1604 SendMessageW (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
1605 infoPtr->filter_change_timeout = 1000;
1606
1607 hdc = GetDC (0);
1610 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
1611 SelectObject (hdc, hOldFont);
1612 ReleaseDC (0, hdc);
1613
1615
1616 return 0;
1617}
1618
1619
1620static LRESULT
1622{
1623 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
1624 CloseThemeData(theme);
1625 return 0;
1626}
1627
1628static LRESULT
1630{
1631 HEADER_ITEM *lpItem;
1632 INT nItem;
1633
1634 if (infoPtr->items) {
1635 lpItem = infoPtr->items;
1636 for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++)
1637 heap_free(lpItem->pszText);
1638 heap_free(infoPtr->items);
1639 }
1640
1641 heap_free(infoPtr->order);
1642
1643 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
1644 heap_free(infoPtr);
1645
1646 return 0;
1647}
1648
1649
1650static inline LRESULT
1652{
1653 return (LRESULT)infoPtr->hFont;
1654}
1655
1656
1657static BOOL
1659{
1660 /* Windows allows for a mouse movement before starting the drag. We use the
1661 * SM_CXDOUBLECLICK/SM_CYDOUBLECLICK as that distance.
1662 */
1663 return (abs(infoPtr->ptLButtonDown.x - pt->x)>GetSystemMetrics(SM_CXDOUBLECLK) ||
1665}
1666
1667static LRESULT
1669{
1670 POINT pt;
1671 UINT flags;
1672 INT nItem;
1673
1674 pt.x = x;
1675 pt.y = y;
1676 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1677
1678 if ((infoPtr->dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER))
1680 else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
1682
1683 return 0;
1684}
1685
1686
1687static LRESULT
1689{
1690 POINT pt;
1691 UINT flags;
1692 INT nItem;
1693 HDC hdc;
1694
1695 pt.x = x;
1696 pt.y = y;
1697 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1698
1699 if ((infoPtr->dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER)) {
1700 SetCapture (infoPtr->hwndSelf);
1701 infoPtr->bCaptured = TRUE;
1702 infoPtr->bPressed = TRUE;
1703 infoPtr->bDragging = FALSE;
1704 infoPtr->iMoveItem = nItem;
1705 infoPtr->ptLButtonDown = pt;
1706
1707 infoPtr->items[nItem].bDown = TRUE;
1708
1709 /* Send WM_CUSTOMDRAW */
1710 hdc = GetDC (infoPtr->hwndSelf);
1711 HEADER_RefreshItem (infoPtr, nItem);
1712 ReleaseDC (infoPtr->hwndSelf, hdc);
1713
1714 TRACE("Pressed item %d.\n", nItem);
1715 }
1716 else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) {
1717 INT iCurrWidth = infoPtr->items[nItem].cxy;
1718 if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_BEGINTRACKW, nItem, HDI_WIDTH, iCurrWidth))
1719 {
1720 SetCapture (infoPtr->hwndSelf);
1721 infoPtr->bCaptured = TRUE;
1722 infoPtr->bTracking = TRUE;
1723 infoPtr->iMoveItem = nItem;
1724 infoPtr->xTrackOffset = infoPtr->items[nItem].rect.right - pt.x;
1725
1726 if (!(infoPtr->dwStyle & HDS_FULLDRAG)) {
1727 infoPtr->xOldTrack = infoPtr->items[nItem].rect.right;
1728 hdc = GetDC (infoPtr->hwndSelf);
1729 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1730 ReleaseDC (infoPtr->hwndSelf, hdc);
1731 }
1732
1733 TRACE("Begin tracking item %d.\n", nItem);
1734 }
1735 }
1736
1737 return 0;
1738}
1739
1740
1741static LRESULT
1743{
1744 POINT pt;
1745 UINT flags;
1746 INT nItem;
1747 HDC hdc;
1748
1749 pt.x = x;
1750 pt.y = y;
1751 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1752
1753 if (infoPtr->bPressed) {
1754
1755 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;
1756
1757 if (infoPtr->bDragging)
1758 {
1759 HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
1760 INT iNewOrder;
1761
1764
1765 if (infoPtr->iHotDivider == -1)
1766 iNewOrder = -1;
1767 else if (infoPtr->iHotDivider == infoPtr->uNumItem)
1768 iNewOrder = infoPtr->uNumItem-1;
1769 else
1770 {
1771 iNewOrder = HEADER_IndexToOrder(infoPtr, infoPtr->iHotDivider);
1772 if (iNewOrder > lpItem->iOrder)
1773 iNewOrder--;
1774 }
1775
1776 if (iNewOrder != -1 &&
1777 !HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ENDDRAG, infoPtr->iMoveItem, HDI_ORDER, iNewOrder))
1778 {
1779 HEADER_ChangeItemOrder(infoPtr, infoPtr->iMoveItem, iNewOrder);
1780 infoPtr->bRectsValid = FALSE;
1781 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1782 }
1783 else
1784 InvalidateRect(infoPtr->hwndSelf, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE);
1785
1786 infoPtr->bDragging = FALSE;
1787 HEADER_SetHotDivider(infoPtr, FALSE, -1);
1788 }
1789 else
1790 {
1791 hdc = GetDC (infoPtr->hwndSelf);
1792 HEADER_RefreshItem (infoPtr, infoPtr->iMoveItem);
1793 ReleaseDC (infoPtr->hwndSelf, hdc);
1794
1795 if (!(infoPtr->dwStyle & HDS_DRAGDROP) || !HEADER_IsDragDistance(infoPtr, &pt))
1797 }
1798
1799 TRACE("Released item %d.\n", infoPtr->iMoveItem);
1800 infoPtr->bPressed = FALSE;
1801 }
1802 else if (infoPtr->bTracking) {
1803 INT iNewWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;
1804 if (iNewWidth < 0)
1805 iNewWidth = 0;
1806 TRACE("End tracking item %d.\n", infoPtr->iMoveItem);
1807 infoPtr->bTracking = FALSE;
1808
1809 HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ENDTRACKW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
1810
1811 if (!(infoPtr->dwStyle & HDS_FULLDRAG)) {
1812 hdc = GetDC (infoPtr->hwndSelf);
1813 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1814 ReleaseDC (infoPtr->hwndSelf, hdc);
1815 }
1816
1817 if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth))
1818 {
1819 infoPtr->items[infoPtr->iMoveItem].cxy = iNewWidth;
1821 }
1822
1823 HEADER_SetItemBounds (infoPtr);
1824 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1825 }
1826
1827 if (infoPtr->bCaptured) {
1828 infoPtr->bCaptured = FALSE;
1829 ReleaseCapture ();
1831 }
1832
1833 return 0;
1834}
1835
1836
1837static LRESULT
1839{
1840 switch (lParam)
1841 {
1842 case NF_QUERY:
1843 return infoPtr->nNotifyFormat;
1844
1845 case NF_REQUERY:
1846 infoPtr->nNotifyFormat =
1847 SendMessageW ((HWND)wParam, WM_NOTIFYFORMAT,
1848 (WPARAM)infoPtr->hwndSelf, NF_QUERY);
1849 return infoPtr->nNotifyFormat;
1850 }
1851
1852 return 0;
1853}
1854
1855static LRESULT
1857{
1858 /* Reset hot-tracked item when mouse leaves control. */
1859 INT oldHotItem = infoPtr->iHotItem;
1860 HDC hdc = GetDC (infoPtr->hwndSelf);
1861
1862 infoPtr->iHotItem = -1;
1863 if (oldHotItem != -1) HEADER_RefreshItem (infoPtr, oldHotItem);
1864 ReleaseDC (infoPtr->hwndSelf, hdc);
1865
1866 return 0;
1867}
1868
1869
1870static LRESULT
1872{
1873 POINT pt;
1874 UINT flags;
1875 INT nItem, nWidth;
1876 HDC hdc;
1877 /* With theming, hottracking is always enabled */
1878 BOOL hotTrackEnabled =
1879 ((infoPtr->dwStyle & HDS_BUTTONS) && (infoPtr->dwStyle & HDS_HOTTRACK))
1880 || (GetWindowTheme (infoPtr->hwndSelf) != NULL);
1881 INT oldHotItem = infoPtr->iHotItem;
1882
1883 pt.x = (INT)(SHORT)LOWORD(lParam);
1884 pt.y = (INT)(SHORT)HIWORD(lParam);
1885 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1886
1887 if (hotTrackEnabled) {
1889 infoPtr->iHotItem = nItem;
1890 else
1891 infoPtr->iHotItem = -1;
1892 }
1893
1894 if (infoPtr->bCaptured) {
1895 /* check if we should drag the header */
1896 if (infoPtr->bPressed && !infoPtr->bDragging && (infoPtr->dwStyle & HDS_DRAGDROP)
1897 && HEADER_IsDragDistance(infoPtr, &pt))
1898 {
1899 if (!HEADER_SendNotifyWithHDItemT(infoPtr, HDN_BEGINDRAG, infoPtr->iMoveItem, NULL))
1900 {
1901 HIMAGELIST hDragItem = HEADER_CreateDragImage(infoPtr, infoPtr->iMoveItem);
1902 if (hDragItem != NULL)
1903 {
1904 HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
1905 TRACE("Starting item drag\n");
1906 ImageList_BeginDrag(hDragItem, 0, pt.x - lpItem->rect.left, 0);
1908 ImageList_Destroy(hDragItem);
1909 infoPtr->bDragging = TRUE;
1910 }
1911 }
1912 }
1913
1914 if (infoPtr->bDragging)
1915 {
1916 POINT drag;
1917 drag.x = pt.x;
1918 drag.y = 0;
1919 ClientToScreen(infoPtr->hwndSelf, &drag);
1920 ImageList_DragMove(drag.x, drag.y);
1921 HEADER_SetHotDivider(infoPtr, TRUE, lParam);
1922 }
1923
1924 if (infoPtr->bPressed && !infoPtr->bDragging) {
1925 BOOL oldState = infoPtr->items[infoPtr->iMoveItem].bDown;
1926 if ((nItem == infoPtr->iMoveItem) && (flags == HHT_ONHEADER))
1927 infoPtr->items[infoPtr->iMoveItem].bDown = TRUE;
1928 else
1929 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;
1930 if (oldState != infoPtr->items[infoPtr->iMoveItem].bDown) {
1931 hdc = GetDC (infoPtr->hwndSelf);
1932 HEADER_RefreshItem (infoPtr, infoPtr->iMoveItem);
1933 ReleaseDC (infoPtr->hwndSelf, hdc);
1934 }
1935
1936 TRACE("Moving pressed item %d.\n", infoPtr->iMoveItem);
1937 }
1938 else if (infoPtr->bTracking) {
1939 if (infoPtr->dwStyle & HDS_FULLDRAG) {
1940 HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
1941 nWidth = pt.x - lpItem->rect.left + infoPtr->xTrackOffset;
1942 if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, nWidth))
1943 {
1944 INT nOldWidth = lpItem->rect.right - lpItem->rect.left;
1945 RECT rcClient;
1946 RECT rcScroll;
1947
1948 if (nWidth < 0) nWidth = 0;
1949 infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
1950#ifdef __REACTOS__
1951 InvalidateRect(infoPtr->hwndSelf, &lpItem->rect, FALSE);
1952#endif
1953 HEADER_SetItemBounds(infoPtr);
1954
1955 GetClientRect(infoPtr->hwndSelf, &rcClient);
1956 rcScroll = rcClient;
1957 rcScroll.left = lpItem->rect.left + nOldWidth;
1958#ifdef __REACTOS__
1959 ScrollWindowEx(infoPtr->hwndSelf, nWidth - nOldWidth, 0, &rcScroll, &rcClient,
1961#else
1962 ScrollWindowEx(infoPtr->hwndSelf, nWidth - nOldWidth, 0, &rcScroll, &rcClient, NULL, NULL, 0);
1963 InvalidateRect(infoPtr->hwndSelf, &lpItem->rect, FALSE);
1964#endif
1965 UpdateWindow(infoPtr->hwndSelf);
1966
1968 }
1969 }
1970 else {
1971 INT iTrackWidth;
1972 hdc = GetDC (infoPtr->hwndSelf);
1973 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1974 infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset;
1975 if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left)
1976 infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left;
1977 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1978 ReleaseDC (infoPtr->hwndSelf, hdc);
1979 iTrackWidth = infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left;
1980 /* FIXME: should stop tracking if HDN_TRACK returns TRUE */
1981 HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_TRACKW, infoPtr->iMoveItem, HDI_WIDTH, iTrackWidth);
1982 }
1983
1984 TRACE("Tracking item %d.\n", infoPtr->iMoveItem);
1985 }
1986 }
1987
1988 if (hotTrackEnabled) {
1989 TRACKMOUSEEVENT tme;
1990 if (oldHotItem != infoPtr->iHotItem && !infoPtr->bDragging) {
1991 hdc = GetDC (infoPtr->hwndSelf);
1992 if (oldHotItem != -1) HEADER_RefreshItem (infoPtr, oldHotItem);
1993 if (infoPtr->iHotItem != -1) HEADER_RefreshItem (infoPtr, infoPtr->iHotItem);
1994 ReleaseDC (infoPtr->hwndSelf, hdc);
1995 }
1996 tme.cbSize = sizeof( tme );
1997 tme.dwFlags = TME_LEAVE;
1998 tme.hwndTrack = infoPtr->hwndSelf;
1999 TrackMouseEvent( &tme );
2000 }
2001
2002 return 0;
2003}
2004
2005
2006static LRESULT
2007HEADER_Paint (HEADER_INFO *infoPtr, HDC hdcParam)
2008{
2009 HDC hdc;
2010 PAINTSTRUCT ps;
2011
2012 hdc = hdcParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : hdcParam;
2013 HEADER_Refresh (infoPtr, hdc);
2014 if(!hdcParam)
2015 EndPaint (infoPtr->hwndSelf, &ps);
2016 return 0;
2017}
2018
2019
2020static LRESULT
2022{
2023 BOOL bRet;
2024 POINT pt;
2025
2026 pt.x = x;
2027 pt.y = y;
2028
2029 /* Send a Notify message */
2030 bRet = HEADER_SendSimpleNotify (infoPtr, NM_RCLICK);
2031
2032 /* Change to screen coordinate for WM_CONTEXTMENU */
2033 ClientToScreen(infoPtr->hwndSelf, &pt);
2034
2035 /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
2036 SendMessageW( infoPtr->hwndSelf, WM_CONTEXTMENU, (WPARAM) infoPtr->hwndSelf, MAKELPARAM(pt.x, pt.y));
2037
2038 return bRet;
2039}
2040
2041
2042static LRESULT
2044{
2045 POINT pt;
2046 UINT flags;
2047 INT nItem;
2048
2049 TRACE("code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
2050
2051 GetCursorPos (&pt);
2052 ScreenToClient (infoPtr->hwndSelf, &pt);
2053
2054 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
2055
2056 if (flags == HHT_ONDIVIDER)
2057 SetCursor (infoPtr->hcurDivider);
2058 else if (flags == HHT_ONDIVOPEN)
2059 SetCursor (infoPtr->hcurDivopen);
2060 else
2061 SetCursor (infoPtr->hcurArrow);
2062
2063 return 0;
2064}
2065
2066
2067static LRESULT
2069{
2071 HFONT hOldFont;
2072 HDC hdc;
2073
2074 infoPtr->hFont = hFont;
2075
2076 hdc = GetDC (0);
2077 hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT));
2079 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
2080 SelectObject (hdc, hOldFont);
2081 ReleaseDC (0, hdc);
2082
2083 infoPtr->bRectsValid = FALSE;
2084
2085 if (Redraw) {
2086 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
2087 }
2088
2089 return 0;
2090}
2091
2093{
2094 /* ignoring the InvalidateRect calls is handled by user32. But some apps expect
2095 * that we invalidate the header and this has to be done manually */
2096 LRESULT ret;
2097
2099 if (wParam)
2100 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
2101 return ret;
2102}
2103
2104static INT HEADER_StyleChanged(HEADER_INFO *infoPtr, WPARAM wStyleType,
2105 const STYLESTRUCT *lpss)
2106{
2107 TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
2108 wStyleType, lpss->styleOld, lpss->styleNew);
2109
2110 if (wStyleType != GWL_STYLE) return 0;
2111
2112 infoPtr->dwStyle = lpss->styleNew;
2113
2114 return 0;
2115}
2116
2117/* Update the theme handle after a theme change */
2119{
2120 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
2121 CloseThemeData(theme);
2123 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
2124 return 0;
2125}
2126
2128{
2129 INT old_timeout = infoPtr->filter_change_timeout;
2130
2131 if (timeout != 0)
2132 infoPtr->filter_change_timeout = timeout;
2133 return old_timeout;
2134}
2135
2136static LRESULT WINAPI
2138{
2140
2141 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx\n", hwnd, msg, wParam, lParam);
2142 if (!infoPtr && (msg != WM_CREATE))
2143 return DefWindowProcW (hwnd, msg, wParam, lParam);
2144 switch (msg) {
2145/* case HDM_CLEARFILTER: */
2146
2148 return (LRESULT)HEADER_CreateDragImage (infoPtr, (INT)wParam);
2149
2150 case HDM_DELETEITEM:
2151 return HEADER_DeleteItem (infoPtr, (INT)wParam);
2152
2153/* case HDM_EDITFILTER: */
2154
2156 return HEADER_GetBitmapMargin(infoPtr);
2157
2158 case HDM_GETIMAGELIST:
2159 return HEADER_GetImageList (infoPtr);
2160
2161 case HDM_GETITEMA:
2162 case HDM_GETITEMW:
2163 return HEADER_GetItemT (infoPtr, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_GETITEMW);
2164
2165 case HDM_GETITEMCOUNT:
2166 return HEADER_GetItemCount (infoPtr);
2167
2168 case HDM_GETITEMRECT:
2169 return HEADER_GetItemRect (infoPtr, (INT)wParam, (LPRECT)lParam);
2170
2171 case HDM_GETORDERARRAY:
2172 return HEADER_GetOrderArray(infoPtr, (INT)wParam, (LPINT)lParam);
2173
2175 return HEADER_GetUnicodeFormat (infoPtr);
2176
2177 case HDM_HITTEST:
2178 return HEADER_HitTest (infoPtr, (LPHDHITTESTINFO)lParam);
2179
2180 case HDM_INSERTITEMA:
2181 case HDM_INSERTITEMW:
2183
2184 case HDM_LAYOUT:
2185 return HEADER_Layout (infoPtr, (LPHDLAYOUT)lParam);
2186
2187 case HDM_ORDERTOINDEX:
2188 return HEADER_OrderToIndex(infoPtr, (INT)wParam);
2189
2191 return HEADER_SetBitmapMargin(infoPtr, (INT)wParam);
2192
2194 return HEADER_SetFilterChangeTimeout(infoPtr, (INT)lParam);
2195
2196 case HDM_SETHOTDIVIDER:
2197 return HEADER_SetHotDivider(infoPtr, wParam, lParam);
2198
2199 case HDM_SETIMAGELIST:
2200 return HEADER_SetImageList (infoPtr, (HIMAGELIST)lParam);
2201
2202 case HDM_SETITEMA:
2203 case HDM_SETITEMW:
2204 return HEADER_SetItemT (infoPtr, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_SETITEMW);
2205
2206 case HDM_SETORDERARRAY:
2207 return HEADER_SetOrderArray(infoPtr, (INT)wParam, (LPINT)lParam);
2208
2210 return HEADER_SetUnicodeFormat (infoPtr, wParam);
2211
2212 case WM_CREATE:
2214
2215 case WM_DESTROY:
2216 return HEADER_Destroy (infoPtr);
2217
2218 case WM_NCDESTROY:
2219 return HEADER_NCDestroy (infoPtr);
2220
2221 case WM_ERASEBKGND:
2222 return 1;
2223
2224 case WM_GETDLGCODE:
2226
2227 case WM_GETFONT:
2228 return HEADER_GetFont (infoPtr);
2229
2230 case WM_LBUTTONDBLCLK:
2231 return HEADER_LButtonDblClk (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2232
2233 case WM_LBUTTONDOWN:
2234 return HEADER_LButtonDown (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2235
2236 case WM_LBUTTONUP:
2237 return HEADER_LButtonUp (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2238
2239 case WM_MOUSELEAVE:
2240 return HEADER_MouseLeave (infoPtr);
2241
2242 case WM_MOUSEMOVE:
2243 return HEADER_MouseMove (infoPtr, lParam);
2244
2245 case WM_NOTIFYFORMAT:
2246 return HEADER_NotifyFormat (infoPtr, wParam, lParam);
2247
2248 case WM_SIZE:
2249 return HEADER_Size (infoPtr);
2250
2251 case WM_THEMECHANGED:
2252 return HEADER_ThemeChanged (infoPtr);
2253
2254 case WM_PRINTCLIENT:
2255 case WM_PAINT:
2256 return HEADER_Paint (infoPtr, (HDC)wParam);
2257
2258 case WM_RBUTTONUP:
2259 return HEADER_RButtonUp (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2260
2261 case WM_SETCURSOR:
2262 return HEADER_SetCursor (infoPtr, lParam);
2263
2264 case WM_SETFONT:
2265 return HEADER_SetFont (infoPtr, (HFONT)wParam, (WORD)lParam);
2266
2267 case WM_SETREDRAW:
2268 return HEADER_SetRedraw(infoPtr, wParam, lParam);
2269
2270 case WM_STYLECHANGED:
2272
2273 case WM_SYSCOLORCHANGE:
2275 return 0;
2276
2277 default:
2278 if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg))
2279 ERR("unknown msg %04x wp=%04lx lp=%08lx\n",
2280 msg, wParam, lParam );
2281 return DefWindowProcW(hwnd, msg, wParam, lParam);
2282 }
2283}
2284
2285
2286VOID
2288{
2289 WNDCLASSW wndClass;
2290
2291 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2292 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
2293 wndClass.lpfnWndProc = HEADER_WindowProc;
2294 wndClass.cbClsExtra = 0;
2295 wndClass.cbWndExtra = sizeof(HEADER_INFO *);
2296 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
2297 wndClass.lpszClassName = WC_HEADERW;
2298
2299 RegisterClassW (&wndClass);
2300}
2301
2302
2303VOID
2305{
2307}
static int bw
Definition: maze.c:120
static int state
Definition: maze.c:121
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
HFONT hFont
Definition: main.c:53
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
HIMAGELIST himl
Definition: bufpool.h:45
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
INT Str_GetPtrWtoA(LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1755
BOOL Str_SetPtrWtoA(LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN
BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN
#define IDC_DIVIDER
Definition: comctl32.h:98
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1593
#define IDC_DIVIDEROPEN
Definition: comctl32.h:99
INT WINAPI Str_GetPtrW(LPCWSTR, LPWSTR, INT)
Definition: string.c:200
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
static LRESULT HEADER_GetItemT(const HEADER_INFO *infoPtr, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
Definition: header.c:1220
static LRESULT HEADER_LButtonDown(HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:1688
static LRESULT HEADER_DeleteItem(HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:1170
static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDITEMW *phdi, BOOL fUnicode)
Definition: header.c:116
static LRESULT HEADER_Layout(HEADER_INFO *infoPtr, LPHDLAYOUT lpLayout)
Definition: header.c:1469
static void HEADER_DrawHotDivider(const HEADER_INFO *infoPtr, HDC hdc)
Definition: header.c:605
static LRESULT HEADER_SetFont(HEADER_INFO *infoPtr, HFONT hFont, WORD Redraw)
Definition: header.c:2068
static LRESULT HEADER_SendCtrlCustomDraw(const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect)
Definition: header.c:902
static void HEADER_CopyHDItemForNotify(const HEADER_INFO *infoPtr, HDITEMW *dest, const HDITEMW *src, BOOL fSourceUnicode, LPVOID *ppvScratch)
Definition: header.c:850
#define HDN_UNICODE_OFFSET
Definition: header.c:100
static BOOL HEADER_IsItemFixed(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:224
static BOOL HEADER_SendSimpleNotify(const HEADER_INFO *infoPtr, UINT code)
Definition: header.c:895
#define HDI_UNSUPPORTED_FIELDS
Definition: header.c:104
#define HOT_DIVIDER_WIDTH
Definition: header.c:98
static INT HEADER_NextItem(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:210
static HIMAGELIST HEADER_CreateDragImage(HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:1071
static LRESULT HEADER_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: header.c:1575
static LRESULT HEADER_Paint(HEADER_INFO *infoPtr, HDC hdcParam)
Definition: header.c:2007
static void HEADER_DrawTrackLine(const HEADER_INFO *infoPtr, HDC hdc, INT x)
Definition: header.c:828
#define MAX_HEADER_TEXT_LEN
Definition: header.c:99
static INT HEADER_DrawItem(HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags)
Definition: header.c:372
static LRESULT HEADER_GetItemCount(const HEADER_INFO *infoPtr)
Definition: header.c:1278
static LRESULT HEADER_ThemeChanged(const HEADER_INFO *infoPtr)
Definition: header.c:2118
#define HDI_COMCTL32_4_0_FIELDS
Definition: header.c:106
static LRESULT HEADER_SetRedraw(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: header.c:2092
static void HEADER_FillItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item, BOOL hottrack)
Definition: header.c:294
static UINT HEADER_NotifyCodeWtoA(UINT code)
Definition: header.c:874
static void HEADER_InternalHitTest(const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pItem)
Definition: header.c:696
#define HDI_UNKNOWN_FIELDS
Definition: header.c:105
static LRESULT HEADER_GetBitmapMargin(const HEADER_INFO *infoPtr)
Definition: header.c:1510
static LRESULT HEADER_MouseMove(HEADER_INFO *infoPtr, LPARAM lParam)
Definition: header.c:1871
static LRESULT HEADER_NotifyFormat(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: header.c:1838
static void HEADER_Refresh(HEADER_INFO *infoPtr, HDC hdc)
Definition: header.c:617
static LRESULT HEADER_SetImageList(HEADER_INFO *infoPtr, HIMAGELIST himl)
Definition: header.c:1495
static LRESULT HEADER_LButtonDblClk(const HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:1668
static INT has_duplicate(const INT *array, INT to, INT value)
Definition: header.c:1311
static LRESULT HEADER_GetFont(const HEADER_INFO *infoPtr)
Definition: header.c:1651
static LRESULT HEADER_SetUnicodeFormat(HEADER_INFO *infoPtr, WPARAM wParam)
Definition: header.c:1564
static LRESULT HEADER_SetHotDivider(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: header.c:1121
static LRESULT HEADER_GetImageList(const HEADER_INFO *infoPtr)
Definition: header.c:1213
#define DIVIDER_WIDTH
Definition: header.c:97
static void HEADER_ChangeItemOrder(const HEADER_INFO *infoPtr, INT iItem, INT iNewOrder)
Definition: header.c:183
static INT get_nextvalue(const INT *array, INT to, INT max)
Definition: header.c:1320
static INT HEADER_OrderToIndex(const HEADER_INFO *infoPtr, INT iorder)
Definition: header.c:175
static BOOL HEADER_IsDragDistance(const HEADER_INFO *infoPtr, const POINT *pt)
Definition: header.c:1658
static BOOL HEADER_SendNotifyWithIntFieldT(const HEADER_INFO *infoPtr, UINT code, INT iItem, INT mask, INT iValue)
Definition: header.c:930
static LRESULT HEADER_SendNotify(const HEADER_INFO *infoPtr, UINT code, NMHDR *hdr)
Definition: header.c:884
static LRESULT HEADER_HitTest(const HEADER_INFO *infoPtr, LPHDHITTESTINFO phti)
Definition: header.c:1388
static LRESULT HEADER_RButtonUp(HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:2021
static const WCHAR themeClass[]
Definition: header.c:114
static LRESULT HEADER_LButtonUp(HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:1742
static LRESULT HEADER_SetOrderArray(HEADER_INFO *infoPtr, INT size, const INT *order)
Definition: header.c:1329
static void HEADER_SetItemBounds(HEADER_INFO *infoPtr)
Definition: header.c:230
static void HEADER_DrawItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item)
Definition: header.c:312
static INT HEADER_PrevItem(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:216
static LRESULT HEADER_GetItemRect(const HEADER_INFO *infoPtr, INT iItem, LPRECT lpRect)
Definition: header.c:1285
static LRESULT HEADER_GetOrderArray(const HEADER_INFO *infoPtr, INT size, LPINT order)
Definition: header.c:1300
static LRESULT HEADER_Destroy(HEADER_INFO *infoPtr)
Definition: header.c:1621
static LRESULT HEADER_MouseLeave(HEADER_INFO *infoPtr)
Definition: header.c:1856
static LRESULT HEADER_SetItemT(HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
Definition: header.c:1526
VOID HEADER_Register(void)
Definition: header.c:2287
static BOOL HEADER_SendNotifyWithHDItemT(const HEADER_INFO *infoPtr, UINT code, INT iItem, HDITEMW *lpItem)
Definition: header.c:916
static LRESULT HEADER_GetUnicodeFormat(const HEADER_INFO *infoPtr)
Definition: header.c:1381
static void HEADER_RefreshItem(HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:686
static LRESULT HEADER_Size(HEADER_INFO *infoPtr)
Definition: header.c:256
#define HDN_FIRST_UNICODE
Definition: header.c:101
static BOOL HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
Definition: header.c:976
static void HEADER_GetHotDividerRect(const HEADER_INFO *infoPtr, RECT *r)
Definition: header.c:262
#define VERT_BORDER
Definition: header.c:96
static LRESULT HEADER_NCDestroy(HEADER_INFO *infoPtr)
Definition: header.c:1629
static INT HEADER_SetFilterChangeTimeout(HEADER_INFO *infoPtr, INT timeout)
Definition: header.c:2127
static LRESULT HEADER_InsertItemT(HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
Definition: header.c:1402
static LRESULT HEADER_SetCursor(HEADER_INFO *infoPtr, LPARAM lParam)
Definition: header.c:2043
static LRESULT HEADER_IndexToOrder(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:167
static LRESULT WINAPI HEADER_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: header.c:2137
static LRESULT HEADER_SetBitmapMargin(HEADER_INFO *infoPtr, INT iMargin)
Definition: header.c:1516
static void HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
Definition: header.c:1058
static HRGN create_sort_arrow(INT x, INT y, INT h, BOOL is_up)
Definition: header.c:331
static INT HEADER_StyleChanged(HEADER_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: header.c:2104
VOID HEADER_Unregister(void)
Definition: header.c:2304
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
VOID WINAPI ImageList_EndDrag(void)
Definition: imagelist.c:1847
BOOL WINAPI ImageList_DragMove(INT x, INT y)
Definition: imagelist.c:1070
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
BOOL WINAPI ImageList_BeginDrag(HIMAGELIST himlTrack, INT iTrack, INT dxHotspot, INT dyHotspot)
Definition: imagelist.c:638
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
BOOL WINAPI ImageList_DragShowNolock(BOOL bShow)
Definition: imagelist.c:1153
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:232
#define TRACE_ON(x)
Definition: compat.h:75
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
HRESULT WINAPI DrawThemeText(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, const RECT *pRect)
Definition: draw.c:1500
HRESULT WINAPI GetThemeTextExtent(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, DWORD dwTextFlags, const RECT *pBoundingRect, RECT *pExtentRect)
Definition: draw.c:1853
HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
Definition: draw.c:1523
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
#define pt(x, y)
Definition: drawing.c:79
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define WM_APP
Definition: eventvwr.h:73
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
WDFMEMORY hMemory
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
char hdr[14]
Definition: iptest.cpp:33
#define debugstr_w
Definition: kernel32.h:32
#define dup
Definition: syshdrs.h:51
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
BITMAP bmp
Definition: alphablend.c:62
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static char * dest
Definition: rtl.c:135
static ATOM item
Definition: dde.c:856
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND
#define min(a, b)
Definition: monoChain.cc:55
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define LOWORD(l)
Definition: pedump.c:82
short SHORT
Definition: pedump.c:59
#define INT
Definition: polytest.cpp:20
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
#define ODT_HEADER
Definition: commctrl.h:78
#define I_IMAGECALLBACK
Definition: commctrl.h:2390
#define HDM_SETORDERARRAY
Definition: commctrl.h:809
#define HDS_BUTTONS
Definition: commctrl.h:629
#define HDS_HIDDEN
Definition: commctrl.h:631
#define CDDS_ITEM
Definition: commctrl.h:284
#define HDF_LEFT
Definition: commctrl.h:713
#define TME_LEAVE
Definition: commctrl.h:4986
#define HDF_OWNERDRAW
Definition: commctrl.h:719
#define HDN_LAST
Definition: commctrl.h:206
#define HDI_TEXT
Definition: commctrl.h:704
#define HDF_CENTER
Definition: commctrl.h:715
#define HDN_ITEMCHANGEDW
Definition: commctrl.h:840
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2385
#define HDM_GETBITMAPMARGIN
Definition: commctrl.h:818
#define ILC_COLORDDB
Definition: commctrl.h:353
#define HDM_SETITEMA
Definition: commctrl.h:753
#define HDM_SETUNICODEFORMAT
Definition: commctrl.h:821
#define HDM_GETUNICODEFORMAT
Definition: commctrl.h:824
#define HDF_RIGHT
Definition: commctrl.h:714
#define HDM_INSERTITEMA
Definition: commctrl.h:736
#define HDS_FULLDRAG
Definition: commctrl.h:633
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define HDM_LAYOUT
Definition: commctrl.h:767
#define HDM_GETITEMCOUNT
Definition: commctrl.h:733
#define HDF_IMAGE
Definition: commctrl.h:723
_Out_opt_ int * cx
Definition: commctrl.h:585
#define HDN_BEGINDRAG
Definition: commctrl.h:855
#define HDM_GETITEMA
Definition: commctrl.h:746
#define CDIS_SELECTED
Definition: commctrl.h:291
#define HDI_WIDTH
Definition: commctrl.h:702
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define HDI_BITMAP
Definition: commctrl.h:707
#define HDN_ENDTRACKW
Definition: commctrl.h:850
#define HDS_FLAT
Definition: commctrl.h:635
#define HDS_DRAGDROP
Definition: commctrl.h:632
#define HDF_SORTUP
Definition: commctrl.h:724
#define HDF_BITMAP_ON_RIGHT
Definition: commctrl.h:722
#define HDM_SETHOTDIVIDER
Definition: commctrl.h:812
#define HDM_HITTEST
Definition: commctrl.h:789
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define HDN_ITEMDBLCLICKW
Definition: commctrl.h:844
#define HHT_ABOVE
Definition: commctrl.h:776
#define HDN_TRACKW
Definition: commctrl.h:852
#define HDN_ENDDRAG
Definition: commctrl.h:856
#define HDM_SETIMAGELIST
Definition: commctrl.h:794
#define WC_HEADERW
Definition: commctrl.h:624
#define HDN_ITEMCHANGINGW
Definition: commctrl.h:838
#define HDI_DI_SETITEM
Definition: commctrl.h:709
#define HDF_STRING
Definition: commctrl.h:720
#define HDM_GETORDERARRAY
Definition: commctrl.h:806
#define HDM_SETBITMAPMARGIN
Definition: commctrl.h:815
#define HDI_FORMAT
Definition: commctrl.h:705
#define WM_MOUSELEAVE
Definition: commctrl.h:4980
#define HDS_HOTTRACK
Definition: commctrl.h:630
#define CLR_DEFAULT
Definition: commctrl.h:320
#define HDN_GETDISPINFOA
Definition: commctrl.h:853
#define HHT_ONDIVIDER
Definition: commctrl.h:772
#define HHT_ONDIVOPEN
Definition: commctrl.h:773
#define HDM_GETITEMW
Definition: commctrl.h:747
#define HDN_GETDISPINFOW
Definition: commctrl.h:854
#define HDN_DIVIDERDBLCLICKW
Definition: commctrl.h:846
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define HHT_NOWHERE
Definition: commctrl.h:770
#define HDM_GETITEMRECT
Definition: commctrl.h:791
#define NM_RCLICK
Definition: commctrl.h:133
#define HDI_LPARAM
Definition: commctrl.h:706
#define CDDS_POSTPAINT
Definition: commctrl.h:281
#define HDN_BEGINTRACKW
Definition: commctrl.h:848
#define HDF_BITMAP
Definition: commctrl.h:721
#define HDM_SETITEMW
Definition: commctrl.h:754
#define HDM_INSERTITEMW
Definition: commctrl.h:737
#define HDM_ORDERTOINDEX
Definition: commctrl.h:800
#define HDM_SETFILTERCHANGETIMEOUT
Definition: commctrl.h:827
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define HDM_CREATEDRAGIMAGE
Definition: commctrl.h:803
#define HHT_BELOW
Definition: commctrl.h:777
#define HDI_IMAGE
Definition: commctrl.h:708
#define HDM_GETIMAGELIST
Definition: commctrl.h:797
#define HDN_ITEMCLICKW
Definition: commctrl.h:842
#define HHT_TOLEFT
Definition: commctrl.h:779
#define HHT_TORIGHT
Definition: commctrl.h:778
#define HDF_SORTDOWN
Definition: commctrl.h:725
#define HHT_ONHEADER
Definition: commctrl.h:771
#define HDF_JUSTIFYMASK
Definition: commctrl.h:716
#define HDM_DELETEITEM
Definition: commctrl.h:743
#define HDI_ORDER
Definition: commctrl.h:710
static unsigned __int64 next
Definition: rand_nt.c:6
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_NOTIFY
Definition: richedit.h:61
#define rw
Definition: rosglue.h:38
#define memset(x, y, z)
Definition: compat.h:39
HDC hdcBitmap
Definition: solcreate.cpp:9
#define TRACE(s)
Definition: solgame.cpp:4
RECT textRect
Definition: startmenu.cpp:1392
& rect
Definition: startmenu.cpp:1413
COLORREF clrBtnText
Definition: comctl32.h:173
COLORREF clr3dFace
Definition: comctl32.h:181
COLORREF clrHighlight
Definition: comctl32.h:175
BOOL bPressed
Definition: header.c:76
INT * order
Definition: header.c:91
BOOL bTracking
Definition: header.c:78
UINT uNumItem
Definition: header.c:69
INT xOldTrack
Definition: header.c:83
INT nHeight
Definition: header.c:70
HCURSOR hcurDivider
Definition: header.c:73
INT iMargin
Definition: header.c:86
HFONT hFont
Definition: header.c:71
INT iHotDivider
Definition: header.c:85
POINT ptLButtonDown
Definition: header.c:79
BOOL bCaptured
Definition: header.c:75
INT xTrackOffset
Definition: header.c:82
HEADER_ITEM * items
Definition: header.c:90
HIMAGELIST himl
Definition: header.c:89
BOOL bDragging
Definition: header.c:77
HCURSOR hcurDivopen
Definition: header.c:74
DWORD dwStyle
Definition: header.c:80
INT filter_change_timeout
Definition: header.c:87
INT iHotItem
Definition: header.c:84
BOOL bRectsValid
Definition: header.c:92
HWND hwndSelf
Definition: header.c:66
INT iMoveItem
Definition: header.c:81
HWND hwndNotify
Definition: header.c:67
INT nNotifyFormat
Definition: header.c:68
HCURSOR hcurArrow
Definition: header.c:72
RECT rect
Definition: header.c:59
INT cxy
Definition: header.c:50
LPARAM lParam
Definition: header.c:54
LPWSTR pszText
Definition: header.c:52
INT iImage
Definition: header.c:55
BOOL bDown
Definition: header.c:58
INT fmt
Definition: header.c:53
HBITMAP hbm
Definition: header.c:51
INT iOrder
Definition: header.c:56
DWORD callbackMask
Definition: header.c:60
Definition: bl.h:1331
UINT mask
Definition: commctrl.h:684
int iImage
Definition: commctrl.h:691
LPARAM lParam
Definition: commctrl.h:690
HBITMAP hbm
Definition: commctrl.h:687
int iOrder
Definition: commctrl.h:692
int fmt
Definition: commctrl.h:689
int cxy
Definition: commctrl.h:685
LPWSTR pszText
Definition: commctrl.h:686
int cchTextMax
Definition: commctrl.h:688
WINDOWPOS * pwpos
Definition: commctrl.h:764
RECT * prc
Definition: commctrl.h:763
HWND hwnd
Definition: winuser.h:3591
UINT flags
Definition: winuser.h:3597
HWND hwndInsertAfter
Definition: winuser.h:3592
LPCWSTR lpszClassName
Definition: winuser.h:3188
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
Definition: inflate.c:139
ULONG_PTR itemData
Definition: winuser.h:3096
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
LPWSTR pszText
Definition: commctrl.h:901
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
HDITEMW * pitem
Definition: commctrl.h:891
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD styleNew
Definition: winuser.h:3696
DWORD styleOld
Definition: winuser.h:3695
Definition: dhcpd.h:245
Definition: time.h:68
#define max(a, b)
Definition: svc.c:63
int nOldWidth
Definition: taskmgr.c:31
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
Definition: pdh_main.c:94
@ HP_HEADERITEM
Definition: vsstyle.h:621
@ HIS_NORMAL
Definition: vsstyle.h:638
@ HIS_HOT
Definition: vsstyle.h:639
@ HIS_PRESSED
Definition: vsstyle.h:640
int ret
#define RECT
Definition: precomp.h:26
#define ZeroMemory
Definition: winbase.h:1737
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
int * LPINT
Definition: windef.h:178
HICON HCURSOR
Definition: windef.h:299
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI GetStockObject(_In_ int)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI RectVisible(_In_ HDC, _In_ LPCRECT)
#define RDH_RECTANGLES
Definition: wingdi.h:669
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HRGN WINAPI ExtCreateRegion(_In_opt_ const XFORM *lpx, _In_ DWORD nCount, _In_reads_bytes_(nCount) const RGNDATA *lpData)
#define TRANSPARENT
Definition: wingdi.h:950
#define SRCCOPY
Definition: wingdi.h:333
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
#define DSTINVERT
Definition: wingdi.h:327
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRgn(_In_ HDC, _In_ HRGN, _In_ HBRUSH)
Definition: painting.c:183
#define SYSTEM_FONT
Definition: wingdi.h:911
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define WM_PAINT
Definition: winuser.h:1623
HWND WINAPI SetCapture(_In_ HWND hWnd)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define ODS_SELECTED
Definition: winuser.h:2548
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define SM_CXDOUBLECLK
Definition: winuser.h:1002
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define COLOR_GRAYTEXT
Definition: winuser.h:935
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
#define ODA_DRAWENTIRE
Definition: winuser.h:2545
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SM_CXEDGE
Definition: winuser.h:1011
#define DT_END_ELLIPSIS
Definition: winuser.h:529
#define WM_CREATE
Definition: winuser.h:1611
#define DLGC_WANTTAB
Definition: winuser.h:2614
#define WM_SIZE
Definition: winuser.h:1614
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1781
#define SW_INVALIDATE
Definition: winuser.h:2582
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define BF_LEFT
Definition: winuser.h:454
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2722
#define WM_RBUTTONUP
Definition: winuser.h:1783
#define SM_CYDOUBLECLK
Definition: winuser.h:1003
#define BF_ADJUST
Definition: winuser.h:470
#define EDGE_ETCHED
Definition: winuser.h:452
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1778
BOOL WINAPI TrackMouseEvent(_Inout_ LPTRACKMOUSEEVENT)
#define BF_MIDDLE
Definition: winuser.h:468
#define BF_BOTTOM
Definition: winuser.h:457
#define CS_DBLCLKS
Definition: winuser.h:651
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define NF_REQUERY
Definition: winuser.h:2464
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
#define WM_GETFONT
Definition: winuser.h:1654
#define BF_FLAT
Definition: winuser.h:471
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
#define WM_DRAWITEM
Definition: winuser.h:1648
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_TOP
Definition: winuser.h:455
#define WM_SETFONT
Definition: winuser.h:1653
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define BF_RIGHT
Definition: winuser.h:456
#define DLGC_WANTARROWS
Definition: winuser.h:2613
BOOL WINAPI UpdateWindow(_In_ HWND)
HDC WINAPI GetDC(_In_opt_ HWND)
#define WM_LBUTTONUP
Definition: winuser.h:1780
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define DT_VCENTER
Definition: winuser.h:543
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define NFR_ANSI
Definition: winuser.h:2461
#define WM_NCDESTROY
Definition: winuser.h:1687
#define GWLP_ID
Definition: winuser.h:863
#define WM_SETCURSOR
Definition: winuser.h:1639
#define WM_USER
Definition: winuser.h:1898
#define BDR_RAISEDOUTER
Definition: winuser.h:442
#define WM_DESTROY
Definition: winuser.h:1612
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1250
#define DT_CALCRECT
Definition: winuser.h:526
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define BF_SOFT
Definition: winuser.h:469
#define SetWindowLongPtrW
Definition: winuser.h:5358
#define NFR_UNICODE
Definition: winuser.h:2462
#define BF_RECT
Definition: winuser.h:462
#define GWL_STYLE
Definition: winuser.h:855
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define EDGE_RAISED
Definition: winuser.h:450
int WINAPI GetSystemMetrics(_In_ int)
#define WM_GETDLGCODE
Definition: winuser.h:1692
#define NF_QUERY
Definition: winuser.h:2463
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define COLOR_3DFACE
Definition: winuser.h:932
#define WM_SETREDRAW
Definition: winuser.h:1619
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175