Implemented WM_ENABLE.

This commit is contained in:
Felix Nawothnig 2005-05-09 09:24:05 +00:00 committed by Alexandre Julliard
parent 70fe39e42c
commit 4899a50056
1 changed files with 34 additions and 0 deletions

View File

@ -62,6 +62,7 @@ typedef struct
{
HWND Self;
HWND Notify;
BOOL Enabled;
IPPART_INFO Part[4];
} IPADDRESS_INFO;
@ -127,12 +128,26 @@ 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);
@ -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);