More control patches from CW
Duane Clark
dclark at akamail.com
Sat Jan 26 20:51:20 CST 2002
Some more control patches from Codeweavers.
Modified files:
controls : static.c
controls : menu.c
controls : listbox.c
controls : scroll.c
Log message:
Codeweavers
Implemented additional StaticWndProc styles.
For some reason, CW did not like the code in SetMenuItemInfoA.
Minor listbox painting changes.
Additional ScrollBarWndProc case.
-------------- next part --------------
Index: controls/static.c
===================================================================
RCS file: /home/wine/wine/controls/static.c,v
retrieving revision 1.31
diff -u -r1.31 static.c
--- controls/static.c 2001/08/10 22:51:42 1.31
+++ controls/static.c 2002/01/27 00:36:30
@@ -177,6 +177,26 @@
}
/***********************************************************************
+ * STATIC_TryPaintFcn
+ *
+ * Try to immediately paint the control.
+ */
+static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style)
+{
+ LONG style = full_style & SS_TYPEMASK;
+ RECT rc;
+
+ GetClientRect( hwnd, &rc );
+ if (!IsRectEmpty(&rc) && IsWindowVisible(hwnd) && staticPaintFunc[style])
+ {
+ HDC hdc;
+ hdc = GetDC( hwnd );
+ (staticPaintFunc[style])( hwnd, hdc, full_style );
+ ReleaseDC( hwnd, hdc );
+ }
+}
+
+/***********************************************************************
* StaticWndProc_common
*/
static LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam,
@@ -247,7 +267,8 @@
lParam = (LPARAM)(((LPCREATESTRUCTA)lParam)->lpszName);
/* fall through */
case WM_SETTEXT:
- if (style == SS_ICON)
+ switch (style) {
+ case SS_ICON:
{
HICON hIcon;
if(unicode)
@@ -256,8 +277,9 @@
hIcon = STATIC_LoadIconA(hwnd, (LPCSTR)lParam);
/* FIXME : should we also return the previous hIcon here ??? */
STATIC_SetIcon(hwnd, hIcon, style);
+ break;
}
- else if (style == SS_BITMAP)
+ case SS_BITMAP:
{
HBITMAP hBitmap;
if(unicode)
@@ -265,23 +287,56 @@
else
hBitmap = STATIC_LoadBitmapA(hwnd, (LPCSTR)lParam);
STATIC_SetBitmap(hwnd, hBitmap, style);
+ break;
}
- else if (HIWORD(lParam))
- {
- if(unicode)
- lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
- else
- lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
+ case SS_LEFT:
+ case SS_CENTER:
+ case SS_RIGHT:
+ case SS_SIMPLE:
+ case SS_LEFTNOWORDWRAP:
+ {
+ if (HIWORD(lParam))
+ {
+ if(unicode)
+ lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
+ else
+ lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
+ }
+ if (uMsg == WM_SETTEXT)
+ STATIC_TryPaintFcn( hwnd, full_style );
+ break;
+ }
+ default:
+ if (HIWORD(lParam))
+ {
+ if(unicode)
+ lResult = DefWindowProcW( hwnd, WM_SETTEXT, wParam, lParam );
+ else
+ lResult = DefWindowProcA( hwnd, WM_SETTEXT, wParam, lParam );
+ }
+ if(uMsg == WM_SETTEXT)
+ InvalidateRect(hwnd, NULL, FALSE);
}
- if(uMsg == WM_SETTEXT)
- InvalidateRect(hwnd, NULL, FALSE);
return 1; /* success. FIXME: check text length */
case WM_SETFONT:
if ((style == SS_ICON) || (style == SS_BITMAP)) return 0;
SetWindowLongA( hwnd, HFONT_GWL_OFFSET, wParam );
- if (LOWORD(lParam))
- InvalidateRect( hwnd, NULL, FALSE );
+ switch (style) {
+ case SS_LEFT:
+ case SS_CENTER:
+ case SS_RIGHT:
+ case SS_SIMPLE:
+ case SS_LEFTNOWORDWRAP:
+ {
+ if (uMsg == WM_SETTEXT)
+ STATIC_TryPaintFcn( hwnd, full_style );
+ break;
+ }
+ default:
+ if (LOWORD(lParam))
+ InvalidateRect( hwnd, NULL, FALSE );
+ }
break;
case WM_GETFONT:
Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.135
diff -u -r1.135 menu.c
--- controls/menu.c 2002/01/03 02:35:23 1.135
+++ controls/menu.c 2002/01/27 00:36:37
@@ -4426,6 +4426,7 @@
BOOL WINAPI SetMenuItemInfoA(HMENU hmenu, UINT item, BOOL bypos,
const MENUITEMINFOA *lpmii)
{
+#if 0
if ((lpmii->fType & (MF_HILITE|MF_POPUP)) || (lpmii->fState)) {
/* QuickTime does pass invalid data into SetMenuItemInfo.
* do some of the checks Windows does.
@@ -4434,7 +4435,7 @@
lpmii->fType,lpmii->fState );
return FALSE;
}
-
+#endif
return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos? MF_BYPOSITION : 0),
(const MENUITEMINFOW *)lpmii, FALSE);
}
Index: controls/listbox.c
===================================================================
RCS file: /home/wine/wine/controls/listbox.c,v
retrieving revision 1.79
diff -u -r1.79 listbox.c
--- controls/listbox.c 2001/09/07 18:38:57 1.79
+++ controls/listbox.c 2002/01/27 00:36:40
@@ -1136,7 +1136,7 @@
* LISTBOX_SetItemHeight
*/
static LRESULT LISTBOX_SetItemHeight( HWND hwnd, LB_DESCR *descr, INT index,
- INT height )
+ INT height, BOOL repaint )
{
if (!height) height = 1;
@@ -1146,7 +1146,8 @@
TRACE("[%04x]: item %d height = %d\n", hwnd, index, height );
descr->items[index].height = height;
LISTBOX_UpdateScroll( hwnd, descr );
- LISTBOX_InvalidateItems( hwnd, descr, index );
+ if (repaint)
+ LISTBOX_InvalidateItems( hwnd, descr, index );
}
else if (height != descr->item_height)
{
@@ -1154,7 +1155,8 @@
descr->item_height = height;
LISTBOX_UpdatePage( hwnd, descr );
LISTBOX_UpdateScroll( hwnd, descr );
- InvalidateRect( hwnd, 0, TRUE );
+ if (repaint)
+ InvalidateRect( hwnd, 0, TRUE );
}
return LB_OKAY;
}
@@ -1238,7 +1240,7 @@
if (oldFont) SelectObject( hdc, oldFont );
ReleaseDC( hwnd, hdc );
if (!IS_OWNERDRAW(descr))
- LISTBOX_SetItemHeight( hwnd, descr, 0, tm.tmHeight );
+ LISTBOX_SetItemHeight( hwnd, descr, 0, tm.tmHeight, FALSE );
return tm.tmHeight ;
}
@@ -2620,7 +2622,7 @@
lParam = LOWORD(lParam);
/* fall through */
case LB_SETITEMHEIGHT:
- return LISTBOX_SetItemHeight( hwnd, descr, wParam, lParam );
+ return LISTBOX_SetItemHeight( hwnd, descr, wParam, lParam, TRUE );
case LB_ITEMFROMPOINT:
{
Index: controls/scroll.c
===================================================================
RCS file: /home/wine/wine/controls/scroll.c,v
retrieving revision 1.49
diff -u -r1.49 scroll.c
--- controls/scroll.c 2001/10/22 19:08:33 1.49
+++ controls/scroll.c 2002/01/27 00:36:43
@@ -1172,7 +1178,16 @@
{
case WM_CREATE:
{
+ SCROLLBAR_INFO *infoPtr;
CREATESTRUCTW *lpCreat = (CREATESTRUCTW *)lParam;
+
+ if (!(infoPtr = SCROLL_GetScrollInfo( hwnd, SB_CTL ))) return -1;
+ if (lpCreat->style & WS_DISABLED)
+ {
+ TRACE("Created WS_DISABLED scrollbar\n");
+ infoPtr->flags = ESB_DISABLE_BOTH;
+ }
+
if (lpCreat->style & SBS_SIZEBOX)
{
FIXME("Unimplemented style SBS_SIZEBOX.\n" );
@@ -1204,7 +1219,18 @@
if (!hUpArrow) SCROLL_LoadBitmaps();
TRACE("ScrollBar creation, hwnd=%04x\n", hwnd );
return 0;
-
+
+ case WM_ENABLE:
+ {
+ SCROLLBAR_INFO *infoPtr;
+ if ((infoPtr = SCROLL_GetScrollInfo( hwnd, SB_CTL )))
+ {
+ infoPtr->flags = wParam ? ESB_ENABLE_BOTH : ESB_DISABLE_BOTH;
+ SCROLL_RefreshScrollBar(hwnd, SB_CTL, TRUE, TRUE);
+ }
+ }
+ return 0;
+
case WM_LBUTTONDOWN:
{
POINT pt;
More information about the wine-patches
mailing list