[comctl32] ipaddress.c: WM_ENABLE

Felix Nawothnig felix.nawothnig at t-online.de
Sun May 8 01:19:38 CDT 2005


Fixes bug 2779. (at least the "Color doesn't change when control  
disabled.")

ChangeLog:
- Implemented WM_ENABLE
-------------- next part --------------
Index: ipaddress.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/ipaddress.c,v
retrieving revision 1.40
diff -u -r1.40 ipaddress.c
--- ipaddress.c	27 Oct 2004 21:15:53 -0000	1.40
+++ ipaddress.c	8 May 2005 06:13:09 -0000
@@ -62,6 +62,7 @@
 {
     HWND	Self;
     HWND	Notify;
+    BOOL	Enabled;
     IPPART_INFO	Part[4];
 } IPADDRESS_INFO;
 
@@ -127,12 +128,26 @@
     static const WCHAR dotW[] = { '.', 0 };
     RECT rect, rcPart;
     POINT pt;
+    COLORREF bgCol, fgCol;
     int i;
 
     TRACE("\n");
 
     GetClientRect (infoPtr->Self, &rect);
+
+    if (infoPtr->Enabled) {
+        bgCol = COLOR_WINDOW;
+        fgCol = COLOR_WINDOWTEXT;
+    } else {
+        bgCol = COLOR_3DFACE;
+        fgCol = COLOR_GRAYTEXT;
+    }
+    
+    FillRect (hdc, &rect, (HBRUSH) (bgCol+1));
     DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
+    
+    SetBkColor  (hdc, GetSysColor(bgCol));
+    SetTextColor(hdc, GetSysColor(fgCol));
 
     for (i = 0; i < 3; i++) {
         GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart);
@@ -174,6 +189,7 @@
     edit.bottom = rcClient.bottom - 2;
 
     infoPtr->Self = hwnd;
+    infoPtr->Enabled = FALSE;
     infoPtr->Notify = lpCreate->hwndParent;
 
     for (i = 0; i < 4; i++) {
@@ -215,6 +231,20 @@
 }
 
 
+static LRESULT IPADDRESS_Enable (IPADDRESS_INFO *infoPtr, BOOL enabled)
+{
+    int i;
+
+    infoPtr->Enabled = enabled;
+
+    for (i = 0; i < 4; i++)
+        EnableWindow(infoPtr->Part[i].EditHwnd, enabled);
+
+    InvalidateRgn(infoPtr->Self, NULL, FALSE);
+    return 0;
+}
+
+
 static LRESULT IPADDRESS_Paint (IPADDRESS_INFO *infoPtr, HDC hdc)
 {
     PAINTSTRUCT ps;
@@ -517,6 +547,10 @@
 	case WM_DESTROY:
 	    return IPADDRESS_Destroy (infoPtr);
 
+	case WM_ENABLE:
+	    return IPADDRESS_Enable (infoPtr, (BOOL)wParam);
+	    break;
+
 	case WM_PAINT:
 	    return IPADDRESS_Paint (infoPtr, (HDC)wParam);
 


More information about the wine-patches mailing list