ReactOS 0.4.15-dev-5672-gf73ac17
header.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/unicode.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "vssym32.h"
#include "uxtheme.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for header.c:

Go to the source code of this file.

Classes

struct  HEADER_ITEM
 
struct  HEADER_INFO
 

Macros

#define VERT_BORDER   4
 
#define DIVIDER_WIDTH   10
 
#define HOT_DIVIDER_WIDTH   2
 
#define MAX_HEADER_TEXT_LEN   260
 
#define HDN_UNICODE_OFFSET   20
 
#define HDN_FIRST_UNICODE   (HDN_FIRST-HDN_UNICODE_OFFSET)
 
#define HDI_SUPPORTED_FIELDS   (HDI_WIDTH|HDI_TEXT|HDI_FORMAT|HDI_LPARAM|HDI_BITMAP|HDI_IMAGE|HDI_ORDER)
 
#define HDI_UNSUPPORTED_FIELDS   (HDI_FILTER)
 
#define HDI_UNKNOWN_FIELDS   (~(HDI_SUPPORTED_FIELDS|HDI_UNSUPPORTED_FIELDS|HDI_DI_SETITEM))
 
#define HDI_COMCTL32_4_0_FIELDS   (HDI_WIDTH|HDI_TEXT|HDI_FORMAT|HDI_LPARAM|HDI_BITMAP)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (header)
 
static BOOL HEADER_PrepareCallbackItems (const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
 
static void HEADER_FreeCallbackItems (HEADER_ITEM *lpItem)
 
static LRESULT HEADER_SendNotify (const HEADER_INFO *infoPtr, UINT code, NMHDR *hdr)
 
static LRESULT HEADER_SendCtrlCustomDraw (const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect)
 
static void HEADER_StoreHDItemInHeader (HEADER_ITEM *lpItem, UINT mask, const HDITEMW *phdi, BOOL fUnicode)
 
static LRESULT HEADER_IndexToOrder (const HEADER_INFO *infoPtr, INT iItem)
 
static INT HEADER_OrderToIndex (const HEADER_INFO *infoPtr, INT iorder)
 
static void HEADER_ChangeItemOrder (const HEADER_INFO *infoPtr, INT iItem, INT iNewOrder)
 
static INT HEADER_NextItem (const HEADER_INFO *infoPtr, INT iItem)
 
static INT HEADER_PrevItem (const HEADER_INFO *infoPtr, INT iItem)
 
static BOOL HEADER_IsItemFixed (const HEADER_INFO *infoPtr, INT iItem)
 
static void HEADER_SetItemBounds (HEADER_INFO *infoPtr)
 
static LRESULT HEADER_Size (HEADER_INFO *infoPtr)
 
static void HEADER_GetHotDividerRect (const HEADER_INFO *infoPtr, RECT *r)
 
static void HEADER_FillItemFrame (HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item, BOOL hottrack)
 
static void HEADER_DrawItemFrame (HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item)
 
static HRGN create_sort_arrow (INT x, INT y, INT h, BOOL is_up)
 
static INT HEADER_DrawItem (HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags)
 
static void HEADER_DrawHotDivider (const HEADER_INFO *infoPtr, HDC hdc)
 
static void HEADER_Refresh (HEADER_INFO *infoPtr, HDC hdc)
 
static void HEADER_RefreshItem (HEADER_INFO *infoPtr, INT iItem)
 
static void HEADER_InternalHitTest (const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pItem)
 
static void HEADER_DrawTrackLine (const HEADER_INFO *infoPtr, HDC hdc, INT x)
 
static void HEADER_CopyHDItemForNotify (const HEADER_INFO *infoPtr, HDITEMW *dest, const HDITEMW *src, BOOL fSourceUnicode, LPVOID *ppvScratch)
 
static UINT HEADER_NotifyCodeWtoA (UINT code)
 
static BOOL HEADER_SendSimpleNotify (const HEADER_INFO *infoPtr, UINT code)
 
static BOOL HEADER_SendNotifyWithHDItemT (const HEADER_INFO *infoPtr, UINT code, INT iItem, HDITEMW *lpItem)
 
static BOOL HEADER_SendNotifyWithIntFieldT (const HEADER_INFO *infoPtr, UINT code, INT iItem, INT mask, INT iValue)
 
static HIMAGELIST HEADER_CreateDragImage (HEADER_INFO *infoPtr, INT iItem)
 
static LRESULT HEADER_SetHotDivider (HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT HEADER_DeleteItem (HEADER_INFO *infoPtr, INT iItem)
 
static LRESULT HEADER_GetImageList (const HEADER_INFO *infoPtr)
 
static LRESULT HEADER_GetItemT (const HEADER_INFO *infoPtr, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
 
static LRESULT HEADER_GetItemCount (const HEADER_INFO *infoPtr)
 
static LRESULT HEADER_GetItemRect (const HEADER_INFO *infoPtr, INT iItem, LPRECT lpRect)
 
static LRESULT HEADER_GetOrderArray (const HEADER_INFO *infoPtr, INT size, LPINT order)
 
static INT has_duplicate (const INT *array, INT to, INT value)
 
static INT get_nextvalue (const INT *array, INT to, INT max)
 
static LRESULT HEADER_SetOrderArray (HEADER_INFO *infoPtr, INT size, const INT *order)
 
static LRESULT HEADER_GetUnicodeFormat (const HEADER_INFO *infoPtr)
 
static LRESULT HEADER_HitTest (const HEADER_INFO *infoPtr, LPHDHITTESTINFO phti)
 
static LRESULT HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
 
static LRESULT HEADER_Layout (HEADER_INFO *infoPtr, LPHDLAYOUT lpLayout)
 
static LRESULT HEADER_SetImageList (HEADER_INFO *infoPtr, HIMAGELIST himl)
 
static LRESULT HEADER_GetBitmapMargin (const HEADER_INFO *infoPtr)
 
static LRESULT HEADER_SetBitmapMargin (HEADER_INFO *infoPtr, INT iMargin)
 
static LRESULT HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
 
static LRESULT HEADER_SetUnicodeFormat (HEADER_INFO *infoPtr, WPARAM wParam)
 
static LRESULT HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 
static LRESULT HEADER_Destroy (HEADER_INFO *infoPtr)
 
static LRESULT HEADER_NCDestroy (HEADER_INFO *infoPtr)
 
static LRESULT HEADER_GetFont (const HEADER_INFO *infoPtr)
 
static BOOL HEADER_IsDragDistance (const HEADER_INFO *infoPtr, const POINT *pt)
 
static LRESULT HEADER_LButtonDblClk (const HEADER_INFO *infoPtr, INT x, INT y)
 
static LRESULT HEADER_LButtonDown (HEADER_INFO *infoPtr, INT x, INT y)
 
static LRESULT HEADER_LButtonUp (HEADER_INFO *infoPtr, INT x, INT y)
 
static LRESULT HEADER_NotifyFormat (HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT HEADER_MouseLeave (HEADER_INFO *infoPtr)
 
static LRESULT HEADER_MouseMove (HEADER_INFO *infoPtr, LPARAM lParam)
 
static LRESULT HEADER_Paint (HEADER_INFO *infoPtr, HDC hdcParam)
 
static LRESULT HEADER_RButtonUp (HEADER_INFO *infoPtr, INT x, INT y)
 
static LRESULT HEADER_SetCursor (HEADER_INFO *infoPtr, LPARAM lParam)
 
static LRESULT HEADER_SetFont (HEADER_INFO *infoPtr, HFONT hFont, WORD Redraw)
 
static LRESULT HEADER_SetRedraw (HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static INT HEADER_StyleChanged (HEADER_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 
static LRESULT HEADER_ThemeChanged (const HEADER_INFO *infoPtr)
 
static INT HEADER_SetFilterChangeTimeout (HEADER_INFO *infoPtr, INT timeout)
 
static LRESULT WINAPI HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
VOID HEADER_Register (void)
 
VOID HEADER_Unregister (void)
 

Variables

static const WCHAR themeClass [] = {'H','e','a','d','e','r',0}
 

Macro Definition Documentation

◆ DIVIDER_WIDTH

#define DIVIDER_WIDTH   10

Definition at line 98 of file header.c.

◆ HDI_COMCTL32_4_0_FIELDS

#define HDI_COMCTL32_4_0_FIELDS   (HDI_WIDTH|HDI_TEXT|HDI_FORMAT|HDI_LPARAM|HDI_BITMAP)

Definition at line 107 of file header.c.

◆ HDI_SUPPORTED_FIELDS

Definition at line 104 of file header.c.

◆ HDI_UNKNOWN_FIELDS

Definition at line 106 of file header.c.

◆ HDI_UNSUPPORTED_FIELDS

#define HDI_UNSUPPORTED_FIELDS   (HDI_FILTER)

Definition at line 105 of file header.c.

◆ HDN_FIRST_UNICODE

#define HDN_FIRST_UNICODE   (HDN_FIRST-HDN_UNICODE_OFFSET)

Definition at line 102 of file header.c.

◆ HDN_UNICODE_OFFSET

#define HDN_UNICODE_OFFSET   20

Definition at line 101 of file header.c.

◆ HOT_DIVIDER_WIDTH

#define HOT_DIVIDER_WIDTH   2

Definition at line 99 of file header.c.

◆ MAX_HEADER_TEXT_LEN

#define MAX_HEADER_TEXT_LEN   260

Definition at line 100 of file header.c.

◆ VERT_BORDER

#define VERT_BORDER   4

Definition at line 97 of file header.c.

Function Documentation

◆ create_sort_arrow()

static HRGN create_sort_arrow ( INT  x,
INT  y,
INT  h,
BOOL  is_up 
)
static

Definition at line 332 of file header.c.

333{
334 char buffer[256];
336 DWORD size = FIELD_OFFSET(RGNDATA, Buffer[h * sizeof(RECT)]);
337 INT i, yinc = 1;
338 HRGN rgn;
339
340 if (size > sizeof(buffer))
341 {
342 data = heap_alloc( size );
343 if (!data) return NULL;
344 }
345 data->rdh.dwSize = sizeof(data->rdh);
346 data->rdh.iType = RDH_RECTANGLES;
347 data->rdh.nCount = 0;
348 data->rdh.nRgnSize = h * sizeof(RECT);
349
350 if (!is_up)
351 {
352 y += h - 1;
353 yinc = -1;
354 }
355
356 x += h - 1; /* set x to the centre */
357
358 for (i = 0; i < h; i++, y += yinc)
359 {
360 RECT *rect = (RECT *)data->Buffer + data->rdh.nCount;
361 rect->left = x - i;
362 rect->top = y;
363 rect->right = x + i + 1;
364 rect->bottom = y + 1;
365 data->rdh.nCount++;
366 }
367 rgn = ExtCreateRegion( NULL, size, data );
368 if (data != (RGNDATA *)buffer) heap_free( data );
369 return rgn;
370}
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: bufpool.h:45
#define NULL
Definition: types.h:112
unsigned long DWORD
Definition: ntddk_ex.h:95
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
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
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
& rect
Definition: startmenu.cpp:1413
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int32_t INT
Definition: typedefs.h:58
#define RECT
Definition: precomp.h:26
#define RDH_RECTANGLES
Definition: wingdi.h:669
HRGN WINAPI ExtCreateRegion(_In_opt_ const XFORM *lpx, _In_ DWORD nCount, _In_reads_bytes_(nCount) const RGNDATA *lpData)

Referenced by HEADER_DrawItem().

◆ get_nextvalue()

static INT get_nextvalue ( const INT array,
INT  to,
INT  max 
)
static

Definition at line 1321 of file header.c.

1322{
1323 INT i;
1324 for(i = 0; i < max; i++)
1325 if (has_duplicate(array, to, i) == -1) return i;
1326 return 0;
1327}
static INT has_duplicate(const INT *array, INT to, INT value)
Definition: header.c:1312
#define max(a, b)
Definition: svc.c:63

Referenced by HEADER_SetOrderArray().

◆ has_duplicate()

static INT has_duplicate ( const INT array,
INT  to,
INT  value 
)
static

Definition at line 1312 of file header.c.

1313{
1314 INT i;
1315 for(i = 0; i < to; i++)
1316 if (array[i] == value) return i;
1317 return -1;
1318}
Definition: pdh_main.c:94

Referenced by get_nextvalue(), HEADER_SetOrderArray(), test_secondary(), and test_secondary8().

◆ HEADER_ChangeItemOrder()

static void HEADER_ChangeItemOrder ( const HEADER_INFO infoPtr,
INT  iItem,
INT  iNewOrder 
)
static

Definition at line 184 of file header.c.

185{
186 HEADER_ITEM *lpItem = &infoPtr->items[iItem];
187 INT i, nMin, nMax;
188
189 TRACE("%d: %d->%d\n", iItem, lpItem->iOrder, iNewOrder);
190 if (lpItem->iOrder < iNewOrder)
191 {
192 memmove(&infoPtr->order[lpItem->iOrder],
193 &infoPtr->order[lpItem->iOrder + 1],
194 (iNewOrder - lpItem->iOrder) * sizeof(INT));
195 }
196 if (iNewOrder < lpItem->iOrder)
197 {
198 memmove(&infoPtr->order[iNewOrder + 1],
199 &infoPtr->order[iNewOrder],
200 (lpItem->iOrder - iNewOrder) * sizeof(INT));
201 }
202 infoPtr->order[iNewOrder] = iItem;
203 nMin = min(lpItem->iOrder, iNewOrder);
204 nMax = max(lpItem->iOrder, iNewOrder);
205 for (i = nMin; i <= nMax; i++)
206 infoPtr->items[infoPtr->order[i]].iOrder = i;
207}
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define min(a, b)
Definition: monoChain.cc:55
#define TRACE(s)
Definition: solgame.cpp:4
INT * order
Definition: header.c:92
HEADER_ITEM * items
Definition: header.c:91
INT iOrder
Definition: header.c:57

Referenced by HEADER_LButtonUp(), and HEADER_SetItemT().

◆ HEADER_CopyHDItemForNotify()

static void HEADER_CopyHDItemForNotify ( const HEADER_INFO infoPtr,
HDITEMW dest,
const HDITEMW src,
BOOL  fSourceUnicode,
LPVOID ppvScratch 
)
static

Definition at line 851 of file header.c.

853{
854 *ppvScratch = NULL;
855 *dest = *src;
856
857 if (src->mask & HDI_TEXT && src->pszText != LPSTR_TEXTCALLBACKW) /* covers TEXTCALLBACKA as well */
858 {
859 if (fSourceUnicode && infoPtr->nNotifyFormat != NFR_UNICODE)
860 {
861 dest->pszText = NULL;
862 Str_SetPtrWtoA((LPSTR *)&dest->pszText, src->pszText);
863 *ppvScratch = dest->pszText;
864 }
865
866 if (!fSourceUnicode && infoPtr->nNotifyFormat == NFR_UNICODE)
867 {
868 dest->pszText = NULL;
869 Str_SetPtrAtoW(&dest->pszText, (LPSTR)src->pszText);
870 *ppvScratch = dest->pszText;
871 }
872 }
873}
BOOL Str_SetPtrWtoA(LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN
BOOL Str_SetPtrAtoW(LPWSTR *lppDest, LPCSTR lpSrc) DECLSPEC_HIDDEN
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:135
#define HDI_TEXT
Definition: commctrl.h:704
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2380
INT nNotifyFormat
Definition: header.c:69
#define NFR_UNICODE
Definition: winuser.h:2449
char * LPSTR
Definition: xmlstorage.h:182

Referenced by HEADER_SetItemT().

◆ HEADER_Create()

static LRESULT HEADER_Create ( HWND  hwnd,
const CREATESTRUCTW lpcs 
)
static

Definition at line 1576 of file header.c.

1577{
1578 HEADER_INFO *infoPtr;
1580 HFONT hOldFont;
1581 HDC hdc;
1582
1583 infoPtr = heap_alloc_zero (sizeof(*infoPtr));
1584 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
1585
1586 infoPtr->hwndSelf = hwnd;
1587 infoPtr->hwndNotify = lpcs->hwndParent;
1588 infoPtr->uNumItem = 0;
1589 infoPtr->hFont = 0;
1590 infoPtr->items = 0;
1591 infoPtr->order = 0;
1592 infoPtr->bRectsValid = FALSE;
1593 infoPtr->hcurArrow = LoadCursorW (0, (LPWSTR)IDC_ARROW);
1596 infoPtr->bPressed = FALSE;
1597 infoPtr->bTracking = FALSE;
1598 infoPtr->dwStyle = lpcs->style;
1599 infoPtr->iMoveItem = 0;
1600 infoPtr->himl = 0;
1601 infoPtr->iHotItem = -1;
1602 infoPtr->iHotDivider = -1;
1603 infoPtr->iMargin = 3*GetSystemMetrics(SM_CXEDGE);
1604 infoPtr->nNotifyFormat =
1605 SendMessageW (infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)hwnd, NF_QUERY);
1606 infoPtr->filter_change_timeout = 1000;
1607
1608 hdc = GetDC (0);
1611 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
1612 SelectObject (hdc, hOldFont);
1613 ReleaseDC (0, hdc);
1614
1616
1617 return 0;
1618}
#define IDC_DIVIDER
Definition: comctl32.h:95
#define IDC_DIVIDEROPEN
Definition: comctl32.h:96
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
#define FALSE
Definition: types.h:117
static const WCHAR themeClass[]
Definition: header.c:115
#define VERT_BORDER
Definition: header.c:97
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL bPressed
Definition: header.c:77
BOOL bTracking
Definition: header.c:79
UINT uNumItem
Definition: header.c:70
INT nHeight
Definition: header.c:71
HCURSOR hcurDivider
Definition: header.c:74
INT iMargin
Definition: header.c:87
HFONT hFont
Definition: header.c:72
INT iHotDivider
Definition: header.c:86
HIMAGELIST himl
Definition: header.c:90
HCURSOR hcurDivopen
Definition: header.c:75
DWORD dwStyle
Definition: header.c:81
INT filter_change_timeout
Definition: header.c:88
INT iHotItem
Definition: header.c:85
BOOL bRectsValid
Definition: header.c:93
HWND hwndSelf
Definition: header.c:67
INT iMoveItem
Definition: header.c:82
HWND hwndNotify
Definition: header.c:68
HCURSOR hcurArrow
Definition: header.c:73
Definition: time.h:68
uint32_t DWORD_PTR
Definition: typedefs.h:65
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define SYSTEM_FONT
Definition: wingdi.h:911
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SM_CXEDGE
Definition: winuser.h:1002
#define IDC_ARROW
Definition: winuser.h:682
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HDC WINAPI GetDC(_In_opt_ HWND)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SetWindowLongPtrW
Definition: winuser.h:5336
int WINAPI GetSystemMetrics(_In_ int)
#define NF_QUERY
Definition: winuser.h:2450
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by HEADER_WindowProc().

◆ HEADER_CreateDragImage()

static HIMAGELIST HEADER_CreateDragImage ( HEADER_INFO infoPtr,
INT  iItem 
)
static

Definition at line 1072 of file header.c.

1073{
1074 HEADER_ITEM *lpItem;
1076 HBITMAP hMemory, hOldBitmap;
1077 LRESULT lCDFlags;
1078 RECT rc;
1079 HDC hMemoryDC;
1080 HDC hDeviceDC;
1081 int height, width;
1082 HFONT hFont;
1083
1084 if (iItem >= infoPtr->uNumItem)
1085 return NULL;
1086
1087 if (!infoPtr->bRectsValid)
1088 HEADER_SetItemBounds(infoPtr);
1089
1090 lpItem = &infoPtr->items[iItem];
1091 width = lpItem->rect.right - lpItem->rect.left;
1092 height = lpItem->rect.bottom - lpItem->rect.top;
1093
1094 hDeviceDC = GetDC(NULL);
1095 hMemoryDC = CreateCompatibleDC(hDeviceDC);
1097 ReleaseDC(NULL, hDeviceDC);
1098 hOldBitmap = SelectObject(hMemoryDC, hMemory);
1099 SetViewportOrgEx(hMemoryDC, -lpItem->rect.left, -lpItem->rect.top, NULL);
1100 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject(SYSTEM_FONT);
1101 SelectObject(hMemoryDC, hFont);
1102
1103 GetClientRect(infoPtr->hwndSelf, &rc);
1104 lCDFlags = HEADER_SendCtrlCustomDraw(infoPtr, CDDS_PREPAINT, hMemoryDC, &rc);
1105 HEADER_DrawItem(infoPtr, hMemoryDC, iItem, FALSE, lCDFlags);
1106 if (lCDFlags & CDRF_NOTIFYPOSTPAINT)
1107 HEADER_SendCtrlCustomDraw(infoPtr, CDDS_POSTPAINT, hMemoryDC, &rc);
1108
1109 hMemory = SelectObject(hMemoryDC, hOldBitmap);
1110 DeleteDC(hMemoryDC);
1111
1112 if (hMemory == NULL) /* if anything failed */
1113 return NULL;
1114
1118 return himl;
1119}
HFONT hFont
Definition: main.c:53
HIMAGELIST himl
static LRESULT HEADER_SendCtrlCustomDraw(const HEADER_INFO *infoPtr, DWORD dwDrawStage, HDC hdc, const RECT *rect)
Definition: header.c:903
static INT HEADER_DrawItem(HEADER_INFO *infoPtr, HDC hdc, INT iItem, BOOL bHotTrack, LRESULT lCDFlags)
Definition: header.c:373
static void HEADER_SetItemBounds(HEADER_INFO *infoPtr)
Definition: header.c:231
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
WDFMEMORY hMemory
pKey DeleteObject()
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
static HBITMAP
Definition: button.c:44
#define ILC_COLORDDB
Definition: commctrl.h:353
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define CDDS_POSTPAINT
Definition: commctrl.h:281
RECT rect
Definition: header.c:60
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG_PTR LRESULT
Definition: windef.h:209
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by HEADER_MouseMove(), and HEADER_WindowProc().

◆ HEADER_DeleteItem()

static LRESULT HEADER_DeleteItem ( HEADER_INFO infoPtr,
INT  iItem 
)
static

Definition at line 1171 of file header.c.

1172{
1173 INT iOrder;
1174 UINT i;
1175
1176 TRACE("[iItem=%d]\n", iItem);
1177
1178 if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem))
1179 return FALSE;
1180
1181 for (i = 0; i < infoPtr->uNumItem; i++)
1182 TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
1183
1184 iOrder = infoPtr->items[iItem].iOrder;
1185 heap_free(infoPtr->items[iItem].pszText);
1186
1187 infoPtr->uNumItem--;
1188 memmove(&infoPtr->items[iItem], &infoPtr->items[iItem + 1],
1189 (infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM));
1190 memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1],
1191 (infoPtr->uNumItem - iOrder) * sizeof(INT));
1192 infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
1193 infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
1194
1195 /* Correct the orders */
1196 for (i = 0; i < infoPtr->uNumItem; i++)
1197 {
1198 if (infoPtr->order[i] > iItem)
1199 infoPtr->order[i]--;
1200 if (i >= iOrder)
1201 infoPtr->items[infoPtr->order[i]].iOrder = i;
1202 }
1203 for (i = 0; i < infoPtr->uNumItem; i++)
1204 TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
1205
1206 HEADER_SetItemBounds (infoPtr);
1207 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1208
1209 return TRUE;
1210}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
#define TRUE
Definition: types.h:120
unsigned int UINT
Definition: ndis.h:50
LPWSTR pszText
Definition: header.c:53
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by HEADER_WindowProc().

◆ HEADER_Destroy()

static LRESULT HEADER_Destroy ( HEADER_INFO infoPtr)
static

Definition at line 1622 of file header.c.

1623{
1624 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
1625 CloseThemeData(theme);
1626 return 0;
1627}
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND

Referenced by HEADER_WindowProc().

◆ HEADER_DrawHotDivider()

static void HEADER_DrawHotDivider ( const HEADER_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 606 of file header.c.

607{
608 HBRUSH brush;
609 RECT r;
610
611 HEADER_GetHotDividerRect(infoPtr, &r);
613 FillRect(hdc, &r, brush);
614 DeleteObject(brush);
615}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
static void HEADER_GetHotDividerRect(const HEADER_INFO *infoPtr, RECT *r)
Definition: header.c:263
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
COLORREF clrHighlight
Definition: comctl32.h:169
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

Referenced by HEADER_Refresh().

◆ HEADER_DrawItem()

static INT HEADER_DrawItem ( HEADER_INFO infoPtr,
HDC  hdc,
INT  iItem,
BOOL  bHotTrack,
LRESULT  lCDFlags 
)
static

Definition at line 373 of file header.c.

374{
375 HEADER_ITEM *phdi = &infoPtr->items[iItem];
376 RECT r;
377 INT oldBkMode;
378 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
379 NMCUSTOMDRAW nmcd;
380 int state = 0;
381
382 TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, (infoPtr->nNotifyFormat == NFR_UNICODE));
383
384 r = phdi->rect;
385 if (r.right - r.left == 0)
386 return phdi->rect.right;
387
388 if (theme)
389 state = (phdi->bDown) ? HIS_PRESSED : (bHotTrack ? HIS_HOT : HIS_NORMAL);
390
391 /* Set the colors before sending NM_CUSTOMDRAW so that it can change them */
392 SetTextColor(hdc, (bHotTrack && !theme) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);
394
395 if (lCDFlags & CDRF_NOTIFYITEMDRAW && !(phdi->fmt & HDF_OWNERDRAW))
396 {
397 LRESULT lCDItemFlags;
398
400 nmcd.hdc = hdc;
401 nmcd.dwItemSpec = iItem;
402 nmcd.rc = r;
403 nmcd.uItemState = phdi->bDown ? CDIS_SELECTED : 0;
404 nmcd.lItemlParam = phdi->lParam;
405
406 lCDItemFlags = HEADER_SendNotify(infoPtr, NM_CUSTOMDRAW, (NMHDR *)&nmcd);
407 if (lCDItemFlags & CDRF_SKIPDEFAULT)
408 return phdi->rect.right;
409 }
410
411 /* Fill background, owner could draw over it. */
412 HEADER_FillItemFrame(infoPtr, hdc, &r, phdi, bHotTrack);
413
414 if (phdi->fmt & HDF_OWNERDRAW)
415 {
416 DRAWITEMSTRUCT dis;
417 BOOL ret;
418
419 dis.CtlType = ODT_HEADER;
420 dis.CtlID = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
421 dis.itemID = iItem;
423 dis.itemState = phdi->bDown ? ODS_SELECTED : 0;
424 dis.hwndItem = infoPtr->hwndSelf;
425 dis.hDC = hdc;
426 dis.rcItem = phdi->rect;
427 dis.itemData = phdi->lParam;
428 oldBkMode = SetBkMode(hdc, TRANSPARENT);
429 ret = SendMessageW (infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
430 if (oldBkMode != TRANSPARENT)
431 SetBkMode(hdc, oldBkMode);
432
433 if (!ret)
434 HEADER_FillItemFrame(infoPtr, hdc, &r, phdi, bHotTrack);
435
436 /* Edges are always drawn if we don't have attached theme. */
437 HEADER_DrawItemFrame(infoPtr, hdc, &r, phdi);
438 /* If application processed WM_DRAWITEM we should skip label painting,
439 edges are drawn no matter what. */
440 if (ret) return phdi->rect.right;
441 }
442 else
443 HEADER_DrawItemFrame(infoPtr, hdc, &r, phdi);
444
445 if (phdi->bDown) {
446 r.left += 2;
447 r.top += 2;
448 }
449
450 /* Now text and image */
451 {
452 INT rw, rh; /* width and height of r */
453 INT *x = NULL; /* x and ... */
454 UINT *w = NULL; /* ... width of the pic (bmp or img) which is part of cnt */
455 /* cnt,txt,img,bmp */
456 INT cx, tx, ix, bx;
457 UINT cw, tw, iw, bw;
458 INT img_cx, img_cy;
459 INT sort_w, sort_x, sort_h;
460 BITMAP bmp;
461
463 cw = iw = bw = sort_w = sort_h = 0;
464 rw = r.right - r.left;
465 rh = r.bottom - r.top;
466
467 if (phdi->fmt & HDF_STRING) {
469
471
472 if (theme) {
475 } else {
476 DrawTextW (hdc, phdi->pszText, -1,
478 }
479 cw = textRect.right - textRect.left + 2 * infoPtr->iMargin;
480 }
481
482 if (phdi->fmt & (HDF_SORTUP | HDF_SORTDOWN)) {
483 sort_h = MulDiv( infoPtr->nHeight - VERT_BORDER, 4, 13 );
484 sort_w = 2 * sort_h - 1 + infoPtr->iMargin * 2;
485 cw += sort_w;
486 } else { /* sort arrows take precedent over images/bitmaps */
487 if ((phdi->fmt & HDF_IMAGE) && ImageList_GetIconSize( infoPtr->himl, &img_cx, &img_cy )) {
488 iw = img_cx + 2 * infoPtr->iMargin;
489 x = &ix;
490 w = &iw;
491 }
492
493 if ((phdi->fmt & HDF_BITMAP) && (phdi->hbm)) {
494 GetObjectW (phdi->hbm, sizeof(BITMAP), &bmp);
495 bw = bmp.bmWidth + 2 * infoPtr->iMargin;
496 if (!iw) {
497 x = &bx;
498 w = &bw;
499 }
500 }
501 if (bw || iw)
502 cw += *w;
503 }
504
505 /* align cx using the unclipped cw */
506 if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_LEFT)
507 cx = r.left;
508 else if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER)
509 cx = r.left + rw / 2 - cw / 2;
510 else /* HDF_RIGHT */
511 cx = r.right - cw;
512
513 /* clip cx & cw */
514 if (cx < r.left)
515 cx = r.left;
516 if (cx + cw > r.right)
517 cw = r.right - cx;
518
519 tx = cx + infoPtr->iMargin;
520 /* since cw might have changed we have to recalculate tw */
521 tw = cw - infoPtr->iMargin * 2;
522
523 tw -= sort_w;
524 sort_x = cx + tw + infoPtr->iMargin * 3;
525
526 if (iw || bw) {
527 tw -= *w;
528 if (phdi->fmt & HDF_BITMAP_ON_RIGHT) {
529 /* put pic behind text */
530 *x = cx + tw + infoPtr->iMargin * 3;
531 } else {
532 *x = cx + infoPtr->iMargin;
533 /* move text behind pic */
534 tx += *w;
535 }
536 }
537
538 if (iw && bw) {
539 /* since we're done with the layout we can
540 now calculate the position of bmp which
541 has no influence on alignment and layout
542 because of img */
543 if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_RIGHT)
544 bx = cx - bw + infoPtr->iMargin;
545 else
546 bx = cx + cw + infoPtr->iMargin;
547 }
548
549 if (sort_w || iw || bw) {
550 HDC hClipDC = GetDC(infoPtr->hwndSelf);
551 HRGN hClipRgn = CreateRectRgn(r.left, r.top, r.right, r.bottom);
552 SelectClipRgn(hClipDC, hClipRgn);
553
554 if (sort_w) {
555 HRGN arrow = create_sort_arrow( sort_x, r.top + (rh - sort_h) / 2,
556 sort_h, phdi->fmt & HDF_SORTUP );
557 if (arrow) {
558 FillRgn( hClipDC, arrow, GetSysColorBrush( COLOR_GRAYTEXT ) );
559 DeleteObject( arrow );
560 }
561 }
562
563 if (bw) {
564 HDC hdcBitmap = CreateCompatibleDC (hClipDC);
565 SelectObject (hdcBitmap, phdi->hbm);
566 BitBlt (hClipDC, bx, r.top + (rh - bmp.bmHeight) / 2,
567 bmp.bmWidth, bmp.bmHeight, hdcBitmap, 0, 0, SRCCOPY);
569 }
570
571 if (iw) {
572 ImageList_DrawEx (infoPtr->himl, phdi->iImage, hClipDC,
573 ix, r.top + (rh - img_cy) / 2,
574 img_cx, img_cy, CLR_DEFAULT, CLR_DEFAULT, 0);
575 }
576
577 DeleteObject(hClipRgn);
578 ReleaseDC(infoPtr->hwndSelf, hClipDC);
579 }
580
581 if (((phdi->fmt & HDF_STRING)
582 || (!(phdi->fmt & (HDF_OWNERDRAW|HDF_STRING|HDF_BITMAP|
583 HDF_BITMAP_ON_RIGHT|HDF_IMAGE)))) /* no explicit format specified? */
584 && (phdi->pszText)) {
585 oldBkMode = SetBkMode(hdc, TRANSPARENT);
586 r.left = tx;
587 r.right = tx + tw;
588 if (theme) {
591 0, &r);
592 } else {
593 DrawTextW (hdc, phdi->pszText, -1,
595 }
596 if (oldBkMode != TRANSPARENT)
597 SetBkMode(hdc, oldBkMode);
598 }
600 }
601
602 return phdi->rect.right;
603}
static int bw
Definition: maze.c:120
static int state
Definition: maze.c:121
static void HEADER_FillItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item, BOOL hottrack)
Definition: header.c:295
static LRESULT HEADER_SendNotify(const HEADER_INFO *infoPtr, UINT code, NMHDR *hdr)
Definition: header.c:885
static void HEADER_DrawItemFrame(HEADER_INFO *infoPtr, HDC hdc, RECT *r, const HEADER_ITEM *item)
Definition: header.c:313
static BOOL HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
Definition: header.c:977
static void HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
Definition: header.c:1059
static HRGN create_sort_arrow(INT x, INT y, INT h, BOOL is_up)
Definition: header.c:332
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_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
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:1377
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:1809
static VOID NTAPI 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:49
unsigned int BOOL
Definition: ntddk_ex.h:94
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BITMAP bmp
Definition: alphablend.c:62
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:17
#define ODT_HEADER
Definition: commctrl.h:78
#define CDDS_ITEM
Definition: commctrl.h:284
#define HDF_LEFT
Definition: commctrl.h:713
#define HDF_OWNERDRAW
Definition: commctrl.h:719
#define HDF_CENTER
Definition: commctrl.h:715
#define HDF_RIGHT
Definition: commctrl.h:714
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define HDF_IMAGE
Definition: commctrl.h:723
_Out_opt_ int * cx
Definition: commctrl.h:585
#define CDIS_SELECTED
Definition: commctrl.h:291
#define HDF_SORTUP
Definition: commctrl.h:724
#define HDF_BITMAP_ON_RIGHT
Definition: commctrl.h:722
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
#define HDF_STRING
Definition: commctrl.h:720
#define CLR_DEFAULT
Definition: commctrl.h:320
#define HDF_BITMAP
Definition: commctrl.h:721
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define HDI_IMAGE
Definition: commctrl.h:708
#define HDF_SORTDOWN
Definition: commctrl.h:725
#define HDF_JUSTIFYMASK
Definition: commctrl.h:716
#define rw
Definition: rosglue.h:38
HDC hdcBitmap
Definition: solcreate.cpp:9
RECT textRect
Definition: startmenu.cpp:1392
COLORREF clr3dFace
Definition: comctl32.h:175
LPARAM lParam
Definition: header.c:55
INT iImage
Definition: header.c:56
BOOL bDown
Definition: header.c:59
INT fmt
Definition: header.c:54
HBITMAP hbm
Definition: header.c:52
Definition: bl.h:1331
ULONG_PTR itemData
Definition: winuser.h:3083
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
@ 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
LONG_PTR LPARAM
Definition: windef.h:208
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)
#define TRANSPARENT
Definition: wingdi.h:950
#define SRCCOPY
Definition: wingdi.h:333
int WINAPI FillRgn(_In_ HDC, _In_ HRGN, _In_ HBRUSH)
Definition: painting.c:183
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define ODS_SELECTED
Definition: winuser.h:2535
#define COLOR_BTNTEXT
Definition: winuser.h:927
#define GetWindowLongPtrW
Definition: winuser.h:4819
#define COLOR_GRAYTEXT
Definition: winuser.h:926
#define ODA_DRAWENTIRE
Definition: winuser.h:2532
#define DT_END_ELLIPSIS
Definition: winuser.h:529
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define WM_DRAWITEM
Definition: winuser.h:1635
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define DT_VCENTER
Definition: winuser.h:543
#define GWLP_ID
Definition: winuser.h:854
#define DT_CALCRECT
Definition: winuser.h:526

Referenced by HEADER_CreateDragImage(), and HEADER_Refresh().

◆ HEADER_DrawItemFrame()

static void HEADER_DrawItemFrame ( HEADER_INFO infoPtr,
HDC  hdc,
RECT r,
const HEADER_ITEM item 
)
static

Definition at line 313 of file header.c.

314{
315 if (GetWindowTheme(infoPtr->hwndSelf)) return;
316
317 if (!(infoPtr->dwStyle & HDS_FLAT))
318 {
319 if (infoPtr->dwStyle & HDS_BUTTONS) {
320 if (item->bDown)
322 else
324 }
325 else
327 }
328}
static ATOM item
Definition: dde.c:856
#define HDS_BUTTONS
Definition: commctrl.h:629
#define HDS_FLAT
Definition: commctrl.h:635
#define BF_ADJUST
Definition: winuser.h:470
#define EDGE_ETCHED
Definition: winuser.h:452
#define BF_BOTTOM
Definition: winuser.h:457
#define BF_FLAT
Definition: winuser.h:471
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define BF_RIGHT
Definition: winuser.h:456
#define BDR_RAISEDOUTER
Definition: winuser.h:442
#define BF_SOFT
Definition: winuser.h:469
#define BF_RECT
Definition: winuser.h:462
#define EDGE_RAISED
Definition: winuser.h:450

Referenced by HEADER_DrawItem().

◆ HEADER_DrawTrackLine()

static void HEADER_DrawTrackLine ( const HEADER_INFO infoPtr,
HDC  hdc,
INT  x 
)
static

Definition at line 829 of file header.c.

830{
831 RECT rect;
832
833 GetClientRect (infoPtr->hwndSelf, &rect);
834 PatBlt( hdc, x, rect.top, 1, rect.bottom - rect.top, DSTINVERT );
835}
#define DSTINVERT
Definition: wingdi.h:327
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)

Referenced by HEADER_LButtonDown(), HEADER_LButtonUp(), and HEADER_MouseMove().

◆ HEADER_FillItemFrame()

static void HEADER_FillItemFrame ( HEADER_INFO infoPtr,
HDC  hdc,
RECT r,
const HEADER_ITEM item,
BOOL  hottrack 
)
static

Definition at line 295 of file header.c.

296{
297 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
298
299 if (theme) {
300 int state = (item->bDown) ? HIS_PRESSED : (hottrack ? HIS_HOT : HIS_NORMAL);
303 }
304 else
305 {
306 HBRUSH hbr = CreateSolidBrush(GetBkColor(hdc));
307 FillRect(hdc, r, hbr);
308 DeleteObject(hbr);
309 }
310}
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
HRESULT WINAPI GetThemeBackgroundContentRect(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pBoundingRect, RECT *pContentRect)
Definition: draw.c:1479
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978

Referenced by HEADER_DrawItem().

◆ HEADER_FreeCallbackItems()

static void HEADER_FreeCallbackItems ( HEADER_ITEM lpItem)
static

Definition at line 1059 of file header.c.

1060{
1061 if (lpItem->callbackMask&HDI_TEXT)
1062 {
1063 heap_free(lpItem->pszText);
1064 lpItem->pszText = NULL;
1065 }
1066
1067 if (lpItem->callbackMask&HDI_IMAGE)
1068 lpItem->iImage = I_IMAGECALLBACK;
1069}
#define I_IMAGECALLBACK
Definition: commctrl.h:2385
DWORD callbackMask
Definition: header.c:61

Referenced by HEADER_DrawItem(), and HEADER_GetItemT().

◆ HEADER_GetBitmapMargin()

static LRESULT HEADER_GetBitmapMargin ( const HEADER_INFO infoPtr)
static

Definition at line 1511 of file header.c.

1512{
1513 return infoPtr->iMargin;
1514}

Referenced by HEADER_WindowProc().

◆ HEADER_GetFont()

static LRESULT HEADER_GetFont ( const HEADER_INFO infoPtr)
inlinestatic

Definition at line 1652 of file header.c.

1653{
1654 return (LRESULT)infoPtr->hFont;
1655}

Referenced by HEADER_WindowProc().

◆ HEADER_GetHotDividerRect()

static void HEADER_GetHotDividerRect ( const HEADER_INFO infoPtr,
RECT r 
)
static

Definition at line 263 of file header.c.

264{
265 INT iDivider = infoPtr->iHotDivider;
266 if (infoPtr->uNumItem > 0)
267 {
268 HEADER_ITEM *lpItem;
269
270 if (iDivider < infoPtr->uNumItem)
271 {
272 lpItem = &infoPtr->items[iDivider];
273 r->left = lpItem->rect.left - HOT_DIVIDER_WIDTH/2;
274 r->right = lpItem->rect.left + HOT_DIVIDER_WIDTH/2;
275 }
276 else
277 {
278 lpItem = &infoPtr->items[HEADER_OrderToIndex(infoPtr, infoPtr->uNumItem-1)];
279 r->left = lpItem->rect.right - HOT_DIVIDER_WIDTH/2;
280 r->right = lpItem->rect.right + HOT_DIVIDER_WIDTH/2;
281 }
282 r->top = lpItem->rect.top;
283 r->bottom = lpItem->rect.bottom;
284 }
285 else
286 {
287 RECT clientRect;
288 GetClientRect(infoPtr->hwndSelf, &clientRect);
289 *r = clientRect;
290 r->right = r->left + HOT_DIVIDER_WIDTH/2;
291 }
292}
#define HOT_DIVIDER_WIDTH
Definition: header.c:99
static INT HEADER_OrderToIndex(const HEADER_INFO *infoPtr, INT iorder)
Definition: header.c:176

Referenced by HEADER_DrawHotDivider(), and HEADER_SetHotDivider().

◆ HEADER_GetImageList()

static LRESULT HEADER_GetImageList ( const HEADER_INFO infoPtr)
static

Definition at line 1214 of file header.c.

1215{
1216 return (LRESULT)infoPtr->himl;
1217}

Referenced by HEADER_WindowProc().

◆ HEADER_GetItemCount()

static LRESULT HEADER_GetItemCount ( const HEADER_INFO infoPtr)
inlinestatic

Definition at line 1279 of file header.c.

1280{
1281 return infoPtr->uNumItem;
1282}

Referenced by HEADER_WindowProc().

◆ HEADER_GetItemRect()

static LRESULT HEADER_GetItemRect ( const HEADER_INFO infoPtr,
INT  iItem,
LPRECT  lpRect 
)
static

Definition at line 1286 of file header.c.

1287{
1288 if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem))
1289 return FALSE;
1290
1291 lpRect->left = infoPtr->items[iItem].rect.left;
1292 lpRect->right = infoPtr->items[iItem].rect.right;
1293 lpRect->top = infoPtr->items[iItem].rect.top;
1294 lpRect->bottom = infoPtr->items[iItem].rect.bottom;
1295
1296 return TRUE;
1297}

Referenced by HEADER_WindowProc().

◆ HEADER_GetItemT()

static LRESULT HEADER_GetItemT ( const HEADER_INFO infoPtr,
INT  nItem,
LPHDITEMW  phdi,
BOOL  bUnicode 
)
static

Definition at line 1221 of file header.c.

1222{
1223 HEADER_ITEM *lpItem;
1224 UINT mask;
1225
1226 if (!phdi)
1227 return FALSE;
1228
1229 TRACE("[nItem=%d]\n", nItem);
1230
1231 mask = phdi->mask;
1232 if (mask == 0)
1233 return TRUE;
1234
1235 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem))
1236 return FALSE;
1237
1239 {
1240 TRACE("mask %x contains unknown fields. Using only comctl32 4.0 fields\n", mask);
1242 }
1243
1244 lpItem = &infoPtr->items[nItem];
1245 HEADER_PrepareCallbackItems(infoPtr, nItem, mask);
1246
1247 if (mask & HDI_BITMAP)
1248 phdi->hbm = lpItem->hbm;
1249
1250 if (mask & HDI_FORMAT)
1251 phdi->fmt = lpItem->fmt;
1252
1253 if (mask & HDI_WIDTH)
1254 phdi->cxy = lpItem->cxy;
1255
1256 if (mask & HDI_LPARAM)
1257 phdi->lParam = lpItem->lParam;
1258
1259 if (mask & HDI_IMAGE)
1260 phdi->iImage = lpItem->iImage;
1261
1262 if (mask & HDI_ORDER)
1263 phdi->iOrder = lpItem->iOrder;
1264
1265 if (mask & HDI_TEXT)
1266 {
1267 if (bUnicode)
1268 Str_GetPtrW (lpItem->pszText, phdi->pszText, phdi->cchTextMax);
1269 else
1270 Str_GetPtrWtoA (lpItem->pszText, (LPSTR)phdi->pszText, phdi->cchTextMax);
1271 }
1272
1274 return TRUE;
1275}
INT Str_GetPtrWtoA(LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN
INT WINAPI Str_GetPtrW(LPCWSTR, LPWSTR, INT)
Definition: string.c:204
#define HDI_COMCTL32_4_0_FIELDS
Definition: header.c:107
#define HDI_UNKNOWN_FIELDS
Definition: header.c:106
GLenum GLint GLuint mask
Definition: glext.h:6028
#define HDI_WIDTH
Definition: commctrl.h:702
#define HDI_BITMAP
Definition: commctrl.h:707
#define HDI_FORMAT
Definition: commctrl.h:705
#define HDI_LPARAM
Definition: commctrl.h:706
#define HDI_ORDER
Definition: commctrl.h:710
INT cxy
Definition: header.c:51
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

Referenced by HEADER_WindowProc().

◆ HEADER_GetOrderArray()

static LRESULT HEADER_GetOrderArray ( const HEADER_INFO infoPtr,
INT  size,
LPINT  order 
)
static

Definition at line 1301 of file header.c.

1302{
1303 if ((UINT)size <infoPtr->uNumItem)
1304 return FALSE;
1305
1306 memcpy(order, infoPtr->order, infoPtr->uNumItem * sizeof(INT));
1307 return TRUE;
1308}
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by HEADER_WindowProc().

◆ HEADER_GetUnicodeFormat()

static LRESULT HEADER_GetUnicodeFormat ( const HEADER_INFO infoPtr)
inlinestatic

Definition at line 1382 of file header.c.

1383{
1384 return (infoPtr->nNotifyFormat == NFR_UNICODE);
1385}

Referenced by HEADER_WindowProc().

◆ HEADER_HitTest()

static LRESULT HEADER_HitTest ( const HEADER_INFO infoPtr,
LPHDHITTESTINFO  phti 
)
static

Definition at line 1389 of file header.c.

1390{
1392
1393 HEADER_InternalHitTest (infoPtr, &phti->pt, &phti->flags, &phti->iItem);
1394
1395 if (phti->flags & outside)
1396 return phti->iItem = -1;
1397 else
1398 return phti->iItem;
1399}
static void HEADER_InternalHitTest(const HEADER_INFO *infoPtr, const POINT *lpPt, UINT *pFlags, INT *pItem)
Definition: header.c:697
#define HHT_ABOVE
Definition: commctrl.h:776
#define HHT_NOWHERE
Definition: commctrl.h:770
#define HHT_BELOW
Definition: commctrl.h:777
#define HHT_TOLEFT
Definition: commctrl.h:779
#define HHT_TORIGHT
Definition: commctrl.h:778

Referenced by HEADER_WindowProc().

◆ HEADER_IndexToOrder()

static LRESULT HEADER_IndexToOrder ( const HEADER_INFO infoPtr,
INT  iItem 
)
inlinestatic

Definition at line 168 of file header.c.

169{
170 HEADER_ITEM *lpItem = &infoPtr->items[iItem];
171 return lpItem->iOrder;
172}

Referenced by HEADER_InternalHitTest(), HEADER_LButtonUp(), HEADER_NextItem(), and HEADER_PrevItem().

◆ HEADER_InsertItemT()

static LRESULT HEADER_InsertItemT ( HEADER_INFO infoPtr,
INT  nItem,
const HDITEMW phdi,
BOOL  bUnicode 
)
static

Definition at line 1403 of file header.c.

1404{
1405 HEADER_ITEM *lpItem;
1406 INT iOrder;
1407 UINT i;
1408 UINT copyMask;
1409
1410 if ((phdi == NULL) || (nItem < 0) || (phdi->mask == 0))
1411 return -1;
1412
1413 if (nItem > infoPtr->uNumItem)
1414 nItem = infoPtr->uNumItem;
1415
1416 iOrder = (phdi->mask & HDI_ORDER) ? phdi->iOrder : nItem;
1417 if (iOrder < 0)
1418 iOrder = 0;
1419 else if (infoPtr->uNumItem < iOrder)
1420 iOrder = infoPtr->uNumItem;
1421
1422 infoPtr->uNumItem++;
1423 infoPtr->items = heap_realloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
1424 infoPtr->order = heap_realloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
1425
1426 /* make space for the new item */
1427 memmove(&infoPtr->items[nItem + 1], &infoPtr->items[nItem],
1428 (infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM));
1429 memmove(&infoPtr->order[iOrder + 1], &infoPtr->order[iOrder],
1430 (infoPtr->uNumItem - iOrder - 1) * sizeof(INT));
1431
1432 /* update the order array */
1433 infoPtr->order[iOrder] = nItem;
1434 for (i = 0; i < infoPtr->uNumItem; i++)
1435 {
1436 if (i != iOrder && infoPtr->order[i] >= nItem)
1437 infoPtr->order[i]++;
1438 infoPtr->items[infoPtr->order[i]].iOrder = i;
1439 }
1440
1441 lpItem = &infoPtr->items[nItem];
1442 ZeroMemory(lpItem, sizeof(HEADER_ITEM));
1443 /* cxy, fmt and lParam are copied even if not in the HDITEM mask */
1444 copyMask = phdi->mask | HDI_WIDTH | HDI_FORMAT | HDI_LPARAM;
1445 HEADER_StoreHDItemInHeader(lpItem, copyMask, phdi, bUnicode);
1446 lpItem->iOrder = iOrder;
1447
1448 /* set automatically some format bits */
1449 if (phdi->mask & HDI_TEXT)
1450 lpItem->fmt |= HDF_STRING;
1451 else
1452 lpItem->fmt &= ~HDF_STRING;
1453
1454 if (lpItem->hbm != NULL)
1455 lpItem->fmt |= HDF_BITMAP;
1456 else
1457 lpItem->fmt &= ~HDF_BITMAP;
1458
1459 if (phdi->mask & HDI_IMAGE)
1460 lpItem->fmt |= HDF_IMAGE;
1461
1462 HEADER_SetItemBounds (infoPtr);
1463 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1464
1465 return nItem;
1466}
static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDITEMW *phdi, BOOL fUnicode)
Definition: header.c:117
if(dx< 0)
Definition: linetemp.h:194
#define ZeroMemory
Definition: winbase.h:1670

Referenced by HEADER_WindowProc().

◆ HEADER_InternalHitTest()

static void HEADER_InternalHitTest ( const HEADER_INFO infoPtr,
const POINT lpPt,
UINT pFlags,
INT pItem 
)
static

Definition at line 697 of file header.c.

698{
699 RECT rect, rcTest;
700 UINT iCount;
701 INT width;
702 BOOL bNoWidth;
703
704 GetClientRect (infoPtr->hwndSelf, &rect);
705
706 *pFlags = 0;
707 bNoWidth = FALSE;
708 if (PtInRect (&rect, *lpPt))
709 {
710 if (infoPtr->uNumItem == 0) {
711 *pFlags |= HHT_NOWHERE;
712 *pItem = 1;
713 TRACE("NOWHERE\n");
714 return;
715 }
716 else {
717 /* somewhere inside */
718 for (iCount = 0; iCount < infoPtr->uNumItem; iCount++) {
719 rect = infoPtr->items[iCount].rect;
720 width = rect.right - rect.left;
721 if (width == 0) {
722 bNoWidth = TRUE;
723 continue;
724 }
725 if (PtInRect (&rect, *lpPt)) {
726 if (width <= 2 * DIVIDER_WIDTH) {
727 *pFlags |= HHT_ONHEADER;
728 *pItem = iCount;
729 TRACE("ON HEADER %d\n", iCount);
730 return;
731 }
732 if (HEADER_IndexToOrder(infoPtr, iCount) > 0) {
733 rcTest = rect;
734 rcTest.right = rcTest.left + DIVIDER_WIDTH;
735 if (PtInRect (&rcTest, *lpPt)) {
736 if (HEADER_IsItemFixed(infoPtr, HEADER_PrevItem(infoPtr, iCount)))
737 {
738 *pFlags |= HHT_ONHEADER;
739 *pItem = iCount;
740 TRACE("ON HEADER %d\n", *pItem);
741 return;
742 }
743 if (bNoWidth) {
744 *pFlags |= HHT_ONDIVOPEN;
745 *pItem = HEADER_PrevItem(infoPtr, iCount);
746 TRACE("ON DIVOPEN %d\n", *pItem);
747 return;
748 }
749 else {
750 *pFlags |= HHT_ONDIVIDER;
751 *pItem = HEADER_PrevItem(infoPtr, iCount);
752 TRACE("ON DIVIDER %d\n", *pItem);
753 return;
754 }
755 }
756 }
757 rcTest = rect;
758 rcTest.left = rcTest.right - DIVIDER_WIDTH;
759 if (!HEADER_IsItemFixed(infoPtr, iCount) && PtInRect (&rcTest, *lpPt))
760 {
761 *pFlags |= HHT_ONDIVIDER;
762 *pItem = iCount;
763 TRACE("ON DIVIDER %d\n", *pItem);
764 return;
765 }
766
767 *pFlags |= HHT_ONHEADER;
768 *pItem = iCount;
769 TRACE("ON HEADER %d\n", iCount);
770 return;
771 }
772 }
773
774 /* check for last divider part (on nowhere) */
775 if (!HEADER_IsItemFixed(infoPtr, infoPtr->uNumItem - 1))
776 {
777 rect = infoPtr->items[infoPtr->uNumItem-1].rect;
778 rect.left = rect.right;
779 rect.right += DIVIDER_WIDTH;
780 if (PtInRect (&rect, *lpPt)) {
781 if (bNoWidth) {
782 *pFlags |= HHT_ONDIVOPEN;
783 *pItem = infoPtr->uNumItem - 1;
784 TRACE("ON DIVOPEN %d\n", *pItem);
785 return;
786 }
787 else {
788 *pFlags |= HHT_ONDIVIDER;
789 *pItem = infoPtr->uNumItem - 1;
790 TRACE("ON DIVIDER %d\n", *pItem);
791 return;
792 }
793 }
794 }
795
796 *pFlags |= HHT_NOWHERE;
797 *pItem = 1;
798 TRACE("NOWHERE\n");
799 return;
800 }
801 }
802 else {
803 if (lpPt->x < rect.left) {
804 TRACE("TO LEFT\n");
805 *pFlags |= HHT_TOLEFT;
806 }
807 else if (lpPt->x > rect.right) {
808 TRACE("TO RIGHT\n");
809 *pFlags |= HHT_TORIGHT;
810 }
811
812 if (lpPt->y < rect.top) {
813 TRACE("ABOVE\n");
814 *pFlags |= HHT_ABOVE;
815 }
816 else if (lpPt->y > rect.bottom) {
817 TRACE("BELOW\n");
818 *pFlags |= HHT_BELOW;
819 }
820 }
821
822 *pItem = 1;
823 TRACE("flags=0x%X\n", *pFlags);
824 return;
825}
static BOOL HEADER_IsItemFixed(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:225
#define DIVIDER_WIDTH
Definition: header.c:98
static INT HEADER_PrevItem(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:217
static LRESULT HEADER_IndexToOrder(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:168
#define HHT_ONDIVIDER
Definition: commctrl.h:772
#define HHT_ONDIVOPEN
Definition: commctrl.h:773
#define HHT_ONHEADER
Definition: commctrl.h:771
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by HEADER_HitTest(), HEADER_LButtonDblClk(), HEADER_LButtonDown(), HEADER_LButtonUp(), HEADER_MouseMove(), HEADER_SetCursor(), and HEADER_SetHotDivider().

◆ HEADER_IsDragDistance()

static BOOL HEADER_IsDragDistance ( const HEADER_INFO infoPtr,
const POINT pt 
)
static

Definition at line 1659 of file header.c.

1660{
1661 /* Windows allows for a mouse movement before starting the drag. We use the
1662 * SM_CXDOUBLECLICK/SM_CYDOUBLECLICK as that distance.
1663 */
1664 return (abs(infoPtr->ptLButtonDown.x - pt->x)>GetSystemMetrics(SM_CXDOUBLECLK) ||
1666}
#define pt(x, y)
Definition: drawing.c:79
#define abs(i)
Definition: fconv.c:206
POINT ptLButtonDown
Definition: header.c:80
#define SM_CXDOUBLECLK
Definition: winuser.h:993
#define SM_CYDOUBLECLK
Definition: winuser.h:994

Referenced by HEADER_LButtonUp(), and HEADER_MouseMove().

◆ HEADER_IsItemFixed()

static BOOL HEADER_IsItemFixed ( const HEADER_INFO infoPtr,
INT  iItem 
)
inlinestatic

Definition at line 225 of file header.c.

226{
227 return (infoPtr->dwStyle & HDS_NOSIZING) || (infoPtr->items[iItem].fmt & HDF_FIXEDWIDTH);
228}

Referenced by HEADER_InternalHitTest().

◆ HEADER_Layout()

static LRESULT HEADER_Layout ( HEADER_INFO infoPtr,
LPHDLAYOUT  lpLayout 
)
static

Definition at line 1470 of file header.c.

1471{
1472 lpLayout->pwpos->hwnd = infoPtr->hwndSelf;
1473 lpLayout->pwpos->hwndInsertAfter = 0;
1474 lpLayout->pwpos->x = lpLayout->prc->left;
1475 lpLayout->pwpos->y = lpLayout->prc->top;
1476 lpLayout->pwpos->cx = lpLayout->prc->right - lpLayout->prc->left;
1477 if (infoPtr->dwStyle & HDS_HIDDEN)
1478 lpLayout->pwpos->cy = 0;
1479 else {
1480 lpLayout->pwpos->cy = infoPtr->nHeight;
1481 lpLayout->prc->top += infoPtr->nHeight;
1482 }
1483 lpLayout->pwpos->flags = SWP_NOZORDER;
1484
1485 TRACE("Layout x=%d y=%d cx=%d cy=%d\n",
1486 lpLayout->pwpos->x, lpLayout->pwpos->y,
1487 lpLayout->pwpos->cx, lpLayout->pwpos->cy);
1488
1489 infoPtr->bRectsValid = FALSE;
1490
1491 return TRUE;
1492}
#define HDS_HIDDEN
Definition: commctrl.h:631
WINDOWPOS * pwpos
Definition: commctrl.h:764
RECT * prc
Definition: commctrl.h:763
HWND hwnd
Definition: winuser.h:3578
UINT flags
Definition: winuser.h:3584
HWND hwndInsertAfter
Definition: winuser.h:3579
#define SWP_NOZORDER
Definition: winuser.h:1237

Referenced by HEADER_WindowProc().

◆ HEADER_LButtonDblClk()

static LRESULT HEADER_LButtonDblClk ( const HEADER_INFO infoPtr,
INT  x,
INT  y 
)
static

Definition at line 1669 of file header.c.

1670{
1671 POINT pt;
1672 UINT flags;
1673 INT nItem;
1674
1675 pt.x = x;
1676 pt.y = y;
1677 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1678
1679 if ((infoPtr->dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER))
1681 else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
1683
1684 return 0;
1685}
static BOOL HEADER_SendNotifyWithHDItemT(const HEADER_INFO *infoPtr, UINT code, INT iItem, HDITEMW *lpItem)
Definition: header.c:917
GLbitfield flags
Definition: glext.h:7161
#define HDN_ITEMDBLCLICKW
Definition: commctrl.h:844
#define HDN_DIVIDERDBLCLICKW
Definition: commctrl.h:846

Referenced by HEADER_WindowProc().

◆ HEADER_LButtonDown()

static LRESULT HEADER_LButtonDown ( HEADER_INFO infoPtr,
INT  x,
INT  y 
)
static

Definition at line 1689 of file header.c.

1690{
1691 POINT pt;
1692 UINT flags;
1693 INT nItem;
1694 HDC hdc;
1695
1696 pt.x = x;
1697 pt.y = y;
1698 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1699
1700 if ((infoPtr->dwStyle & HDS_BUTTONS) && (flags == HHT_ONHEADER)) {
1701 SetCapture (infoPtr->hwndSelf);
1702 infoPtr->bCaptured = TRUE;
1703 infoPtr->bPressed = TRUE;
1704 infoPtr->bDragging = FALSE;
1705 infoPtr->iMoveItem = nItem;
1706 infoPtr->ptLButtonDown = pt;
1707
1708 infoPtr->items[nItem].bDown = TRUE;
1709
1710 /* Send WM_CUSTOMDRAW */
1711 hdc = GetDC (infoPtr->hwndSelf);
1712 HEADER_RefreshItem (infoPtr, nItem);
1713 ReleaseDC (infoPtr->hwndSelf, hdc);
1714
1715 TRACE("Pressed item %d.\n", nItem);
1716 }
1717 else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) {
1718 INT iCurrWidth = infoPtr->items[nItem].cxy;
1719 if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_BEGINTRACKW, nItem, HDI_WIDTH, iCurrWidth))
1720 {
1721 SetCapture (infoPtr->hwndSelf);
1722 infoPtr->bCaptured = TRUE;
1723 infoPtr->bTracking = TRUE;
1724 infoPtr->iMoveItem = nItem;
1725 infoPtr->xTrackOffset = infoPtr->items[nItem].rect.right - pt.x;
1726
1727 if (!(infoPtr->dwStyle & HDS_FULLDRAG)) {
1728 infoPtr->xOldTrack = infoPtr->items[nItem].rect.right;
1729 hdc = GetDC (infoPtr->hwndSelf);
1730 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1731 ReleaseDC (infoPtr->hwndSelf, hdc);
1732 }
1733
1734 TRACE("Begin tracking item %d.\n", nItem);
1735 }
1736 }
1737
1738 return 0;
1739}
static void HEADER_DrawTrackLine(const HEADER_INFO *infoPtr, HDC hdc, INT x)
Definition: header.c:829
static BOOL HEADER_SendNotifyWithIntFieldT(const HEADER_INFO *infoPtr, UINT code, INT iItem, INT mask, INT iValue)
Definition: header.c:931
static void HEADER_RefreshItem(HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:687
#define HDS_FULLDRAG
Definition: commctrl.h:633
#define HDN_BEGINTRACKW
Definition: commctrl.h:848
INT xOldTrack
Definition: header.c:84
BOOL bCaptured
Definition: header.c:76
INT xTrackOffset
Definition: header.c:83
BOOL bDragging
Definition: header.c:78
HWND WINAPI SetCapture(_In_ HWND hWnd)

Referenced by HEADER_WindowProc().

◆ HEADER_LButtonUp()

static LRESULT HEADER_LButtonUp ( HEADER_INFO infoPtr,
INT  x,
INT  y 
)
static

Definition at line 1743 of file header.c.

1744{
1745 POINT pt;
1746 UINT flags;
1747 INT nItem;
1748 HDC hdc;
1749
1750 pt.x = x;
1751 pt.y = y;
1752 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1753
1754 if (infoPtr->bPressed) {
1755
1756 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;
1757
1758 if (infoPtr->bDragging)
1759 {
1760 HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
1761 INT iNewOrder;
1762
1765
1766 if (infoPtr->iHotDivider == -1)
1767 iNewOrder = -1;
1768 else if (infoPtr->iHotDivider == infoPtr->uNumItem)
1769 iNewOrder = infoPtr->uNumItem-1;
1770 else
1771 {
1772 iNewOrder = HEADER_IndexToOrder(infoPtr, infoPtr->iHotDivider);
1773 if (iNewOrder > lpItem->iOrder)
1774 iNewOrder--;
1775 }
1776
1777 if (iNewOrder != -1 &&
1778 !HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ENDDRAG, infoPtr->iMoveItem, HDI_ORDER, iNewOrder))
1779 {
1780 HEADER_ChangeItemOrder(infoPtr, infoPtr->iMoveItem, iNewOrder);
1781 infoPtr->bRectsValid = FALSE;
1782 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1783 }
1784 else
1785 InvalidateRect(infoPtr->hwndSelf, &infoPtr->items[infoPtr->iMoveItem].rect, FALSE);
1786
1787 infoPtr->bDragging = FALSE;
1788 HEADER_SetHotDivider(infoPtr, FALSE, -1);
1789 }
1790 else
1791 {
1792 hdc = GetDC (infoPtr->hwndSelf);
1793 HEADER_RefreshItem (infoPtr, infoPtr->iMoveItem);
1794 ReleaseDC (infoPtr->hwndSelf, hdc);
1795
1796 if (!(infoPtr->dwStyle & HDS_DRAGDROP) || !HEADER_IsDragDistance(infoPtr, &pt))
1798 }
1799
1800 TRACE("Released item %d.\n", infoPtr->iMoveItem);
1801 infoPtr->bPressed = FALSE;
1802 }
1803 else if (infoPtr->bTracking) {
1804 INT iNewWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;
1805 if (iNewWidth < 0)
1806 iNewWidth = 0;
1807 TRACE("End tracking item %d.\n", infoPtr->iMoveItem);
1808 infoPtr->bTracking = FALSE;
1809
1810 HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ENDTRACKW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
1811
1812 if (!(infoPtr->dwStyle & HDS_FULLDRAG)) {
1813 hdc = GetDC (infoPtr->hwndSelf);
1814 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1815 ReleaseDC (infoPtr->hwndSelf, hdc);
1816 }
1817
1818 if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth))
1819 {
1820 infoPtr->items[infoPtr->iMoveItem].cxy = iNewWidth;
1822 }
1823
1824 HEADER_SetItemBounds (infoPtr);
1825 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
1826 }
1827
1828 if (infoPtr->bCaptured) {
1829 infoPtr->bCaptured = FALSE;
1830 ReleaseCapture ();
1832 }
1833
1834 return 0;
1835}
static BOOL HEADER_SendSimpleNotify(const HEADER_INFO *infoPtr, UINT code)
Definition: header.c:896
static LRESULT HEADER_SetHotDivider(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: header.c:1122
static void HEADER_ChangeItemOrder(const HEADER_INFO *infoPtr, INT iItem, INT iNewOrder)
Definition: header.c:184
static BOOL HEADER_IsDragDistance(const HEADER_INFO *infoPtr, const POINT *pt)
Definition: header.c:1659
VOID WINAPI ImageList_EndDrag(void)
Definition: imagelist.c:1847
BOOL WINAPI ImageList_DragShowNolock(BOOL bShow)
Definition: imagelist.c:1153
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
#define HDN_ITEMCHANGEDW
Definition: commctrl.h:840
#define HDN_ENDTRACKW
Definition: commctrl.h:850
#define HDS_DRAGDROP
Definition: commctrl.h:632
#define HDN_ENDDRAG
Definition: commctrl.h:856
#define HDN_ITEMCHANGINGW
Definition: commctrl.h:838
#define HDN_ITEMCLICKW
Definition: commctrl.h:842
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890

Referenced by HEADER_WindowProc().

◆ HEADER_MouseLeave()

static LRESULT HEADER_MouseLeave ( HEADER_INFO infoPtr)
static

Definition at line 1857 of file header.c.

1858{
1859 /* Reset hot-tracked item when mouse leaves control. */
1860 INT oldHotItem = infoPtr->iHotItem;
1861 HDC hdc = GetDC (infoPtr->hwndSelf);
1862
1863 infoPtr->iHotItem = -1;
1864 if (oldHotItem != -1) HEADER_RefreshItem (infoPtr, oldHotItem);
1865 ReleaseDC (infoPtr->hwndSelf, hdc);
1866
1867 return 0;
1868}

Referenced by HEADER_WindowProc().

◆ HEADER_MouseMove()

static LRESULT HEADER_MouseMove ( HEADER_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 1872 of file header.c.

1873{
1874 POINT pt;
1875 UINT flags;
1876 INT nItem, nWidth;
1877 HDC hdc;
1878 /* With theming, hottracking is always enabled */
1879 BOOL hotTrackEnabled =
1880 ((infoPtr->dwStyle & HDS_BUTTONS) && (infoPtr->dwStyle & HDS_HOTTRACK))
1881 || (GetWindowTheme (infoPtr->hwndSelf) != NULL);
1882 INT oldHotItem = infoPtr->iHotItem;
1883
1884 pt.x = (INT)(SHORT)LOWORD(lParam);
1885 pt.y = (INT)(SHORT)HIWORD(lParam);
1886 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
1887
1888 if (hotTrackEnabled) {
1890 infoPtr->iHotItem = nItem;
1891 else
1892 infoPtr->iHotItem = -1;
1893 }
1894
1895 if (infoPtr->bCaptured) {
1896 /* check if we should drag the header */
1897 if (infoPtr->bPressed && !infoPtr->bDragging && (infoPtr->dwStyle & HDS_DRAGDROP)
1898 && HEADER_IsDragDistance(infoPtr, &pt))
1899 {
1900 if (!HEADER_SendNotifyWithHDItemT(infoPtr, HDN_BEGINDRAG, infoPtr->iMoveItem, NULL))
1901 {
1902 HIMAGELIST hDragItem = HEADER_CreateDragImage(infoPtr, infoPtr->iMoveItem);
1903 if (hDragItem != NULL)
1904 {
1905 HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
1906 TRACE("Starting item drag\n");
1907 ImageList_BeginDrag(hDragItem, 0, pt.x - lpItem->rect.left, 0);
1909 ImageList_Destroy(hDragItem);
1910 infoPtr->bDragging = TRUE;
1911 }
1912 }
1913 }
1914
1915 if (infoPtr->bDragging)
1916 {
1917 POINT drag;
1918 drag.x = pt.x;
1919 drag.y = 0;
1920 ClientToScreen(infoPtr->hwndSelf, &drag);
1921 ImageList_DragMove(drag.x, drag.y);
1922 HEADER_SetHotDivider(infoPtr, TRUE, lParam);
1923 }
1924
1925 if (infoPtr->bPressed && !infoPtr->bDragging) {
1926 BOOL oldState = infoPtr->items[infoPtr->iMoveItem].bDown;
1927 if ((nItem == infoPtr->iMoveItem) && (flags == HHT_ONHEADER))
1928 infoPtr->items[infoPtr->iMoveItem].bDown = TRUE;
1929 else
1930 infoPtr->items[infoPtr->iMoveItem].bDown = FALSE;
1931 if (oldState != infoPtr->items[infoPtr->iMoveItem].bDown) {
1932 hdc = GetDC (infoPtr->hwndSelf);
1933 HEADER_RefreshItem (infoPtr, infoPtr->iMoveItem);
1934 ReleaseDC (infoPtr->hwndSelf, hdc);
1935 }
1936
1937 TRACE("Moving pressed item %d.\n", infoPtr->iMoveItem);
1938 }
1939 else if (infoPtr->bTracking) {
1940 if (infoPtr->dwStyle & HDS_FULLDRAG) {
1941 HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
1942 nWidth = pt.x - lpItem->rect.left + infoPtr->xTrackOffset;
1943 if (!HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, nWidth))
1944 {
1945 INT nOldWidth = lpItem->rect.right - lpItem->rect.left;
1946 RECT rcClient;
1947 RECT rcScroll;
1948
1949 if (nWidth < 0) nWidth = 0;
1950 infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
1951 HEADER_SetItemBounds(infoPtr);
1952
1953 GetClientRect(infoPtr->hwndSelf, &rcClient);
1954 rcScroll = rcClient;
1955 rcScroll.left = lpItem->rect.left + nOldWidth;
1956 ScrollWindowEx(infoPtr->hwndSelf, nWidth - nOldWidth, 0, &rcScroll, &rcClient, NULL, NULL, 0);
1957 InvalidateRect(infoPtr->hwndSelf, &lpItem->rect, FALSE);
1958 UpdateWindow(infoPtr->hwndSelf);
1959
1961 }
1962 }
1963 else {
1964 INT iTrackWidth;
1965 hdc = GetDC (infoPtr->hwndSelf);
1966 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1967 infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset;
1968 if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left)
1969 infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left;
1970 HEADER_DrawTrackLine (infoPtr, hdc, infoPtr->xOldTrack);
1971 ReleaseDC (infoPtr->hwndSelf, hdc);
1972 iTrackWidth = infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left;
1973 /* FIXME: should stop tracking if HDN_TRACK returns TRUE */
1974 HEADER_SendNotifyWithIntFieldT(infoPtr, HDN_TRACKW, infoPtr->iMoveItem, HDI_WIDTH, iTrackWidth);
1975 }
1976
1977 TRACE("Tracking item %d.\n", infoPtr->iMoveItem);
1978 }
1979 }
1980
1981 if (hotTrackEnabled) {
1982 TRACKMOUSEEVENT tme;
1983 if (oldHotItem != infoPtr->iHotItem && !infoPtr->bDragging) {
1984 hdc = GetDC (infoPtr->hwndSelf);
1985 if (oldHotItem != -1) HEADER_RefreshItem (infoPtr, oldHotItem);
1986 if (infoPtr->iHotItem != -1) HEADER_RefreshItem (infoPtr, infoPtr->iHotItem);
1987 ReleaseDC (infoPtr->hwndSelf, hdc);
1988 }
1989 tme.cbSize = sizeof( tme );
1990 tme.dwFlags = TME_LEAVE;
1991 tme.hwndTrack = infoPtr->hwndSelf;
1992 TrackMouseEvent( &tme );
1993 }
1994
1995 return 0;
1996}
LPARAM lParam
Definition: combotst.c:139
static HIMAGELIST HEADER_CreateDragImage(HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:1072
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_BeginDrag(HIMAGELIST himlTrack, INT iTrack, INT dxHotspot, INT dyHotspot)
Definition: imagelist.c:638
#define LOWORD(l)
Definition: pedump.c:82
short SHORT
Definition: pedump.c:59
#define INT
Definition: polytest.cpp:20
#define TME_LEAVE
Definition: commctrl.h:4981
#define HDN_BEGINDRAG
Definition: commctrl.h:855
#define HDN_TRACKW
Definition: commctrl.h:852
#define HDS_HOTTRACK
Definition: commctrl.h:630
int nOldWidth
Definition: taskmgr.c:46
#define HIWORD(l)
Definition: typedefs.h:247
BOOL WINAPI TrackMouseEvent(_Inout_ LPTRACKMOUSEEVENT)
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
BOOL WINAPI UpdateWindow(_In_ HWND)
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)

Referenced by HEADER_WindowProc().

◆ HEADER_NCDestroy()

static LRESULT HEADER_NCDestroy ( HEADER_INFO infoPtr)
static

Definition at line 1630 of file header.c.

1631{
1632 HEADER_ITEM *lpItem;
1633 INT nItem;
1634
1635 if (infoPtr->items) {
1636 lpItem = infoPtr->items;
1637 for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++)
1638 heap_free(lpItem->pszText);
1639 heap_free(infoPtr->items);
1640 }
1641
1642 heap_free(infoPtr->order);
1643
1644 SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0);
1645 heap_free(infoPtr);
1646
1647 return 0;
1648}

Referenced by HEADER_WindowProc().

◆ HEADER_NextItem()

static INT HEADER_NextItem ( const HEADER_INFO infoPtr,
INT  iItem 
)
static

Definition at line 211 of file header.c.

212{
213 return HEADER_OrderToIndex(infoPtr, HEADER_IndexToOrder(infoPtr, iItem)+1);
214}

Referenced by HEADER_SetHotDivider().

◆ HEADER_NotifyCodeWtoA()

static UINT HEADER_NotifyCodeWtoA ( UINT  code)
static

Definition at line 875 of file header.c.

876{
877 /* we use the fact that all the unicode messages are in HDN_FIRST_UNICODE..HDN_LAST*/
878 if (code >= HDN_LAST && code <= HDN_FIRST_UNICODE)
879 return code + HDN_UNICODE_OFFSET;
880 else
881 return code;
882}
#define HDN_UNICODE_OFFSET
Definition: header.c:101
#define HDN_FIRST_UNICODE
Definition: header.c:102
#define HDN_LAST
Definition: commctrl.h:206
Definition: inflate.c:139

Referenced by HEADER_SendNotifyWithHDItemT().

◆ HEADER_NotifyFormat()

static LRESULT HEADER_NotifyFormat ( HEADER_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1839 of file header.c.

1840{
1841 switch (lParam)
1842 {
1843 case NF_QUERY:
1844 return infoPtr->nNotifyFormat;
1845
1846 case NF_REQUERY:
1847 infoPtr->nNotifyFormat =
1848 SendMessageW ((HWND)wParam, WM_NOTIFYFORMAT,
1849 (WPARAM)infoPtr->hwndSelf, NF_QUERY);
1850 return infoPtr->nNotifyFormat;
1851 }
1852
1853 return 0;
1854}
WPARAM wParam
Definition: combotst.c:138
#define NF_REQUERY
Definition: winuser.h:2451

Referenced by HEADER_WindowProc().

◆ HEADER_OrderToIndex()

static INT HEADER_OrderToIndex ( const HEADER_INFO infoPtr,
INT  iorder 
)
static

Definition at line 176 of file header.c.

177{
178 if ((iorder <0) || iorder >= infoPtr->uNumItem)
179 return iorder;
180 return infoPtr->order[iorder];
181}

Referenced by HEADER_GetHotDividerRect(), HEADER_NextItem(), HEADER_PrevItem(), HEADER_Refresh(), HEADER_SetItemBounds(), and HEADER_WindowProc().

◆ HEADER_Paint()

static LRESULT HEADER_Paint ( HEADER_INFO infoPtr,
HDC  hdcParam 
)
static

Definition at line 2000 of file header.c.

2001{
2002 HDC hdc;
2003 PAINTSTRUCT ps;
2004
2005 hdc = hdcParam==0 ? BeginPaint (infoPtr->hwndSelf, &ps) : hdcParam;
2006 HEADER_Refresh (infoPtr, hdc);
2007 if(!hdcParam)
2008 EndPaint (infoPtr->hwndSelf, &ps);
2009 return 0;
2010}
static void HEADER_Refresh(HEADER_INFO *infoPtr, HDC hdc)
Definition: header.c:618
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by HEADER_WindowProc().

◆ HEADER_PrepareCallbackItems()

static BOOL HEADER_PrepareCallbackItems ( const HEADER_INFO infoPtr,
INT  iItem,
INT  reqMask 
)
static

Prepare callback items depends on NMHDDISPINFOW having same structure as NMHDDISPINFOA (so we handle the two cases only doing a specific cast for pszText). Checks if any of the required fields is a callback. If this is the case sends a NMHDISPINFO notify to retrieve these items. The items are stored in the HEADER_ITEM pszText and iImage fields. They should be freed with HEADER_FreeCallbackItems.

Parameters
hwnd: hwnd header container handler
iItem: the header item id
reqMask: required fields. If any of them is callback this function will fetch it
Returns
TRUE on success, else FALSE

Definition at line 977 of file header.c.

978{
979 HEADER_ITEM *lpItem = &infoPtr->items[iItem];
980 DWORD mask = reqMask & lpItem->callbackMask;
981 NMHDDISPINFOW dispInfo;
982 void *pvBuffer = NULL;
983
984 if (mask == 0)
985 return TRUE;
986 if (mask&HDI_TEXT && lpItem->pszText != NULL)
987 {
988 ERR("(): function called without a call to FreeCallbackItems\n");
989 heap_free(lpItem->pszText);
990 lpItem->pszText = NULL;
991 }
992
993 memset(&dispInfo, 0, sizeof(NMHDDISPINFOW));
994 dispInfo.hdr.hwndFrom = infoPtr->hwndSelf;
995 dispInfo.hdr.idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
996 if (infoPtr->nNotifyFormat == NFR_UNICODE)
997 {
998 dispInfo.hdr.code = HDN_GETDISPINFOW;
999 if (mask & HDI_TEXT)
1000 pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(WCHAR));
1001 }
1002 else
1003 {
1004 dispInfo.hdr.code = HDN_GETDISPINFOA;
1005 if (mask & HDI_TEXT)
1006 pvBuffer = heap_alloc_zero(MAX_HEADER_TEXT_LEN * sizeof(CHAR));
1007 }
1008 dispInfo.pszText = pvBuffer;
1009 dispInfo.cchTextMax = (pvBuffer!=NULL?MAX_HEADER_TEXT_LEN:0);
1010 dispInfo.iItem = iItem;
1011 dispInfo.mask = mask;
1012 dispInfo.lParam = lpItem->lParam;
1013
1014 TRACE("Sending HDN_GETDISPINFO%c\n", infoPtr->nNotifyFormat == NFR_UNICODE?'W':'A');
1015 SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, dispInfo.hdr.idFrom, (LPARAM)&dispInfo);
1016
1017 TRACE("SendMessage returns(mask:0x%x,str:%s,lParam:%p)\n",
1018 dispInfo.mask,
1019 (infoPtr->nNotifyFormat == NFR_UNICODE ? debugstr_w(dispInfo.pszText) : (LPSTR) dispInfo.pszText),
1020 (void*) dispInfo.lParam);
1021
1022 if (mask & HDI_IMAGE)
1023 lpItem->iImage = dispInfo.iImage;
1024 if (mask & HDI_TEXT)
1025 {
1026 if (infoPtr->nNotifyFormat == NFR_UNICODE)
1027 {
1028 lpItem->pszText = pvBuffer;
1029
1030 /* the user might have used his own buffer */
1031 if (dispInfo.pszText != lpItem->pszText)
1032 Str_GetPtrW(dispInfo.pszText, lpItem->pszText, MAX_HEADER_TEXT_LEN);
1033 }
1034 else
1035 {
1036 Str_SetPtrAtoW(&lpItem->pszText, (LPSTR)dispInfo.pszText);
1037 heap_free(pvBuffer);
1038 }
1039 }
1040
1041 if (dispInfo.mask & HDI_DI_SETITEM)
1042 {
1043 /* make the items permanent */
1044 lpItem->callbackMask &= ~dispInfo.mask;
1045 }
1046
1047 return TRUE;
1048}
#define ERR(fmt,...)
Definition: debug.h:110
#define MAX_HEADER_TEXT_LEN
Definition: header.c:100
#define debugstr_w
Definition: kernel32.h:32
#define HDI_DI_SETITEM
Definition: commctrl.h:709
#define HDN_GETDISPINFOA
Definition: commctrl.h:853
#define HDN_GETDISPINFOW
Definition: commctrl.h:854
#define WM_NOTIFY
Definition: richedit.h:61
#define memset(x, y, z)
Definition: compat.h:39
LPWSTR pszText
Definition: commctrl.h:901
UINT_PTR idFrom
Definition: winuser.h:3148
UINT code
Definition: winuser.h:3149
HWND hwndFrom
Definition: winuser.h:3147
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175

Referenced by HEADER_DrawItem(), and HEADER_GetItemT().

◆ HEADER_PrevItem()

static INT HEADER_PrevItem ( const HEADER_INFO infoPtr,
INT  iItem 
)
static

Definition at line 217 of file header.c.

218{
219 return HEADER_OrderToIndex(infoPtr, HEADER_IndexToOrder(infoPtr, iItem)-1);
220}

Referenced by HEADER_InternalHitTest().

◆ HEADER_RButtonUp()

static LRESULT HEADER_RButtonUp ( HEADER_INFO infoPtr,
INT  x,
INT  y 
)
static

Definition at line 2014 of file header.c.

2015{
2016 BOOL bRet;
2017 POINT pt;
2018
2019 pt.x = x;
2020 pt.y = y;
2021
2022 /* Send a Notify message */
2023 bRet = HEADER_SendSimpleNotify (infoPtr, NM_RCLICK);
2024
2025 /* Change to screen coordinate for WM_CONTEXTMENU */
2026 ClientToScreen(infoPtr->hwndSelf, &pt);
2027
2028 /* Send a WM_CONTEXTMENU message in response to the RBUTTONUP */
2029 SendMessageW( infoPtr->hwndSelf, WM_CONTEXTMENU, (WPARAM) infoPtr->hwndSelf, MAKELPARAM(pt.x, pt.y));
2030
2031 return bRet;
2032}
#define NM_RCLICK
Definition: commctrl.h:133
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define MAKELPARAM(l, h)
Definition: winuser.h:3998

Referenced by HEADER_WindowProc().

◆ HEADER_Refresh()

static void HEADER_Refresh ( HEADER_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 618 of file header.c.

619{
620 HFONT hFont, hOldFont;
621 RECT rect, rcRest;
622 HBRUSH hbrBk;
623 UINT i;
624 INT x;
625 LRESULT lCDFlags;
626 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
627
628 if (!infoPtr->bRectsValid)
629 HEADER_SetItemBounds(infoPtr);
630
631 /* get rect for the bar, adjusted for the border */
632 GetClientRect (infoPtr->hwndSelf, &rect);
633 lCDFlags = HEADER_SendCtrlCustomDraw(infoPtr, CDDS_PREPAINT, hdc, &rect);
634
635 if (infoPtr->bDragging)
637
638 hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT);
639 hOldFont = SelectObject (hdc, hFont);
640
641 /* draw Background */
642 if (infoPtr->uNumItem == 0 && theme == NULL) {
644 FillRect(hdc, &rect, hbrBk);
645 }
646
647 x = rect.left;
648 for (i = 0; x <= rect.right && i < infoPtr->uNumItem; i++) {
649 int idx = HEADER_OrderToIndex(infoPtr,i);
650 if (RectVisible(hdc, &infoPtr->items[idx].rect))
651 HEADER_DrawItem(infoPtr, hdc, idx, infoPtr->iHotItem == idx, lCDFlags);
652 x = infoPtr->items[idx].rect.right;
653 }
654
655 rcRest = rect;
656 rcRest.left = x;
657 if ((x <= rect.right) && RectVisible(hdc, &rcRest) && (infoPtr->uNumItem > 0)) {
658 if (theme != NULL) {
660 }
661 else if (infoPtr->dwStyle & HDS_FLAT) {
663 FillRect(hdc, &rcRest, hbrBk);
664 }
665 else
666 {
667 if (infoPtr->dwStyle & HDS_BUTTONS)
669 else
671 }
672 }
673
674 if (infoPtr->iHotDivider != -1)
675 HEADER_DrawHotDivider(infoPtr, hdc);
676
677 if (infoPtr->bDragging)
679 SelectObject (hdc, hOldFont);
680
681 if (lCDFlags & CDRF_NOTIFYPOSTPAINT)
683}
unsigned int idx
Definition: utils.c:41
static void HEADER_DrawHotDivider(const HEADER_INFO *infoPtr, HDC hdc)
Definition: header.c:606
BOOL WINAPI RectVisible(_In_ HDC, _In_ LPCRECT)
#define BF_LEFT
Definition: winuser.h:454
#define BF_MIDDLE
Definition: winuser.h:468
#define BF_TOP
Definition: winuser.h:455
#define COLOR_3DFACE
Definition: winuser.h:923

Referenced by HEADER_Paint().

◆ HEADER_RefreshItem()

static void HEADER_RefreshItem ( HEADER_INFO infoPtr,
INT  iItem 
)
static

Definition at line 687 of file header.c.

688{
689 if (!infoPtr->bRectsValid)
690 HEADER_SetItemBounds(infoPtr);
691
692 InvalidateRect(infoPtr->hwndSelf, &infoPtr->items[iItem].rect, FALSE);
693}

Referenced by HEADER_LButtonDown(), HEADER_LButtonUp(), HEADER_MouseLeave(), and HEADER_MouseMove().

◆ HEADER_Register()

VOID HEADER_Register ( void  )

Definition at line 2280 of file header.c.

2281{
2282 WNDCLASSW wndClass;
2283
2284 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2285 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
2286 wndClass.lpfnWndProc = HEADER_WindowProc;
2287 wndClass.cbClsExtra = 0;
2288 wndClass.cbWndExtra = sizeof(HEADER_INFO *);
2289 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
2290 wndClass.lpszClassName = WC_HEADERW;
2291
2292 RegisterClassW (&wndClass);
2293}
static LRESULT WINAPI HEADER_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: header.c:2130
#define WC_HEADERW
Definition: commctrl.h:624
LPCWSTR lpszClassName
Definition: winuser.h:3175
int cbClsExtra
Definition: winuser.h:3168
UINT style
Definition: winuser.h:3166
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbWndExtra
Definition: winuser.h:3169
HCURSOR hCursor
Definition: winuser.h:3172
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CS_DBLCLKS
Definition: winuser.h:646
#define CS_GLOBALCLASS
Definition: winuser.h:647

Referenced by DllMain().

◆ HEADER_SendCtrlCustomDraw()

static LRESULT HEADER_SendCtrlCustomDraw ( const HEADER_INFO infoPtr,
DWORD  dwDrawStage,
HDC  hdc,
const RECT rect 
)
static

Definition at line 903 of file header.c.

904{
905 NMCUSTOMDRAW nm;
906 nm.dwDrawStage = dwDrawStage;
907 nm.hdc = hdc;
908 nm.rc = *rect;
909 nm.dwItemSpec = 0;
910 nm.uItemState = 0;
911 nm.lItemlParam = 0;
912
913 return HEADER_SendNotify(infoPtr, NM_CUSTOMDRAW, (NMHDR *)&nm);
914}

Referenced by HEADER_CreateDragImage(), and HEADER_Refresh().

◆ HEADER_SendNotify()

static LRESULT HEADER_SendNotify ( const HEADER_INFO infoPtr,
UINT  code,
NMHDR hdr 
)
static

