ReactOS 0.4.16-dev-13-ge2fc578
clb.c
Go to the documentation of this file.
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
10
11static const WCHAR ClbClassName[] = L"ColumnListBox";
12static const WCHAR ClbColumns[] = L"Column1;Column2;Column3";
13
14typedef struct _CLB_PRIVATEDATA
15{
18
20{
21 {
23 0x0,
24 L"CLBS_NOTIFY"
25 },
26 {
28 0x0,
29 L"CLBS_SORT"
30 },
31 {
33 0x0,
34 L"CLBS_DISABLENOSCROLL"
35 },
36 {
38 0x0,
39 L"CLBS_VSCROLL"
40 },
41 {
43 0x0,
44 L"CLBS_BORDER"
45 },
46 {
48 0x0,
49 L"CLBS_POPOUT_HEADINGS"
50 },
51 {
53 0x0,
54 L"CLBS_SPRINGLY_COLUMNS"
55 },
56 {
58 0x0,
59 L"LBS_OWNERDRAWFIXED"
60 }
61};
62
63/*
64 * @unimplemented
65 */
69 IN DWORD Unknown2,
71{
72 DPRINT1("ClbAddData(0x%x, 0x%x, 0x%x)\n", Unknown1, Unknown2, Unknown3);
73 return 0;
74}
75
76/*
77 * @unimplemented
78 */
82 IN DWORD Unknown2,
84{
85 DPRINT1("ClbSetColumnWidths(0x%x, 0x%x, 0x%x)\n", Unknown1, Unknown2, Unknown3);
86 return 0;
87}
88
89/*
90 * @unimplemented
91 */
95 IN UINT uMsg,
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:
129HandleDefMsg:
130 Ret = DefWindowProc(hwnd, uMsg, wParam, lParam);
131 break;
132 }
133
134 return Ret;
135}
136
137static INT_PTR CALLBACK
139 IN UINT uMsg,
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 */
175WINAPI
177 IN LPARAM dwInitParam)
178{
183 dwInitParam);
184}
185
186/*
187 * @implemented
188 */
189BOOL
190WINAPI
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
223BOOL
224WINAPI
228{
229 BOOL Ret = TRUE;
230
231 switch (dwReason)
232 {
234 {
235 WNDCLASS ClbWndClass;
236
237 hDllInstance = hinstDLL;
238
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
263 break;
264
266 UnregisterClass(ClbClassName, hinstDLL);
267 break;
268 }
269 return Ret;
270}
271
272/* EOF */
#define DPRINT1
Definition: precomp.h:8
#define IDD_COLUMNLISTBOXSTYLES
Definition: resource.h:3
DWORD dwReason
Definition: misc.cpp:141
LRESULT CALLBACK ClbWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: clb.c:94
static const WCHAR ClbColumns[]
Definition: clb.c:12
DWORD WINAPI ClbAddData(IN DWORD Unknown1, IN DWORD Unknown2, IN DWORD Unknown3)
Definition: clb.c:68
static const WCHAR ClbClassName[]
Definition: clb.c:11
struct _CLB_PRIVATEDATA * PCLB_PRIVATEDATA
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: clb.c:225
BOOL WINAPI CustomControlInfoW(OUT LPCUSTOM_CONTROL_INFO CustomControlInfo OPTIONAL)
Definition: clb.c:191
DWORD WINAPI ClbSetColumnWidths(IN DWORD Unknown1, IN DWORD Unknown2, IN DWORD Unknown3)
Definition: clb.c:81
INT_PTR WINAPI ClbStyleW(IN HWND hWndParent, IN LPARAM dwInitParam)
Definition: clb.c:176
struct _CLB_PRIVATEDATA CLB_PRIVATEDATA
static INT_PTR CALLBACK ClbpStyleDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: clb.c:138
static const CLBS_INFO ClbsSupportedStyles[]
Definition: clb.c:19
static HINSTANCE hDllInstance
Definition: clb.c:9
#define CLBS_NOTIFY
Definition: clbdll.h:3
#define CLBS_VSCROLL
Definition: clbdll.h:6
#define CLBS_SPRINGLY_COLUMNS
Definition: clbdll.h:9
#define CLBS_DISABLENOSCROLL
Definition: clbdll.h:5
#define CLBS_BORDER
Definition: clbdll.h:7
#define CLBS_SORT
Definition: clbdll.h:4
#define CLBS_POPOUT_HEADINGS
Definition: clbdll.h:8
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:870
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD Unknown3
Definition: conport.c:37
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_THREAD_DETACH
Definition: compat.h:133
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define DLL_THREAD_ATTACH
Definition: compat.h:132
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
static IN DWORD IN LPVOID lpvReserved
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define LRESULT
Definition: ole.h:14
#define LOWORD(l)
Definition: pedump.c:82
#define LBS_OWNERDRAWFIXED
Definition: pedump.c:682
#define DefWindowProc
Definition: ros2win.h:31
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define _countof(array)
Definition: sndvol32.h:70
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
HWND hwnd
Definition: clb.c:16
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
#define GetWindowLongPtr
Definition: treelist.c:73
int32_t INT_PTR
Definition: typedefs.h:64
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define WM_CLOSE
Definition: winuser.h:1624
#define IDCANCEL
Definition: winuser.h:834
#define WM_CREATE
Definition: winuser.h:1611
#define WM_COMMAND
Definition: winuser.h:1743
#define IDC_ARROW
Definition: winuser.h:687
#define UnregisterClass
Definition: winuser.h:5873
#define DialogBoxParam
Definition: winuser.h:5776
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
#define LoadCursor
Definition: winuser.h:5824
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define CS_OWNDC
Definition: winuser.h:655
#define RegisterClass
Definition: winuser.h:5848
#define WM_DESTROY
Definition: winuser.h:1612
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184