Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbeyj@wpi.edu>

Fixes a problem when using STATUSBAR_SetText() to toggle SBT_OWNERDRAW
This commit is contained in:
Alexandre Julliard 1999-06-13 08:46:30 +00:00
parent 49080d3b59
commit a79cc39ffa
1 changed files with 12 additions and 8 deletions

View File

@ -647,20 +647,22 @@ STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
else else
part = &self->parts[part_num]; part = &self->parts[part_num];
if (!part) return FALSE; if (!part) return FALSE;
part->style = style;
if (!(part->style & SBT_OWNERDRAW) && part->text)
COMCTL32_Free (part->text);
part->text = 0;
if (style & SBT_OWNERDRAW) { if (style & SBT_OWNERDRAW) {
part->text = (LPWSTR)text; part->text = (LPWSTR)text;
} }
else { else {
/* duplicate string */ /* duplicate string */
if (part->text)
COMCTL32_Free (part->text);
part->text = 0;
if (text && (len = lstrlenA(text))) { if (text && (len = lstrlenA(text))) {
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpyAtoW (part->text, text); lstrcpyAtoW (part->text, text);
} }
} }
part->style = style;
hdc = GetDC (hwnd); hdc = GetDC (hwnd);
STATUSBAR_RefreshPart (hwnd, part, hdc); STATUSBAR_RefreshPart (hwnd, part, hdc);
@ -688,20 +690,22 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
else else
part = &self->parts[part_num]; part = &self->parts[part_num];
if (!part) return FALSE; if (!part) return FALSE;
part->style = style;
if (!(part->style & SBT_OWNERDRAW) && part->text)
COMCTL32_Free (part->text);
part->text = 0;
if (style & SBT_OWNERDRAW) { if (style & SBT_OWNERDRAW) {
part->text = text; part->text = text;
} }
else { else {
/* duplicate string */ /* duplicate string */
if (part->text)
COMCTL32_Free (part->text);
part->text = 0;
if (text && (len = lstrlenW(text))) { if (text && (len = lstrlenW(text))) {
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR)); part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
lstrcpyW(part->text, text); lstrcpyW(part->text, text);
} }
} }
part->style = style;
hdc = GetDC (hwnd); hdc = GetDC (hwnd);
STATUSBAR_RefreshPart (hwnd, part, hdc); STATUSBAR_RefreshPart (hwnd, part, hdc);