Definition at line 885 of file header.c.

886{
887 nmhdr->hwndFrom = infoPtr->hwndSelf;
888 nmhdr->idFrom = GetWindowLongPtrW (infoPtr->hwndSelf, GWLP_ID);
889 nmhdr->code = code;
890
891 return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY,
892 nmhdr->idFrom, (LPARAM)nmhdr);
893}

Referenced by HEADER_DrawItem(), HEADER_SendCtrlCustomDraw(), HEADER_SendNotifyWithHDItemT(), and HEADER_SendSimpleNotify().

◆ HEADER_SendNotifyWithHDItemT()

static BOOL HEADER_SendNotifyWithHDItemT ( const HEADER_INFO infoPtr,
UINT  code,
INT  iItem,
HDITEMW lpItem 
)
static

Definition at line 917 of file header.c.

918{
919 NMHEADERW nmhdr;
920
921 if (infoPtr->nNotifyFormat != NFR_UNICODE)
923 nmhdr.iItem = iItem;
924 nmhdr.iButton = 0;
925 nmhdr.pitem = lpItem;
926
927 return (BOOL)HEADER_SendNotify(infoPtr, code, (NMHDR *)&nmhdr);
928}
static UINT HEADER_NotifyCodeWtoA(UINT code)
Definition: header.c:875
HDITEMW * pitem
Definition: commctrl.h:891

Referenced by HEADER_LButtonDblClk(), HEADER_LButtonUp(), HEADER_MouseMove(), HEADER_SendNotifyWithIntFieldT(), and HEADER_SetItemT().

◆ HEADER_SendNotifyWithIntFieldT()

static BOOL HEADER_SendNotifyWithIntFieldT ( const HEADER_INFO infoPtr,
UINT  code,
INT  iItem,
INT  mask,
INT  iValue 
)
static

Definition at line 931 of file header.c.

932{
933 HDITEMW nmitem;
934
935 /* copying only the iValue should be ok but to make the code more robust we copy everything */
936 nmitem.cxy = infoPtr->items[iItem].cxy;
937 nmitem.hbm = infoPtr->items[iItem].hbm;
938 nmitem.pszText = NULL;
939 nmitem.cchTextMax = 0;
940 nmitem.fmt = infoPtr->items[iItem].fmt;
941 nmitem.lParam = infoPtr->items[iItem].lParam;
942 nmitem.iOrder = infoPtr->items[iItem].iOrder;
943 nmitem.iImage = infoPtr->items[iItem].iImage;
944
945 nmitem.mask = mask;
946 switch (mask)
947 {
948 case HDI_WIDTH:
949 nmitem.cxy = iValue;
950 break;
951 case HDI_ORDER:
952 nmitem.iOrder = iValue;
953 break;
954 default:
955 ERR("invalid mask value 0x%x\n", iValue);
956 }
957
958 return HEADER_SendNotifyWithHDItemT(infoPtr, code, iItem, &nmitem);
959}

Referenced by HEADER_LButtonDown(), HEADER_LButtonUp(), and HEADER_MouseMove().

◆ HEADER_SendSimpleNotify()

static BOOL HEADER_SendSimpleNotify ( const HEADER_INFO infoPtr,
UINT  code 
)
static

Definition at line 896 of file header.c.

897{
898 NMHDR nmhdr;
899 return (BOOL)HEADER_SendNotify(infoPtr, code, &nmhdr);
900}

Referenced by HEADER_LButtonUp(), and HEADER_RButtonUp().

◆ HEADER_SetBitmapMargin()

static LRESULT HEADER_SetBitmapMargin ( HEADER_INFO infoPtr,
INT  iMargin 
)
static

Definition at line 1517 of file header.c.

1518{
1519 INT oldMargin = infoPtr->iMargin;
1520
1521 infoPtr->iMargin = iMargin;
1522
1523 return oldMargin;
1524}

Referenced by HEADER_WindowProc().

◆ HEADER_SetCursor()

static LRESULT HEADER_SetCursor ( HEADER_INFO infoPtr,
LPARAM  lParam 
)
static

Definition at line 2036 of file header.c.

2037{
2038 POINT pt;
2039 UINT flags;
2040 INT nItem;
2041
2042 TRACE("code=0x%X id=0x%X\n", LOWORD(lParam), HIWORD(lParam));
2043
2044 GetCursorPos (&pt);
2045 ScreenToClient (infoPtr->hwndSelf, &pt);
2046
2047 HEADER_InternalHitTest (infoPtr, &pt, &flags, &nItem);
2048
2049 if (flags == HHT_ONDIVIDER)
2050 SetCursor (infoPtr->hcurDivider);
2051 else if (flags == HHT_ONDIVOPEN)
2052 SetCursor (infoPtr->hcurDivopen);
2053 else
2054 SetCursor (infoPtr->hcurArrow);
2055
2056 return 0;
2057}
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by HEADER_WindowProc().

◆ HEADER_SetFilterChangeTimeout()

static INT HEADER_SetFilterChangeTimeout ( HEADER_INFO infoPtr,
INT  timeout 
)
static

Definition at line 2120 of file header.c.

2121{
2122 INT old_timeout = infoPtr->filter_change_timeout;
2123
2124 if (timeout != 0)
2125 infoPtr->filter_change_timeout = timeout;
2126 return old_timeout;
2127}
Definition: dhcpd.h:245

Referenced by HEADER_WindowProc().

◆ HEADER_SetFont()

static LRESULT HEADER_SetFont ( HEADER_INFO infoPtr,
HFONT  hFont,
WORD  Redraw 
)
static

Definition at line 2061 of file header.c.

2062{
2064 HFONT hOldFont;
2065 HDC hdc;
2066
2067 infoPtr->hFont = hFont;
2068
2069 hdc = GetDC (0);
2070 hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : GetStockObject (SYSTEM_FONT));
2072 infoPtr->nHeight = tm.tmHeight + VERT_BORDER;
2073 SelectObject (hdc, hOldFont);
2074 ReleaseDC (0, hdc);
2075
2076 infoPtr->bRectsValid = FALSE;
2077
2078 if (Redraw) {
2079 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
2080 }
2081
2082 return 0;
2083}

Referenced by HEADER_WindowProc().

◆ HEADER_SetHotDivider()

static LRESULT HEADER_SetHotDivider ( HEADER_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1122 of file header.c.

1123{
1124 INT iDivider;
1125 RECT r;
1126
1127 if (wParam)
1128 {
1129 POINT pt;
1130 UINT flags;
1131 pt.x = (INT)(SHORT)LOWORD(lParam);
1132 pt.y = 0;
1133 HEADER_InternalHitTest (infoPtr, &pt, &flags, &iDivider);
1134
1135 if (flags & HHT_TOLEFT)
1136 iDivider = 0;
1137 else if (flags & HHT_NOWHERE || flags & HHT_TORIGHT)
1138 iDivider = infoPtr->uNumItem;
1139 else
1140 {
1141 HEADER_ITEM *lpItem = &infoPtr->items[iDivider];
1142 if (pt.x > (lpItem->rect.left+lpItem->rect.right)/2)
1143 iDivider = HEADER_NextItem(infoPtr, iDivider);
1144 }
1145 }
1146 else
1147 iDivider = (INT)lParam;
1148
1149 /* Note; wParam==FALSE, lParam==-1 is valid and is used to clear the hot divider */
1150 if (iDivider<-1 || iDivider>(int)infoPtr->uNumItem)
1151 return iDivider;
1152
1153 if (iDivider != infoPtr->iHotDivider)
1154 {
1155 if (infoPtr->iHotDivider != -1)
1156 {
1157 HEADER_GetHotDividerRect(infoPtr, &r);
1158 InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
1159 }
1160 infoPtr->iHotDivider = iDivider;
1161 if (iDivider != -1)
1162 {
1163 HEADER_GetHotDividerRect(infoPtr, &r);
1164 InvalidateRect(infoPtr->hwndSelf, &r, FALSE);
1165 }
1166 }
1167 return iDivider;
1168}
static INT HEADER_NextItem(const HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:211

Referenced by HEADER_LButtonUp(), HEADER_MouseMove(), and HEADER_WindowProc().

◆ HEADER_SetImageList()

static LRESULT HEADER_SetImageList ( HEADER_INFO infoPtr,
HIMAGELIST  himl 
)
static

Definition at line 1496 of file header.c.

1497{
1498 HIMAGELIST himlOld;
1499
1500 TRACE("(himl %p)\n", himl);
1501 himlOld = infoPtr->himl;
1502 infoPtr->himl = himl;
1503
1504 /* FIXME: Refresh needed??? */
1505
1506 return (LRESULT)himlOld;
1507}

Referenced by HEADER_WindowProc().

◆ HEADER_SetItemBounds()

static void HEADER_SetItemBounds ( HEADER_INFO infoPtr)
static

Definition at line 231 of file header.c.

232{
233 HEADER_ITEM *phdi;
234 RECT rect;
235 unsigned int i;
236 int x;
237
238 infoPtr->bRectsValid = TRUE;
239
240 if (infoPtr->uNumItem == 0)
241 return;
242
243 GetClientRect (infoPtr->hwndSelf, &rect);
244
245 x = rect.left;
246 for (i = 0; i < infoPtr->uNumItem; i++) {
247 phdi = &infoPtr->items[HEADER_OrderToIndex(infoPtr,i)];
248 phdi->rect.top = rect.top;
249 phdi->rect.bottom = rect.bottom;
250 phdi->rect.left = x;
251 phdi->rect.right = phdi->rect.left + ((phdi->cxy>0)?phdi->cxy:0);
252 x = phdi->rect.right;
253 }
254}

Referenced by HEADER_CreateDragImage(), HEADER_DeleteItem(), HEADER_InsertItemT(), HEADER_LButtonUp(), HEADER_MouseMove(), HEADER_Refresh(), HEADER_RefreshItem(), HEADER_SetItemT(), HEADER_SetOrderArray(), and HEADER_Size().

◆ HEADER_SetItemT()

static LRESULT HEADER_SetItemT ( HEADER_INFO infoPtr,
INT  nItem,
const HDITEMW phdi,
BOOL  bUnicode 
)
static

Definition at line 1527 of file header.c.

1528{
1529 HEADER_ITEM *lpItem;
1530 HDITEMW hdNotify;
1531 void *pvScratch;
1532
1533 if (phdi == NULL)
1534 return FALSE;
1535 if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem))
1536 return FALSE;
1537
1538 TRACE("[nItem=%d]\n", nItem);
1539
1540 HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch);
1541 if (HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGINGW, nItem, &hdNotify))
1542 {
1543 heap_free(pvScratch);
1544 return FALSE;
1545 }
1546
1547 lpItem = &infoPtr->items[nItem];
1548 HEADER_StoreHDItemInHeader(lpItem, phdi->mask, phdi, bUnicode);
1549
1550 if (phdi->mask & HDI_ORDER)
1551 if (phdi->iOrder >= 0 && phdi->iOrder < infoPtr->uNumItem)
1552 HEADER_ChangeItemOrder(infoPtr, nItem, phdi->iOrder);
1553
1554 HEADER_SendNotifyWithHDItemT(infoPtr, HDN_ITEMCHANGEDW, nItem, &hdNotify);
1555
1556 HEADER_SetItemBounds (infoPtr);
1557
1558 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1559
1560 heap_free(pvScratch);
1561 return TRUE;
1562}
static void HEADER_CopyHDItemForNotify(const HEADER_INFO *infoPtr, HDITEMW *dest, const HDITEMW *src, BOOL fSourceUnicode, LPVOID *ppvScratch)
Definition: header.c:851

Referenced by HEADER_WindowProc().

◆ HEADER_SetOrderArray()

static LRESULT HEADER_SetOrderArray ( HEADER_INFO infoPtr,
INT  size,
const INT order 
)
static

Definition at line 1330 of file header.c.

1331{
1332 HEADER_ITEM *lpItem;
1333 INT i;
1334
1335 if ((UINT)size != infoPtr->uNumItem)
1336 return FALSE;
1337
1338 if (TRACE_ON(header))
1339 {
1340 TRACE("count=%d, order array={", size);
1341 for (i = 0; i < size; i++)
1342 TRACE("%d%c", order[i], i != size-1 ? ',' : '}');
1343 TRACE("\n");
1344 }
1345
1346 for (i=0; i<size; i++)
1347 {
1348 if (order[i] >= size || order[i] < 0)
1349 /* on invalid index get next available */
1350 /* FIXME: if i==0 array item is out of range behaviour is
1351 different, see tests */
1352 infoPtr->order[i] = get_nextvalue(infoPtr->order, i, size);
1353 else
1354 {
1355 INT j, dup;
1356
1357 infoPtr->order[i] = order[i];
1358 j = i;
1359 /* remove duplicates */
1360 while ((dup = has_duplicate(infoPtr->order, j, order[j])) != -1)
1361 {
1362 INT next;
1363
1364 next = get_nextvalue(infoPtr->order, j, size);
1365 infoPtr->order[dup] = next;
1366 j--;
1367 }
1368 }
1369 }
1370 /* sync with item data */
1371 for (i=0; i<size; i++)
1372 {
1373 lpItem = &infoPtr->items[infoPtr->order[i]];
1374 lpItem->iOrder = i;
1375 }
1376 HEADER_SetItemBounds(infoPtr);
1377 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
1378 return TRUE;
1379}
static INT get_nextvalue(const INT *array, INT to, INT max)
Definition: header.c:1321
#define TRACE_ON(x)
Definition: compat.h:75
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
#define dup
Definition: syshdrs.h:51
static unsigned __int64 next
Definition: rand_nt.c:6

Referenced by HEADER_WindowProc().

◆ HEADER_SetRedraw()

