Changed RedrawWindow()'s to InvalidateRect()'s. RedrawWindow() was
being called with RDW_UPDATENOW, forcing immediate painting. Added redrawing logic to STATUSBAR_SetTextW().
This commit is contained in:
parent
36c8db8c7d
commit
a45919338d
|
@ -845,7 +845,7 @@ DATETIME_LButtonUp (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
if(infoPtr->bCalDepressed == TRUE) {
|
||||
infoPtr->bCalDepressed = FALSE;
|
||||
RedrawWindow(hwnd, &(infoPtr->calbutton), 0, RDW_ERASE|RDW_INVALIDATE);
|
||||
InvalidateRect(hwnd, &(infoPtr->calbutton), TRUE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1324,15 +1324,13 @@ MONTHCAL_LButtonDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
MONTHCAL_CopyTime(&ht.st, &selArray[1]);
|
||||
MONTHCAL_SetSelRange(hwnd,0,(LPARAM) &selArray);
|
||||
|
||||
/* FIXME: for some reason if RedrawWindow has a NULL instead of zero it gives */
|
||||
/* a compiler warning */
|
||||
/* redraw both old and new days if the selected day changed */
|
||||
if(infoPtr->curSelDay != ht.st.wDay) {
|
||||
MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &rcDay);
|
||||
RedrawWindow(hwnd, &rcDay, 0, RDW_ERASE|RDW_INVALIDATE);
|
||||
InvalidateRect(hwnd, &rcDay, TRUE);
|
||||
|
||||
MONTHCAL_CalcPosFromDay(infoPtr, infoPtr->curSelDay, infoPtr->currentMonth, &rcDay);
|
||||
RedrawWindow(hwnd, &rcDay, 0, RDW_ERASE|RDW_INVALIDATE);
|
||||
InvalidateRect(hwnd, &rcDay, TRUE);
|
||||
}
|
||||
|
||||
infoPtr->firstSelDay = ht.st.wDay;
|
||||
|
@ -1487,7 +1485,7 @@ done:
|
|||
|
||||
/* only redraw if the currently selected day changed */
|
||||
/* FIXME: this should specify a rectangle containing only the days that changed */
|
||||
/* using RedrawWindow */
|
||||
/* using InvalidateRect */
|
||||
if(oldselday != infoPtr->curSelDay)
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
* FIXME/TODO
|
||||
* 1) Don't hard code bar to bottom of window, allow CCS_TOP also.
|
||||
* 2) Tooltip support (almost done).
|
||||
* 3) I think RedrawWindow() is rather wrong, we should use InvalidateRect
|
||||
* probably.
|
||||
*/
|
||||
|
||||
#include "winbase.h"
|
||||
|
@ -518,7 +516,7 @@ STATUSBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
oldBkColor = self->clrBk;
|
||||
self->clrBk = (COLORREF)lParam;
|
||||
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
|
||||
return oldBkColor;
|
||||
}
|
||||
|
@ -540,16 +538,14 @@ STATUSBAR_SetIcon (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
return TRUE;
|
||||
self->part0.hIcon = (HICON)lParam;
|
||||
if (self->simple)
|
||||
RedrawWindow(hwnd, &self->part0.bound,(HRGN)NULL,
|
||||
RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, &self->part0.bound, FALSE);
|
||||
} else {
|
||||
if (self->parts[nPart].hIcon == (HICON)lParam) /* same as - no redraw */
|
||||
return TRUE;
|
||||
|
||||
self->parts[nPart].hIcon = (HICON)lParam;
|
||||
if (!(self->simple))
|
||||
RedrawWindow(hwnd,&self->parts[nPart].bound,(HRGN)NULL,
|
||||
RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, &self->parts[nPart].bound, FALSE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -652,7 +648,7 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
STATUSBAR_SetPartBounds (hwnd);
|
||||
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -710,7 +706,7 @@ STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
COMCTL32_Free (part->text);
|
||||
part->text = ntext;
|
||||
}
|
||||
RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, &part->bound, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -723,6 +719,7 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
STATUSWINDOWPART *part;
|
||||
INT part_num, style, len;
|
||||
LPWSTR text;
|
||||
BOOL bRedraw = FALSE;
|
||||
|
||||
text = (LPWSTR) lParam;
|
||||
part_num = ((INT) wParam) & 0x00ff;
|
||||
|
@ -734,23 +731,36 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
part = &self->parts[part_num];
|
||||
if (!part) return FALSE;
|
||||
|
||||
if (!(part->style & SBT_OWNERDRAW) && part->text)
|
||||
COMCTL32_Free (part->text);
|
||||
part->text = 0;
|
||||
if(part->style != style)
|
||||
bRedraw = TRUE;
|
||||
|
||||
/* FIXME: add "no need to redraw logic" */
|
||||
if (style & SBT_OWNERDRAW) {
|
||||
part->text = text;
|
||||
} else {
|
||||
/* duplicate string */
|
||||
if (text && (len = lstrlenW(text))) {
|
||||
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
|
||||
strcpyW(part->text, text);
|
||||
}
|
||||
}
|
||||
part->style = style;
|
||||
|
||||
RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
/* FIXME: not sure how/if we can check for change in string with ownerdraw(remove this if we can't)... */
|
||||
if (style & SBT_OWNERDRAW)
|
||||
{
|
||||
part->text = text;
|
||||
bRedraw = TRUE;
|
||||
} else if(!text)
|
||||
{
|
||||
if(part->text)
|
||||
{
|
||||
COMCTL32_Free(part->text);
|
||||
bRedraw = TRUE;
|
||||
}
|
||||
part->text = 0;
|
||||
} else if(!part->text || strcmpW(part->text, text)) /* see if the new string differs from the existing string */
|
||||
{
|
||||
if(part->text) COMCTL32_Free(part->text);
|
||||
|
||||
len = lstrlenW(text);
|
||||
part->text = COMCTL32_Alloc ((len+1)*sizeof(WCHAR));
|
||||
strcpyW(part->text, text);
|
||||
bRedraw = TRUE;
|
||||
}
|
||||
|
||||
if(bRedraw)
|
||||
InvalidateRect(hwnd, &part->bound, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -827,7 +837,7 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
nmhdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
|
||||
nmhdr.code = SBN_SIMPLEMODECHANGE;
|
||||
SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
|
||||
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1061,8 +1071,7 @@ STATUSBAR_WMSetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
infoPtr->hFont = (HFONT)wParam;
|
||||
if (LOWORD(lParam) == TRUE)
|
||||
RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,
|
||||
RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, NULL, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1096,7 +1105,7 @@ STATUSBAR_WMSetText (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
|
||||
RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
|
||||
InvalidateRect(hwnd, &part->bound, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue