Commit 5b85db3d authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Fixed StatusBar SetText again, added some comments.

parent 9a68b7be
...@@ -327,6 +327,7 @@ static HICON ...@@ -327,6 +327,7 @@ static HICON
STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart) STATUSBAR_GetIcon (STATUSWINDOWINFO *infoPtr, INT nPart)
{ {
TRACE("%d\n", nPart); TRACE("%d\n", nPart);
/* MSDN says: "simple parts are indexed with -1" */
if ((nPart < -1) || (nPart >= infoPtr->numParts)) if ((nPart < -1) || (nPart >= infoPtr->numParts))
return 0; return 0;
...@@ -371,6 +372,8 @@ STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf) ...@@ -371,6 +372,8 @@ STATUSBAR_GetTextA (STATUSWINDOWINFO *infoPtr, INT nPart, LPSTR buf)
LRESULT result; LRESULT result;
TRACE("part %d\n", nPart); TRACE("part %d\n", nPart);
/* MSDN says: "simple parts use index of 0", so this check is ok. */
if (nPart < 0 || nPart >= infoPtr->numParts) return 0; if (nPart < 0 || nPart >= infoPtr->numParts) return 0;
if (infoPtr->simple) if (infoPtr->simple)
...@@ -505,6 +508,7 @@ STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon) ...@@ -505,6 +508,7 @@ STATUSBAR_SetIcon (STATUSWINDOWINFO *infoPtr, INT nPart, HICON hIcon)
TRACE("setting part %d\n", nPart); TRACE("setting part %d\n", nPart);
/* FIXME: MSDN says "if nPart is -1, the status bar is assumed simple" */
if (nPart == -1) { if (nPart == -1) {
if (infoPtr->part0.hIcon == hIcon) /* same as - no redraw */ if (infoPtr->part0.hIcon == hIcon) /* same as - no redraw */
return TRUE; return TRUE;
...@@ -625,12 +629,17 @@ STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style, ...@@ -625,12 +629,17 @@ STATUSBAR_SetTextT (STATUSWINDOWINFO *infoPtr, INT nPart, WORD style,
BOOL changed = FALSE; BOOL changed = FALSE;
TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW)); TRACE("part %d, text %s\n", nPart, debugstr_t(text, isW));
if (nPart < 0 || nPart >= infoPtr->numParts) return FALSE;
if (nPart == 0x00ff) /* MSDN says: "If the parameter is set to SB_SIMPLEID (255), the status
* window is assumed to be a simple window */
if (nPart == 0x00ff) {
part = &infoPtr->part0; part = &infoPtr->part0;
else if (!infoPtr->simple && infoPtr->parts) } else {
part = &infoPtr->parts[nPart]; if (infoPtr->parts && (nPart < 0 || nPart >= infoPtr->numParts)) {
part = &infoPtr->parts[nPart];
}
}
if (!part) return FALSE; if (!part) return FALSE;
if (part->style != style) if (part->style != style)
......
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