Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/dlls/comctl32/ipaddress.c
8649 views
1
/*
2
* IP Address control
3
*
4
* Copyright 2002 Dimitrie O. Paun
5
* Copyright 1999 Chris Morgan<[email protected]>
6
* Copyright 1999 James Abbatiello<[email protected]>
7
* Copyright 1998, 1999 Eric Kohl
8
* Copyright 1998 Alex Priem <[email protected]>
9
*
10
* This library is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU Lesser General Public
12
* License as published by the Free Software Foundation; either
13
* version 2.1 of the License, or (at your option) any later version.
14
*
15
* This library is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
* Lesser General Public License for more details.
19
*
20
* You should have received a copy of the GNU Lesser General Public
21
* License along with this library; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23
*/
24
25
#include <ctype.h>
26
#include <stdlib.h>
27
#include <stdarg.h>
28
#include <stdio.h>
29
#include <string.h>
30
31
#include "windef.h"
32
#include "winbase.h"
33
#include "wingdi.h"
34
#include "winuser.h"
35
#include "winnls.h"
36
#include "commctrl.h"
37
#include "comctl32.h"
38
#include "wine/debug.h"
39
40
WINE_DEFAULT_DEBUG_CHANNEL(ipaddress);
41
42
typedef struct
43
{
44
HWND EditHwnd;
45
INT LowerLimit;
46
INT UpperLimit;
47
WNDPROC OrigProc;
48
} IPPART_INFO;
49
50
typedef struct
51
{
52
HWND Self;
53
HWND Notify;
54
BOOL Enabled;
55
HFONT hFont;
56
IPPART_INFO Part[4];
57
} IPADDRESS_INFO;
58
59
static const WCHAR IP_SUBCLASS_PROP[] = L"CCIP32SubclassInfo";
60
61
#define POS_DEFAULT 0
62
#define POS_LEFT 1
63
#define POS_RIGHT 2
64
#define POS_SELALL 3
65
66
static LRESULT CALLBACK
67
IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
68
69
static void IPADDRESS_UpdateText (const IPADDRESS_INFO *infoPtr)
70
{
71
WCHAR field[4];
72
WCHAR ip[16];
73
INT i;
74
75
ip[0] = 0;
76
77
for (i = 0; i < 4; i++) {
78
if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4))
79
lstrcatW(ip, field);
80
else
81
/* empty edit treated as zero */
82
lstrcatW(ip, L"0");
83
if (i != 3)
84
lstrcatW(ip, L".");
85
}
86
87
SetWindowTextW(infoPtr->Self, ip);
88
}
89
90
static LRESULT IPADDRESS_Notify (const IPADDRESS_INFO *infoPtr, UINT command)
91
{
92
HWND hwnd = infoPtr->Self;
93
94
TRACE("(command=%x)\n", command);
95
96
return SendMessageW (infoPtr->Notify, WM_COMMAND,
97
MAKEWPARAM (GetWindowLongPtrW (hwnd, GWLP_ID), command), (LPARAM)hwnd);
98
}
99
100
static INT IPADDRESS_IPNotify (const IPADDRESS_INFO *infoPtr, INT field, INT value)
101
{
102
NMIPADDRESS nmip;
103
104
TRACE("(field=%x, value=%d)\n", field, value);
105
106
nmip.hdr.hwndFrom = infoPtr->Self;
107
nmip.hdr.idFrom = GetWindowLongPtrW (infoPtr->Self, GWLP_ID);
108
nmip.hdr.code = IPN_FIELDCHANGED;
109
110
nmip.iField = field;
111
nmip.iValue = value;
112
113
SendMessageW (infoPtr->Notify, WM_NOTIFY, nmip.hdr.idFrom, (LPARAM)&nmip);
114
115
TRACE("<-- %d\n", nmip.iValue);
116
117
return nmip.iValue;
118
}
119
120
121
static int IPADDRESS_GetPartIndex(const IPADDRESS_INFO *infoPtr, HWND hwnd)
122
{
123
int i;
124
125
TRACE("(hwnd=%p)\n", hwnd);
126
127
for (i = 0; i < 4; i++)
128
if (infoPtr->Part[i].EditHwnd == hwnd) return i;
129
130
return -1;
131
}
132
133
#if __WINE_COMCTL32_VERSION == 6
134
static int IPADDRESS_GetThemeTextState (const IPADDRESS_INFO *infoPtr)
135
{
136
if (!infoPtr->Enabled)
137
return ETS_DISABLED;
138
else if (GetWindowLongW(infoPtr->Self, GWL_STYLE) & ES_READONLY)
139
return ETS_READONLY;
140
else if (GetFocus() == infoPtr->Self)
141
return ETS_FOCUSED;
142
else
143
return ETS_NORMAL;
144
}
145
#endif
146
147
static void IPADDRESS_GetTextColors (const IPADDRESS_INFO *infoPtr, COLORREF *background_color,
148
COLORREF *foreground_color)
149
{
150
if (infoPtr->Enabled)
151
{
152
*background_color = comctl32_color.clrWindow;
153
*foreground_color = comctl32_color.clrWindowText;
154
}
155
else
156
{
157
*background_color = comctl32_color.clr3dFace;
158
*foreground_color = comctl32_color.clrGrayText;
159
}
160
}
161
162
static void IPADDRESS_DrawBackground (const IPADDRESS_INFO *infoPtr, HDC hdc, RECT *rect)
163
{
164
COLORREF background_color, foreground_color;
165
#if __WINE_COMCTL32_VERSION == 6
166
HTHEME theme = GetWindowTheme(infoPtr->Self);
167
168
if (theme)
169
{
170
int state = IPADDRESS_GetThemeTextState(infoPtr);
171
if (IsThemeBackgroundPartiallyTransparent(theme, EP_EDITTEXT, state))
172
DrawThemeParentBackground(infoPtr->Self, hdc, rect);
173
DrawThemeBackground(theme, hdc, EP_EDITTEXT, state, rect, 0);
174
return;
175
}
176
#endif
177
178
IPADDRESS_GetTextColors(infoPtr, &background_color, &foreground_color);
179
FillRect(hdc, rect, (HBRUSH)(DWORD_PTR)(background_color + 1));
180
DrawEdge(hdc, rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
181
}
182
183
static void IPADDRESS_DrawDot (const IPADDRESS_INFO *infoPtr, HDC hdc, RECT *rect)
184
{
185
#if __WINE_COMCTL32_VERSION == 6
186
HTHEME theme = GetWindowTheme(infoPtr->Self);
187
188
if (theme)
189
{
190
int state = IPADDRESS_GetThemeTextState(infoPtr);
191
DrawThemeText(theme, hdc, EP_EDITTEXT, state, L".", 1, DT_SINGLELINE | DT_CENTER | DT_BOTTOM, 0, rect);
192
return;
193
}
194
#endif
195
196
DrawTextW(hdc, L".", 1, rect, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);
197
}
198
199
static LRESULT IPADDRESS_Draw (const IPADDRESS_INFO *infoPtr, HDC hdc)
200
{
201
RECT rect, rcPart;
202
COLORREF bgCol, fgCol;
203
int i;
204
205
TRACE("\n");
206
207
GetClientRect (infoPtr->Self, &rect);
208
IPADDRESS_DrawBackground(infoPtr, hdc, &rect);
209
210
IPADDRESS_GetTextColors(infoPtr, &bgCol, &fgCol);
211
SetBkColor (hdc, bgCol);
212
SetTextColor(hdc, fgCol);
213
214
for (i = 0; i < 3; i++) {
215
GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart);
216
MapWindowPoints( 0, infoPtr->Self, (POINT *)&rcPart, 2 );
217
rect.left = rcPart.right;
218
GetWindowRect (infoPtr->Part[i+1].EditHwnd, &rcPart);
219
MapWindowPoints( 0, infoPtr->Self, (POINT *)&rcPart, 2 );
220
rect.right = rcPart.left;
221
222
IPADDRESS_DrawDot(infoPtr, hdc, &rect);
223
}
224
225
return 0;
226
}
227
228
229
static LRESULT IPADDRESS_Create (HWND hwnd, const CREATESTRUCTA *lpCreate)
230
{
231
IPADDRESS_INFO *infoPtr;
232
RECT rcClient, edit;
233
int i, fieldsize;
234
HFONT hFont, hSysFont;
235
LOGFONTW logFont, logSysFont;
236
237
TRACE("\n");
238
239
SetWindowLongW (hwnd, GWL_STYLE,
240
GetWindowLongW(hwnd, GWL_STYLE) & ~WS_BORDER);
241
242
infoPtr = Alloc (sizeof(*infoPtr));
243
if (!infoPtr) return -1;
244
SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
245
246
GetClientRect (hwnd, &rcClient);
247
248
fieldsize = (rcClient.right - rcClient.left) / 4;
249
250
edit.top = rcClient.top + 2;
251
edit.bottom = rcClient.bottom - 2;
252
253
infoPtr->Self = hwnd;
254
infoPtr->Enabled = TRUE;
255
infoPtr->Notify = lpCreate->hwndParent;
256
257
hSysFont = GetStockObject(ANSI_VAR_FONT);
258
GetObjectW(hSysFont, sizeof(LOGFONTW), &logSysFont);
259
SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
260
lstrcpyW(logFont.lfFaceName, logSysFont.lfFaceName);
261
hFont = CreateFontIndirectW(&logFont);
262
263
for (i = 0; i < 4; i++) {
264
IPPART_INFO* part = &infoPtr->Part[i];
265
266
part->LowerLimit = 0;
267
part->UpperLimit = 255;
268
edit.left = rcClient.left + i*fieldsize + 6;
269
edit.right = rcClient.left + (i+1)*fieldsize - 2;
270
part->EditHwnd =
271
CreateWindowW (WC_EDITW, NULL, WS_CHILD | WS_VISIBLE | ES_CENTER,
272
edit.left, edit.top, edit.right - edit.left,
273
edit.bottom - edit.top, hwnd, (HMENU) 1,
274
(HINSTANCE)GetWindowLongPtrW(hwnd, GWLP_HINSTANCE), NULL);
275
SendMessageW(part->EditHwnd, WM_SETFONT, (WPARAM) hFont, FALSE);
276
SetPropW(part->EditHwnd, IP_SUBCLASS_PROP, hwnd);
277
part->OrigProc = (WNDPROC)
278
SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC,
279
(DWORD_PTR)IPADDRESS_SubclassProc);
280
EnableWindow(part->EditHwnd, infoPtr->Enabled);
281
}
282
283
IPADDRESS_UpdateText (infoPtr);
284
COMCTL32_OpenThemeForWindow (infoPtr->Self, WC_EDITW);
285
286
return 0;
287
}
288
289
290
static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr)
291
{
292
int i;
293
294
TRACE("\n");
295
296
for (i = 0; i < 4; i++) {
297
IPPART_INFO* part = &infoPtr->Part[i];
298
SetWindowLongPtrW (part->EditHwnd, GWLP_WNDPROC, (DWORD_PTR)part->OrigProc);
299
}
300
301
if (infoPtr->hFont)
302
DeleteObject (infoPtr->hFont);
303
SetWindowLongPtrW (infoPtr->Self, 0, 0);
304
COMCTL32_CloseThemeForWindow (infoPtr->Self);
305
Free (infoPtr);
306
return 0;
307
}
308
309
310
static LRESULT IPADDRESS_Enable (IPADDRESS_INFO *infoPtr, BOOL enabled)
311
{
312
int i;
313
314
infoPtr->Enabled = enabled;
315
316
for (i = 0; i < 4; i++)
317
EnableWindow(infoPtr->Part[i].EditHwnd, enabled);
318
319
InvalidateRgn(infoPtr->Self, NULL, FALSE);
320
return 0;
321
}
322
323
324
static LRESULT IPADDRESS_Paint (const IPADDRESS_INFO *infoPtr, HDC hdc)
325
{
326
PAINTSTRUCT ps;
327
328
TRACE("\n");
329
330
if (hdc) return IPADDRESS_Draw (infoPtr, hdc);
331
332
hdc = BeginPaint (infoPtr->Self, &ps);
333
IPADDRESS_Draw (infoPtr, hdc);
334
EndPaint (infoPtr->Self, &ps);
335
return 0;
336
}
337
338
339
static BOOL IPADDRESS_IsBlank (const IPADDRESS_INFO *infoPtr)
340
{
341
int i;
342
343
TRACE("\n");
344
345
for (i = 0; i < 4; i++)
346
if (GetWindowTextLengthW (infoPtr->Part[i].EditHwnd)) return FALSE;
347
348
return TRUE;
349
}
350
351
352
static int IPADDRESS_GetAddress (const IPADDRESS_INFO *infoPtr, LPDWORD ip_address)
353
{
354
WCHAR field[5];
355
int i, invalid = 0;
356
DWORD ip_addr = 0;
357
358
TRACE("\n");
359
360
for (i = 0; i < 4; i++) {
361
ip_addr *= 256;
362
if (GetWindowTextW (infoPtr->Part[i].EditHwnd, field, 4))
363
ip_addr += wcstol(field, NULL, 10);
364
else
365
invalid++;
366
}
367
*ip_address = ip_addr;
368
369
return 4 - invalid;
370
}
371
372
373
static BOOL IPADDRESS_SetRange (IPADDRESS_INFO *infoPtr, int index, WORD range)
374
{
375
TRACE("\n");
376
377
if ( (index < 0) || (index > 3) ) return FALSE;
378
379
infoPtr->Part[index].LowerLimit = range & 0xFF;
380
infoPtr->Part[index].UpperLimit = (range >> 8) & 0xFF;
381
382
return TRUE;
383
}
384
385
386
static LRESULT IPADDRESS_ClearAddress (const IPADDRESS_INFO *infoPtr)
387
{
388
int i;
389
390
TRACE("\n");
391
392
for (i = 0; i < 4; i++)
393
SetWindowTextW (infoPtr->Part[i].EditHwnd, L"");
394
395
return 1;
396
}
397
398
399
static LRESULT IPADDRESS_SetAddress (const IPADDRESS_INFO *infoPtr, DWORD ip_address)
400
{
401
WCHAR buf[20];
402
int i;
403
404
TRACE("\n");
405
406
for (i = 3; i >= 0; i--) {
407
const IPPART_INFO* part = &infoPtr->Part[i];
408
int value = ip_address & 0xff;
409
if ( (value >= part->LowerLimit) && (value <= part->UpperLimit) ) {
410
wsprintfW (buf, L"%d", value);
411
SetWindowTextW (part->EditHwnd, buf);
412
IPADDRESS_Notify (infoPtr, EN_CHANGE);
413
}
414
ip_address >>= 8;
415
}
416
417
return TRUE;
418
}
419
420
421
static LRESULT IPADDRESS_SetFocusToField (const IPADDRESS_INFO *infoPtr, INT index)
422
{
423
TRACE("%d\n", index);
424
425
if (index > 3 || index < 0) index=0;
426
427
SendMessageW (infoPtr->Part[index].EditHwnd, EM_SETSEL, 0, -1);
428
SetFocus (infoPtr->Part[index].EditHwnd);
429
430
return 1;
431
}
432
433
434
static BOOL IPADDRESS_ConstrainField (const IPADDRESS_INFO *infoPtr, int currentfield)
435
{
436
const IPPART_INFO *part;
437
int curValue, newValue;
438
WCHAR field[10];
439
440
TRACE("(currentfield=%d)\n", currentfield);
441
442
if (currentfield < 0 || currentfield > 3) return FALSE;
443
444
part = &infoPtr->Part[currentfield];
445
if (!GetWindowTextW (part->EditHwnd, field, 4)) return FALSE;
446
447
curValue = wcstol(field, NULL, 10);
448
TRACE(" curValue=%d\n", curValue);
449
450
newValue = IPADDRESS_IPNotify(infoPtr, currentfield, curValue);
451
TRACE(" newValue=%d\n", newValue);
452
453
if (newValue < part->LowerLimit) newValue = part->LowerLimit;
454
if (newValue > part->UpperLimit) newValue = part->UpperLimit;
455
456
if (newValue == curValue) return FALSE;
457
458
wsprintfW (field, L"%d", newValue);
459
TRACE(" field=%s\n", debugstr_w(field));
460
return SetWindowTextW (part->EditHwnd, field);
461
}
462
463
464
static BOOL IPADDRESS_GotoNextField (const IPADDRESS_INFO *infoPtr, int cur, int sel)
465
{
466
TRACE("\n");
467
468
if(cur >= -1 && cur < 4) {
469
IPADDRESS_ConstrainField(infoPtr, cur);
470
471
if(cur < 3) {
472
const IPPART_INFO *next = &infoPtr->Part[cur + 1];
473
int start = 0, end = 0;
474
SetFocus (next->EditHwnd);
475
if (sel != POS_DEFAULT) {
476
if (sel == POS_RIGHT)
477
start = end = GetWindowTextLengthW(next->EditHwnd);
478
else if (sel == POS_SELALL)
479
end = -1;
480
SendMessageW(next->EditHwnd, EM_SETSEL, start, end);
481
}
482
return TRUE;
483
}
484
485
}
486
return FALSE;
487
}
488
489
/*
490
* period: move and select the text in the next field to the right if
491
* the current field is not empty(l!=0), we are not in the
492
* left most position, and nothing is selected(startsel==endsel)
493
*
494
* spacebar: same behavior as period
495
*
496
* alpha characters: completely ignored
497
*
498
* digits: accepted when field text length < 2 ignored otherwise.
499
* when 3 numbers have been entered into the field the value
500
* of the field is checked, if the field value exceeds the
501
* maximum value and is changed the field remains the current
502
* field, otherwise focus moves to the field to the right
503
*
504
* tab: change focus from the current ipaddress control to the next
505
* control in the tab order
506
*
507
* right arrow: move to the field on the right to the left most
508
* position in that field if no text is selected,
509
* we are in the right most position in the field,
510
* we are not in the right most field
511
*
512
* left arrow: move to the field on the left to the right most
513
* position in that field if no text is selected,
514
* we are in the left most position in the current field
515
* and we are not in the left most field
516
*
517
* backspace: delete the character to the left of the cursor position,
518
* if none are present move to the field on the left if
519
* we are not in the left most field and delete the right
520
* most digit in that field while keeping the cursor
521
* on the right side of the field
522
*/
523
LRESULT CALLBACK
524
IPADDRESS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
525
{
526
HWND Self = GetPropW (hwnd, IP_SUBCLASS_PROP);
527
IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (Self, 0);
528
CHAR c = (CHAR)wParam;
529
INT index, len = 0, startsel, endsel;
530
IPPART_INFO *part;
531
532
TRACE("hwnd %p, msg 0x%x, wparam %#Ix, lparam %#Ix\n", hwnd, uMsg, wParam, lParam);
533
534
if ((index = IPADDRESS_GetPartIndex(infoPtr, hwnd)) < 0)
535
{
536
ERR("We subclassed the wrong window! (hwnd=%p)\n", hwnd);
537
return 0;
538
}
539
part = &infoPtr->Part[index];
540
541
if (uMsg == WM_CHAR || uMsg == WM_KEYDOWN) {
542
len = GetWindowTextLengthW (hwnd);
543
SendMessageW(hwnd, EM_GETSEL, (WPARAM)&startsel, (LPARAM)&endsel);
544
}
545
switch (uMsg) {
546
case WM_CHAR:
547
if(isdigit(c)) {
548
if(len == 2 && startsel==endsel && endsel==len) {
549
/* process the digit press before we check the field */
550
LRESULT return_val = CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam);
551
552
/* if the field value was changed stay at the current field */
553
if(!IPADDRESS_ConstrainField(infoPtr, index))
554
IPADDRESS_GotoNextField (infoPtr, index, POS_DEFAULT);
555
556
return return_val;
557
} else if (len == 3 && startsel==endsel && endsel==len)
558
IPADDRESS_GotoNextField (infoPtr, index, POS_SELALL);
559
else if (len < 3 || startsel != endsel) break;
560
} else if(c == '.' || c == ' ') {
561
if(len && startsel==endsel && startsel != 0) {
562
IPADDRESS_GotoNextField(infoPtr, index, POS_SELALL);
563
}
564
} else if (c == VK_BACK) break;
565
return 0;
566
567
case WM_KEYDOWN:
568
switch(c) {
569
case VK_RIGHT:
570
if(startsel==endsel && startsel==len) {
571
IPADDRESS_GotoNextField(infoPtr, index, POS_LEFT);
572
return 0;
573
}
574
break;
575
case VK_LEFT:
576
if(startsel==0 && startsel==endsel && index > 0) {
577
IPADDRESS_GotoNextField(infoPtr, index - 2, POS_RIGHT);
578
return 0;
579
}
580
break;
581
case VK_BACK:
582
if(startsel==endsel && startsel==0 && index > 0) {
583
IPPART_INFO *prev = &infoPtr->Part[index-1];
584
WCHAR val[10];
585
586
if(GetWindowTextW(prev->EditHwnd, val, 5)) {
587
val[lstrlenW(val) - 1] = 0;
588
SetWindowTextW(prev->EditHwnd, val);
589
}
590
591
IPADDRESS_GotoNextField(infoPtr, index - 2, POS_RIGHT);
592
return 0;
593
}
594
break;
595
}
596
break;
597
case WM_KILLFOCUS:
598
if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0)
599
IPADDRESS_Notify(infoPtr, EN_KILLFOCUS);
600
break;
601
case WM_SETFOCUS:
602
if (IPADDRESS_GetPartIndex(infoPtr, (HWND)wParam) < 0)
603
IPADDRESS_Notify(infoPtr, EN_SETFOCUS);
604
break;
605
}
606
return CallWindowProcW (part->OrigProc, hwnd, uMsg, wParam, lParam);
607
}
608
609
610
static LRESULT WINAPI
611
IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
612
{
613
IPADDRESS_INFO *infoPtr = (IPADDRESS_INFO *)GetWindowLongPtrW (hwnd, 0);
614
615
TRACE("hwnd %p, msg 0x%x, wparam %#Ix, lparam %#Ix\n", hwnd, uMsg, wParam, lParam);
616
617
if (!infoPtr && (uMsg != WM_CREATE))
618
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
619
620
switch (uMsg)
621
{
622
case WM_CREATE:
623
return IPADDRESS_Create (hwnd, (LPCREATESTRUCTA)lParam);
624
625
case WM_DESTROY:
626
return IPADDRESS_Destroy (infoPtr);
627
628
case WM_ENABLE:
629
return IPADDRESS_Enable (infoPtr, (BOOL)wParam);
630
631
case WM_PAINT:
632
return IPADDRESS_Paint (infoPtr, (HDC)wParam);
633
634
case WM_COMMAND:
635
switch(wParam >> 16) {
636
case EN_CHANGE:
637
IPADDRESS_UpdateText(infoPtr);
638
IPADDRESS_Notify(infoPtr, EN_CHANGE);
639
break;
640
case EN_KILLFOCUS:
641
IPADDRESS_ConstrainField(infoPtr, IPADDRESS_GetPartIndex(infoPtr, (HWND)lParam));
642
break;
643
}
644
break;
645
646
case WM_SYSCOLORCHANGE:
647
COMCTL32_RefreshSysColors();
648
return 0;
649
650
case WM_THEMECHANGED:
651
return COMCTL32_ThemeChanged (infoPtr->Self, WC_EDITW, TRUE, TRUE);
652
653
case IPM_CLEARADDRESS:
654
return IPADDRESS_ClearAddress (infoPtr);
655
656
case IPM_SETADDRESS:
657
return IPADDRESS_SetAddress (infoPtr, (DWORD)lParam);
658
659
case IPM_GETADDRESS:
660
return IPADDRESS_GetAddress (infoPtr, (LPDWORD)lParam);
661
662
case IPM_SETRANGE:
663
return IPADDRESS_SetRange (infoPtr, (int)wParam, (WORD)lParam);
664
665
case IPM_SETFOCUS:
666
return IPADDRESS_SetFocusToField (infoPtr, (int)wParam);
667
668
case IPM_ISBLANK:
669
return IPADDRESS_IsBlank (infoPtr);
670
671
case WM_SETFOCUS:
672
IPADDRESS_SetFocusToField (infoPtr, 0);
673
break;
674
675
case WM_SETFONT:
676
infoPtr->hFont = (HFONT)wParam;
677
return 0;
678
679
default:
680
if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
681
ERR("unknown msg %04x, wp %Ix, lp %Ix\n", uMsg, wParam, lParam);
682
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
683
}
684
return 0;
685
}
686
687
688
void IPADDRESS_Register (void)
689
{
690
WNDCLASSW wndClass;
691
692
ZeroMemory (&wndClass, sizeof(WNDCLASSW));
693
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
694
wndClass.lpfnWndProc = IPADDRESS_WindowProc;
695
wndClass.cbClsExtra = 0;
696
wndClass.cbWndExtra = sizeof(IPADDRESS_INFO *);
697
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_IBEAM);
698
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
699
wndClass.lpszClassName = WC_IPADDRESSW;
700
701
RegisterClassW (&wndClass);
702
}
703
704