4 * Copyright 1998 Eric Kohl
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>
13 * - All notifications.
24 #define LISTVIEW_GetInfoPtr(wndPtr) ((LISTVIEW_INFO *)wndPtr->wExtra[0])
28 LISTVIEW_Refresh (WND
*wndPtr
, HDC32 hdc
)
30 LISTVIEW_INFO
*infoPtr
= LISTVIEW_GetInfoPtr(wndPtr
);
39 LISTVIEW_SetBkColor (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
41 LISTVIEW_INFO
*infoPtr
= LISTVIEW_GetInfoPtr(wndPtr
);
43 if (!(infoPtr
)) return FALSE
;
45 /* set background color */
46 infoPtr
->clrBk
= (COLORREF
)lParam
;
53 LISTVIEW_SetImageList (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
55 LISTVIEW_INFO
*infoPtr
= LISTVIEW_GetInfoPtr(wndPtr
);
57 FIXME (listview
, "(0x%08x 0x%08lx)\n", wParam
, lParam
);
64 LISTVIEW_Create (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
66 LISTVIEW_INFO
*infoPtr
= LISTVIEW_GetInfoPtr(wndPtr
);
68 /* initialize info structure */
69 infoPtr
->clrBk
= CLR_NONE
;
76 LISTVIEW_Destroy (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
78 LISTVIEW_INFO
*infoPtr
= LISTVIEW_GetInfoPtr(wndPtr
);
86 LISTVIEW_EraseBackground (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
88 LISTVIEW_INFO
*infoPtr
= LISTVIEW_GetInfoPtr(wndPtr
);
90 if (infoPtr
->clrBk
== CLR_NONE
) {
91 return SendMessage32A (GetParent32 (wndPtr
->hwndSelf
),
92 WM_ERASEBKGND
, wParam
, lParam
);
96 HBRUSH32 hBrush
= CreateSolidBrush32 (infoPtr
->clrBk
);
97 GetClientRect32 (wndPtr
->hwndSelf
, &rect
);
98 FillRect32 ((HDC32
)wParam
, &rect
, hBrush
);
99 DeleteObject32 (hBrush
);
107 LISTVIEW_NCCreate (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
109 LISTVIEW_INFO
*infoPtr
;
111 /* allocate memory for info structure */
112 infoPtr
= (LISTVIEW_INFO
*)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY
,
113 sizeof(LISTVIEW_INFO
));
114 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
116 if (infoPtr
== NULL
) {
117 ERR (listview
, "could not allocate info memory!\n");
121 if ((LISTVIEW_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
122 ERR (listview
, "pointer assignment error!\n");
126 return DefWindowProc32A (wndPtr
->hwndSelf
, WM_NCCREATE
, wParam
, lParam
);
131 LISTVIEW_NCDestroy (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
133 LISTVIEW_INFO
*infoPtr
= LISTVIEW_GetInfoPtr(wndPtr
);
138 /* free list view info data */
139 HeapFree (GetProcessHeap (), 0, infoPtr
);
146 LISTVIEW_Paint (WND
*wndPtr
, WPARAM32 wParam
)
151 hdc
= wParam
==0 ? BeginPaint32 (wndPtr
->hwndSelf
, &ps
) : (HDC32
)wParam
;
152 LISTVIEW_Refresh (wndPtr
, hdc
);
154 EndPaint32 (wndPtr
->hwndSelf
, &ps
);
160 ListviewWindowProc (HWND32 hwnd
, UINT32 uMsg
, WPARAM32 wParam
, LPARAM lParam
)
162 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
168 return LISTVIEW_SetBkColor (wndPtr
, wParam
, lParam
);
171 case LVM_SETIMAGELIST
:
172 return LISTVIEW_SetImageList (wndPtr
, wParam
, lParam
);
181 return LISTVIEW_Create (wndPtr
, wParam
, lParam
);
184 return LISTVIEW_Destroy (wndPtr
, wParam
, lParam
);
187 return LISTVIEW_EraseBackground (wndPtr
, wParam
, lParam
);
189 // case WM_GETDLGCODE:
193 // case WM_MOUSEMOVE:
194 // return LISTVIEW_MouseMove (wndPtr, wParam, lParam);
197 return LISTVIEW_NCCreate (wndPtr
, wParam
, lParam
);
200 return LISTVIEW_NCDestroy (wndPtr
, wParam
, lParam
);
205 return LISTVIEW_Paint (wndPtr
, wParam
);
207 // case WM_RBUTTONDOWN:
210 // case WM_SETREDRAW:
213 // case WM_WINDOWPOSCHANGED:
214 // case WM_WININICHANGE:
218 ERR (listview
, "unknown msg %04x wp=%08x lp=%08lx\n",
219 uMsg
, wParam
, lParam
);
220 return DefWindowProc32A (hwnd
, uMsg
, wParam
, lParam
);
227 LISTVIEW_Register (void)
229 WNDCLASS32A wndClass
;
231 if (GlobalFindAtom32A (WC_LISTVIEW32A
)) return;
233 ZeroMemory (&wndClass
, sizeof(WNDCLASS32A
));
234 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
235 wndClass
.lpfnWndProc
= (WNDPROC32
)ListviewWindowProc
;
236 wndClass
.cbClsExtra
= 0;
237 wndClass
.cbWndExtra
= sizeof(LISTVIEW_INFO
*);
238 wndClass
.hCursor
= LoadCursor32A (0, IDC_ARROW32A
);
239 wndClass
.hbrBackground
= (HBRUSH32
)(COLOR_WINDOW
+ 1);
240 wndClass
.lpszClassName
= WC_LISTVIEW32A
;
242 RegisterClass32A (&wndClass
);