Commit 4899a500 authored by Felix Nawothnig's avatar Felix Nawothnig Committed by Alexandre Julliard

Implemented WM_ENABLE.

parent 70fe39e4
......@@ -62,6 +62,7 @@ typedef struct
{
HWND Self;
HWND Notify;
BOOL Enabled;
IPPART_INFO Part[4];
} IPADDRESS_INFO;
......@@ -127,13 +128,27 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
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);
pt.x = rcPart.right;
......@@ -174,6 +189,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
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_Destroy (IPADDRESS_INFO *infoPtr)
}
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 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
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);
......
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