static LRESULT HEADER_SetRedraw ( HEADER_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2085 of file header.c.

2086{
2087 /* ignoring the InvalidateRect calls is handled by user32. But some apps expect
2088 * that we invalidate the header and this has to be done manually */
2089 LRESULT ret;
2090
2092 if (wParam)
2093 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
2094 return ret;
2095}
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETREDRAW
Definition: winuser.h:1606

Referenced by HEADER_WindowProc().

◆ HEADER_SetUnicodeFormat()

static LRESULT HEADER_SetUnicodeFormat ( HEADER_INFO infoPtr,
WPARAM  wParam 
)
inlinestatic

Definition at line 1565 of file header.c.

1566{
1567 BOOL bTemp = (infoPtr->nNotifyFormat == NFR_UNICODE);
1568
1569 infoPtr->nNotifyFormat = ((BOOL)wParam ? NFR_UNICODE : NFR_ANSI);
1570
1571 return bTemp;
1572}
#define BOOL
Definition: nt_native.h:43
#define NFR_ANSI
Definition: winuser.h:2448

Referenced by HEADER_WindowProc().

◆ HEADER_Size()

static LRESULT HEADER_Size ( HEADER_INFO infoPtr)
static

Definition at line 257 of file header.c.

258{
259 HEADER_SetItemBounds(infoPtr);
260 return 0;
261}

Referenced by HEADER_WindowProc().

◆ HEADER_StoreHDItemInHeader()

static void HEADER_StoreHDItemInHeader ( HEADER_ITEM lpItem,
UINT  mask,
const HDITEMW phdi,
BOOL  fUnicode 
)
static

Definition at line 117 of file header.c.

118{
120 FIXME("unsupported header fields %x\n", (mask & HDI_UNSUPPORTED_FIELDS));
121
122 if (mask & HDI_BITMAP)
123 lpItem->hbm = phdi->hbm;
124
125 if (mask & HDI_FORMAT)
126 lpItem->fmt = phdi->fmt;
127
128 if (mask & HDI_LPARAM)
129 lpItem->lParam = phdi->lParam;
130
131 if (mask & HDI_WIDTH)
132 lpItem->cxy = phdi->cxy;
133
134 if (mask & HDI_IMAGE)
135 {
136 lpItem->iImage = phdi->iImage;
137 if (phdi->iImage == I_IMAGECALLBACK)
138 lpItem->callbackMask |= HDI_IMAGE;
139 else
140 lpItem->callbackMask &= ~HDI_IMAGE;
141 }
142
143 if (mask & HDI_TEXT)
144 {
145 heap_free(lpItem->pszText);
146 lpItem->pszText = NULL;
147
148 if (phdi->pszText != LPSTR_TEXTCALLBACKW) /* covers != TEXTCALLBACKA too */
149 {
150 static const WCHAR emptyString[] = {0};
151
152 LPCWSTR pszText = (phdi->pszText != NULL ? phdi->pszText : emptyString);
153 if (fUnicode)
154 Str_SetPtrW(&lpItem->pszText, pszText);
155 else
156 Str_SetPtrAtoW(&lpItem->pszText, (LPCSTR)pszText);
157 lpItem->callbackMask &= ~HDI_TEXT;
158 }
159 else
160 {
161 lpItem->pszText = NULL;
162 lpItem->callbackMask |= HDI_TEXT;
163 }
164 }
165}
#define FIXME(fmt,...)
Definition: debug.h:111
#define HDI_UNSUPPORTED_FIELDS
Definition: header.c:105
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:236
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by HEADER_InsertItemT(), and HEADER_SetItemT().

◆ HEADER_StyleChanged()

static INT HEADER_StyleChanged ( HEADER_INFO infoPtr,
WPARAM  wStyleType,
const STYLESTRUCT lpss 
)
static

Definition at line 2097 of file header.c.

2099{
2100 TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
2101 wStyleType, lpss->styleOld, lpss->styleNew);
2102
2103 if (wStyleType != GWL_STYLE) return 0;
2104
2105 infoPtr->dwStyle = lpss->styleNew;
2106
2107 return 0;
2108}
DWORD styleNew
Definition: winuser.h:3683
DWORD styleOld
Definition: winuser.h:3682
#define GWL_STYLE
Definition: winuser.h:846

Referenced by HEADER_WindowProc().

◆ HEADER_ThemeChanged()

static LRESULT HEADER_ThemeChanged ( const HEADER_INFO infoPtr)
static

Definition at line 2111 of file header.c.

2112{
2113 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
2114 CloseThemeData(theme);
2116 InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
2117 return 0;
2118}

Referenced by HEADER_WindowProc().

◆ HEADER_Unregister()

VOID HEADER_Unregister ( void  )

Definition at line 2297 of file header.c.

2298{
2300}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ HEADER_WindowProc()

static LRESULT WINAPI HEADER_WindowProc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2130 of file header.c.

2131{
2133
2134 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx\n", hwnd, msg, wParam, lParam);
2135 if (!infoPtr && (msg != WM_CREATE))
2136 return DefWindowProcW (hwnd, msg, wParam, lParam);
2137 switch (msg) {
2138/* case HDM_CLEARFILTER: */
2139
2141 return (LRESULT)HEADER_CreateDragImage (infoPtr, (INT)wParam);
2142
2143 case HDM_DELETEITEM:
2144 return HEADER_DeleteItem (infoPtr, (INT)wParam);
2145
2146/* case HDM_EDITFILTER: */
2147
2149 return HEADER_GetBitmapMargin(infoPtr);
2150
2151 case HDM_GETIMAGELIST:
2152 return HEADER_GetImageList (infoPtr);
2153
2154 case HDM_GETITEMA:
2155 case HDM_GETITEMW:
2156 return HEADER_GetItemT (infoPtr, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_GETITEMW);
2157
2158 case HDM_GETITEMCOUNT:
2159 return HEADER_GetItemCount (infoPtr);
2160
2161 case HDM_GETITEMRECT:
2162 return HEADER_GetItemRect (infoPtr, (INT)wParam, (LPRECT)lParam);
2163
2164 case HDM_GETORDERARRAY:
2165 return HEADER_GetOrderArray(infoPtr, (INT)wParam, (LPINT)lParam);
2166
2168 return HEADER_GetUnicodeFormat (infoPtr);
2169
2170 case HDM_HITTEST:
2171 return HEADER_HitTest (infoPtr, (LPHDHITTESTINFO)lParam);
2172
2173 case HDM_INSERTITEMA:
2174 case HDM_INSERTITEMW:
2176
2177 case HDM_LAYOUT:
2178 return HEADER_Layout (infoPtr, (LPHDLAYOUT)lParam);
2179
2180 case HDM_ORDERTOINDEX:
2181 return HEADER_OrderToIndex(infoPtr, (INT)wParam);
2182
2184 return HEADER_SetBitmapMargin(infoPtr, (INT)wParam);
2185
2187 return HEADER_SetFilterChangeTimeout(infoPtr, (INT)lParam);
2188
2189 case HDM_SETHOTDIVIDER:
2190 return HEADER_SetHotDivider(infoPtr, wParam, lParam);
2191
2192 case HDM_SETIMAGELIST:
2193 return HEADER_SetImageList (infoPtr, (HIMAGELIST)lParam);
2194
2195 case HDM_SETITEMA:
2196 case HDM_SETITEMW:
2197 return HEADER_SetItemT (infoPtr, (INT)wParam, (LPHDITEMW)lParam, msg == HDM_SETITEMW);
2198
2199 case HDM_SETORDERARRAY:
2200 return HEADER_SetOrderArray(infoPtr, (INT)wParam, (LPINT)lParam);
2201
2203 return HEADER_SetUnicodeFormat (infoPtr, wParam);
2204
2205 case WM_CREATE:
2207
2208 case WM_DESTROY:
2209 return HEADER_Destroy (infoPtr);
2210
2211 case WM_NCDESTROY:
2212 return HEADER_NCDestroy (infoPtr);
2213
2214 case WM_ERASEBKGND:
2215 return 1;
2216
2217 case WM_GETDLGCODE:
2219
2220 case WM_GETFONT:
2221 return HEADER_GetFont (infoPtr);
2222
2223 case WM_LBUTTONDBLCLK:
2224 return HEADER_LButtonDblClk (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2225
2226 case WM_LBUTTONDOWN:
2227 return HEADER_LButtonDown (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2228
2229 case WM_LBUTTONUP:
2230 return HEADER_LButtonUp (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2231
2232 case WM_MOUSELEAVE:
2233 return HEADER_MouseLeave (infoPtr);
2234
2235 case WM_MOUSEMOVE:
2236 return HEADER_MouseMove (infoPtr, lParam);
2237
2238 case WM_NOTIFYFORMAT:
2239 return HEADER_NotifyFormat (infoPtr, wParam, lParam);
2240
2241 case WM_SIZE:
2242 return HEADER_Size (infoPtr);
2243
2244 case WM_THEMECHANGED:
2245 return HEADER_ThemeChanged (infoPtr);
2246
2247 case WM_PRINTCLIENT:
2248 case WM_PAINT:
2249 return HEADER_Paint (infoPtr, (HDC)wParam);
2250
2251 case WM_RBUTTONUP:
2252 return HEADER_RButtonUp (infoPtr, (SHORT)LOWORD(lParam), (SHORT)HIWORD(lParam));
2253
2254 case WM_SETCURSOR:
2255 return HEADER_SetCursor (infoPtr, lParam);
2256
2257 case WM_SETFONT:
2258 return HEADER_SetFont (infoPtr, (HFONT)wParam, (WORD)lParam);
2259
2260 case WM_SETREDRAW:
2261 return HEADER_SetRedraw(infoPtr, wParam, lParam);
2262
2263 case WM_STYLECHANGED:
2265
2266 case WM_SYSCOLORCHANGE:
2268 return 0;
2269
2270 default:
2271 if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg))
2272 ERR("unknown msg %04x wp=%04lx lp=%08lx\n",
2273 msg, wParam, lParam );
2274 return DefWindowProcW(hwnd, msg, wParam, lParam);
2275 }
2276}
#define msg(x)
Definition: auth_time.c:54
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1586
static LRESULT HEADER_GetItemT(const HEADER_INFO *infoPtr, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
Definition: header.c:1221
static LRESULT HEADER_LButtonDown(HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:1689
static LRESULT HEADER_DeleteItem(HEADER_INFO *infoPtr, INT iItem)
Definition: header.c:1171
static LRESULT HEADER_Layout(HEADER_INFO *infoPtr, LPHDLAYOUT lpLayout)
Definition: header.c:1470
static LRESULT HEADER_SetFont(HEADER_INFO *infoPtr, HFONT hFont, WORD Redraw)
Definition: header.c:2061
static LRESULT HEADER_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: header.c:1576
static LRESULT HEADER_Paint(HEADER_INFO *infoPtr, HDC hdcParam)
Definition: header.c:2000
static LRESULT HEADER_GetItemCount(const HEADER_INFO *infoPtr)
Definition: header.c:1279
static LRESULT HEADER_ThemeChanged(const HEADER_INFO *infoPtr)
Definition: header.c:2111
static LRESULT HEADER_SetRedraw(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: header.c:2085
static LRESULT HEADER_GetBitmapMargin(const HEADER_INFO *infoPtr)
Definition: header.c:1511
static LRESULT HEADER_MouseMove(HEADER_INFO *infoPtr, LPARAM lParam)
Definition: header.c:1872
static LRESULT HEADER_NotifyFormat(HEADER_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: header.c:1839
static LRESULT HEADER_SetImageList(HEADER_INFO *infoPtr, HIMAGELIST himl)
Definition: header.c:1496
static LRESULT HEADER_LButtonDblClk(const HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:1669
static LRESULT HEADER_GetFont(const HEADER_INFO *infoPtr)
Definition: header.c:1652
static LRESULT HEADER_SetUnicodeFormat(HEADER_INFO *infoPtr, WPARAM wParam)
Definition: header.c:1565
static LRESULT HEADER_GetImageList(const HEADER_INFO *infoPtr)
Definition: header.c:1214
static LRESULT HEADER_HitTest(const HEADER_INFO *infoPtr, LPHDHITTESTINFO phti)
Definition: header.c:1389
static LRESULT HEADER_RButtonUp(HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:2014
static LRESULT HEADER_LButtonUp(HEADER_INFO *infoPtr, INT x, INT y)
Definition: header.c:1743
static LRESULT HEADER_SetOrderArray(HEADER_INFO *infoPtr, INT size, const INT *order)
Definition: header.c:1330
static LRESULT HEADER_GetItemRect(const HEADER_INFO *infoPtr, INT iItem, LPRECT lpRect)
Definition: header.c:1286
static LRESULT HEADER_GetOrderArray(const HEADER_INFO *infoPtr, INT size, LPINT order)
Definition: header.c:1301
static LRESULT HEADER_Destroy(HEADER_INFO *infoPtr)
Definition: header.c:1622
static LRESULT HEADER_MouseLeave(HEADER_INFO *infoPtr)
Definition: header.c:1857
static LRESULT HEADER_SetItemT(HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
Definition: header.c:1527
static LRESULT HEADER_GetUnicodeFormat(const HEADER_INFO *infoPtr)
Definition: header.c:1382
static LRESULT HEADER_Size(HEADER_INFO *infoPtr)
Definition: header.c:257
static LRESULT HEADER_NCDestroy(HEADER_INFO *infoPtr)
Definition: header.c:1630
static INT HEADER_SetFilterChangeTimeout(HEADER_INFO *infoPtr, INT timeout)
Definition: header.c:2120
static LRESULT HEADER_InsertItemT(HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUnicode)
Definition: header.c:1403
static LRESULT HEADER_SetCursor(HEADER_INFO *infoPtr, LPARAM lParam)
Definition: header.c:2036
static LRESULT HEADER_SetBitmapMargin(HEADER_INFO *infoPtr, INT iMargin)
Definition: header.c:1517
static INT HEADER_StyleChanged(HEADER_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: header.c:2097
#define WM_APP
Definition: eventvwr.h:73
unsigned short WORD
Definition: ntddk_ex.h:93
#define HDM_SETORDERARRAY
Definition: commctrl.h:809
#define HDM_GETBITMAPMARGIN
Definition: commctrl.h:818
#define HDM_SETITEMA
Definition: commctrl.h:753
#define HDM_SETUNICODEFORMAT
Definition: commctrl.h:821
#define HDM_GETUNICODEFORMAT
Definition: commctrl.h:824
#define HDM_INSERTITEMA
Definition: commctrl.h:736
#define HDM_LAYOUT
Definition: commctrl.h:767
#define HDM_GETITEMCOUNT
Definition: commctrl.h:733
#define HDM_GETITEMA
Definition: commctrl.h:746
#define HDM_SETHOTDIVIDER
Definition: commctrl.h:812
#define HDM_HITTEST
Definition: commctrl.h:789
#define HDM_SETIMAGELIST
Definition: commctrl.h:794
#define HDM_GETORDERARRAY
Definition: commctrl.h:806
#define HDM_SETBITMAPMARGIN
Definition: commctrl.h:815
#define WM_MOUSELEAVE
Definition: commctrl.h:4975
#define HDM_GETITEMW
Definition: commctrl.h:747
#define HDM_GETITEMRECT
Definition: commctrl.h:791
#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 HDM_CREATEDRAGIMAGE
Definition: commctrl.h:803
#define HDM_GETIMAGELIST
Definition: commctrl.h:797
#define HDM_DELETEITEM
Definition: commctrl.h:743
#define WM_PRINTCLIENT
Definition: richedit.h:70
int * LPINT
Definition: windef.h:178
#define WM_PAINT
Definition: winuser.h:1610
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define WM_CREATE
Definition: winuser.h:1598
#define DLGC_WANTTAB
Definition: winuser.h:2601
#define WM_SIZE
Definition: winuser.h:1601
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
#define WM_RBUTTONUP
Definition: winuser.h:1770
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
#define WM_GETFONT
Definition: winuser.h:1641
#define WM_SETFONT
Definition: winuser.h:1640
#define DLGC_WANTARROWS
Definition: winuser.h:2600
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define WM_NCDESTROY
Definition: winuser.h:1674
#define WM_SETCURSOR
Definition: winuser.h:1626
#define WM_USER
Definition: winuser.h:1885
#define WM_DESTROY
Definition: winuser.h:1599
#define WM_GETDLGCODE
Definition: winuser.h:1679

Referenced by HEADER_Register().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( header  )

Variable Documentation

◆ themeClass

const WCHAR themeClass[] = {'H','e','a','d','e','r',0}
static