Commit 7f97372a authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

comctl32: statusbar: Window is always Unicode, CCM_SETUNICODEFORMAT should…

comctl32: statusbar: Window is always Unicode, CCM_SETUNICODEFORMAT should change the notify format.
parent 9528b1c6
...@@ -77,7 +77,6 @@ typedef struct ...@@ -77,7 +77,6 @@ typedef struct
HFONT hFont; HFONT hFont;
HFONT hDefaultFont; HFONT hDefaultFont;
COLORREF clrBk; /* background color */ COLORREF clrBk; /* background color */
BOOL bUnicode; /* unicode flag */
BOOL NtfUnicode; /* notify format */ BOOL NtfUnicode; /* notify format */
STATUSWINDOWPART part0; /* simple window */ STATUSWINDOWPART part0; /* simple window */
STATUSWINDOWPART* parts; STATUSWINDOWPART* parts;
...@@ -845,10 +844,10 @@ STATUSBAR_SetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR text) ...@@ -845,10 +844,10 @@ STATUSBAR_SetTipTextW (const STATUS_INFO *infoPtr, INT id, LPWSTR text)
static inline LRESULT static inline LRESULT
STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode) STATUSBAR_SetUnicodeFormat (STATUS_INFO *infoPtr, BOOL bUnicode)
{ {
BOOL bOld = infoPtr->bUnicode; BOOL bOld = infoPtr->NtfUnicode;
TRACE("(0x%x)\n", bUnicode); TRACE("(0x%x)\n", bUnicode);
infoPtr->bUnicode = bUnicode; infoPtr->NtfUnicode = bUnicode;
return bOld; return bOld;
} }
...@@ -961,24 +960,11 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate) ...@@ -961,24 +960,11 @@ STATUSBAR_WMCreate (HWND hwnd, const CREATESTRUCTA *lpCreate)
OpenThemeData (hwnd, themeClass); OpenThemeData (hwnd, themeClass);
if (IsWindowUnicode (hwnd)) { if (lpCreate->lpszName && (len = strlenW ((LPCWSTR)lpCreate->lpszName)))
infoPtr->bUnicode = TRUE; {
if (lpCreate->lpszName && infoPtr->parts[0].text = Alloc ((len + 1)*sizeof(WCHAR));
(len = strlenW ((LPCWSTR)lpCreate->lpszName))) { if (!infoPtr->parts[0].text) goto create_fail;
infoPtr->parts[0].text = Alloc ((len + 1)*sizeof(WCHAR)); strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
if (!infoPtr->parts[0].text) goto create_fail;
strcpyW (infoPtr->parts[0].text, (LPCWSTR)lpCreate->lpszName);
}
}
else {
if (lpCreate->lpszName &&
(len = strlen((LPCSTR)lpCreate->lpszName))) {
DWORD lenW = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1, NULL, 0 );
infoPtr->parts[0].text = Alloc (lenW*sizeof(WCHAR));
if (!infoPtr->parts[0].text) goto create_fail;
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)lpCreate->lpszName, -1,
infoPtr->parts[0].text, lenW );
}
} }
dwStyle = GetWindowLongW (hwnd, GWL_STYLE); dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
...@@ -1062,17 +1048,11 @@ STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf) ...@@ -1062,17 +1048,11 @@ STATUSBAR_WMGetText (const STATUS_INFO *infoPtr, INT size, LPWSTR buf)
TRACE("\n"); TRACE("\n");
if (!(infoPtr->parts[0].text)) if (!(infoPtr->parts[0].text))
return 0; return 0;
if (infoPtr->bUnicode)
len = strlenW (infoPtr->parts[0].text); len = strlenW (infoPtr->parts[0].text);
else
len = WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1, NULL, 0, NULL, NULL )-1;
if (size > len) { if (size > len) {
if (infoPtr->bUnicode) strcpyW (buf, infoPtr->parts[0].text);
strcpyW (buf, infoPtr->parts[0].text);
else
WideCharToMultiByte( CP_ACP, 0, infoPtr->parts[0].text, -1,
(LPSTR)buf, len+1, NULL, NULL );
return len; return len;
} }
...@@ -1145,20 +1125,11 @@ STATUSBAR_WMSetText (const STATUS_INFO *infoPtr, LPCSTR text) ...@@ -1145,20 +1125,11 @@ STATUSBAR_WMSetText (const STATUS_INFO *infoPtr, LPCSTR text)
/* duplicate string */ /* duplicate string */
Free (part->text); Free (part->text);
part->text = 0; part->text = 0;
if (infoPtr->bUnicode) {
if (text && (len = strlenW((LPCWSTR)text))) { if (text && (len = strlenW((LPCWSTR)text))) {
part->text = Alloc ((len+1)*sizeof(WCHAR)); part->text = Alloc ((len+1)*sizeof(WCHAR));
if (!part->text) return FALSE; if (!part->text) return FALSE;
strcpyW (part->text, (LPCWSTR)text); strcpyW (part->text, (LPCWSTR)text);
}
}
else {
if (text && (len = lstrlenA(text))) {
DWORD lenW = MultiByteToWideChar( CP_ACP, 0, text, -1, NULL, 0 );
part->text = Alloc (lenW*sizeof(WCHAR));
if (!part->text) return FALSE;
MultiByteToWideChar( CP_ACP, 0, text, -1, part->text, lenW );
}
} }
InvalidateRect(infoPtr->Self, &part->bound, FALSE); InvalidateRect(infoPtr->Self, &part->bound, FALSE);
...@@ -1278,7 +1249,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -1278,7 +1249,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
return STATUSBAR_GetTipTextW (infoPtr, LOWORD(wParam), (LPWSTR)lParam, HIWORD(wParam)); return STATUSBAR_GetTipTextW (infoPtr, LOWORD(wParam), (LPWSTR)lParam, HIWORD(wParam));
case SB_GETUNICODEFORMAT: case SB_GETUNICODEFORMAT:
return infoPtr->bUnicode; return infoPtr->NtfUnicode;
case SB_ISSIMPLE: case SB_ISSIMPLE:
return infoPtr->simple; return infoPtr->simple;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment