Added Unicode support (at least partially).

This commit is contained in:
Eric Kohl 1998-11-22 18:12:12 +00:00 committed by Alexandre Julliard
parent f9d92882f0
commit 8d2933d3cb
11 changed files with 659 additions and 213 deletions

View File

@ -130,7 +130,7 @@ HEADER_DrawItem (WND *wndPtr, HDC32 hdc, INT32 iItem, BOOL32 bHotTrack)
GetObject32A (phdi->hbm, sizeof(BITMAP32), (LPVOID)&bmp); GetObject32A (phdi->hbm, sizeof(BITMAP32), (LPVOID)&bmp);
textRect = r; textRect = r;
DrawText32A(hdc, phdi->pszText, lstrlen32A(phdi->pszText), DrawText32W (hdc, phdi->pszText, lstrlen32W (phdi->pszText),
&textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT); &textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
tx = textRect.right - textRect.left; tx = textRect.right - textRect.left;
ry = r.bottom - r.top; ry = r.bottom - r.top;
@ -182,7 +182,7 @@ HEADER_DrawItem (WND *wndPtr, HDC32 hdc, INT32 iItem, BOOL32 bHotTrack)
r.left += 3; r.left += 3;
r.right -= 3; r.right -= 3;
SetTextColor32 (hdc, bHotTrack ? COLOR_HIGHLIGHT : COLOR_BTNTEXT); SetTextColor32 (hdc, bHotTrack ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);
DrawText32A(hdc, phdi->pszText, lstrlen32A(phdi->pszText), DrawText32W (hdc, phdi->pszText, lstrlen32W (phdi->pszText),
&r, uTextJustify|DT_VCENTER|DT_SINGLELINE); &r, uTextJustify|DT_VCENTER|DT_SINGLELINE);
if (oldBkMode != TRANSPARENT) if (oldBkMode != TRANSPARENT)
SetBkMode32(hdc, oldBkMode); SetBkMode32(hdc, oldBkMode);
@ -591,8 +591,8 @@ HEADER_GetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
phdi->lParam = lpItem->lParam; phdi->lParam = lpItem->lParam;
if (phdi->mask & HDI_TEXT) { if (phdi->mask & HDI_TEXT) {
if (lpItem->pszText != LPSTR_TEXTCALLBACK32A) if (lpItem->pszText != LPSTR_TEXTCALLBACK32W)
lstrcpyn32A (phdi->pszText, lpItem->pszText, phdi->cchTextMax); lstrcpynWtoA (phdi->pszText, lpItem->pszText, phdi->cchTextMax);
else else
phdi->pszText = LPSTR_TEXTCALLBACK32A; phdi->pszText = LPSTR_TEXTCALLBACK32A;
} }
@ -608,11 +608,58 @@ HEADER_GetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
static LRESULT static LRESULT
HEADER_GetItem32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr);
HDITEM32W *phdi = (HDITEM32W*)lParam;
INT32 nItem = (INT32)wParam;
HEADER_ITEM *lpItem;
if (!phdi)
return FALSE;
if ((nItem < 0) || (nItem >= (INT32)infoPtr->uNumItem))
return FALSE;
TRACE (header, "[nItem=%d]\n", nItem);
if (phdi->mask == 0)
return TRUE;
lpItem = (HEADER_ITEM*)&infoPtr->items[nItem];
if (phdi->mask & HDI_BITMAP)
phdi->hbm = lpItem->hbm;
if (phdi->mask & HDI_FORMAT)
phdi->fmt = lpItem->fmt;
if (phdi->mask & HDI_WIDTH)
phdi->cxy = lpItem->cxy;
if (phdi->mask & HDI_LPARAM)
phdi->lParam = lpItem->lParam;
if (phdi->mask & HDI_TEXT) {
if (lpItem->pszText != LPSTR_TEXTCALLBACK32W)
lstrcpyn32W (phdi->pszText, lpItem->pszText, phdi->cchTextMax);
else
phdi->pszText = LPSTR_TEXTCALLBACK32W;
}
if (phdi->mask & HDI_IMAGE)
phdi->iImage = lpItem->iImage;
if (phdi->mask & HDI_ORDER)
phdi->iOrder = lpItem->iOrder;
return TRUE;
}
__inline__ static LRESULT
HEADER_GetItemCount (WND *wndPtr) HEADER_GetItemCount (WND *wndPtr)
{ {
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr); HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr);
return infoPtr->uNumItem;
return (infoPtr->uNumItem);
} }
@ -635,6 +682,17 @@ HEADER_GetItemRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
} }
// << HEADER_GetOrderArray >>
__inline__ static LRESULT
HEADER_GetUnicodeFormat (WND *wndPtr)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr);
return infoPtr->bUnicode;
}
static LRESULT static LRESULT
HEADER_HitTest (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) HEADER_HitTest (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
@ -695,11 +753,95 @@ HEADER_InsertItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (phdi->mask & HDI_TEXT) { if (phdi->mask & HDI_TEXT) {
if (phdi->pszText != LPSTR_TEXTCALLBACK32A) { if (phdi->pszText != LPSTR_TEXTCALLBACK32A) {
len = lstrlen32A (phdi->pszText); len = lstrlen32A (phdi->pszText);
lpItem->pszText = COMCTL32_Alloc (len+1); lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpy32A (lpItem->pszText, phdi->pszText); lstrcpyAtoW (lpItem->pszText, phdi->pszText);
} }
else else
lpItem->pszText = LPSTR_TEXTCALLBACK32A; lpItem->pszText = LPSTR_TEXTCALLBACK32W;
}
if (phdi->mask & HDI_FORMAT)
lpItem->fmt = phdi->fmt;
if (lpItem->fmt == 0)
lpItem->fmt = HDF_LEFT;
if (phdi->mask & HDI_BITMAP)
lpItem->hbm = phdi->hbm;
if (phdi->mask & HDI_LPARAM)
lpItem->lParam = phdi->lParam;
if (phdi->mask & HDI_IMAGE)
lpItem->iImage = phdi->iImage;
if (phdi->mask & HDI_ORDER)
lpItem->iOrder = phdi->iOrder;
HEADER_SetItemBounds (wndPtr);
hdc = GetDC32 (wndPtr->hwndSelf);
HEADER_Refresh (wndPtr, hdc);
ReleaseDC32 (wndPtr->hwndSelf, hdc);
return nItem;
}
static LRESULT
HEADER_InsertItem32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr);
HDITEM32W *phdi = (HDITEM32W*)lParam;
INT32 nItem = (INT32)wParam;
HEADER_ITEM *lpItem;
HDC32 hdc;
INT32 len;
if ((phdi == NULL) || (nItem < 0))
return -1;
if (nItem > infoPtr->uNumItem)
nItem = infoPtr->uNumItem;
if (infoPtr->uNumItem == 0) {
infoPtr->items = COMCTL32_Alloc (sizeof (HEADER_ITEM));
infoPtr->uNumItem++;
}
else {
HEADER_ITEM *oldItems = infoPtr->items;
infoPtr->uNumItem++;
infoPtr->items = COMCTL32_Alloc (sizeof (HEADER_ITEM) * infoPtr->uNumItem);
/* 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) * sizeof(HEADER_ITEM));
}
COMCTL32_Free (oldItems);
}
lpItem = (HEADER_ITEM*)&infoPtr->items[nItem];
lpItem->bDown = FALSE;
if (phdi->mask & HDI_WIDTH)
lpItem->cxy = phdi->cxy;
if (phdi->mask & HDI_TEXT) {
if (phdi->pszText != LPSTR_TEXTCALLBACK32W) {
len = lstrlen32W (phdi->pszText);
lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpy32W (lpItem->pszText, phdi->pszText);
}
else
lpItem->pszText = LPSTR_TEXTCALLBACK32W;
} }
if (phdi->mask & HDI_FORMAT) if (phdi->mask & HDI_FORMAT)
@ -809,14 +951,18 @@ HEADER_SetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (phdi->mask & HDI_TEXT) { if (phdi->mask & HDI_TEXT) {
if (phdi->pszText != LPSTR_TEXTCALLBACK32A) { if (phdi->pszText != LPSTR_TEXTCALLBACK32A) {
INT32 len = lstrlen32A (phdi->pszText); if (lpItem->pszText) {
if (lpItem->pszText)
COMCTL32_Free (lpItem->pszText); COMCTL32_Free (lpItem->pszText);
lpItem->pszText = COMCTL32_Alloc (len+1); lpItem->pszText = NULL;
lstrcpy32A (lpItem->pszText, phdi->pszText); }
if (phdi->pszText) {
INT32 len = lstrlen32A (phdi->pszText);
lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpyAtoW (lpItem->pszText, phdi->pszText);
}
} }
else else
lpItem->pszText = LPSTR_TEXTCALLBACK32A; lpItem->pszText = LPSTR_TEXTCALLBACK32W;
} }
if (phdi->mask & HDI_WIDTH) if (phdi->mask & HDI_WIDTH)
@ -839,6 +985,86 @@ HEADER_SetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
} }
static LRESULT
HEADER_SetItem32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr);
HDITEM32W *phdi = (HDITEM32W*)lParam;
INT32 nItem = (INT32)wParam;
HEADER_ITEM *lpItem;
HDC32 hdc;
if (phdi == NULL)
return FALSE;
if ((nItem < 0) || (nItem >= (INT32)infoPtr->uNumItem))
return FALSE;
TRACE (header, "[nItem=%d]\n", nItem);
if (HEADER_SendHeaderNotify (wndPtr, HDN_ITEMCHANGING32A, nItem))
return FALSE;
lpItem = (HEADER_ITEM*)&infoPtr->items[nItem];
if (phdi->mask & HDI_BITMAP)
lpItem->hbm = phdi->hbm;
if (phdi->mask & HDI_FORMAT)
lpItem->fmt = phdi->fmt;
if (phdi->mask & HDI_LPARAM)
lpItem->lParam = phdi->lParam;
if (phdi->mask & HDI_TEXT) {
if (phdi->pszText != LPSTR_TEXTCALLBACK32W) {
if (lpItem->pszText) {
COMCTL32_Free (lpItem->pszText);
lpItem->pszText = NULL;
}
if (phdi->pszText) {
INT32 len = lstrlen32W (phdi->pszText);
lpItem->pszText = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpy32W (lpItem->pszText, phdi->pszText);
}
}
else
lpItem->pszText = LPSTR_TEXTCALLBACK32W;
}
if (phdi->mask & HDI_WIDTH)
lpItem->cxy = phdi->cxy;
if (phdi->mask & HDI_IMAGE)
lpItem->iImage = phdi->iImage;
if (phdi->mask & HDI_ORDER)
lpItem->iOrder = phdi->iOrder;
HEADER_SendHeaderNotify (wndPtr, HDN_ITEMCHANGED32A, nItem);
HEADER_SetItemBounds (wndPtr);
hdc = GetDC32 (wndPtr->hwndSelf);
HEADER_Refresh (wndPtr, hdc);
ReleaseDC32 (wndPtr->hwndSelf, hdc);
return TRUE;
}
// << HEADER_SetOrderArray >>
__inline__ static LRESULT
HEADER_SetUnicodeFormat (WND *wndPtr, WPARAM32 wParam)
{
HEADER_INFO *infoPtr = HEADER_GetInfoPtr(wndPtr);
BOOL32 bTemp = infoPtr->bUnicode;
infoPtr->bUnicode = (BOOL32)wParam;
return bTemp;
}
static LRESULT static LRESULT
HEADER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) HEADER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
@ -862,6 +1088,7 @@ HEADER_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
infoPtr->iMoveItem = 0; infoPtr->iMoveItem = 0;
infoPtr->himl = 0; infoPtr->himl = 0;
infoPtr->iHotItem = -1; infoPtr->iHotItem = -1;
infoPtr->bUnicode = IsWindowUnicode (wndPtr->hwndSelf);
hdc = GetDC32 (0); hdc = GetDC32 (0);
hOldFont = SelectObject32 (hdc, GetStockObject32 (SYSTEM_FONT)); hOldFont = SelectObject32 (hdc, GetStockObject32 (SYSTEM_FONT));
@ -884,7 +1111,7 @@ HEADER_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (infoPtr->items) { if (infoPtr->items) {
lpItem = (HEADER_ITEM*)infoPtr->items; lpItem = (HEADER_ITEM*)infoPtr->items;
for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++) { for (nItem = 0; nItem < infoPtr->uNumItem; nItem++, lpItem++) {
if ((lpItem->pszText) && (lpItem->pszText != LPSTR_TEXTCALLBACK32A)) if ((lpItem->pszText) && (lpItem->pszText != LPSTR_TEXTCALLBACK32W))
COMCTL32_Free (lpItem->pszText); COMCTL32_Free (lpItem->pszText);
} }
COMCTL32_Free (infoPtr->items); COMCTL32_Free (infoPtr->items);
@ -1214,7 +1441,8 @@ HEADER_WindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case HDM_GETITEM32A: case HDM_GETITEM32A:
return HEADER_GetItem32A (wndPtr, wParam, lParam); return HEADER_GetItem32A (wndPtr, wParam, lParam);
// case HDM_GETITEM32W: case HDM_GETITEM32W:
return HEADER_GetItem32W (wndPtr, wParam, lParam);
case HDM_GETITEMCOUNT: case HDM_GETITEMCOUNT:
return HEADER_GetItemCount (wndPtr); return HEADER_GetItemCount (wndPtr);
@ -1223,7 +1451,9 @@ HEADER_WindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
return HEADER_GetItemRect (wndPtr, wParam, lParam); return HEADER_GetItemRect (wndPtr, wParam, lParam);
// case HDM_GETORDERARRAY: // case HDM_GETORDERARRAY:
// case HDM_GETUNICODEFORMAT:
case HDM_GETUNICODEFORMAT:
return HEADER_GetUnicodeFormat (wndPtr);
case HDM_HITTEST: case HDM_HITTEST:
return HEADER_HitTest (wndPtr, wParam, lParam); return HEADER_HitTest (wndPtr, wParam, lParam);
@ -1231,7 +1461,8 @@ HEADER_WindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case HDM_INSERTITEM32A: case HDM_INSERTITEM32A:
return HEADER_InsertItem32A (wndPtr, wParam, lParam); return HEADER_InsertItem32A (wndPtr, wParam, lParam);
// case HDM_INSERTITEM32W: case HDM_INSERTITEM32W:
return HEADER_InsertItem32W (wndPtr, wParam, lParam);
case HDM_LAYOUT: case HDM_LAYOUT:
return HEADER_Layout (wndPtr, wParam, lParam); return HEADER_Layout (wndPtr, wParam, lParam);
@ -1242,9 +1473,13 @@ HEADER_WindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case HDM_SETITEM32A: case HDM_SETITEM32A:
return HEADER_SetItem32A (wndPtr, wParam, lParam); return HEADER_SetItem32A (wndPtr, wParam, lParam);
// case HDM_SETITEM32W: case HDM_SETITEM32W:
return HEADER_SetItem32W (wndPtr, wParam, lParam);
// case HDM_SETORDERARRAY: // case HDM_SETORDERARRAY:
// case HDM_SETUNICODEFORMAT:
case HDM_SETUNICODEFORMAT:
return HEADER_SetUnicodeFormat (wndPtr, wParam);
case WM_CREATE: case WM_CREATE:
@ -1274,6 +1509,8 @@ HEADER_WindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
return HEADER_MouseMove (wndPtr, wParam, lParam); return HEADER_MouseMove (wndPtr, wParam, lParam);
// case WM_NOTIFYFORMAT:
case WM_PAINT: case WM_PAINT:
return HEADER_Paint (wndPtr, wParam); return HEADER_Paint (wndPtr, wParam);

View File

@ -20,7 +20,7 @@
/* /*
* Fixme/Todo * Fixme/Todo
* 1) Don't hard code bar to bottom of window, allow CCS_TOP also. * 1) Don't hard code bar to bottom of window, allow CCS_TOP also.
+ 2) Tooltip support (almost done). * 2) Tooltip support (almost done).
*/ */
#define _MAX(a,b) (((a)>(b))?(a):(b)) #define _MAX(a,b) (((a)>(b))?(a):(b))
@ -95,19 +95,19 @@ STATUSBAR_DrawPart (HDC32 hdc, STATUSWINDOWPART *part)
/* now draw text */ /* now draw text */
if (part->text) { if (part->text) {
int oldbkmode = SetBkMode32(hdc, TRANSPARENT); int oldbkmode = SetBkMode32(hdc, TRANSPARENT);
LPSTR p = (LPSTR)part->text; LPWSTR p = (LPWSTR)part->text;
UINT32 align = DT_LEFT; UINT32 align = DT_LEFT;
if (*p == '\t') { if (*p == L'\t') {
p++; p++;
align = DT_CENTER; align = DT_CENTER;
if (*p == '\t') { if (*p == L'\t') {
p++; p++;
align = DT_RIGHT; align = DT_RIGHT;
} }
} }
r.left += 3; r.left += 3;
DrawText32A(hdc, p, lstrlen32A(p), &r, align|DT_VCENTER|DT_SINGLELINE); DrawText32W (hdc, p, lstrlen32W (p), &r, align|DT_VCENTER|DT_SINGLELINE);
if (oldbkmode != TRANSPARENT) if (oldbkmode != TRANSPARENT)
SetBkMode32(hdc, oldbkmode); SetBkMode32(hdc, oldbkmode);
} }
@ -332,16 +332,16 @@ STATUSBAR_GetParts (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
static LRESULT static LRESULT
STATUSBAR_GetRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_GetRect (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
int part_num; int part_num;
LPRECT32 rect; LPRECT32 rect;
part_num = ((INT32) wParam) & 0x00ff; part_num = ((INT32) wParam) & 0x00ff;
rect = (LPRECT32) lParam; rect = (LPRECT32) lParam;
if (self->simple) if (infoPtr->simple)
*rect = self->part0.bound; *rect = infoPtr->part0.bound;
else else
*rect = self->parts[part_num].bound; *rect = infoPtr->parts[part_num].bound;
return TRUE; return TRUE;
} }
@ -351,50 +351,70 @@ STATUSBAR_GetText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr);
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
int part_num; INT32 nPart;
LRESULT result; LRESULT result;
LPSTR out_text;
part_num = ((INT32) wParam) & 0x00ff; nPart = ((INT32) wParam) & 0x00ff;
out_text = (LPSTR) lParam;
if (self->simple) if (self->simple)
part = &self->part0; part = &self->part0;
else else
part = &self->parts[part_num]; part = &self->parts[nPart];
if (part->style == SBT_OWNERDRAW) if (part->style == SBT_OWNERDRAW)
result = (LRESULT)part->text; result = (LRESULT)part->text;
else { else {
result = part->text ? lstrlen32A(part->text) : 0; result = part->text ? lstrlen32W (part->text) : 0;
result |= (part->style << 16); result |= (part->style << 16);
if (out_text) { if (lParam)
lstrcpy32A(out_text, part->text); lstrcpyWtoA ((LPSTR)lParam, part->text);
}
} }
return result; return result;
} }
// << STATUSBAR_GetText32W >>
static LRESULT static LRESULT
STATUSBAR_GetTextLength32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_GetText32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr);
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
int part_num; INT32 nPart;
LRESULT result;
nPart = ((INT32)wParam) & 0x00ff;
if (self->simple)
part = &self->part0;
else
part = &self->parts[nPart];
if (part->style == SBT_OWNERDRAW)
result = (LRESULT)part->text;
else {
result = part->text ? lstrlen32W (part->text) : 0;
result |= (part->style << 16);
if (lParam)
lstrcpy32W ((LPWSTR)lParam, part->text);
}
return result;
}
static LRESULT
STATUSBAR_GetTextLength (WND *wndPtr, WPARAM32 wParam)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
STATUSWINDOWPART *part;
INT32 part_num;
DWORD result; DWORD result;
part_num = ((INT32) wParam) & 0x00ff; part_num = ((INT32) wParam) & 0x00ff;
if (self->simple) if (infoPtr->simple)
part = &self->part0; part = &infoPtr->part0;
else else
part = &self->parts[part_num]; part = &infoPtr->parts[part_num];
if (part->text) if (part->text)
result = lstrlen32A(part->text); result = lstrlen32W(part->text);
else else
result = 0; result = 0;
@ -403,9 +423,6 @@ STATUSBAR_GetTextLength32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
} }
// << STATUSBAR_GetTextLength32W >>
static LRESULT static LRESULT
STATUSBAR_GetTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_GetTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
@ -413,7 +430,6 @@ STATUSBAR_GetTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (infoPtr->hwndToolTip) { if (infoPtr->hwndToolTip) {
TTTOOLINFO32A ti; TTTOOLINFO32A ti;
ti.cbSize = sizeof(TTTOOLINFO32A); ti.cbSize = sizeof(TTTOOLINFO32A);
ti.hwnd = wndPtr->hwndSelf; ti.hwnd = wndPtr->hwndSelf;
ti.uId = LOWORD(wParam); ti.uId = LOWORD(wParam);
@ -427,16 +443,39 @@ STATUSBAR_GetTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
} }
// << STATUSBAR_GetTipText32W >> static LRESULT
// << STATUSBAR_GetUnicodeFormat >> STATUSBAR_GetTipText32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
if (infoPtr->hwndToolTip) {
TTTOOLINFO32W ti;
ti.cbSize = sizeof(TTTOOLINFO32W);
ti.hwnd = wndPtr->hwndSelf;
ti.uId = LOWORD(wParam);
SendMessage32W (infoPtr->hwndToolTip, TTM_GETTEXT32W, 0, (LPARAM)&ti);
if (ti.lpszText)
lstrcpyn32W ((LPWSTR)lParam, ti.lpszText, HIWORD(wParam));
}
return 0;
}
__inline__ static LRESULT
STATUSBAR_GetUnicodeFormat (WND *wndPtr)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
return infoPtr->bUnicode;
}
__inline__ static LRESULT __inline__ static LRESULT
STATUSBAR_IsSimple (WND *wndPtr) STATUSBAR_IsSimple (WND *wndPtr)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
return infoPtr->simple;
return self->simple;
} }
@ -464,7 +503,8 @@ STATUSBAR_SetIcon (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
INT32 nPart = (INT32)wParam & 0x00ff; INT32 nPart = (INT32)wParam & 0x00ff;
HDC32 hdc; HDC32 hdc;
if ((nPart < -1) || (nPart >= self->numParts)) return FALSE; if ((nPart < -1) || (nPart >= self->numParts))
return FALSE;
hdc = GetDC32 (wndPtr->hwndSelf); hdc = GetDC32 (wndPtr->hwndSelf);
if (nPart == -1) { if (nPart == -1) {
@ -512,9 +552,9 @@ static LRESULT
STATUSBAR_SetParts (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_SetParts (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr);
STATUSWINDOWPART *tmp;
HDC32 hdc; HDC32 hdc;
LPINT32 parts; LPINT32 parts;
STATUSWINDOWPART * tmp;
int i; int i;
int oldNumParts; int oldNumParts;
@ -569,7 +609,7 @@ STATUSBAR_SetParts (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
for (i = nTipCount - 1; i >= self->numParts; i--) { for (i = nTipCount - 1; i >= self->numParts; i--) {
TRACE (statusbar, "delete tool %d\n", i); FIXME (statusbar, "delete tool %d\n", i);
} }
} }
@ -607,7 +647,7 @@ STATUSBAR_SetText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (!part) return FALSE; if (!part) return FALSE;
part->style = style; part->style = style;
if (style == SBT_OWNERDRAW) { if (style == SBT_OWNERDRAW) {
part->text = text; part->text = (LPWSTR)text;
} }
else { else {
/* duplicate string */ /* duplicate string */
@ -615,8 +655,8 @@ STATUSBAR_SetText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
COMCTL32_Free (part->text); COMCTL32_Free (part->text);
part->text = 0; part->text = 0;
if (text && (len = lstrlen32A(text))) { if (text && (len = lstrlen32A(text))) {
part->text = COMCTL32_Alloc (len+1); part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpy32A(part->text, text); lstrcpyAtoW (part->text, text);
} }
} }
@ -628,23 +668,61 @@ STATUSBAR_SetText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
} }
// << STATUSBAR_SetText32W >> static LRESULT
STATUSBAR_SetText32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr);
STATUSWINDOWPART *part;
INT32 part_num, style, len;
LPWSTR text;
HDC32 hdc;
text = (LPWSTR) lParam;
part_num = ((INT32) wParam) & 0x00ff;
style = ((INT32) wParam) & 0xff00;
if ((self->simple) || (self->parts==NULL) || (part_num==255))
part = &self->part0;
else
part = &self->parts[part_num];
if (!part) return FALSE;
part->style = style;
if (style == SBT_OWNERDRAW) {
part->text = text;
}
else {
/* duplicate string */
if (part->text)
COMCTL32_Free (part->text);
part->text = 0;
if (text && (len = lstrlen32W(text))) {
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpy32W(part->text, text);
}
}
hdc = GetDC32 (wndPtr->hwndSelf);
STATUSBAR_RefreshPart (wndPtr, part, hdc);
ReleaseDC32 (wndPtr->hwndSelf, hdc);
return TRUE;
}
static LRESULT static LRESULT
STATUSBAR_SetTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_SetTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
TTTOOLINFO32A ti;
TRACE (statusbar, "part %d: \"%s\"\n", (INT32)wParam, (LPSTR)lParam); TRACE (statusbar, "part %d: \"%s\"\n", (INT32)wParam, (LPSTR)lParam);
if (self->hwndToolTip) { if (infoPtr->hwndToolTip) {
TTTOOLINFO32A ti;
ti.cbSize = sizeof(TTTOOLINFO32A); ti.cbSize = sizeof(TTTOOLINFO32A);
ti.hwnd = wndPtr->hwndSelf; ti.hwnd = wndPtr->hwndSelf;
ti.uId = (INT32)wParam; ti.uId = (INT32)wParam;
ti.hinst = 0; ti.hinst = 0;
ti.lpszText = (LPSTR)lParam; ti.lpszText = (LPSTR)lParam;
SendMessage32A (self->hwndToolTip, TTM_UPDATETIPTEXT32A, SendMessage32A (infoPtr->hwndToolTip, TTM_UPDATETIPTEXT32A,
0, (LPARAM)&ti); 0, (LPARAM)&ti);
} }
@ -652,20 +730,48 @@ STATUSBAR_SetTipText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
} }
// << STATUSBAR_SetTipText32W >> static LRESULT
// << STATUSBAR_SetUnicodeFormat >> STATUSBAR_SetTipText32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
TRACE (statusbar, "part %d: \"%s\"\n", (INT32)wParam, (LPSTR)lParam);
if (infoPtr->hwndToolTip) {
TTTOOLINFO32W ti;
ti.cbSize = sizeof(TTTOOLINFO32W);
ti.hwnd = wndPtr->hwndSelf;
ti.uId = (INT32)wParam;
ti.hinst = 0;
ti.lpszText = (LPWSTR)lParam;
SendMessage32W (infoPtr->hwndToolTip, TTM_UPDATETIPTEXT32W,
0, (LPARAM)&ti);
}
return 0;
}
__inline__ static LRESULT
STATUSBAR_SetUnicodeFormat (WND *wndPtr, WPARAM32 wParam)
{
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
BOOL32 bTemp = infoPtr->bUnicode;
TRACE (statusbar, "(0x%x)\n", (BOOL32)wParam);
infoPtr->bUnicode = (BOOL32)wParam;
return bTemp;
}
static LRESULT static LRESULT
STATUSBAR_Simple (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_Simple (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
BOOL32 simple;
HDC32 hdc; HDC32 hdc;
NMHDR nmhdr; NMHDR nmhdr;
simple = (BOOL32) wParam; infoPtr->simple = (BOOL32)wParam;
self->simple = simple;
/* send notification */ /* send notification */
nmhdr.hwndFrom = wndPtr->hwndSelf; nmhdr.hwndFrom = wndPtr->hwndSelf;
@ -721,9 +827,18 @@ STATUSBAR_WMCreate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
self->parts[0].style = 0; self->parts[0].style = 0;
self->parts[0].hIcon = 0; self->parts[0].hIcon = 0;
if ((len = lstrlen32A (lpCreate->lpszName))) { if (IsWindowUnicode (wndPtr->hwndSelf)) {
self->parts[0].text = COMCTL32_Alloc (len + 1); self->bUnicode = TRUE;
lstrcpy32A (self->parts[0].text, lpCreate->lpszName); if ((len = lstrlen32W ((LPCWSTR)lpCreate->lpszName))) {
self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
lstrcpy32W (self->parts[0].text, (LPCWSTR)lpCreate->lpszName);
}
}
else {
if ((len = lstrlen32A ((LPCSTR)lpCreate->lpszName))) {
self->parts[0].text = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
lstrcpyAtoW (self->parts[0].text, (LPCSTR)lpCreate->lpszName);
}
} }
if ((hdc = GetDC32 (0))) { if ((hdc = GetDC32 (0))) {
@ -800,49 +915,39 @@ STATUSBAR_WMDestroy (WND *wndPtr)
static __inline__ LRESULT static __inline__ LRESULT
STATUSBAR_WMGetFont (WND *wndPtr) STATUSBAR_WMGetFont (WND *wndPtr)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
return infoPtr->hFont;
return self->hFont;
} }
static LRESULT static LRESULT
STATUSBAR_WMGetText (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_WMGetText (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
INT32 len; INT32 len;
if (!(self->parts[0].text)) if (!(infoPtr->parts[0].text))
return 0; return 0;
len = lstrlen32A (self->parts[0].text); len = lstrlen32W (infoPtr->parts[0].text);
if (wParam > len) { if (wParam > len) {
lstrcpy32A ((LPSTR)lParam, self->parts[0].text); if (infoPtr->bUnicode)
lstrcpy32W ((LPWSTR)lParam, infoPtr->parts[0].text);
else
lstrcpyWtoA ((LPSTR)lParam, infoPtr->parts[0].text);
return len; return len;
} }
else
return -1; return -1;
} }
static LRESULT
STATUSBAR_WMGetTextLength (WND *wndPtr)
{
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr);
if (!(self->parts[0].text))
return 0;
return (lstrlen32A (self->parts[0].text));
}
__inline__ static LRESULT __inline__ static LRESULT
STATUSBAR_WMMouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_WMMouseMove (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
if (self->hwndToolTip) if (infoPtr->hwndToolTip)
STATUSBAR_RelayEvent (self->hwndToolTip, wndPtr->hwndSelf, STATUSBAR_RelayEvent (infoPtr->hwndToolTip, wndPtr->hwndSelf,
WM_MOUSEMOVE, wParam, lParam); WM_MOUSEMOVE, wParam, lParam);
return 0; return 0;
} }
@ -908,9 +1013,9 @@ STATUSBAR_WMPaint (WND *wndPtr, WPARAM32 wParam)
static LRESULT static LRESULT
STATUSBAR_WMSetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_WMSetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
self->hFont = (HFONT32)wParam; infoPtr->hFont = (HFONT32)wParam;
if (LOWORD(lParam) == TRUE) { if (LOWORD(lParam) == TRUE) {
HDC32 hdc = GetDC32 (wndPtr->hwndSelf); HDC32 hdc = GetDC32 (wndPtr->hwndSelf);
STATUSBAR_Refresh (wndPtr, hdc); STATUSBAR_Refresh (wndPtr, hdc);
@ -924,22 +1029,30 @@ STATUSBAR_WMSetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
static LRESULT static LRESULT
STATUSBAR_WMSetText (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_WMSetText (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
int len; int len;
HDC32 hdc; HDC32 hdc;
if (self->numParts == 0) if (infoPtr->numParts == 0)
return FALSE; return FALSE;
part = &self->parts[0]; part = &infoPtr->parts[0];
/* duplicate string */ /* duplicate string */
if (part->text) if (part->text)
COMCTL32_Free (part->text); COMCTL32_Free (part->text);
part->text = 0; part->text = 0;
if (infoPtr->bUnicode) {
if (lParam && (len = lstrlen32W((LPCWSTR)lParam))) {
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpy32W (part->text, (LPCWSTR)lParam);
}
}
else {
if (lParam && (len = lstrlen32A((LPCSTR)lParam))) { if (lParam && (len = lstrlen32A((LPCSTR)lParam))) {
part->text = COMCTL32_Alloc (len+1); part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpy32A (part->text, (LPCSTR)lParam); lstrcpyAtoW (part->text, (LPCSTR)lParam);
}
} }
hdc = GetDC32 (wndPtr->hwndSelf); hdc = GetDC32 (wndPtr->hwndSelf);
@ -953,7 +1066,7 @@ STATUSBAR_WMSetText (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
static LRESULT static LRESULT
STATUSBAR_WMSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam) STATUSBAR_WMSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (wndPtr); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (wndPtr);
INT32 width, x, y, flags; INT32 width, x, y, flags;
RECT32 parent_rect; RECT32 parent_rect;
HWND32 parent; HWND32 parent;
@ -971,10 +1084,10 @@ STATUSBAR_WMSize (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
GetClientRect32 (parent, &parent_rect); GetClientRect32 (parent, &parent_rect);
width = parent_rect.right - parent_rect.left; width = parent_rect.right - parent_rect.left;
x = parent_rect.left; x = parent_rect.left;
y = parent_rect.bottom - self->height; y = parent_rect.bottom - infoPtr->height;
MoveWindow32 (wndPtr->hwndSelf, parent_rect.left, MoveWindow32 (wndPtr->hwndSelf, parent_rect.left,
parent_rect.bottom - self->height, parent_rect.bottom - infoPtr->height,
width, self->height, TRUE); width, infoPtr->height, TRUE);
STATUSBAR_SetPartBounds (wndPtr); STATUSBAR_SetPartBounds (wndPtr);
} }
return 0; return 0;
@ -1017,18 +1130,21 @@ StatusWindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case SB_GETTEXT32A: case SB_GETTEXT32A:
return STATUSBAR_GetText32A (wndPtr, wParam, lParam); return STATUSBAR_GetText32A (wndPtr, wParam, lParam);
// case SB_GETTEXT32W: case SB_GETTEXT32W:
return STATUSBAR_GetText32W (wndPtr, wParam, lParam);
case SB_GETTEXTLENGTH32A: case SB_GETTEXTLENGTH32A:
return STATUSBAR_GetTextLength32A (wndPtr, wParam, lParam); case SB_GETTEXTLENGTH32W:
return STATUSBAR_GetTextLength (wndPtr, wParam);
// case SB_GETTEXTLENGHT32W:
case SB_GETTIPTEXT32A: case SB_GETTIPTEXT32A:
return STATUSBAR_GetTipText32A (wndPtr, wParam, lParam); return STATUSBAR_GetTipText32A (wndPtr, wParam, lParam);
// case SB_GETTIPTEXT32W: case SB_GETTIPTEXT32W:
// case SB_GETUNICODEFORMAT: return STATUSBAR_GetTipText32W (wndPtr, wParam, lParam);
case SB_GETUNICODEFORMAT:
return STATUSBAR_GetUnicodeFormat (wndPtr);
case SB_ISSIMPLE: case SB_ISSIMPLE:
return STATUSBAR_IsSimple (wndPtr); return STATUSBAR_IsSimple (wndPtr);
@ -1048,13 +1164,17 @@ StatusWindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
case SB_SETTEXT32A: case SB_SETTEXT32A:
return STATUSBAR_SetText32A (wndPtr, wParam, lParam); return STATUSBAR_SetText32A (wndPtr, wParam, lParam);
// case SB_SETTEXT32W: case SB_SETTEXT32W:
return STATUSBAR_SetText32W (wndPtr, wParam, lParam);
case SB_SETTIPTEXT32A: case SB_SETTIPTEXT32A:
return STATUSBAR_SetTipText32A (wndPtr, wParam, lParam); return STATUSBAR_SetTipText32A (wndPtr, wParam, lParam);
// case SB_SETTIPTEXT32W: case SB_SETTIPTEXT32W:
// case SB_SETUNICODEFORMAT: return STATUSBAR_SetTipText32W (wndPtr, wParam, lParam);
case SB_SETUNICODEFORMAT:
return STATUSBAR_SetUnicodeFormat (wndPtr, wParam);
case SB_SIMPLE: case SB_SIMPLE:
return STATUSBAR_Simple (wndPtr, wParam, lParam); return STATUSBAR_Simple (wndPtr, wParam, lParam);
@ -1073,7 +1193,7 @@ StatusWindowProc (HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
return STATUSBAR_WMGetText (wndPtr, wParam, lParam); return STATUSBAR_WMGetText (wndPtr, wParam, lParam);
case WM_GETTEXTLENGTH: case WM_GETTEXTLENGTH:
return STATUSBAR_WMGetTextLength (wndPtr); return STATUSBAR_GetTextLength (wndPtr, 0);
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
return STATUSBAR_SendNotify (wndPtr, NM_DBLCLK); return STATUSBAR_SendNotify (wndPtr, NM_DBLCLK);

View File

@ -83,21 +83,21 @@ TOOLBAR_DrawString (TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr,
if (!(nState & TBSTATE_ENABLED)) { if (!(nState & TBSTATE_ENABLED)) {
clrOld = SetTextColor32 (hdc, GetSysColor32 (COLOR_3DHILIGHT)); clrOld = SetTextColor32 (hdc, GetSysColor32 (COLOR_3DHILIGHT));
OffsetRect32 (&rcText, 1, 1); OffsetRect32 (&rcText, 1, 1);
DrawText32A (hdc, infoPtr->strings[btnPtr->iString], -1, DrawText32W (hdc, infoPtr->strings[btnPtr->iString], -1,
&rcText, infoPtr->dwDTFlags); &rcText, infoPtr->dwDTFlags);
SetTextColor32 (hdc, GetSysColor32 (COLOR_3DSHADOW)); SetTextColor32 (hdc, GetSysColor32 (COLOR_3DSHADOW));
OffsetRect32 (&rcText, -1, -1); OffsetRect32 (&rcText, -1, -1);
DrawText32A (hdc, infoPtr->strings[btnPtr->iString], -1, DrawText32W (hdc, infoPtr->strings[btnPtr->iString], -1,
&rcText, infoPtr->dwDTFlags); &rcText, infoPtr->dwDTFlags);
} }
else if (nState & TBSTATE_INDETERMINATE) { else if (nState & TBSTATE_INDETERMINATE) {
clrOld = SetTextColor32 (hdc, GetSysColor32 (COLOR_3DSHADOW)); clrOld = SetTextColor32 (hdc, GetSysColor32 (COLOR_3DSHADOW));
DrawText32A (hdc, infoPtr->strings[btnPtr->iString], -1, DrawText32W (hdc, infoPtr->strings[btnPtr->iString], -1,
&rcText, infoPtr->dwDTFlags); &rcText, infoPtr->dwDTFlags);
} }
else { else {
clrOld = SetTextColor32 (hdc, GetSysColor32 (COLOR_BTNTEXT)); clrOld = SetTextColor32 (hdc, GetSysColor32 (COLOR_BTNTEXT));
DrawText32A (hdc, infoPtr->strings[btnPtr->iString], -1, DrawText32W (hdc, infoPtr->strings[btnPtr->iString], -1,
&rcText, infoPtr->dwDTFlags); &rcText, infoPtr->dwDTFlags);
} }
@ -292,8 +292,8 @@ TOOLBAR_CalcStrings (WND *wndPtr, LPSIZE32 lpSize)
if (!(btnPtr->fsState & TBSTATE_HIDDEN) && if (!(btnPtr->fsState & TBSTATE_HIDDEN) &&
(btnPtr->iString > -1) && (btnPtr->iString > -1) &&
(btnPtr->iString < infoPtr->nNumStrings)) { (btnPtr->iString < infoPtr->nNumStrings)) {
LPSTR lpText = infoPtr->strings[btnPtr->iString]; LPWSTR lpText = infoPtr->strings[btnPtr->iString];
GetTextExtentPoint32A (hdc, lpText, lstrlen32A(lpText), &sz); GetTextExtentPoint32W (hdc, lpText, lstrlen32W (lpText), &sz);
if (sz.cx > lpSize->cx) if (sz.cx > lpSize->cx)
lpSize->cx = sz.cx; lpSize->cx = sz.cx;
if (sz.cy > lpSize->cy) if (sz.cy > lpSize->cy)
@ -753,27 +753,28 @@ TOOLBAR_AddString32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
nIndex = infoPtr->nNumStrings; nIndex = infoPtr->nNumStrings;
if (infoPtr->nNumStrings == 0) { if (infoPtr->nNumStrings == 0) {
infoPtr->strings = infoPtr->strings =
COMCTL32_Alloc (sizeof(char *)); COMCTL32_Alloc (sizeof(LPWSTR));
} }
else { else {
char **oldStrings = infoPtr->strings; LPWSTR *oldStrings = infoPtr->strings;
infoPtr->strings = infoPtr->strings =
COMCTL32_Alloc (sizeof(char *) * (infoPtr->nNumStrings + 1)); COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
memcpy (&infoPtr->strings[0], &oldStrings[0], memcpy (&infoPtr->strings[0], &oldStrings[0],
sizeof(char *) * infoPtr->nNumStrings); sizeof(LPWSTR) * infoPtr->nNumStrings);
COMCTL32_Free (oldStrings); COMCTL32_Free (oldStrings);
} }
infoPtr->strings[infoPtr->nNumStrings] = infoPtr->strings[infoPtr->nNumStrings] =
COMCTL32_Alloc (sizeof(char)*(len+1)); COMCTL32_Alloc (sizeof(WCHAR)*(len+1));
lstrcpy32A (infoPtr->strings[infoPtr->nNumStrings], szString); lstrcpyAtoW (infoPtr->strings[infoPtr->nNumStrings], szString);
infoPtr->nNumStrings++; infoPtr->nNumStrings++;
} }
else { else {
char *p = (char*)lParam; LPSTR p = (LPSTR)lParam;
INT32 len; INT32 len;
if (p == NULL) return -1; if (p == NULL)
return -1;
TRACE (toolbar, "adding string(s) from array!\n"); TRACE (toolbar, "adding string(s) from array!\n");
nIndex = infoPtr->nNumStrings; nIndex = infoPtr->nNumStrings;
while (*p) { while (*p) {
@ -782,20 +783,20 @@ TOOLBAR_AddString32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
if (infoPtr->nNumStrings == 0) { if (infoPtr->nNumStrings == 0) {
infoPtr->strings = infoPtr->strings =
COMCTL32_Alloc (sizeof(char *)); COMCTL32_Alloc (sizeof(LPWSTR));
} }
else { else {
char **oldStrings = infoPtr->strings; LPWSTR *oldStrings = infoPtr->strings;
infoPtr->strings = infoPtr->strings =
COMCTL32_Alloc (sizeof(char *) * (infoPtr->nNumStrings + 1)); COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
memcpy (&infoPtr->strings[0], &oldStrings[0], memcpy (&infoPtr->strings[0], &oldStrings[0],
sizeof(char *) * infoPtr->nNumStrings); sizeof(LPWSTR) * infoPtr->nNumStrings);
COMCTL32_Free (oldStrings); COMCTL32_Free (oldStrings);
} }
infoPtr->strings[infoPtr->nNumStrings] = infoPtr->strings[infoPtr->nNumStrings] =
COMCTL32_Alloc (sizeof(char)*(len+1)); COMCTL32_Alloc (sizeof(WCHAR)*(len+1));
lstrcpy32A (infoPtr->strings[infoPtr->nNumStrings], p); lstrcpyAtoW (infoPtr->strings[infoPtr->nNumStrings], p);
infoPtr->nNumStrings++; infoPtr->nNumStrings++;
p += (len+1); p += (len+1);
@ -806,7 +807,76 @@ TOOLBAR_AddString32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
} }
// << TOOLBAR_AddString32W >> static LRESULT
TOOLBAR_AddString32W (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr(wndPtr);
INT32 nIndex;
if ((wParam) && (HIWORD(lParam) == 0)) {
WCHAR szString[256];
INT32 len;
TRACE (toolbar, "adding string from resource!\n");
len = LoadString32W ((HINSTANCE32)wParam, (UINT32)lParam,
szString, 256);
TRACE (toolbar, "len=%d \"%s\"\n", len, debugstr_w(szString));
nIndex = infoPtr->nNumStrings;
if (infoPtr->nNumStrings == 0) {
infoPtr->strings =
COMCTL32_Alloc (sizeof(LPWSTR));
}
else {
LPWSTR *oldStrings = infoPtr->strings;
infoPtr->strings =
COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
memcpy (&infoPtr->strings[0], &oldStrings[0],
sizeof(LPWSTR) * infoPtr->nNumStrings);
COMCTL32_Free (oldStrings);
}
infoPtr->strings[infoPtr->nNumStrings] =
COMCTL32_Alloc (sizeof(WCHAR)*(len+1));
lstrcpy32W (infoPtr->strings[infoPtr->nNumStrings], szString);
infoPtr->nNumStrings++;
}
else {
LPWSTR p = (LPWSTR)lParam;
INT32 len;
if (p == NULL)
return -1;
TRACE (toolbar, "adding string(s) from array!\n");
nIndex = infoPtr->nNumStrings;
while (*p) {
len = lstrlen32W (p);
TRACE (toolbar, "len=%d \"%s\"\n", len, debugstr_w(p));
if (infoPtr->nNumStrings == 0) {
infoPtr->strings =
COMCTL32_Alloc (sizeof(LPWSTR));
}
else {
LPWSTR *oldStrings = infoPtr->strings;
infoPtr->strings =
COMCTL32_Alloc (sizeof(LPWSTR) * (infoPtr->nNumStrings + 1));
memcpy (&infoPtr->strings[0], &oldStrings[0],
sizeof(LPWSTR) * infoPtr->nNumStrings);
COMCTL32_Free (oldStrings);
}
infoPtr->strings[infoPtr->nNumStrings] =
COMCTL32_Alloc (sizeof(WCHAR)*(len+1));
lstrcpy32W (infoPtr->strings[infoPtr->nNumStrings], p);
infoPtr->nNumStrings++;
p += (len+1);
}
}
return nIndex;
}
static LRESULT static LRESULT
@ -2055,7 +2125,7 @@ TOOLBAR_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
infoPtr->cxMax = -1; infoPtr->cxMax = -1;
infoPtr->bCaptured = FALSE; infoPtr->bCaptured = FALSE;
infoPtr->bUnicode = FALSE; infoPtr->bUnicode = IsWindowUnicode (wndPtr->hwndSelf);
infoPtr->nButtonDown = -1; infoPtr->nButtonDown = -1;
infoPtr->nOldHit = -1; infoPtr->nOldHit = -1;
@ -2555,7 +2625,8 @@ ToolbarWindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case TB_ADDSTRING32A: case TB_ADDSTRING32A:
return TOOLBAR_AddString32A (wndPtr, wParam, lParam); return TOOLBAR_AddString32A (wndPtr, wParam, lParam);
// case TB_ADDSTRING32W: case TB_ADDSTRING32W:
return TOOLBAR_AddString32W (wndPtr, wParam, lParam);
case TB_AUTOSIZE: case TB_AUTOSIZE:
return TOOLBAR_AutoSize (wndPtr, wParam, lParam); return TOOLBAR_AutoSize (wndPtr, wParam, lParam);

View File

@ -141,7 +141,6 @@ typedef struct tagNMTOOLTIPSCREATED
#define SB_GETTEXTLENGTH32A (WM_USER+3) #define SB_GETTEXTLENGTH32A (WM_USER+3)
#define SB_GETTEXTLENGTH32W (WM_USER+12) #define SB_GETTEXTLENGTH32W (WM_USER+12)
#define SB_GETTEXTLENGTH WINELIB_NAME_AW(SB_GETTEXTLENGTH) #define SB_GETTEXTLENGTH WINELIB_NAME_AW(SB_GETTEXTLENGTH)
#define SB_SETPARTS (WM_USER+4) #define SB_SETPARTS (WM_USER+4)
#define SB_GETPARTS (WM_USER+6) #define SB_GETPARTS (WM_USER+6)
#define SB_GETBORDERS (WM_USER+7) #define SB_GETBORDERS (WM_USER+7)
@ -158,6 +157,8 @@ typedef struct tagNMTOOLTIPSCREATED
#define SB_GETTIPTEXT WINELIB_NAME_AW(SB_GETTIPTEXT) #define SB_GETTIPTEXT WINELIB_NAME_AW(SB_GETTIPTEXT)
#define SB_GETICON (WM_USER+20) #define SB_GETICON (WM_USER+20)
#define SB_SETBKCOLOR CCM_SETBKCOLOR /* lParam = bkColor */ #define SB_SETBKCOLOR CCM_SETBKCOLOR /* lParam = bkColor */
#define SB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT
#define SB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT
#define SBN_FIRST (0U-880U) #define SBN_FIRST (0U-880U)
#define SBN_LAST (0U-899U) #define SBN_LAST (0U-899U)
@ -1160,11 +1161,11 @@ typedef struct tagNMTTDISPINFOW
#define RB_SETPALETTE (WM_USER+37) #define RB_SETPALETTE (WM_USER+37)
#define RB_GETPALETTE (WM_USER+38) #define RB_GETPALETTE (WM_USER+38)
#define RB_MOVEBAND (WM_USER+39) #define RB_MOVEBAND (WM_USER+39)
#define RB_GETDROPTARGET CCS_GETDROPTARGET #define RB_GETDROPTARGET CCM_GETDROPTARGET
#define RB_SETCOLORSCHEME CCS_SETCOLORSCHEME #define RB_SETCOLORSCHEME CCM_SETCOLORSCHEME
#define RB_GETCOLORSCHEME CCS_GETCOLORSCHEME #define RB_GETCOLORSCHEME CCM_GETCOLORSCHEME
#define RB_SETUNICODEFORMAT CCS_SETUNICODEFORMAT #define RB_SETUNICODEFORMAT CCM_SETUNICODEFORMAT
#define RB_GETUNICODEFORMAT CCS_GETUNICODEFORMAT #define RB_GETUNICODEFORMAT CCM_GETUNICODEFORMAT
#define RBN_FIRST (0U-831U) #define RBN_FIRST (0U-831U)
#define RBN_LAST (0U-859U) #define RBN_LAST (0U-859U)
@ -1218,7 +1219,7 @@ typedef struct tagREBARBANDINFOW
UINT32 fStyle; UINT32 fStyle;
COLORREF clrFore; COLORREF clrFore;
COLORREF clrBack; COLORREF clrBack;
LPSTR lpText; LPWSTR lpText;
UINT32 cch; UINT32 cch;
INT32 iImage; INT32 iImage;
HWND32 hwndChild; HWND32 hwndChild;
@ -1248,7 +1249,7 @@ typedef REBARBANDINFO32W const *LPCREBARBANDINFO32W;
typedef struct tagNMREBARCHILDSIZE typedef struct tagNMREBARCHILDSIZE
{ {
NMHDR hdr; NMHDR hdr;
UINT32 iBand; UINT32 uBand;
UINT32 wID; UINT32 wID;
RECT32 rcChild; RECT32 rcChild;
RECT32 rcBand; RECT32 rcBand;
@ -2443,6 +2444,10 @@ LPVOID WINAPI DSA_GetItemPtr (const HDSA, INT32);
INT32 WINAPI DSA_InsertItem (const HDSA, INT32, LPVOID); INT32 WINAPI DSA_InsertItem (const HDSA, INT32, LPVOID);
BOOL32 WINAPI DSA_SetItem (const HDSA, INT32, LPVOID); BOOL32 WINAPI DSA_SetItem (const HDSA, INT32, LPVOID);
typedef INT32 (CALLBACK *DSAENUMPROC)(LPVOID, DWORD);
VOID WINAPI DSA_EnumCallback (const HDSA, DSAENUMPROC, LPARAM);
BOOL32 WINAPI DSA_DestroyCallback (const HDSA, DSAENUMPROC, LPARAM);
/* Dynamic Pointer Array */ /* Dynamic Pointer Array */
@ -2476,6 +2481,15 @@ BOOL32 WINAPI DPA_Sort (const HDPA, PFNDPACOMPARE, LPARAM);
INT32 WINAPI DPA_Search (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32); INT32 WINAPI DPA_Search (const HDPA, LPVOID, INT32, PFNDPACOMPARE, LPARAM, UINT32);
#define DPAM_SORT 0x0001
BOOL32 WINAPI DPA_Merge (const HDPA, const HDPA, DWORD, PFNDPACOMPARE, LPVOID, LPARAM);
typedef INT32 (CALLBACK *DPAENUMPROC)(LPVOID, DWORD);
VOID WINAPI DPA_EnumCallback (const HDPA, DPAENUMPROC, LPARAM);
BOOL32 WINAPI DPA_DestroyCallback (const HDPA, DPAENUMPROC, LPARAM);
#define DPA_GetPtrCount(hdpa) (*(INT32*)(hdpa)) #define DPA_GetPtrCount(hdpa) (*(INT32*)(hdpa))
#define DPA_GetPtrPtr(hdpa) (*((LPVOID**)((BYTE*)(hdpa)+sizeof(INT32)))) #define DPA_GetPtrPtr(hdpa) (*((LPVOID**)((BYTE*)(hdpa)+sizeof(INT32))))
#define DPA_FastGetPtr(hdpa,i) (DPA_GetPtrPtr(hdpa)[i]) #define DPA_FastGetPtr(hdpa,i) (DPA_GetPtrPtr(hdpa)[i])

View File

@ -12,7 +12,7 @@ typedef struct
{ {
INT32 cxy; INT32 cxy;
HBITMAP32 hbm; HBITMAP32 hbm;
LPSTR pszText; LPWSTR pszText;
INT32 fmt; INT32 fmt;
LPARAM lParam; LPARAM lParam;
INT32 iImage; INT32 iImage;
@ -34,6 +34,7 @@ typedef struct
BOOL32 bCaptured; /* Is the mouse captured? */ BOOL32 bCaptured; /* Is the mouse captured? */
BOOL32 bPressed; /* Is a header item pressed (down)? */ BOOL32 bPressed; /* Is a header item pressed (down)? */
BOOL32 bTracking; /* Is in tracking mode? */ BOOL32 bTracking; /* Is in tracking mode? */
BOOL32 bUnicode; /* Unicode flag */
INT32 iMoveItem; /* index of tracked item. (Tracking mode) */ INT32 iMoveItem; /* index of tracked item. (Tracking mode) */
INT32 xTrackOffset; /* distance between the right side of the tracked item and the cursor */ INT32 xTrackOffset; /* distance between the right side of the tracked item and the cursor */
INT32 xOldTrack; /* track offset (see above) after the last WM_MOUSEMOVE */ INT32 xOldTrack; /* track offset (see above) after the last WM_MOUSEMOVE */

View File

@ -35,6 +35,7 @@ typedef struct tagLISTVIEW_INFO
RECT32 rcList; /* "client" area of the list (without header) */ RECT32 rcList; /* "client" area of the list (without header) */
BOOL32 bFocus; BOOL32 bFocus;
DWORD dwExStyle; /* extended listview style */
HDPA hdpaItems; HDPA hdpaItems;
} LISTVIEW_INFO; } LISTVIEW_INFO;

View File

@ -8,7 +8,7 @@
/* to be implemented */ /* to be implemented */
typedef LPVOID LPMESSAGEFILTER; typedef LPVOID LPMESSAGEFILTER;
typedef LPVOID LPDROPTARGET; typedef LPVOID LPDROPTARGET;
typedef LPVOID LPMONIKER; typedef struct tagMONIKER *LPMONIKER, IMoniker;
#define S_OK 0 #define S_OK 0
#define S_FALSE 1 #define S_FALSE 1

View File

@ -34,7 +34,7 @@ typedef struct tagREBAR_BAND
RECT32 rcCapText; /* calculated caption text rectangle */ RECT32 rcCapText; /* calculated caption text rectangle */
RECT32 rcChild; /* calculated child rectangle */ RECT32 rcChild; /* calculated child rectangle */
LPSTR lpText; LPWSTR lpText;
HWND32 hwndPrevParent; HWND32 hwndPrevParent;
} REBAR_BAND; } REBAR_BAND;
@ -51,6 +51,7 @@ typedef struct tagREBAR_INFO
SIZE32 calcSize; /* calculated rebar size */ SIZE32 calcSize; /* calculated rebar size */
BOOL32 bAutoResize; /* auto resize deadlock flag */ BOOL32 bAutoResize; /* auto resize deadlock flag */
BOOL32 bUnicode; /* Unicode flag */
HCURSOR32 hcurArrow; /* handle to the arrow cursor */ HCURSOR32 hcurArrow; /* handle to the arrow cursor */
HCURSOR32 hcurHorz; /* handle to the EW cursor */ HCURSOR32 hcurHorz; /* handle to the EW cursor */
HCURSOR32 hcurVert; /* handle to the NS cursor */ HCURSOR32 hcurVert; /* handle to the NS cursor */

View File

@ -12,7 +12,7 @@ typedef struct
INT32 x; INT32 x;
INT32 style; INT32 style;
RECT32 bound; RECT32 bound;
LPSTR text; LPWSTR text;
HICON32 hIcon; HICON32 hIcon;
} STATUSWINDOWPART; } STATUSWINDOWPART;
@ -26,6 +26,7 @@ typedef struct
HFONT32 hFont; HFONT32 hFont;
HFONT32 hDefaultFont; HFONT32 hDefaultFont;
COLORREF clrBk; /* background color */ COLORREF clrBk; /* background color */
BOOL32 bUnicode; /* unicode flag */
STATUSWINDOWPART part0; /* simple window */ STATUSWINDOWPART part0; /* simple window */
STATUSWINDOWPART *parts; STATUSWINDOWPART *parts;
} STATUSWINDOWINFO; } STATUSWINDOWINFO;

View File

@ -60,7 +60,7 @@ typedef struct tagTOOLBAR_INFO
RECT32 rcBound; /* bounding rectangle */ RECT32 rcBound; /* bounding rectangle */
TBUTTON_INFO *buttons; /* pointer to button array */ TBUTTON_INFO *buttons; /* pointer to button array */
CHAR **strings; LPWSTR *strings; /* pointer to string array */
} TOOLBAR_INFO; } TOOLBAR_INFO;

View File

@ -23,14 +23,14 @@ typedef struct tagTTTOOL_INFO
UINT32 uId; UINT32 uId;
RECT32 rect; RECT32 rect;
HINSTANCE32 hinst; HINSTANCE32 hinst;
LPSTR lpszText; LPWSTR lpszText;
LPARAM lParam; LPARAM lParam;
} TTTOOL_INFO; } TTTOOL_INFO;
typedef struct tagTOOLTIPS_INFO typedef struct tagTOOLTIPS_INFO
{ {
CHAR szTipText[INFOTIPSIZE]; WCHAR szTipText[INFOTIPSIZE];
BOOL32 bActive; BOOL32 bActive;
BOOL32 bTrackActive; BOOL32 bTrackActive;
UINT32 uNumTools; UINT32 uNumTools;