ReactOS  0.4.12-dev-14-gd0c8636
clb.c
Go to the documentation of this file.
1 /*
2  * ReactOS Column List Box
3  * Copyright (C) 2005 Thomas Weidenmueller
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 /*
20  * PROJECT: ReactOS Column List Box
21  * FILE: base/applications/regedit/clb/clb.c
22  * PURPOSE: Column List Box
23  * PROGRAMMER: Thomas Weidenmueller <w3seek@reactos.com>
24  *
25  * UPDATE HISTORY:
26  * 10/29/2005 Created
27  */
28 #include <precomp.h>
29 
31 
32 static const WCHAR ClbClassName[] = L"ColumnListBox";
33 static const WCHAR ClbColumns[] = L"Column1;Column2;Column3";
34 
35 typedef struct _CLB_PRIVATEDATA
36 {
39 
41 {
42  {
44  0x0,
45  L"CLBS_NOTIFY"
46  },
47  {
48  CLBS_SORT,
49  0x0,
50  L"CLBS_SORT"
51  },
52  {
54  0x0,
55  L"CLBS_DISABLENOSCROLL"
56  },
57  {
59  0x0,
60  L"CLBS_VSCROLL"
61  },
62  {
64  0x0,
65  L"CLBS_BORDER"
66  },
67  {
69  0x0,
70  L"CLBS_POPOUT_HEADINGS"
71  },
72  {
74  0x0,
75  L"CLBS_SPRINGLY_COLUMNS"
76  },
77  {
79  0x0,
80  L"LBS_OWNERDRAWFIXED"
81  }
82 };
83 
84 /*
85  * @unimplemented
86  */
87 DWORD
88 WINAPI
89 ClbAddData(IN DWORD Unknown1,
90  IN DWORD Unknown2,
92 {
93  DPRINT1("ClbAddData(0x%x, 0x%x, 0x%x)\n", Unknown1, Unknown2, Unknown3);
94  return 0;
95 }
96 
97 
98 /*
99  * @unimplemented
100  */
101 DWORD
102 WINAPI
104  IN DWORD Unknown2,
105  IN DWORD Unknown3)
106 {
107  DPRINT1("ClbSetColumnWidths(0x%x, 0x%x, 0x%x)\n", Unknown1, Unknown2, Unknown3);
108  return 0;
109 }
110 
111 
112 /*
113  * @unimplemented
114  */
115 LRESULT
116 CALLBACK
118  IN UINT uMsg,
119  IN WPARAM wParam,
120  IN LPARAM lParam)
121 {
122  PCLB_PRIVATEDATA PrivData;
123  LRESULT Ret = 0;
124 
125  DPRINT1("ClbWndProc(0x%p, 0x%x, 0x%p, 0x%p)\n", hwnd, uMsg, wParam, lParam);
126 
127  PrivData = (PCLB_PRIVATEDATA)GetWindowLongPtr(hwnd,
128  0);
129  if (PrivData == NULL && uMsg != WM_CREATE)
130  {
131  goto HandleDefMsg;
132  }
133 
134  switch (uMsg)
135  {
136  case WM_CREATE:
137  PrivData = HeapAlloc(GetProcessHeap(),
138  0,
139  sizeof(CLB_PRIVATEDATA));
140  if (PrivData == NULL)
141  {
142  Ret = (LRESULT)-1;
143  break;
144  }
145  PrivData->hwnd = hwnd;
146  break;
147 
148  case WM_DESTROY:
150  0,
151  PrivData);
152  break;
153 
154  default:
155 HandleDefMsg:
156  Ret = DefWindowProc(hwnd,
157  uMsg,
158  wParam,
159  lParam);
160  break;
161  }
162 
163  return Ret;
164 }
165 
166 
167 static INT_PTR CALLBACK
169  IN UINT uMsg,
170  IN WPARAM wParam,
171  IN LPARAM lParam)
172 {
173  INT_PTR Ret = FALSE;
174 
175  DPRINT1("ClbpStyleDlgProc(0x%p, 0x%x, 0x%p, 0x%p)\n", hwndDlg, uMsg, wParam, lParam);
176 
177  switch (uMsg)
178  {
179  case WM_COMMAND:
180  switch (LOWORD(wParam))
181  {
182  case IDOK:
183  case IDCANCEL:
184  EndDialog(hwndDlg,
185  (INT_PTR)LOWORD(wParam));
186  break;
187  }
188  break;
189 
190  case WM_CLOSE:
191  EndDialog(hwndDlg,
192  IDCANCEL);
193  break;
194 
195  case WM_INITDIALOG:
196  Ret = TRUE;
197  break;
198  }
199 
200  return Ret;
201 }
202 
203 
204 /*
205  * @implemented
206  */
207 INT_PTR
208 WINAPI
210  IN LPARAM dwInitParam)
211 {
212  return DialogBoxParam(hDllInstance,
214  hWndParent,
216  dwInitParam);
217 }
218 
219 
220 /*
221  * @implemented
222  */
223 BOOL
224 WINAPI
226 {
227  if (CustomControlInfo != NULL)
228  {
229  wcscpy(CustomControlInfo->ClassName,
230  ClbClassName);
231 
232  CustomControlInfo->Zero1 = 0;
233 
234  wcscpy(CustomControlInfo->ClassName2,
235  ClbClassName);
236 
237  CustomControlInfo->Unknown1 = 0x60; /* FIXME - ??? */
238  CustomControlInfo->Unknown2 = 0x50; /* FIXME - ??? */
239  CustomControlInfo->Unknown3 = 0x50A10013; /* FIXME - ??? */
240 
241  CustomControlInfo->Zero2 = 0;
242  CustomControlInfo->Zero3 = 0;
243 
244  CustomControlInfo->StylesCount = sizeof(ClbsSupportedStyles) / sizeof(ClbsSupportedStyles[0]);
245  CustomControlInfo->SupportedStyles = ClbsSupportedStyles;
246 
247  wcscpy(CustomControlInfo->Columns,
248  ClbColumns);
249 
250  CustomControlInfo->ClbStyleW = ClbStyleW;
251 
252  CustomControlInfo->Zero4 = 0;
253  CustomControlInfo->Zero5 = 0;
254  CustomControlInfo->Zero6 = 0;
255  }
256 
257  return TRUE;
258 }
259 
260 BOOL
261 WINAPI
263  IN DWORD dwReason,
265 {
266  BOOL Ret = TRUE;
267 
268  switch (dwReason)
269  {
270  case DLL_PROCESS_ATTACH:
271  {
272  WNDCLASS ClbWndClass;
273 
274  hDllInstance = hinstDLL;
275 
277 
278  /* register the control's window class */
279  ClbWndClass.style = CS_GLOBALCLASS | CS_OWNDC;
280  ClbWndClass.lpfnWndProc = ClbWndProc;
281  ClbWndClass.cbClsExtra = 0;
282  ClbWndClass.cbWndExtra = sizeof(PCLB_PRIVATEDATA);
283  ClbWndClass.hInstance = hinstDLL,
284  ClbWndClass.hIcon = NULL;
285  ClbWndClass.hCursor = LoadCursor(NULL,
286  (LPWSTR)IDC_ARROW);
287  ClbWndClass.hbrBackground = NULL;
288  ClbWndClass.lpszMenuName = NULL;
289  ClbWndClass.lpszClassName = ClbClassName;
290 
291  if (!RegisterClass(&ClbWndClass))
292  {
293  Ret = FALSE;
294  break;
295  }
296  break;
297  }
298 
299  case DLL_THREAD_ATTACH:
300  case DLL_THREAD_DETACH:
301  break;
302 
303  case DLL_PROCESS_DETACH:
305  hinstDLL);
306  break;
307  }
308  return Ret;
309 }
310 
311 /* EOF */
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IN
Definition: typedefs.h:38
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define CLBS_VSCROLL
Definition: clbdll.h:6
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES IN DWORD Unknown3
Definition: conport.c:35
#define LRESULT
Definition: msvc.h:49
HWND hwnd
Definition: clb.c:37
#define IDD_COLUMNLISTBOXSTYLES
Definition: resource.h:3
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define DLL_THREAD_ATTACH
Definition: compat.h:121
#define CALLBACK
Definition: compat.h:27
DWORD WINAPI ClbAddData(IN DWORD Unknown1, IN DWORD Unknown2, IN DWORD Unknown3)
Definition: clb.c:89
int cbClsExtra
Definition: winuser.h:3118
LPCSTR lpszMenuName
Definition: winuser.h:3124
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
HBRUSH hbrBackground
Definition: winuser.h:3123
#define CS_OWNDC
Definition: winuser.h:650
int32_t INT_PTR
Definition: typedefs.h:62
struct _CLB_PRIVATEDATA * PCLB_PRIVATEDATA
static const CLBS_INFO ClbsSupportedStyles[]
Definition: clb.c:40
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define DLL_THREAD_DETACH
Definition: compat.h:122
#define CLBS_POPOUT_HEADINGS
Definition: clbdll.h:8
static IN DWORD IN LPVOID lpvReserved
#define LBS_OWNERDRAWFIXED
Definition: pedump.c:682
UINT_PTR WPARAM
Definition: windef.h:207
DWORD dwReason
Definition: misc.cpp:154
BOOL WINAPI CustomControlInfoW(OUT LPCUSTOM_CONTROL_INFO CustomControlInfo OPTIONAL)
Definition: clb.c:225
int cbWndExtra
Definition: winuser.h:3119
LONG_PTR LPARAM
Definition: windef.h:208
HCURSOR hCursor
Definition: winuser.h:3122
smooth NULL
Definition: ftsmooth.c:416
#define CLBS_BORDER
Definition: clbdll.h:7
struct _CLB_PRIVATEDATA CLB_PRIVATEDATA
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static HINSTANCE hDllInstance
Definition: clb.c:30
static INT_PTR CALLBACK ClbpStyleDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: clb.c:168
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WM_CLOSE
Definition: winuser.h:1603
#define CS_GLOBALCLASS
Definition: winuser.h:647
unsigned int UINT
Definition: ndis.h:50
#define CLBS_SPRINGLY_COLUMNS
Definition: clbdll.h:9
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DialogBoxParam
Definition: winuser.h:5630
#define CLBS_DISABLENOSCROLL
Definition: clbdll.h:5
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1087
DWORD WINAPI ClbSetColumnWidths(IN DWORD Unknown1, IN DWORD Unknown2, IN DWORD Unknown3)
Definition: clb.c:103
static const WCHAR ClbColumns[]
Definition: clb.c:33
#define WM_COMMAND
Definition: winuser.h:1716
LPCSTR lpszClassName
Definition: winuser.h:3125
#define WINAPI
Definition: msvc.h:20
#define LoadCursor
Definition: winuser.h:5678
#define CLBS_NOTIFY
Definition: clbdll.h:3
UINT style
Definition: winuser.h:3116
HINSTANCE hInstance
Definition: winuser.h:3120
INT_PTR WINAPI ClbStyleW(IN HWND hWndParent, IN LPARAM dwInitParam)
Definition: clb.c:209
#define DPRINT1
Definition: precomp.h:8
WNDPROC lpfnWndProc
Definition: winuser.h:3117
LRESULT CALLBACK ClbWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: clb.c:117
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI DllMain(IN HINSTANCE hinstDLL, IN DWORD dwReason, IN LPVOID lpvReserved)
Definition: clb.c:262
#define OUT
Definition: typedefs.h:39
#define WM_CREATE
Definition: winuser.h:1590
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
#define RegisterClass
Definition: winuser.h:5702
#define GetWindowLongPtr
Definition: treelist.c:73
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
#define UnregisterClass
Definition: winuser.h:5727
#define WM_INITDIALOG
Definition: winuser.h:1715
#define CLBS_SORT
Definition: clbdll.h:4
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
static const WCHAR ClbClassName[]
Definition: clb.c:32
HICON hIcon
Definition: winuser.h:3121
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68