mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 09:11:42 +00:00
update comctl32 to Wine-0.9.22 to get the new imagelist code.
svn path=/trunk/; revision=24384
This commit is contained in:
parent
2ef79f3efe
commit
ad0184614e
6 changed files with 379 additions and 461 deletions
|
@ -143,6 +143,7 @@ extern COMCTL32_SysColor comctl32_color;
|
||||||
HWND COMCTL32_CreateToolTip (HWND);
|
HWND COMCTL32_CreateToolTip (HWND);
|
||||||
VOID COMCTL32_RefreshSysColors(void);
|
VOID COMCTL32_RefreshSysColors(void);
|
||||||
void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal);
|
void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal);
|
||||||
|
void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground);
|
||||||
INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen);
|
INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen);
|
||||||
BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc);
|
BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc);
|
||||||
BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc);
|
BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc);
|
||||||
|
|
|
@ -81,3 +81,8 @@ STRINGTABLE DISCARDABLE
|
||||||
{
|
{
|
||||||
IDS_SEPARATOR "Odstêp"
|
IDS_SEPARATOR "Odstêp"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STRINGTABLE DISCARDABLE
|
||||||
|
{
|
||||||
|
HKY_NONE "Brak"
|
||||||
|
}
|
||||||
|
|
|
@ -1448,6 +1448,67 @@ void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark
|
||||||
DeleteObject(hPen);
|
DeleteObject(hPen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* COMCTL32_EnsureBitmapSize [internal]
|
||||||
|
*
|
||||||
|
* If needed enlarge the bitmap so that the width is at least cxMinWidth
|
||||||
|
* the height is at least cyMinHeight. If the bitmap already have these
|
||||||
|
* dimensions nothing changes.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* hBitmap [I/O] Bitmap to modify. The handle may change
|
||||||
|
* cxMinWidth [I] If the width of the bitmap is smaller then it will
|
||||||
|
* be enlarged to this value
|
||||||
|
* cyMinHeight [I] If the height of the bitmap is smaller then it will
|
||||||
|
* be enlarged to this value
|
||||||
|
* cyBackground [I] The color with which the new area will be filled
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* none
|
||||||
|
*/
|
||||||
|
void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground)
|
||||||
|
{
|
||||||
|
int cxNew, cyNew;
|
||||||
|
BITMAP bmp;
|
||||||
|
HBITMAP hNewBitmap;
|
||||||
|
HBITMAP hNewDCBitmap, hOldDCBitmap;
|
||||||
|
HBRUSH hNewDCBrush;
|
||||||
|
HDC hdcNew, hdcOld;
|
||||||
|
|
||||||
|
if (!GetObjectW(*pBitmap, sizeof(BITMAP), &bmp))
|
||||||
|
return;
|
||||||
|
cxNew = (cxMinWidth > bmp.bmWidth ? cxMinWidth : bmp.bmWidth);
|
||||||
|
cyNew = (cyMinHeight > bmp.bmHeight ? cyMinHeight : bmp.bmHeight);
|
||||||
|
if (cxNew == bmp.bmWidth && cyNew == bmp.bmHeight)
|
||||||
|
return;
|
||||||
|
|
||||||
|
hdcNew = CreateCompatibleDC(NULL);
|
||||||
|
hNewBitmap = CreateBitmap(cxNew, cyNew, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
|
||||||
|
hNewDCBitmap = SelectObject(hdcNew, hNewBitmap);
|
||||||
|
hNewDCBrush = SelectObject(hdcNew, CreateSolidBrush(crBackground));
|
||||||
|
|
||||||
|
hdcOld = CreateCompatibleDC(NULL);
|
||||||
|
hOldDCBitmap = SelectObject(hdcOld, *pBitmap);
|
||||||
|
|
||||||
|
BitBlt(hdcNew, 0, 0, bmp.bmWidth, bmp.bmHeight, hdcOld, 0, 0, SRCCOPY);
|
||||||
|
if (bmp.bmWidth < cxMinWidth)
|
||||||
|
PatBlt(hdcNew, bmp.bmWidth, 0, cxNew, bmp.bmHeight, PATCOPY);
|
||||||
|
if (bmp.bmHeight < cyMinHeight)
|
||||||
|
PatBlt(hdcNew, 0, bmp.bmHeight, bmp.bmWidth, cyNew, PATCOPY);
|
||||||
|
if (bmp.bmWidth < cxMinWidth && bmp.bmHeight < cyMinHeight)
|
||||||
|
PatBlt(hdcNew, bmp.bmWidth, bmp.bmHeight, cxNew, cyNew, PATCOPY);
|
||||||
|
|
||||||
|
SelectObject(hdcNew, hNewDCBitmap);
|
||||||
|
DeleteObject(SelectObject(hdcNew, hNewDCBrush));
|
||||||
|
DeleteDC(hdcNew);
|
||||||
|
SelectObject(hdcOld, hOldDCBitmap);
|
||||||
|
DeleteDC(hdcOld);
|
||||||
|
|
||||||
|
DeleteObject(*pBitmap);
|
||||||
|
*pBitmap = hNewBitmap;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MirrorIcon [COMCTL32.414]
|
* MirrorIcon [COMCTL32.414]
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* Copyright 1998 Eric Kohl
|
* Copyright 1998 Eric Kohl
|
||||||
* Copyright 2000 Eric Kohl for CodeWeavers
|
* Copyright 2000 Eric Kohl for CodeWeavers
|
||||||
* Copyright 2003 Maxime Bellenge
|
* Copyright 2003 Maxime Bellenge
|
||||||
|
* Copyright 2006 Mikolaj Zalewski
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -20,15 +21,11 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - Imagelist support (partially).
|
* - Imagelist support (completed?)
|
||||||
* - Callback items (under construction).
|
* - Hottrack support (completed?)
|
||||||
* - Hottrack support (partially).
|
* - Custom draw support (completed?)
|
||||||
* - Custom draw support (including Notifications).
|
* - Filters support (HDS_FILTER, HDI_FILTER, HDM_*FILTER*, HDN_*FILTER*)
|
||||||
* - Drag and Drop support (including Notifications).
|
* - New Windows Vista features
|
||||||
* - New messages.
|
|
||||||
* - Use notification format
|
|
||||||
* - Correct the order maintenance code to preserve valid order
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -84,7 +81,6 @@ typedef struct
|
||||||
INT iMoveItem; /* index of tracked item. (Tracking mode) */
|
INT iMoveItem; /* index of tracked item. (Tracking mode) */
|
||||||
INT xTrackOffset; /* distance between the right side of the tracked item and the cursor */
|
INT xTrackOffset; /* distance between the right side of the tracked item and the cursor */
|
||||||
INT xOldTrack; /* track offset (see above) after the last WM_MOUSEMOVE */
|
INT xOldTrack; /* track offset (see above) after the last WM_MOUSEMOVE */
|
||||||
INT nOldWidth; /* width of a sizing item after the last WM_MOUSEMOVE */
|
|
||||||
INT iHotItem; /* index of hot item (cursor is over this item) */
|
INT iHotItem; /* index of hot item (cursor is over this item) */
|
||||||
INT iHotDivider; /* index of the hot divider (used while dragging an item or by HDM_SETHOTDIVIDER) */
|
INT iHotDivider; /* index of the hot divider (used while dragging an item or by HDM_SETHOTDIVIDER) */
|
||||||
INT iMargin; /* width of the margin that surrounds a bitmap */
|
INT iMargin; /* width of the margin that surrounds a bitmap */
|
||||||
|
@ -802,32 +798,11 @@ HEADER_SendSimpleNotify (HWND hwnd, UINT code)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
HEADER_SendHeaderNotifyT (HWND hwnd, UINT code, INT iItem, INT mask, HDITEMW *lpItem)
|
HEADER_SendNotifyWithHDItemT(HWND hwnd, UINT code, INT iItem, HDITEMW *lpItem)
|
||||||
{
|
{
|
||||||
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
|
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
|
||||||
NMHEADERW nmhdr;
|
NMHEADERW nmhdr;
|
||||||
HDITEMW nmitem;
|
|
||||||
|
|
||||||
if (lpItem == NULL)
|
|
||||||
{
|
|
||||||
/* lpItem == NULL means that we should take the actual data from the item */
|
|
||||||
if (mask & HDI_TEXT)
|
|
||||||
{
|
|
||||||
FIXME("(): invalid parameters - lpItem == NULL and (mask & HDI_TEXT)\n");
|
|
||||||
mask &= ~HDI_TEXT;
|
|
||||||
}
|
|
||||||
nmitem.mask = mask;
|
|
||||||
nmitem.cxy = infoPtr->items[iItem].cxy;
|
|
||||||
nmitem.hbm = infoPtr->items[iItem].hbm;
|
|
||||||
nmitem.pszText = NULL;
|
|
||||||
nmitem.cchTextMax = 0;
|
|
||||||
nmitem.fmt = infoPtr->items[iItem].fmt;
|
|
||||||
nmitem.lParam = infoPtr->items[iItem].lParam;
|
|
||||||
nmitem.iOrder = infoPtr->items[iItem].iOrder;
|
|
||||||
nmitem.iImage = infoPtr->items[iItem].iImage;
|
|
||||||
lpItem = &nmitem;
|
|
||||||
}
|
|
||||||
|
|
||||||
nmhdr.hdr.hwndFrom = hwnd;
|
nmhdr.hdr.hwndFrom = hwnd;
|
||||||
nmhdr.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
|
nmhdr.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
|
||||||
nmhdr.hdr.code = (infoPtr->nNotifyFormat == NFR_UNICODE ? code : HEADER_NotifyCodeWtoA(code));
|
nmhdr.hdr.code = (infoPtr->nNotifyFormat == NFR_UNICODE ? code : HEADER_NotifyCodeWtoA(code));
|
||||||
|
@ -839,6 +814,38 @@ HEADER_SendHeaderNotifyT (HWND hwnd, UINT code, INT iItem, INT mask, HDITEMW *lp
|
||||||
(WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr);
|
(WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
HEADER_SendNotifyWithIntFieldT(HWND hwnd, UINT code, INT iItem, INT mask, INT iValue)
|
||||||
|
{
|
||||||
|
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
|
||||||
|
HDITEMW nmitem;
|
||||||
|
|
||||||
|
/* copying only the iValue should be ok but to make the code more robust we copy everything */
|
||||||
|
nmitem.cxy = infoPtr->items[iItem].cxy;
|
||||||
|
nmitem.hbm = infoPtr->items[iItem].hbm;
|
||||||
|
nmitem.pszText = NULL;
|
||||||
|
nmitem.cchTextMax = 0;
|
||||||
|
nmitem.fmt = infoPtr->items[iItem].fmt;
|
||||||
|
nmitem.lParam = infoPtr->items[iItem].lParam;
|
||||||
|
nmitem.iOrder = infoPtr->items[iItem].iOrder;
|
||||||
|
nmitem.iImage = infoPtr->items[iItem].iImage;
|
||||||
|
|
||||||
|
nmitem.mask = mask;
|
||||||
|
switch (mask)
|
||||||
|
{
|
||||||
|
case HDI_WIDTH:
|
||||||
|
nmitem.cxy = iValue;
|
||||||
|
break;
|
||||||
|
case HDI_ORDER:
|
||||||
|
nmitem.iOrder = iValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ERR("invalid mask value 0x%x\n", iValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return HEADER_SendNotifyWithHDItemT(hwnd, code, iItem, &nmitem);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare callback items
|
* Prepare callback items
|
||||||
* depends on NMHDDISPINFOW having same structure as NMHDDISPINFOA
|
* depends on NMHDDISPINFOW having same structure as NMHDDISPINFOA
|
||||||
|
@ -952,23 +959,6 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
|
||||||
lpItem->iImage = I_IMAGECALLBACK;
|
lpItem->iImage = I_IMAGECALLBACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
|
||||||
HEADER_SendClickNotify (HWND hwnd, UINT code, INT iItem)
|
|
||||||
{
|
|
||||||
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
|
|
||||||
NMHEADERA nmhdr;
|
|
||||||
|
|
||||||
nmhdr.hdr.hwndFrom = hwnd;
|
|
||||||
nmhdr.hdr.idFrom = GetWindowLongPtrW (hwnd, GWLP_ID);
|
|
||||||
nmhdr.hdr.code = code;
|
|
||||||
nmhdr.iItem = iItem;
|
|
||||||
nmhdr.iButton = 0;
|
|
||||||
nmhdr.pitem = NULL;
|
|
||||||
|
|
||||||
return (BOOL)SendMessageA (infoPtr->hwndNotify, WM_NOTIFY,
|
|
||||||
(WPARAM)nmhdr.hdr.idFrom, (LPARAM)&nmhdr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
|
HEADER_CreateDragImage (HWND hwnd, WPARAM wParam)
|
||||||
{
|
{
|
||||||
|
@ -1060,67 +1050,40 @@ HEADER_DeleteItem (HWND hwnd, WPARAM wParam)
|
||||||
{
|
{
|
||||||
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
|
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(hwnd);
|
||||||
INT iItem = (INT)wParam;
|
INT iItem = (INT)wParam;
|
||||||
|
INT iOrder;
|
||||||
|
INT i;
|
||||||
|
|
||||||
TRACE("[iItem=%d]\n", iItem);
|
TRACE("[iItem=%d]\n", iItem);
|
||||||
|
|
||||||
if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem))
|
if ((iItem < 0) || (iItem >= (INT)infoPtr->uNumItem))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (infoPtr->uNumItem == 1) {
|
for (i = 0; i < infoPtr->uNumItem; i++)
|
||||||
TRACE("Simple delete!\n");
|
TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
|
||||||
HEADER_DisposeItem(&infoPtr->items[0]);
|
|
||||||
Free (infoPtr->items);
|
iOrder = infoPtr->items[iItem].iOrder;
|
||||||
Free(infoPtr->order);
|
HEADER_DisposeItem(&infoPtr->items[iItem]);
|
||||||
infoPtr->items = 0;
|
|
||||||
infoPtr->order = 0;
|
infoPtr->uNumItem--;
|
||||||
infoPtr->uNumItem = 0;
|
memmove(&infoPtr->items[iItem], &infoPtr->items[iItem + 1],
|
||||||
}
|
(infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM));
|
||||||
else {
|
memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1],
|
||||||
HEADER_ITEM *oldItems = infoPtr->items;
|
(infoPtr->uNumItem - iOrder) * sizeof(INT));
|
||||||
INT i;
|
infoPtr->items = ReAlloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
|
||||||
INT iOrder;
|
infoPtr->order = ReAlloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
|
||||||
TRACE("Complex delete! [iItem=%d]\n", iItem);
|
|
||||||
|
/* Correct the orders */
|
||||||
for (i = 0; i < infoPtr->uNumItem; i++)
|
for (i = 0; i < infoPtr->uNumItem; i++)
|
||||||
TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
|
{
|
||||||
HEADER_DisposeItem(&infoPtr->items[iItem]);
|
if (infoPtr->order[i] > iItem)
|
||||||
iOrder = infoPtr->items[iItem].iOrder;
|
infoPtr->order[i]--;
|
||||||
|
if (i >= iOrder)
|
||||||
infoPtr->uNumItem--;
|
infoPtr->items[infoPtr->order[i]].iOrder = i;
|
||||||
infoPtr->items = Alloc (sizeof (HEADER_ITEM) * infoPtr->uNumItem);
|
|
||||||
/* pre delete copy */
|
|
||||||
if (iItem > 0) {
|
|
||||||
memcpy (&infoPtr->items[0], &oldItems[0],
|
|
||||||
iItem * sizeof(HEADER_ITEM));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* post delete copy */
|
|
||||||
if (iItem < infoPtr->uNumItem) {
|
|
||||||
memcpy (&infoPtr->items[iItem], &oldItems[iItem+1],
|
|
||||||
(infoPtr->uNumItem - iItem) * sizeof(HEADER_ITEM));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Correct the orders */
|
|
||||||
if (iOrder < infoPtr->uNumItem)
|
|
||||||
{
|
|
||||||
memmove(&infoPtr->order[iOrder], &infoPtr->order[iOrder + 1],
|
|
||||||
(infoPtr->uNumItem - iOrder) * sizeof(INT));
|
|
||||||
for (i = 0; i < infoPtr->uNumItem; i++)
|
|
||||||
{
|
|
||||||
if (infoPtr->order[i] > iItem)
|
|
||||||
infoPtr->order[i]--;
|
|
||||||
if (i >= iOrder)
|
|
||||||
infoPtr->items[infoPtr->order[i]].iOrder = infoPtr->order[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < infoPtr->uNumItem; i++)
|
|
||||||
TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
|
|
||||||
Free (oldItems);
|
|
||||||
}
|
}
|
||||||
|
for (i = 0; i < infoPtr->uNumItem; i++)
|
||||||
|
TRACE("%d: order=%d, iOrder=%d, ->iOrder=%d\n", i, infoPtr->order[i], infoPtr->items[i].iOrder, infoPtr->items[infoPtr->order[i]].iOrder);
|
||||||
|
|
||||||
HEADER_SetItemBounds (hwnd);
|
HEADER_SetItemBounds (hwnd);
|
||||||
|
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1299,51 +1262,23 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
|
||||||
else if (infoPtr->uNumItem < iOrder)
|
else if (infoPtr->uNumItem < iOrder)
|
||||||
iOrder = infoPtr->uNumItem;
|
iOrder = infoPtr->uNumItem;
|
||||||
|
|
||||||
if (infoPtr->uNumItem == 0) {
|
infoPtr->uNumItem++;
|
||||||
infoPtr->items = Alloc (sizeof (HEADER_ITEM));
|
infoPtr->items = ReAlloc(infoPtr->items, sizeof(HEADER_ITEM) * infoPtr->uNumItem);
|
||||||
infoPtr->order = Alloc(sizeof(INT));
|
infoPtr->order = ReAlloc(infoPtr->order, sizeof(INT) * infoPtr->uNumItem);
|
||||||
infoPtr->uNumItem++;
|
|
||||||
}
|
/* make space for the new item */
|
||||||
else {
|
memmove(&infoPtr->items[nItem + 1], &infoPtr->items[nItem],
|
||||||
HEADER_ITEM *oldItems = infoPtr->items;
|
(infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM));
|
||||||
INT *oldOrder = infoPtr->order;
|
memmove(&infoPtr->order[iOrder + 1], &infoPtr->order[iOrder],
|
||||||
|
(infoPtr->uNumItem - iOrder - 1) * sizeof(INT));
|
||||||
infoPtr->uNumItem++;
|
|
||||||
infoPtr->items = Alloc (sizeof (HEADER_ITEM) * infoPtr->uNumItem);
|
|
||||||
if (nItem == 0) {
|
|
||||||
memcpy (&infoPtr->items[1], &oldItems[0],
|
|
||||||
(infoPtr->uNumItem-1) * sizeof(HEADER_ITEM));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* pre insert copy */
|
|
||||||
if (nItem > 0) {
|
|
||||||
memcpy (&infoPtr->items[0], &oldItems[0],
|
|
||||||
nItem * sizeof(HEADER_ITEM));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* post insert copy */
|
|
||||||
if (nItem < infoPtr->uNumItem - 1) {
|
|
||||||
memcpy (&infoPtr->items[nItem+1], &oldItems[nItem],
|
|
||||||
(infoPtr->uNumItem - nItem - 1) * sizeof(HEADER_ITEM));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
infoPtr->order = Alloc(sizeof(INT) * infoPtr->uNumItem);
|
|
||||||
memcpy(infoPtr->order, oldOrder, iOrder * sizeof(INT));
|
|
||||||
infoPtr->order[iOrder] = nItem;
|
|
||||||
memcpy(&infoPtr->order[iOrder + 1], &oldOrder[iOrder],
|
|
||||||
(infoPtr->uNumItem - iOrder - 1) * sizeof(INT));
|
|
||||||
|
|
||||||
Free (oldItems);
|
|
||||||
Free(oldOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* update the order array */
|
||||||
|
infoPtr->order[iOrder] = nItem;
|
||||||
for (i = 0; i < infoPtr->uNumItem; i++)
|
for (i = 0; i < infoPtr->uNumItem; i++)
|
||||||
{
|
{
|
||||||
if (i != iOrder && infoPtr->order[i] >= nItem)
|
if (i != iOrder && infoPtr->order[i] >= nItem)
|
||||||
infoPtr->order[i]++;
|
infoPtr->order[i]++;
|
||||||
infoPtr->items[infoPtr->order[i]].iOrder = infoPtr->order[i];
|
infoPtr->items[infoPtr->order[i]].iOrder = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
lpItem = &infoPtr->items[nItem];
|
lpItem = &infoPtr->items[nItem];
|
||||||
|
@ -1351,6 +1286,7 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
|
||||||
/* cxy, fmt and lParam are copied even if not in the HDITEM mask */
|
/* cxy, fmt and lParam are copied even if not in the HDITEM mask */
|
||||||
copyMask = phdi->mask | HDI_WIDTH | HDI_FORMAT | HDI_LPARAM;
|
copyMask = phdi->mask | HDI_WIDTH | HDI_FORMAT | HDI_LPARAM;
|
||||||
HEADER_StoreHDItemInHeader(lpItem, copyMask, phdi, bUnicode);
|
HEADER_StoreHDItemInHeader(lpItem, copyMask, phdi, bUnicode);
|
||||||
|
lpItem->iOrder = iOrder;
|
||||||
|
|
||||||
/* set automatically some format bits */
|
/* set automatically some format bits */
|
||||||
if (phdi->mask & HDI_TEXT)
|
if (phdi->mask & HDI_TEXT)
|
||||||
|
@ -1366,10 +1302,7 @@ HEADER_InsertItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
|
||||||
if (phdi->mask & HDI_IMAGE)
|
if (phdi->mask & HDI_IMAGE)
|
||||||
lpItem->fmt |= HDF_IMAGE;
|
lpItem->fmt |= HDF_IMAGE;
|
||||||
|
|
||||||
lpItem->iOrder = iOrder;
|
|
||||||
|
|
||||||
HEADER_SetItemBounds (hwnd);
|
HEADER_SetItemBounds (hwnd);
|
||||||
|
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
|
||||||
return nItem;
|
return nItem;
|
||||||
|
@ -1456,7 +1389,7 @@ HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
|
||||||
TRACE("[nItem=%d]\n", nItem);
|
TRACE("[nItem=%d]\n", nItem);
|
||||||
|
|
||||||
HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch);
|
HEADER_CopyHDItemForNotify(infoPtr, &hdNotify, phdi, bUnicode, &pvScratch);
|
||||||
if (HEADER_SendHeaderNotifyT (hwnd, HDN_ITEMCHANGINGW, nItem, phdi->mask, &hdNotify))
|
if (HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMCHANGINGW, nItem, &hdNotify))
|
||||||
{
|
{
|
||||||
if (pvScratch) Free(pvScratch);
|
if (pvScratch) Free(pvScratch);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1469,7 +1402,7 @@ HEADER_SetItemT (HWND hwnd, INT nItem, LPHDITEMW phdi, BOOL bUnicode)
|
||||||
if (phdi->iOrder >= 0 && phdi->iOrder < infoPtr->uNumItem)
|
if (phdi->iOrder >= 0 && phdi->iOrder < infoPtr->uNumItem)
|
||||||
HEADER_ChangeItemOrder(infoPtr, nItem, phdi->iOrder);
|
HEADER_ChangeItemOrder(infoPtr, nItem, phdi->iOrder);
|
||||||
|
|
||||||
HEADER_SendHeaderNotifyT (hwnd, HDN_ITEMCHANGEDW, nItem, phdi->mask, &hdNotify);
|
HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMCHANGEDW, nItem, &hdNotify);
|
||||||
|
|
||||||
HEADER_SetItemBounds (hwnd);
|
HEADER_SetItemBounds (hwnd);
|
||||||
|
|
||||||
|
@ -1597,9 +1530,9 @@ HEADER_LButtonDblClk (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
|
HEADER_InternalHitTest (hwnd, &pt, &flags, &nItem);
|
||||||
|
|
||||||
if ((GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER))
|
if ((GetWindowLongW (hwnd, GWL_STYLE) & HDS_BUTTONS) && (flags == HHT_ONHEADER))
|
||||||
HEADER_SendHeaderNotifyT (hwnd, HDN_ITEMDBLCLICKW, nItem, 0, NULL);
|
HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMDBLCLICKW, nItem, NULL);
|
||||||
else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
|
else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN))
|
||||||
HEADER_SendHeaderNotifyT (hwnd, HDN_DIVIDERDBLCLICKW, nItem, 0, NULL);
|
HEADER_SendNotifyWithHDItemT(hwnd, HDN_DIVIDERDBLCLICKW, nItem, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1637,12 +1570,13 @@ HEADER_LButtonDown (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TRACE("Pressed item %d!\n", nItem);
|
TRACE("Pressed item %d!\n", nItem);
|
||||||
}
|
}
|
||||||
else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) {
|
else if ((flags == HHT_ONDIVIDER) || (flags == HHT_ONDIVOPEN)) {
|
||||||
if (!(HEADER_SendHeaderNotifyT (hwnd, HDN_BEGINTRACKW, nItem, HDI_WIDTH, NULL))) {
|
INT iCurrWidth = infoPtr->items[nItem].cxy;
|
||||||
|
if (!HEADER_SendNotifyWithIntFieldT(hwnd, HDN_BEGINTRACKW, nItem, HDI_WIDTH, iCurrWidth))
|
||||||
|
{
|
||||||
SetCapture (hwnd);
|
SetCapture (hwnd);
|
||||||
infoPtr->bCaptured = TRUE;
|
infoPtr->bCaptured = TRUE;
|
||||||
infoPtr->bTracking = TRUE;
|
infoPtr->bTracking = TRUE;
|
||||||
infoPtr->iMoveItem = nItem;
|
infoPtr->iMoveItem = nItem;
|
||||||
infoPtr->nOldWidth = infoPtr->items[nItem].cxy;
|
|
||||||
infoPtr->xTrackOffset = infoPtr->items[nItem].rect.right - pt.x;
|
infoPtr->xTrackOffset = infoPtr->items[nItem].rect.right - pt.x;
|
||||||
|
|
||||||
if (!(dwStyle & HDS_FULLDRAG)) {
|
if (!(dwStyle & HDS_FULLDRAG)) {
|
||||||
|
@ -1667,7 +1601,7 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
|
DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
|
||||||
POINT pt;
|
POINT pt;
|
||||||
UINT flags;
|
UINT flags;
|
||||||
INT nItem, nWidth;
|
INT nItem;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
|
|
||||||
pt.x = (INT)(SHORT)LOWORD(lParam);
|
pt.x = (INT)(SHORT)LOWORD(lParam);
|
||||||
|
@ -1695,9 +1629,8 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
iNewOrder--;
|
iNewOrder--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: the new order field should be sent, not the old one */
|
|
||||||
if (iNewOrder != -1 &&
|
if (iNewOrder != -1 &&
|
||||||
!HEADER_SendHeaderNotifyT(hwnd, HDN_ENDDRAG, infoPtr->iMoveItem, HDI_ORDER, NULL))
|
!HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ENDDRAG, infoPtr->iMoveItem, HDI_ORDER, iNewOrder))
|
||||||
{
|
{
|
||||||
HEADER_ChangeItemOrder(infoPtr, infoPtr->iMoveItem, iNewOrder);
|
HEADER_ChangeItemOrder(infoPtr, infoPtr->iMoveItem, iNewOrder);
|
||||||
infoPtr->bRectsValid = FALSE;
|
infoPtr->bRectsValid = FALSE;
|
||||||
|
@ -1715,17 +1648,20 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem);
|
HEADER_RefreshItem (hwnd, hdc, infoPtr->iMoveItem);
|
||||||
ReleaseDC (hwnd, hdc);
|
ReleaseDC (hwnd, hdc);
|
||||||
|
|
||||||
HEADER_SendClickNotify (hwnd, HDN_ITEMCLICKA, infoPtr->iMoveItem);
|
HEADER_SendNotifyWithHDItemT(hwnd, HDN_ITEMCLICKW, infoPtr->iMoveItem, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Released item %d!\n", infoPtr->iMoveItem);
|
TRACE("Released item %d!\n", infoPtr->iMoveItem);
|
||||||
infoPtr->bPressed = FALSE;
|
infoPtr->bPressed = FALSE;
|
||||||
}
|
}
|
||||||
else if (infoPtr->bTracking) {
|
else if (infoPtr->bTracking) {
|
||||||
|
INT iNewWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;
|
||||||
|
if (iNewWidth < 0)
|
||||||
|
iNewWidth = 0;
|
||||||
TRACE("End tracking item %d!\n", infoPtr->iMoveItem);
|
TRACE("End tracking item %d!\n", infoPtr->iMoveItem);
|
||||||
infoPtr->bTracking = FALSE;
|
infoPtr->bTracking = FALSE;
|
||||||
|
|
||||||
HEADER_SendHeaderNotifyT (hwnd, HDN_ENDTRACKW, infoPtr->iMoveItem, HDI_WIDTH, NULL);
|
HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ENDTRACKW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
|
||||||
|
|
||||||
if (!(dwStyle & HDS_FULLDRAG)) {
|
if (!(dwStyle & HDS_FULLDRAG)) {
|
||||||
hdc = GetDC (hwnd);
|
hdc = GetDC (hwnd);
|
||||||
|
@ -1733,20 +1669,14 @@ HEADER_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
ReleaseDC (hwnd, hdc);
|
ReleaseDC (hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HEADER_SendHeaderNotifyT(hwnd, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, NULL))
|
if (!HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth))
|
||||||
{
|
{
|
||||||
infoPtr->items[infoPtr->iMoveItem].cxy = infoPtr->nOldWidth;
|
infoPtr->items[infoPtr->iMoveItem].cxy = iNewWidth;
|
||||||
}
|
HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, iNewWidth);
|
||||||
else {
|
|
||||||
nWidth = pt.x - infoPtr->items[infoPtr->iMoveItem].rect.left + infoPtr->xTrackOffset;
|
|
||||||
if (nWidth < 0)
|
|
||||||
nWidth = 0;
|
|
||||||
infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HEADER_SetItemBounds (hwnd);
|
HEADER_SetItemBounds (hwnd);
|
||||||
InvalidateRect(hwnd, NULL, TRUE);
|
InvalidateRect(hwnd, NULL, TRUE);
|
||||||
HEADER_SendHeaderNotifyT(hwnd, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (infoPtr->bCaptured) {
|
if (infoPtr->bCaptured) {
|
||||||
|
@ -1826,7 +1756,7 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (infoPtr->bPressed && !infoPtr->bDragging && dwStyle&HDS_DRAGDROP
|
if (infoPtr->bPressed && !infoPtr->bDragging && dwStyle&HDS_DRAGDROP
|
||||||
&& HEADER_IsDragDistance(infoPtr, &pt))
|
&& HEADER_IsDragDistance(infoPtr, &pt))
|
||||||
{
|
{
|
||||||
if (!HEADER_SendHeaderNotifyT(hwnd, HDN_BEGINDRAG, infoPtr->iMoveItem, 0, NULL))
|
if (!HEADER_SendNotifyWithHDItemT(hwnd, HDN_BEGINDRAG, infoPtr->iMoveItem, NULL))
|
||||||
{
|
{
|
||||||
HIMAGELIST hDragItem = (HIMAGELIST)HEADER_CreateDragImage(hwnd, infoPtr->iMoveItem);
|
HIMAGELIST hDragItem = (HIMAGELIST)HEADER_CreateDragImage(hwnd, infoPtr->iMoveItem);
|
||||||
if (hDragItem != NULL)
|
if (hDragItem != NULL)
|
||||||
|
@ -1867,14 +1797,14 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
else if (infoPtr->bTracking) {
|
else if (infoPtr->bTracking) {
|
||||||
if (dwStyle & HDS_FULLDRAG) {
|
if (dwStyle & HDS_FULLDRAG) {
|
||||||
if (!HEADER_SendHeaderNotifyT (hwnd, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, NULL))
|
HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
|
||||||
|
nWidth = pt.x - lpItem->rect.left + infoPtr->xTrackOffset;
|
||||||
|
if (!HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGINGW, infoPtr->iMoveItem, HDI_WIDTH, nWidth))
|
||||||
{
|
{
|
||||||
HEADER_ITEM *lpItem = &infoPtr->items[infoPtr->iMoveItem];
|
|
||||||
INT nOldWidth = lpItem->rect.right - lpItem->rect.left;
|
INT nOldWidth = lpItem->rect.right - lpItem->rect.left;
|
||||||
RECT rcClient;
|
RECT rcClient;
|
||||||
RECT rcScroll;
|
RECT rcScroll;
|
||||||
|
|
||||||
nWidth = pt.x - lpItem->rect.left + infoPtr->xTrackOffset;
|
|
||||||
if (nWidth < 0) nWidth = 0;
|
if (nWidth < 0) nWidth = 0;
|
||||||
infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
|
infoPtr->items[infoPtr->iMoveItem].cxy = nWidth;
|
||||||
HEADER_SetItemBounds(hwnd);
|
HEADER_SetItemBounds(hwnd);
|
||||||
|
@ -1886,20 +1816,21 @@ HEADER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
InvalidateRect(hwnd, &lpItem->rect, FALSE);
|
InvalidateRect(hwnd, &lpItem->rect, FALSE);
|
||||||
UpdateWindow(hwnd);
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
HEADER_SendHeaderNotifyT(hwnd, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, NULL);
|
HEADER_SendNotifyWithIntFieldT(hwnd, HDN_ITEMCHANGEDW, infoPtr->iMoveItem, HDI_WIDTH, nWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
INT iTrackWidth;
|
||||||
hdc = GetDC (hwnd);
|
hdc = GetDC (hwnd);
|
||||||
HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
|
HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
|
||||||
infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset;
|
infoPtr->xOldTrack = pt.x + infoPtr->xTrackOffset;
|
||||||
if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left)
|
if (infoPtr->xOldTrack < infoPtr->items[infoPtr->iMoveItem].rect.left)
|
||||||
infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left;
|
infoPtr->xOldTrack = infoPtr->items[infoPtr->iMoveItem].rect.left;
|
||||||
infoPtr->items[infoPtr->iMoveItem].cxy =
|
|
||||||
infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left;
|
|
||||||
HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
|
HEADER_DrawTrackLine (hwnd, hdc, infoPtr->xOldTrack);
|
||||||
ReleaseDC (hwnd, hdc);
|
ReleaseDC (hwnd, hdc);
|
||||||
HEADER_SendHeaderNotifyT (hwnd, HDN_TRACKW, infoPtr->iMoveItem, HDI_WIDTH, NULL);
|
iTrackWidth = infoPtr->xOldTrack - infoPtr->items[infoPtr->iMoveItem].rect.left;
|
||||||
|
/* FIXME: should stop tracking if HDN_TRACK returnes TRUE */
|
||||||
|
HEADER_SendNotifyWithIntFieldT(hwnd, HDN_TRACKW, infoPtr->iMoveItem, HDI_WIDTH, iTrackWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Tracking item %d!\n", infoPtr->iMoveItem);
|
TRACE("Tracking item %d!\n", infoPtr->iMoveItem);
|
||||||
|
|
|
@ -2546,11 +2546,12 @@ ImageList_SetImageCount (HIMAGELIST himl, UINT iImageCount)
|
||||||
|
|
||||||
if (!is_valid(himl))
|
if (!is_valid(himl))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (himl->cCurImage >= iImageCount)
|
if (iImageCount < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (himl->cMaxImage > iImageCount)
|
if (himl->cMaxImage > iImageCount)
|
||||||
{
|
{
|
||||||
himl->cCurImage = iImageCount;
|
himl->cCurImage = iImageCount;
|
||||||
|
/* TODO: shrink the bitmap when cMaxImage-cCurImage>cGrow ? */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,6 +250,7 @@ static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIS
|
||||||
static LRESULT TOOLBAR_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
static LRESULT TOOLBAR_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam);
|
||||||
static void TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason);
|
static void TOOLBAR_SetHotItemEx (TOOLBAR_INFO *infoPtr, INT nHit, DWORD dwReason);
|
||||||
static LRESULT TOOLBAR_AutoSize(HWND hwnd);
|
static LRESULT TOOLBAR_AutoSize(HWND hwnd);
|
||||||
|
static void TOOLBAR_CheckImageListIconSize(TOOLBAR_INFO *infoPtr);
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
|
TOOLBAR_NotifyFormat(TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam);
|
||||||
|
@ -1091,6 +1092,9 @@ TOOLBAR_Refresh (HWND hwnd, HDC hdc, PAINTSTRUCT* ps)
|
||||||
|
|
||||||
TOOLBAR_DumpToolbar (infoPtr, __LINE__);
|
TOOLBAR_DumpToolbar (infoPtr, __LINE__);
|
||||||
|
|
||||||
|
/* change the imagelist icon size if we manage the list and it is necessary */
|
||||||
|
TOOLBAR_CheckImageListIconSize(infoPtr);
|
||||||
|
|
||||||
/* Send initial notify */
|
/* Send initial notify */
|
||||||
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
|
ZeroMemory (&tbcd, sizeof(NMTBCUSTOMDRAW));
|
||||||
tbcd.nmcd.dwDrawStage = CDDS_PREPAINT;
|
tbcd.nmcd.dwDrawStage = CDDS_PREPAINT;
|
||||||
|
@ -2568,6 +2572,101 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BOOL
|
||||||
|
TOOLBAR_AddBitmapToImageList(TOOLBAR_INFO *infoPtr, HIMAGELIST himlDef, const TBITMAP_INFO *bitmap)
|
||||||
|
{
|
||||||
|
HBITMAP hbmLoad;
|
||||||
|
INT nCountBefore = ImageList_GetImageCount(himlDef);
|
||||||
|
INT nCountAfter;
|
||||||
|
INT cxIcon, cyIcon;
|
||||||
|
INT nAdded;
|
||||||
|
INT nIndex;
|
||||||
|
|
||||||
|
TRACE("adding hInst=%p nID=%d nButtons=%d\n", bitmap->hInst, bitmap->nID, bitmap->nButtons);
|
||||||
|
/* Add bitmaps to the default image list */
|
||||||
|
if (bitmap->hInst == NULL) /* a handle was passed */
|
||||||
|
{
|
||||||
|
BITMAP bmp;
|
||||||
|
HBITMAP hOldBitmapBitmap, hOldBitmapLoad;
|
||||||
|
HDC hdcImage, hdcBitmap;
|
||||||
|
|
||||||
|
/* copy the bitmap before adding it so that the user's bitmap
|
||||||
|
* doesn't get modified.
|
||||||
|
*/
|
||||||
|
GetObjectW ((HBITMAP)bitmap->nID, sizeof(BITMAP), (LPVOID)&bmp);
|
||||||
|
|
||||||
|
hdcImage = CreateCompatibleDC(0);
|
||||||
|
hdcBitmap = CreateCompatibleDC(0);
|
||||||
|
|
||||||
|
/* create new bitmap */
|
||||||
|
hbmLoad = CreateBitmap (bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
|
||||||
|
hOldBitmapBitmap = SelectObject(hdcBitmap, (HBITMAP)bitmap->nID);
|
||||||
|
hOldBitmapLoad = SelectObject(hdcImage, hbmLoad);
|
||||||
|
|
||||||
|
/* Copy the user's image */
|
||||||
|
BitBlt (hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight,
|
||||||
|
hdcBitmap, 0, 0, SRCCOPY);
|
||||||
|
|
||||||
|
SelectObject (hdcImage, hOldBitmapLoad);
|
||||||
|
SelectObject (hdcBitmap, hOldBitmapBitmap);
|
||||||
|
DeleteDC (hdcImage);
|
||||||
|
DeleteDC (hdcBitmap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hbmLoad = CreateMappedBitmap(bitmap->hInst, bitmap->nID, 0, NULL, 0);
|
||||||
|
|
||||||
|
/* enlarge the bitmap if needed */
|
||||||
|
ImageList_GetIconSize(himlDef, &cxIcon, &cyIcon);
|
||||||
|
COMCTL32_EnsureBitmapSize(&hbmLoad, cxIcon*(INT)bitmap->nButtons, cyIcon, comctl32_color.clrBtnFace);
|
||||||
|
|
||||||
|
nIndex = ImageList_AddMasked(himlDef, hbmLoad, comctl32_color.clrBtnFace);
|
||||||
|
DeleteObject(hbmLoad);
|
||||||
|
if (nIndex == -1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
nCountAfter = ImageList_GetImageCount(himlDef);
|
||||||
|
nAdded = nCountAfter - nCountBefore;
|
||||||
|
if (bitmap->nButtons == 0) /* wParam == 0 is special and means add only one image */
|
||||||
|
{
|
||||||
|
ImageList_SetImageCount(himlDef, nCountBefore + 1);
|
||||||
|
} else if (nAdded > (INT)bitmap->nButtons) {
|
||||||
|
TRACE("Added more images than wParam: Previous image number %i added %i while wParam %i. Images in list %i\n",
|
||||||
|
nCountBefore, nAdded, bitmap->nButtons, nCountAfter);
|
||||||
|
}
|
||||||
|
|
||||||
|
infoPtr->nNumBitmaps += nAdded;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
TOOLBAR_CheckImageListIconSize(TOOLBAR_INFO *infoPtr)
|
||||||
|
{
|
||||||
|
HIMAGELIST himlDef;
|
||||||
|
HIMAGELIST himlNew;
|
||||||
|
INT cx, cy;
|
||||||
|
INT i;
|
||||||
|
|
||||||
|
himlDef = GETDEFIMAGELIST(infoPtr, 0);
|
||||||
|
if (himlDef == NULL || himlDef != infoPtr->himlInt)
|
||||||
|
return;
|
||||||
|
if (!ImageList_GetIconSize(himlDef, &cx, &cy))
|
||||||
|
return;
|
||||||
|
if (cx == infoPtr->nBitmapWidth && cy == infoPtr->nBitmapHeight)
|
||||||
|
return;
|
||||||
|
|
||||||
|
TRACE("Update icon size: %dx%d -> %dx%d\n",
|
||||||
|
cx, cy, infoPtr->nBitmapWidth, infoPtr->nBitmapHeight);
|
||||||
|
|
||||||
|
himlNew = ImageList_Create(infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
|
||||||
|
ILC_COLORDDB|ILC_MASK, 8, 2);
|
||||||
|
for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
|
||||||
|
TOOLBAR_AddBitmapToImageList(infoPtr, himlNew, &infoPtr->bitmaps[i]);
|
||||||
|
TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlNew, 0);
|
||||||
|
infoPtr->himlInt = himlNew;
|
||||||
|
|
||||||
|
infoPtr->nNumBitmaps -= ImageList_GetImageCount(himlDef);
|
||||||
|
ImageList_Destroy(himlDef);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* TOOLBAR_AddBitmap: Add the bitmaps to the default image list.
|
* TOOLBAR_AddBitmap: Add the bitmaps to the default image list.
|
||||||
|
@ -2578,8 +2677,8 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
|
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
|
||||||
LPTBADDBITMAP lpAddBmp = (LPTBADDBITMAP)lParam;
|
LPTBADDBITMAP lpAddBmp = (LPTBADDBITMAP)lParam;
|
||||||
INT nIndex = 0, nButtons, nCount;
|
TBITMAP_INFO info;
|
||||||
HBITMAP hbmLoad;
|
INT iSumButtons, i;
|
||||||
HIMAGELIST himlDef;
|
HIMAGELIST himlDef;
|
||||||
|
|
||||||
TRACE("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam);
|
TRACE("hwnd=%p wParam=%x lParam=%lx\n", hwnd, wParam, lParam);
|
||||||
|
@ -2588,16 +2687,38 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
if (lpAddBmp->hInst == HINST_COMMCTRL)
|
if (lpAddBmp->hInst == HINST_COMMCTRL)
|
||||||
{
|
{
|
||||||
if ((lpAddBmp->nID & ~1) == IDB_STD_SMALL_COLOR)
|
info.hInst = COMCTL32_hModule;
|
||||||
nButtons = 15;
|
switch (lpAddBmp->nID)
|
||||||
else if ((lpAddBmp->nID & ~1) == IDB_VIEW_SMALL_COLOR)
|
{
|
||||||
nButtons = 13;
|
case IDB_STD_SMALL_COLOR:
|
||||||
else if ((lpAddBmp->nID & ~1) == IDB_HIST_SMALL_COLOR)
|
info.nButtons = 15;
|
||||||
nButtons = 5;
|
info.nID = IDB_STD_SMALL;
|
||||||
else
|
break;
|
||||||
return -1;
|
case IDB_STD_LARGE_COLOR:
|
||||||
|
info.nButtons = 15;
|
||||||
|
info.nID = IDB_STD_LARGE;
|
||||||
|
break;
|
||||||
|
case IDB_VIEW_SMALL_COLOR:
|
||||||
|
info.nButtons = 12;
|
||||||
|
info.nID = IDB_VIEW_SMALL;
|
||||||
|
break;
|
||||||
|
case IDB_VIEW_LARGE_COLOR:
|
||||||
|
info.nButtons = 12;
|
||||||
|
info.nID = IDB_VIEW_LARGE;
|
||||||
|
break;
|
||||||
|
case IDB_HIST_SMALL_COLOR:
|
||||||
|
info.nButtons = 5;
|
||||||
|
info.nID = IDB_HIST_SMALL;
|
||||||
|
break;
|
||||||
|
case IDB_HIST_LARGE_COLOR:
|
||||||
|
info.nButtons = 5;
|
||||||
|
info.nID = IDB_HIST_LARGE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
TRACE ("adding %d internal bitmaps!\n", nButtons);
|
TRACE ("adding %d internal bitmaps!\n", info.nButtons);
|
||||||
|
|
||||||
/* Windows resize all the buttons to the size of a newly added standard image */
|
/* Windows resize all the buttons to the size of a newly added standard image */
|
||||||
if (lpAddBmp->nID & 1)
|
if (lpAddBmp->nID & 1)
|
||||||
|
@ -2624,11 +2745,20 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nButtons = (INT)wParam;
|
info.nButtons = (INT)wParam;
|
||||||
if (nButtons <= 0)
|
info.hInst = lpAddBmp->hInst;
|
||||||
return -1;
|
info.nID = lpAddBmp->nID;
|
||||||
|
TRACE("adding %d bitmaps!\n", info.nButtons);
|
||||||
TRACE ("adding %d bitmaps!\n", nButtons);
|
}
|
||||||
|
|
||||||
|
/* check if the bitmap is already loaded and compute iSumButtons */
|
||||||
|
iSumButtons = 0;
|
||||||
|
for (i = 0; i < infoPtr->nNumBitmapInfos; i++)
|
||||||
|
{
|
||||||
|
if (infoPtr->bitmaps[i].hInst == info.hInst &&
|
||||||
|
infoPtr->bitmaps[i].nID == info.nID)
|
||||||
|
return iSumButtons;
|
||||||
|
iSumButtons += infoPtr->bitmaps[i].nButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!infoPtr->cimlDef) {
|
if (!infoPtr->cimlDef) {
|
||||||
|
@ -2636,7 +2766,7 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
TRACE ("creating default image list!\n");
|
TRACE ("creating default image list!\n");
|
||||||
|
|
||||||
himlDef = ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
|
himlDef = ImageList_Create (infoPtr->nBitmapWidth, infoPtr->nBitmapHeight,
|
||||||
ILC_COLORDDB | ILC_MASK, nButtons, 2);
|
ILC_COLORDDB | ILC_MASK, info.nButtons, 2);
|
||||||
TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlDef, 0);
|
TOOLBAR_InsertImageList(&infoPtr->himlDef, &infoPtr->cimlDef, himlDef, 0);
|
||||||
infoPtr->himlInt = himlDef;
|
infoPtr->himlInt = himlDef;
|
||||||
}
|
}
|
||||||
|
@ -2649,145 +2779,17 @@ TOOLBAR_AddBitmap (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nCount = ImageList_GetImageCount(himlDef);
|
if (!TOOLBAR_AddBitmapToImageList(infoPtr, himlDef, &info))
|
||||||
|
return -1;
|
||||||
/* Add bitmaps to the default image list */
|
|
||||||
if (lpAddBmp->hInst == NULL)
|
|
||||||
{
|
|
||||||
BITMAP bmp;
|
|
||||||
HBITMAP hOldBitmapBitmap, hOldBitmapLoad;
|
|
||||||
HDC hdcImage, hdcBitmap;
|
|
||||||
|
|
||||||
/* copy the bitmap before adding it so that the user's bitmap
|
|
||||||
* doesn't get modified.
|
|
||||||
*/
|
|
||||||
GetObjectW ((HBITMAP)lpAddBmp->nID, sizeof(BITMAP), (LPVOID)&bmp);
|
|
||||||
|
|
||||||
hdcImage = CreateCompatibleDC(0);
|
|
||||||
hdcBitmap = CreateCompatibleDC(0);
|
|
||||||
|
|
||||||
/* create new bitmap */
|
|
||||||
hbmLoad = CreateBitmap (bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
|
|
||||||
hOldBitmapBitmap = SelectObject(hdcBitmap, (HBITMAP)lpAddBmp->nID);
|
|
||||||
hOldBitmapLoad = SelectObject(hdcImage, hbmLoad);
|
|
||||||
|
|
||||||
/* Copy the user's image */
|
|
||||||
BitBlt (hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight,
|
|
||||||
hdcBitmap, 0, 0, SRCCOPY);
|
|
||||||
|
|
||||||
SelectObject (hdcImage, hOldBitmapLoad);
|
|
||||||
SelectObject (hdcBitmap, hOldBitmapBitmap);
|
|
||||||
DeleteDC (hdcImage);
|
|
||||||
DeleteDC (hdcBitmap);
|
|
||||||
|
|
||||||
nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
}
|
|
||||||
else if (lpAddBmp->hInst == HINST_COMMCTRL)
|
|
||||||
{
|
|
||||||
/* Add system bitmaps */
|
|
||||||
switch (lpAddBmp->nID)
|
|
||||||
{
|
|
||||||
case IDB_STD_SMALL_COLOR:
|
|
||||||
hbmLoad = CreateMappedBitmap (COMCTL32_hModule,
|
|
||||||
IDB_STD_SMALL, 0, NULL, 0);
|
|
||||||
nIndex = ImageList_AddMasked (himlDef,
|
|
||||||
hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDB_STD_LARGE_COLOR:
|
|
||||||
hbmLoad = CreateMappedBitmap (COMCTL32_hModule,
|
|
||||||
IDB_STD_LARGE, 0, NULL, 0);
|
|
||||||
nIndex = ImageList_AddMasked (himlDef,
|
|
||||||
hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDB_VIEW_SMALL_COLOR:
|
|
||||||
hbmLoad = CreateMappedBitmap (COMCTL32_hModule,
|
|
||||||
IDB_VIEW_SMALL, 0, NULL, 0);
|
|
||||||
nIndex = ImageList_AddMasked (himlDef,
|
|
||||||
hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDB_VIEW_LARGE_COLOR:
|
|
||||||
hbmLoad = CreateMappedBitmap (COMCTL32_hModule,
|
|
||||||
IDB_VIEW_LARGE, 0, NULL, 0);
|
|
||||||
nIndex = ImageList_AddMasked (himlDef,
|
|
||||||
hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDB_HIST_SMALL_COLOR:
|
|
||||||
hbmLoad = CreateMappedBitmap (COMCTL32_hModule,
|
|
||||||
IDB_HIST_SMALL, 0, NULL, 0);
|
|
||||||
nIndex = ImageList_AddMasked (himlDef,
|
|
||||||
hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDB_HIST_LARGE_COLOR:
|
|
||||||
hbmLoad = CreateMappedBitmap (COMCTL32_hModule,
|
|
||||||
IDB_HIST_LARGE, 0, NULL, 0);
|
|
||||||
nIndex = ImageList_AddMasked (himlDef,
|
|
||||||
hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
nIndex = ImageList_GetImageCount (himlDef);
|
|
||||||
ERR ("invalid imagelist!\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hbmLoad = CreateMappedBitmap(lpAddBmp->hInst, lpAddBmp->nID, 0, NULL, 0);
|
|
||||||
nIndex = ImageList_AddMasked (himlDef, hbmLoad, comctl32_color.clrBtnFace);
|
|
||||||
DeleteObject (hbmLoad);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
|
TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
|
||||||
|
infoPtr->bitmaps = ReAlloc(infoPtr->bitmaps, (infoPtr->nNumBitmapInfos + 1) * sizeof(TBITMAP_INFO));
|
||||||
if (infoPtr->nNumBitmapInfos == 0)
|
infoPtr->bitmaps[infoPtr->nNumBitmapInfos] = info;
|
||||||
{
|
|
||||||
infoPtr->bitmaps = Alloc(sizeof(TBITMAP_INFO));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TBITMAP_INFO *oldBitmaps = infoPtr->bitmaps;
|
|
||||||
infoPtr->bitmaps = Alloc((infoPtr->nNumBitmapInfos + 1) * sizeof(TBITMAP_INFO));
|
|
||||||
memcpy(&infoPtr->bitmaps[0], &oldBitmaps[0], infoPtr->nNumBitmapInfos * sizeof(TBITMAP_INFO));
|
|
||||||
}
|
|
||||||
|
|
||||||
infoPtr->bitmaps[infoPtr->nNumBitmapInfos].nButtons = nButtons;
|
|
||||||
infoPtr->bitmaps[infoPtr->nNumBitmapInfos].hInst = lpAddBmp->hInst;
|
|
||||||
infoPtr->bitmaps[infoPtr->nNumBitmapInfos].nID = lpAddBmp->nID;
|
|
||||||
|
|
||||||
infoPtr->nNumBitmapInfos++;
|
infoPtr->nNumBitmapInfos++;
|
||||||
TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
|
TRACE("Number of bitmap infos: %d\n", infoPtr->nNumBitmapInfos);
|
||||||
|
|
||||||
if (nIndex != -1)
|
|
||||||
{
|
|
||||||
INT imagecount = ImageList_GetImageCount(himlDef);
|
|
||||||
|
|
||||||
if (infoPtr->nNumBitmaps + nButtons != imagecount)
|
|
||||||
{
|
|
||||||
WARN("Desired images do not match received images : Previous image number %i Previous images in list %i added %i expecting total %i, Images in list %i\n",
|
|
||||||
infoPtr->nNumBitmaps, nCount, imagecount - nCount,
|
|
||||||
infoPtr->nNumBitmaps+nButtons,imagecount);
|
|
||||||
|
|
||||||
infoPtr->nNumBitmaps = imagecount;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
infoPtr->nNumBitmaps += nButtons;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateRect(hwnd, NULL, TRUE);
|
InvalidateRect(hwnd, NULL, TRUE);
|
||||||
|
return iSumButtons;
|
||||||
return nIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2929,64 +2931,57 @@ TOOLBAR_AddButtonsW (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TOOLBAR_AddStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
#define MAX_RESOURCE_STRING_LENGTH 512
|
||||||
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
|
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
|
||||||
INT nIndex;
|
INT nIndex = infoPtr->nNumStrings;
|
||||||
|
|
||||||
if ((wParam) && (HIWORD(lParam) == 0)) {
|
if ((wParam) && (HIWORD(lParam) == 0)) {
|
||||||
char szString[256];
|
WCHAR szString[MAX_RESOURCE_STRING_LENGTH];
|
||||||
|
WCHAR delimiter;
|
||||||
|
WCHAR *next_delim;
|
||||||
|
WCHAR *p;
|
||||||
INT len;
|
INT len;
|
||||||
TRACE("adding string from resource!\n");
|
TRACE("adding string from resource!\n");
|
||||||
|
|
||||||
len = LoadStringA ((HINSTANCE)wParam, (UINT)lParam, szString, sizeof(szString));
|
LoadStringW ((HINSTANCE)wParam, (UINT)lParam,
|
||||||
|
szString, MAX_RESOURCE_STRING_LENGTH);
|
||||||
|
len = lstrlenW(szString);
|
||||||
|
|
||||||
TRACE("len=%d \"%s\"\n", len, szString);
|
TRACE("len=%d %s\n", len, debugstr_w(szString));
|
||||||
nIndex = infoPtr->nNumStrings;
|
if (len == 0 || len == 1)
|
||||||
if (infoPtr->nNumStrings == 0) {
|
return nIndex;
|
||||||
infoPtr->strings =
|
|
||||||
Alloc (sizeof(LPWSTR));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LPWSTR *oldStrings = infoPtr->strings;
|
|
||||||
infoPtr->strings =
|
|
||||||
Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
|
|
||||||
memcpy (&infoPtr->strings[0], &oldStrings[0],
|
|
||||||
sizeof(LPWSTR) * infoPtr->nNumStrings);
|
|
||||||
Free (oldStrings);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Alloc zeros out the allocated memory*/
|
TRACE("Delimiter: 0x%x\n", *szString);
|
||||||
Str_SetPtrAtoW (&infoPtr->strings[infoPtr->nNumStrings], szString );
|
delimiter = *szString;
|
||||||
infoPtr->nNumStrings++;
|
p = szString + 1;
|
||||||
|
if (szString[len-1] == delimiter)
|
||||||
|
szString[len-1] = 0;
|
||||||
|
|
||||||
|
while ((next_delim = strchrW(p, delimiter)) != NULL) {
|
||||||
|
*next_delim = 0;
|
||||||
|
|
||||||
|
infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
|
||||||
|
Str_SetPtrW(&infoPtr->strings[infoPtr->nNumStrings], p);
|
||||||
|
infoPtr->nNumStrings++;
|
||||||
|
|
||||||
|
p = next_delim + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LPSTR p = (LPSTR)lParam;
|
LPWSTR p = (LPWSTR)lParam;
|
||||||
INT len;
|
INT len;
|
||||||
|
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
TRACE("adding string(s) from array!\n");
|
TRACE("adding string(s) from array!\n");
|
||||||
|
|
||||||
nIndex = infoPtr->nNumStrings;
|
|
||||||
while (*p) {
|
while (*p) {
|
||||||
len = strlen (p);
|
len = strlenW (p);
|
||||||
TRACE("len=%d \"%s\"\n", len, p);
|
|
||||||
|
|
||||||
if (infoPtr->nNumStrings == 0) {
|
TRACE("len=%d %s\n", len, debugstr_w(p));
|
||||||
infoPtr->strings =
|
infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
|
||||||
Alloc (sizeof(LPWSTR));
|
Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], p);
|
||||||
}
|
|
||||||
else {
|
|
||||||
LPWSTR *oldStrings = infoPtr->strings;
|
|
||||||
infoPtr->strings =
|
|
||||||
Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
|
|
||||||
memcpy (&infoPtr->strings[0], &oldStrings[0],
|
|
||||||
sizeof(LPWSTR) * infoPtr->nNumStrings);
|
|
||||||
Free (oldStrings);
|
|
||||||
}
|
|
||||||
|
|
||||||
Str_SetPtrAtoW (&infoPtr->strings[infoPtr->nNumStrings], p );
|
|
||||||
infoPtr->nNumStrings++;
|
infoPtr->nNumStrings++;
|
||||||
|
|
||||||
p += (len+1);
|
p += (len+1);
|
||||||
|
@ -2998,109 +2993,31 @@ TOOLBAR_AddStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
|
|
||||||
static LRESULT
|
static LRESULT
|
||||||
TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
TOOLBAR_AddStringA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
#define MAX_RESOURCE_STRING_LENGTH 512
|
|
||||||
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
|
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
|
||||||
|
LPSTR p;
|
||||||
INT nIndex;
|
INT nIndex;
|
||||||
|
INT len;
|
||||||
|
|
||||||
if ((wParam) && (HIWORD(lParam) == 0)) {
|
if ((wParam) && (HIWORD(lParam) == 0)) /* load from resources */
|
||||||
WCHAR szString[MAX_RESOURCE_STRING_LENGTH];
|
return TOOLBAR_AddStringW(hwnd, wParam, lParam);
|
||||||
INT len;
|
|
||||||
TRACE("adding string from resource!\n");
|
|
||||||
|
|
||||||
len = LoadStringW ((HINSTANCE)wParam, (UINT)lParam,
|
p = (LPSTR)lParam;
|
||||||
szString, MAX_RESOURCE_STRING_LENGTH);
|
if (p == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
TRACE("len=%d %s\n", len, debugstr_w(szString));
|
TRACE("adding string(s) from array!\n");
|
||||||
TRACE("First char: 0x%x\n", *szString);
|
nIndex = infoPtr->nNumStrings;
|
||||||
if (szString[0] == L'|')
|
while (*p) {
|
||||||
{
|
len = strlen (p);
|
||||||
PWSTR p = szString + 1;
|
TRACE("len=%d \"%s\"\n", len, p);
|
||||||
|
|
||||||
nIndex = infoPtr->nNumStrings;
|
infoPtr->strings = ReAlloc(infoPtr->strings, sizeof(LPWSTR)*(infoPtr->nNumStrings+1));
|
||||||
while (*p != L'|' && *p != L'\0') {
|
Str_SetPtrAtoW(&infoPtr->strings[infoPtr->nNumStrings], p);
|
||||||
PWSTR np;
|
infoPtr->nNumStrings++;
|
||||||
|
|
||||||
if (infoPtr->nNumStrings == 0) {
|
p += (len+1);
|
||||||
infoPtr->strings = Alloc (sizeof(LPWSTR));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LPWSTR *oldStrings = infoPtr->strings;
|
|
||||||
infoPtr->strings = Alloc(sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
|
|
||||||
memcpy(&infoPtr->strings[0], &oldStrings[0],
|
|
||||||
sizeof(LPWSTR) * infoPtr->nNumStrings);
|
|
||||||
Free(oldStrings);
|
|
||||||
}
|
|
||||||
|
|
||||||
np=strchrW (p, '|');
|
|
||||||
if (np!=NULL) {
|
|
||||||
len = np - p;
|
|
||||||
np++;
|
|
||||||
} else {
|
|
||||||
len = strlenW(p);
|
|
||||||
np = p + len;
|
|
||||||
}
|
|
||||||
TRACE("len=%d %s\n", len, debugstr_w(p));
|
|
||||||
infoPtr->strings[infoPtr->nNumStrings] =
|
|
||||||
Alloc (sizeof(WCHAR)*(len+1));
|
|
||||||
lstrcpynW (infoPtr->strings[infoPtr->nNumStrings], p, len+1);
|
|
||||||
infoPtr->nNumStrings++;
|
|
||||||
|
|
||||||
p = np;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nIndex = infoPtr->nNumStrings;
|
|
||||||
if (infoPtr->nNumStrings == 0) {
|
|
||||||
infoPtr->strings =
|
|
||||||
Alloc (sizeof(LPWSTR));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LPWSTR *oldStrings = infoPtr->strings;
|
|
||||||
infoPtr->strings =
|
|
||||||
Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
|
|
||||||
memcpy (&infoPtr->strings[0], &oldStrings[0],
|
|
||||||
sizeof(LPWSTR) * infoPtr->nNumStrings);
|
|
||||||
Free (oldStrings);
|
|
||||||
}
|
|
||||||
|
|
||||||
Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], szString);
|
|
||||||
infoPtr->nNumStrings++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LPWSTR p = (LPWSTR)lParam;
|
|
||||||
INT len;
|
|
||||||
|
|
||||||
if (p == NULL)
|
|
||||||
return -1;
|
|
||||||
TRACE("adding string(s) from array!\n");
|
|
||||||
nIndex = infoPtr->nNumStrings;
|
|
||||||
while (*p) {
|
|
||||||
len = strlenW (p);
|
|
||||||
|
|
||||||
TRACE("len=%d %s\n", len, debugstr_w(p));
|
|
||||||
if (infoPtr->nNumStrings == 0) {
|
|
||||||
infoPtr->strings =
|
|
||||||
Alloc (sizeof(LPWSTR));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LPWSTR *oldStrings = infoPtr->strings;
|
|
||||||
infoPtr->strings =
|
|
||||||
Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
|
|
||||||
memcpy (&infoPtr->strings[0], &oldStrings[0],
|
|
||||||
sizeof(LPWSTR) * infoPtr->nNumStrings);
|
|
||||||
Free (oldStrings);
|
|
||||||
}
|
|
||||||
|
|
||||||
Str_SetPtrW (&infoPtr->strings[infoPtr->nNumStrings], p);
|
|
||||||
infoPtr->nNumStrings++;
|
|
||||||
|
|
||||||
p += (len+1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nIndex;
|
return nIndex;
|
||||||
|
@ -3301,7 +3218,7 @@ TOOLBAR_Customize (HWND hwnd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ret = DialogBoxIndirectParamW ((HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE),
|
ret = DialogBoxIndirectParamW ((HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE),
|
||||||
(LPDLGTEMPLATEW)template,
|
(LPCDLGTEMPLATEW)template,
|
||||||
hwnd,
|
hwnd,
|
||||||
TOOLBAR_CustomizeDialogProc,
|
TOOLBAR_CustomizeDialogProc,
|
||||||
(LPARAM)&custInfo);
|
(LPARAM)&custInfo);
|
||||||
|
@ -4746,6 +4663,7 @@ TOOLBAR_SetBitmapSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
infoPtr->nBitmapHeight);
|
infoPtr->nBitmapHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InvalidateRect(infoPtr->hwndSelf, NULL, FALSE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5672,6 +5590,7 @@ TOOLBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
|
||||||
/* delete temporary buffer for tooltip text */
|
/* delete temporary buffer for tooltip text */
|
||||||
Free (infoPtr->pszTooltipText);
|
Free (infoPtr->pszTooltipText);
|
||||||
|
Free (infoPtr->bitmaps); /* bitmaps list */
|
||||||
|
|
||||||
/* delete button data */
|
/* delete button data */
|
||||||
if (infoPtr->buttons)
|
if (infoPtr->buttons)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue