1 /*
2 * PROJECT: ReactOS Column List Box
3 * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4 * PURPOSE: Column List Box
5 * COPYRIGHT: Copyright 2005 Thomas Weidenmueller <w3seek@reactos.com>
6 */
7 #include <precomp.h>
8
9 static HINSTANCE hDllInstance;
10
11 static const WCHAR ClbClassName[] = L"ColumnListBox";
12 static const WCHAR ClbColumns[] = L"Column1;Column2;Column3";
13
14 typedef struct _CLB_PRIVATEDATA
15 {
16 HWND hwnd;
17 } CLB_PRIVATEDATA, *PCLB_PRIVATEDATA;
18
19 static const CLBS_INFO ClbsSupportedStyles[] =
20 {
21 {
22 CLBS_NOTIFY,
23 0x0,
24 L"CLBS_NOTIFY"
25 },
26 {
27 CLBS_SORT,
28 0x0,
29 L"CLBS_SORT"
30 },
31 {
32 CLBS_DISABLENOSCROLL,
33 0x0,
34 L"CLBS_DISABLENOSCROLL"
35 },
36 {
37 CLBS_VSCROLL,
38 0x0,
39 L"CLBS_VSCROLL"
40 },
41 {
42 CLBS_BORDER,
43 0x0,
44 L"CLBS_BORDER"
45 },
46 {
47 CLBS_POPOUT_HEADINGS,
48 0x0,
49 L"CLBS_POPOUT_HEADINGS"
50 },
51 {
52 CLBS_SPRINGLY_COLUMNS,
53 0x0,
54 L"CLBS_SPRINGLY_COLUMNS"
55 },
56 {
57 LBS_OWNERDRAWFIXED,
58 0x0,
59 L"LBS_OWNERDRAWFIXED"
60 }
61 };
62
63 /*
64 * @unimplemented
65 */
66 DWORD
67 WINAPI
ClbAddData(IN DWORD Unknown1,IN DWORD Unknown2,IN DWORD Unknown3)68 ClbAddData(IN DWORD Unknown1,
69 IN DWORD Unknown2,
70 IN DWORD Unknown3)
71 {
72 DPRINT1("ClbAddData(0x%x, 0x%x, 0x%x)\n", Unknown1, Unknown2, Unknown3);
73 return 0;
74 }
75
76 /*
77 * @unimplemented
78 */
79 DWORD
80 WINAPI
ClbSetColumnWidths(IN DWORD Unknown1,IN DWORD Unknown2,IN DWORD Unknown3)81 ClbSetColumnWidths(IN DWORD Unknown1,
82 IN DWORD Unknown2,
83 IN DWORD Unknown3)
84 {
85 DPRINT1("ClbSetColumnWidths(0x%x, 0x%x, 0x%x)\n", Unknown1, Unknown2, Unknown3);
86 return 0;
87 }
88
89 /*
90 * @unimplemented
91 */
92 LRESULT
93 CALLBACK
ClbWndProc(IN HWND hwnd,IN UINT uMsg,IN WPARAM wParam,IN LPARAM lParam)94 ClbWndProc(IN HWND hwnd,
95 IN UINT uMsg,
96 IN WPARAM wParam,
97 IN LPARAM lParam)
98 {
99 PCLB_PRIVATEDATA PrivData;
100 LRESULT Ret = 0;
101
102 DPRINT1("ClbWndProc(0x%p, 0x%x, 0x%p, 0x%p)\n", hwnd, uMsg, wParam, lParam);
103
104 PrivData = (PCLB_PRIVATEDATA)GetWindowLongPtr(hwnd, 0);
105 if (PrivData == NULL && uMsg != WM_CREATE)
106 {
107 goto HandleDefMsg;
108 }
109
110 switch (uMsg)
111 {
112 case WM_CREATE:
113 PrivData = HeapAlloc(GetProcessHeap(),
114 0,
115 sizeof(CLB_PRIVATEDATA));
116 if (PrivData == NULL)
117 {
118 Ret = (LRESULT)-1;
119 break;
120 }
121 PrivData->hwnd = hwnd;
122 break;
123
124 case WM_DESTROY:
125 HeapFree(GetProcessHeap(), 0, PrivData);
126 break;
127
128 default:
129 HandleDefMsg:
130 Ret = DefWindowProc(hwnd, uMsg, wParam, lParam);
131 break;
132 }
133
134 return Ret;
135 }
136
137 static INT_PTR CALLBACK
ClbpStyleDlgProc(IN HWND hwndDlg,IN UINT uMsg,IN WPARAM wParam,IN LPARAM lParam)138 ClbpStyleDlgProc(IN HWND hwndDlg,
139 IN UINT uMsg,
140 IN WPARAM wParam,
141 IN LPARAM lParam)
142 {
143 INT_PTR Ret = FALSE;
144
145 DPRINT1("ClbpStyleDlgProc(0x%p, 0x%x, 0x%p, 0x%p)\n", hwndDlg, uMsg, wParam, lParam);
146
147 switch (uMsg)
148 {
149 case WM_COMMAND:
150 switch (LOWORD(wParam))
151 {
152 case IDOK:
153 case IDCANCEL:
154 EndDialog(hwndDlg, LOWORD(wParam));
155 break;
156 }
157 break;
158
159 case WM_CLOSE:
160 EndDialog(hwndDlg, IDCANCEL);
161 break;
162
163 case WM_INITDIALOG:
164 Ret = TRUE;
165 break;
166 }
167
168 return Ret;
169 }
170
171 /*
172 * @implemented
173 */
174 INT_PTR
175 WINAPI
ClbStyleW(IN HWND hWndParent,IN LPARAM dwInitParam)176 ClbStyleW(IN HWND hWndParent,
177 IN LPARAM dwInitParam)
178 {
179 return DialogBoxParam(hDllInstance,
180 MAKEINTRESOURCE(IDD_COLUMNLISTBOXSTYLES),
181 hWndParent,
182 ClbpStyleDlgProc,
183 dwInitParam);
184 }
185
186 /*
187 * @implemented
188 */
189 BOOL
190 WINAPI
CustomControlInfoW(OUT LPCUSTOM_CONTROL_INFO CustomControlInfo OPTIONAL)191 CustomControlInfoW(OUT LPCUSTOM_CONTROL_INFO CustomControlInfo OPTIONAL)
192 {
193 if (CustomControlInfo != NULL)
194 {
195 wcscpy(CustomControlInfo->ClassName, ClbClassName);
196
197 CustomControlInfo->Zero1 = 0;
198
199 wcscpy(CustomControlInfo->ClassName2, ClbClassName);
200
201 CustomControlInfo->Unknown1 = 0x60; // FIXME - ???
202 CustomControlInfo->Unknown2 = 0x50; // FIXME - ???
203 CustomControlInfo->Unknown3 = 0x50A10013; // FIXME - ???
204
205 CustomControlInfo->Zero2 = 0;
206 CustomControlInfo->Zero3 = 0;
207
208 CustomControlInfo->StylesCount = _countof(ClbsSupportedStyles);
209 CustomControlInfo->SupportedStyles = ClbsSupportedStyles;
210
211 wcscpy(CustomControlInfo->Columns, ClbColumns);
212
213 CustomControlInfo->ClbStyleW = ClbStyleW;
214
215 CustomControlInfo->Zero4 = 0;
216 CustomControlInfo->Zero5 = 0;
217 CustomControlInfo->Zero6 = 0;
218 }
219
220 return TRUE;
221 }
222
223 BOOL
224 WINAPI
DllMain(IN HINSTANCE hinstDLL,IN DWORD dwReason,IN LPVOID lpvReserved)225 DllMain(IN HINSTANCE hinstDLL,
226 IN DWORD dwReason,
227 IN LPVOID lpvReserved)
228 {
229 BOOL Ret = TRUE;
230
231 switch (dwReason)
232 {
233 case DLL_PROCESS_ATTACH:
234 {
235 WNDCLASS ClbWndClass;
236
237 hDllInstance = hinstDLL;
238
239 InitCommonControls();
240
241 /* register the control's window class */
242 ClbWndClass.style = CS_GLOBALCLASS | CS_OWNDC;
243 ClbWndClass.lpfnWndProc = ClbWndProc;
244 ClbWndClass.cbClsExtra = 0;
245 ClbWndClass.cbWndExtra = sizeof(PCLB_PRIVATEDATA);
246 ClbWndClass.hInstance = hinstDLL;
247 ClbWndClass.hIcon = NULL;
248 ClbWndClass.hCursor = LoadCursor(NULL, (LPWSTR)IDC_ARROW);
249 ClbWndClass.hbrBackground = NULL;
250 ClbWndClass.lpszMenuName = NULL;
251 ClbWndClass.lpszClassName = ClbClassName;
252
253 if (!RegisterClass(&ClbWndClass))
254 {
255 Ret = FALSE;
256 break;
257 }
258 break;
259 }
260
261 case DLL_THREAD_ATTACH:
262 case DLL_THREAD_DETACH:
263 break;
264
265 case DLL_PROCESS_DETACH:
266 UnregisterClass(ClbClassName, hinstDLL);
267 break;
268 }
269 return Ret;
270 }
271
272 /* EOF */
273