Fixes for FreeBSD.
[wine] / dlls / comctl32 / ipaddress.c
1 /*
2  * IP Address control
3  *
4  * Copyright 1998 Eric Kohl
5  *
6  * NOTES
7  *   This is just a dummy control. An author is needed! Any volunteers?
8  *   I will only improve this control once in a while.
9  *     Eric <ekohl@abo.rhein-zeitung.de>
10  *
11  * TODO:
12  *   - All messages.
13  *   - All notifications.
14  *
15  */
16
17 #include "windows.h"
18 #include "commctrl.h"
19 #include "ipaddress.h"
20 #include "win.h"
21 #include "debug.h"
22
23
24 #define IPADDRESS_GetInfoPtr(wndPtr) ((IPADDRESS_INFO *)wndPtr->wExtra[0])
25
26
27
28
29
30
31 static LRESULT
32 IPADDRESS_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
33 {
34     IPADDRESS_INFO *infoPtr;
35
36     /* allocate memory for info structure */
37     infoPtr = (IPADDRESS_INFO *)COMCTL32_Alloc (sizeof(IPADDRESS_INFO));
38     wndPtr->wExtra[0] = (DWORD)infoPtr;
39
40     if (infoPtr == NULL) {
41         ERR (listview, "could not allocate info memory!\n");
42         return 0;
43     }
44
45     if ((IPADDRESS_INFO*)wndPtr->wExtra[0] != infoPtr) {
46         ERR (listview, "pointer assignment error!\n");
47         return 0;
48     }
49
50     /* initialize info structure */
51
52
53
54     return 0;
55 }
56
57
58 static LRESULT
59 IPADDRESS_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
60 {
61     IPADDRESS_INFO *infoPtr = IPADDRESS_GetInfoPtr(wndPtr);
62
63
64
65
66
67
68     /* free ipaddress info data */
69     COMCTL32_Free (infoPtr);
70
71     return 0;
72 }
73
74
75
76
77 LRESULT WINAPI
78 IPADDRESS_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
79 {
80     WND *wndPtr = WIN_FindWndPtr(hwnd);
81
82     switch (uMsg)
83     {
84 //      case IPM_CLEARADDRESS:
85 //      case IPM_GETADDRESS:
86 //      case IPM_ISBLANK:
87 //      case IPM_SETADDRESS:
88 //      case IPM_SETFOCUS:
89 //      case IPM_SETRANGE:
90
91
92         case WM_CREATE:
93             return IPADDRESS_Create (wndPtr, wParam, lParam);
94
95         case WM_DESTROY:
96             return IPADDRESS_Destroy (wndPtr, wParam, lParam);
97
98         default:
99             if (uMsg >= WM_USER)
100                 ERR (ipaddress, "unknown msg %04x wp=%08x lp=%08lx\n",
101                      uMsg, wParam, lParam);
102             return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
103     }
104     return 0;
105 }
106
107
108 VOID
109 IPADDRESS_Register (VOID)
110 {
111     WNDCLASS32A wndClass;
112
113     if (GlobalFindAtom32A (WC_IPADDRESS32A)) return;
114
115     ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
116     wndClass.style         = CS_GLOBALCLASS;
117     wndClass.lpfnWndProc   = (WNDPROC32)IPADDRESS_WindowProc;
118     wndClass.cbClsExtra    = 0;
119     wndClass.cbWndExtra    = sizeof(IPADDRESS_INFO *);
120     wndClass.hCursor       = LoadCursor32A (0, IDC_ARROW32A);
121     wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1);
122     wndClass.lpszClassName = WC_IPADDRESS32A;
123  
124     RegisterClass32A (&wndClass);
125 }
126
127
128 VOID
129 IPADDRESS_Unregister (VOID)
130 {
131     if (GlobalFindAtom32A (WC_IPADDRESS32A))
132         UnregisterClass32A (WC_IPADDRESS32A, (HINSTANCE32)NULL);
133 }
134