1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00
wine/dlls/comctl32/listview.c
Alexandre Julliard d30dfd24d6 Release 980927
Sun Sep 27 14:25:38 1998  Petter Reinholdtsen <pere@td.org.uit.no>

	* [files/drive.c]
	Make sure GetDriveType32A() handles param NULL.  Added some
	doc on function.

Sun Sep 27 14:07:26 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [controls/edit.c] [windows/win.c]
	Don't call SetWindowLong() in EDIT_WM_NCREATE.
	Fix SetWindowLong(GWL_[EX]STYLE) to work for 16bit windows. Remove
	UpdateWindow() call. 

Sun Sep 27 13:41:22 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [scheduler/*.c] [server/event.c] [server/mutex.c]
	  [server/semaphore.c]
	Implemented server-side synchronisation objects.

Sun Sep 27 01:13:35 1998  Alex Priem <alexp@sci.kun.nl>

	* [dlls/comctl32/treeview.c] [include/treeview.h] [include/comctl.h]
	Treeview implementation.

	* [dlls/comctl32/trackbar.c] [include/trackbar.h] 
	Trackbar implementation.

Sat Sep 26 20:49:13 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [if1632/thunk.c] [tools/build.c] [win32/kernel32.c]
	Bugfix: several problems with flat thunks fixed.

	* [memory/selector.c]
	Bugfix: IsBad...Ptr16 didn't work for limit_in_pages segments.

	* [scheduler/thread.c]
	Bugfix: CreateThread: Allow id parameter == NULL.

	* [objects/gdiobj.c]
	Bugfix: IsGDIObject: Return correct object type for stock objects.

	* [msdos/dpmi.c]
	Bugfix: fixed typo in INT_DoRealModeInt.

	* [msdos/int21.c]
	Bugfix: int21 READ *must* use WIN16_hread, not _hread16.

	* [if1632/kernel.spec] [if1632/dummy.c] [if1632/thunk.c]
	  [loader/ne/module.c] [scheduler/event.c] [scheduler/synchro.c]
	  [scheduler/thread.c] [win32/kernel32.c] [win32/ordinals.c]
	Added names/stubs for all undocumented KERNEL routines (Win95).
	Added the following undoc. 16-bit equivalents to Win32 routines:
	KERNEL.441-443,449-453,456-462,471-476,479-486,488.
	Added stubs for some other KERNEL routines.

	* [memory/heap.c] [memory/global.c] [include/global.h]
	Implemented Local32... 32-bit local heap routines (KERNEL.208-215, 229).

	* [miscemu/instr.c] [loader/module.c] [include/module.h]
	Implemented __GP fault handling and HasGPHandler (KERNEL.338).

	* [misc/error.c]
	Implemented LogParamErrorRegs (KERNEL.327).

	* [loader/task.c] [include/windows.h]
	Implemented GetCodeInfo (KERNEL.104).

	* [loader/task.c] [scheduler/thread.c] [include/thread.h]
	Implemented [GS]etThreadQueue and [GS]etFastQueue (KERNEL.463/4, 624/5).

	* [if1632/gdi.spec] [objects/dc.c] [objects/dib.c]
	  [objects/bitmap.c] [include/windows.h]
	Bugfix: fixed wrong parameter for CreateDIBSection16.
	Added [GS]etDIBColorTable16, stub for GetBoundsRect16.
	Partially implemented BITMAP_GetObject16 for DIBs.

	* [if1632/gdi.spec] [relay32/gdi32.spec] [objects/palette.c]
	Added some GDI stubs.

	* [if1632/Makefile.in] [if1632/display.spec] [if1632/mouse.spec]
	  [if1632/keyboard.spec] [if1632/builtin.c] [windows/keyboard.c]
	Added some stubs for Win16 drivers: KEYBOARD, MOUSE, DISPLAY.

	* [if1632/wprocs.spec] [msdos/vxd.c]
	Added some stubs for VxDs: VMM, ConfigMG, TimerAPI.

	* [msdos/int2f.c]
	Added some stubs for real-mode network drivers.

Sat Sep 26 18:18:18 1998  Marcus Meissner <marcus@jet.franken.de>

	* [configure.in]
	Merged in some more of the FreeBSD ports/emulators/wine patches. 
	(Maintainer(s) of this port: You can just submit these
	patches to Alexandre directly.)

	 * [loader/pe_image.c]
	Check filesize of image against size derived from header
	to spot truncated executeables without crashing.

	* [files/directory.c]
	Set envvar "COMSPEC". One win32(!!) program crashes without it.

	* [multimedia/mmio.c]
	Added mmioSetInfo32.

	* [include/file.h]
	Return STD_ERROR_HANDLE for AUX and PRT dos handles.

	* [loader/module.c]
	Handle executeables with spaces in their names a bit better in
	CreateProcess.

	* [relay32/msvfw32.spec][if1632/msvideo.spec][multimedia/msvideo.c][include/vfw.h]
	Started on MS Video support (can load Win32 ICMs).

	* [tools/testrun]
	A bit smarter use of ps.

	* [memory/virtual.c]
	Report PAGE_GUARDed pages as PAGE_PROTECTED (AutoCAD LT R17 fails
	without that check (since Win95 doesn't know about PAGE_GUARD)).

Sat Sep 26 15:04:05 1998  Ove Kaaven <ovek@arcticnet.no>

	* [include/miscemu.h] [if1632/builtin.c] [loader/task.c]
	  [miscemu/instr.c] [msdos/dpmi.c] [msdos/int21.c]
	  [msdos/interrupts.c] [windows/user.c]
	INT_[S|G]etHandler was renamed to INT_[S|G]etPMHandler.
	Added handlers to deal with real-mode interrupts; DOS
	programs are now able to hook real-mode interrupts.

	* [loader/dos/module.c] [msdos/dosmem.c] [msdos/int21.c]
	Moved real-mode interrupt table initialization to
	msdos/dosmem.c, and made new V86 tasks get a full copy
	of the existing "system memory" instead of almost empty
	space. Misc fixes.

	* [include/dosexe.h] [loader/dos/module.c] [msdos/dpmi.c]
	  [msdos/int2f.c]
	First shot at letting DOS programs start up DPMI (but DPMI
	is still disabled for DOS programs, for pkunzip's sake).

	* [include/debugger.h] [debugger/break.c] [debugger/dbg.y]
	  [debugger/registers.c] [debugger/memory.c] [debugger/info.c]
	  [loader/dos/dosvm.c]
	First shot at making Wine's debugger work for DOS programs.
	The -debug flag works, as do "nexti" and "stepi".

Sat Sep 26 13:13:13 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [dlls/shell32/dataobject.c]
	New classes IEnumFORMATETC implemented, IDataObject stubs.
	
	* [dlls/shell32/*.*][relay32/shell32.spec]
	Bugfixes.
	New: ICM_InsertItem(), ILCreateFromPath().
	Implemented: ILCloneFirst().
	Stubs: ILIsEqual(), ILFindChild(), SHLogILFromFSIL(),
	  PathMatchSpec(), PathIsExe().
	Changed: ILGetSize(), _ILIsDesktop(), PathCombine().

	* [include/shlobj.h]
	New SHLGUID's
	New structures: DVTARGETDEVICE32, STGMEDIUM32, FORMATETC32,
	CLIPFORMAT32.
	New interfaces: IEnumFORMATETC, IDataObject, ICommDlgBrowser
	IDockingWindowFrame, IServiceProvider.

	* [dlls/shell32/folders.c]
	Stubs for IShellLink.

	* [loader/resource.c]
	Small fixes.

	* [misc/crtdll.c][relay32/crtdll.spec]
	New __dllonexit().

	* [windows/message.c]
	SendNotifyMessageA, SendMessageCallBack32A half implemented.

	* [controls/edit.c]
	EDIT_WM_SetText set EF_UPDATE flag not for ES_MULTILINE.

	* [files/file.c]
	Handling of fileposition fixed.

Fri Sep 25 18:13:30 1998  Patrik Stridvall <ps@leissner.se>

	* [include/windows.h] [include/wintypes.h]
	  [ole/ole2nls.h] [relay32/kernel32.spec]
	Implemented EnumDateFormats and EnumTimeFormats.
	Only adds US English support.

	* [Makefile.in] [configure.in] 
	  [dlls/Makefile.in] [dlls/psapi/Makefile.in] 
	  [dlls/psapi/psapi_main.c] 
	New files to implement stubs for PSAPI.DLL (NT only).

	* [relay32/Makefile.in] [relay32/builtin32.c] 
	  [relay32/psapi.spec]
	New spec file for PSAPI.DLL (NT only).

	* [scheduler/handle.c]
	HANDLE_GetObjPtr should only interpret the pseudo handles as the
	current thread or the current process if a thread or a process is
	requested.

	* [include/winversion.h] [misc/version.c]
	Adds the global function VERSION_GetVersion() so functions can
	have different behavior depending on the -winver flag.

	* [include/oledlg.h] [ole/oledlg.c]
	Minor fixes. 

	* [windows/winproc.c]
	Minor changes.

	* [include/imm.h] [misc/imm.c]
	Now returns correct values under both Windows 95 and NT 4.0.

Thu Sep 24 22:11:44 1998  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [configure.in] [include/acconfig.h] [include/thread.h]
	  [scheduler/sysdeps.c]
	Autoconfig test for non-reentrant libc.

Wed Sep 23 19:52:12 1998  Matthew Becker <mbecker@glasscity.net>

	* [*/*.c]
	Miscellaneous documentation updates and debugging output 
	standardizations.

	* [objects/clipping.c]
	Added ExtSelectClipRgn.

Wed Sep 23 00:03:28 EDT 1998  Pete Ratzlaff <pratzlaff@cfa.harvard.edu>

	* [include/windows.h] [if1632/user.spec] [relay32/user32.spec]
	  [windows/keyboard.c]
	Added, marginally implemented, GetKeyboardLayoutName().
	Only returns US English keyboard name.

Tue Sep 22 16:32:41 1998  Marcel Baur <mbaur@iiic.ethz.ch>

	* [programs/control/*]
	New Winelib application.

Mon Sep 21 00:29:18 1998  Peter Hunnisett <hunnise@nortel.ca>

	* [include/dplay.h][multimedia/dplay.c][ole/compobj.c]
	Added all DirectPlayLobby interfaces and enhanced DirectPlay
	and DirectPlayLobby support. Still not all that much. Useful
	enough if you just need to start a program, don't try any
	real dplay/lobby stuff.

	* [documentation/status/directplay]
	Added a very little bit.

	* [graphics/ddraw.c]
	- Call to SetWindowLong32A wasn't working because there was no
	  memory set aside when the window class was registered.
	- Fixed some xlib reference counting and change the behaviour
	  of DirectDrawSurface3_SetPalette to mimic observed behaviour
	  (palette is associated will all backbuffers)
	- Also stored all palette colour fields and spit back our saved
	  colour fields rather than query X for them.
	- Added plenty of AddRef and Release traces.
	- Added Xlib support for using -desktop option.
	- Fixed Xlib message handling. Messages weren't being passed to
	  the application. Fixes mouse movements in some xlib DDraw games.
	- Added a few stubs.

	* [windows/win.c][include/winerror.h]
	Fixed up some error handling in WIN_SetWindowLong. SetLastError
	wasn't being used. Could cause problems with 0 return codes.
	Added new error in winerror (1400).

	* [AUTHORS] [include/authors.h]
	Added myself as a Wine author.

Sun Sep 20 21:22:44 1998  Alexander Larsson  <alla@lysator.liu.se>

	* [loader/module.c]
	Changed GetModuleFileName32A so that is returns the
	long version of the filename. Note that just the name
	is long, not the directories.

Sat Sep 19 20:05:30 1998 Per �ngstr�m <pang@mind.nu> 

	* [controls/menu.c]
	Made a couple of fixes to make life easier for applications that alter
	their menus at runtime.

	* [windows/defdlg.c]
	Removed the cast of the return value from dialog procedures to a 16-bit
	bool. The return value needs to retain all its 32 bits, since it is not 
	always a bool, such as when responding to the WM_NCHITTEST message.

Fri Sep 18 11:30:38 1998  Sergey Turchanov <turchanov@usa.net>

	* [loader/resource.c]
	Fixed very funny bug (though gravely affecting further excecution)
	with FindResource[Ex]32 functions.

	* [include/multimon.h] [windows/multimon.c] [relay32/user32.spec]
	  [include/windows.h] [windows/sysmetrics.c]
	Default implementation for Multimonitor API.

	* [include/windows.h] [windows/winpos.c]
	Fixed incorrect declaration (and behaviour) of GetWindowRect32.

Wed Sep 16 10:21:15 1998  Gerard Patel <G.Patel@Wanadoo.fr>

	* [controls/edit.c]
	Fixed EDIT_EM_GetLine to use correctly length of lines.

Tue Sep 15 20:40:16 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [misc/tweak.c][include/tweak.h][controls/menu.c]
	Replaced the tweak graphic routines by calls to DrawEdge32().

	* [misc/tweak.c][include/tweak.h][documentation/win95look]
	  [wine.ini][*/*]
	Changed "look and feel" selection. Allows Win3.1, Win95 and
	Win98 (no GUI code implemented) look and feel.

	* [dlls/comctl32/header.c][include/header.h][include/commctrl.h]
	Started callback item support and did some minor improvements.

	* [dlls/comctl32/imagelist.c]
	Fixed bug in transparent image display.
	ImageList_GetIcon is still buggy :-(

	* [dlls/comctl32/toolbar.c]
	Fixed button drawing (partial hack).

	* [dlls/comctl32/commctrl.c]
	Fixed MenuHelp().

	* [controls/button.c]
	Added 3d effect for groupbox.

	* [windows/msgbox.c]
	Added font support for message boxes.

	* [windows/nonclient.c]
	Fixed window moving bug.

	* [dlls/comctl32/*.c]
	Various improvements.

	* [dlls/comctl32/listview.c][dlls/comctl32/rebar.c]
	  [include/commctrl.h]
	More messages.

	* [windows/syscolor.c][include/windows.h]
	Introduced new Win98 system colors.

Tue Sep 15 18:29:45 1998 Wesley Filardo <eightknots@aol.com>

	* [files/profile.c]
	Added support in PROFILE_LoadWineIni for -config option

	* [misc/main.c] [include/options.h]
	Added -config option.

Tue Sep 15 18:22:26 1998  Petter Reinholdtsen <pere@td.org.uit.no>

	* [documentation/Makefile.in]
	Make sure directory exists before installing into it.

Tue Sep 15 01:47:33 1998  Pablo Saratxaga <pablo.sarachaga@ping.be>

	* [ole/nls/*] [ole/ole2nls.c] [include/winnls.h]
	Fixed a few errors and completed some NLS files.

Mon Sep 14 01:23:45 1998  Joseph Pranevich <knight@baltimore.wwaves.com>

	* [include/miscemu.h] [msdos/interrupts.c]
	Removed a compilation warning, added INT 25 to the list of interrupts
	callable from DOS applications, added a debug message when unsupported
	interrupts are used.

Sun Sep 13 19:55:22 1998  Lawson Whitney <lawson_whitney@juno.com>

	* [if1632/relay.c]
	CallProcEx32W should not reverse arguments.

Sun Aug 17 21:18:12 1998  Eric Pouech  <eric.pouech@lemel.fr>

	* [multimedia/midi.c] [multimedia/init.c] [multimedia/mmsys.c] 
	  [include/multimedia.h] [include/mmsystem.h] 
	  [multimedia/Makefile.in] [multimedia/midipatch.c]
	  [if1632/multimedia.spec]
	Made MIDI input and output functional on OSS capable systems.

	* [multimedia/timer.c]
	Changes to trigger callbacks at the accurate pace even when
	fake timers are used.
1998-09-27 18:28:36 +00:00

1524 lines
34 KiB
C

/*
* Listview control
*
* Copyright 1998 Eric Kohl
*
* NOTES
* This is just a dummy control. An author is needed! Any volunteers?
* I will only improve this control once in a while.
* Eric <ekohl@abo.rhein-zeitung.de>
*
* TODO:
* - Most messages.
* - Most notifications.
*/
#include "windows.h"
#include "commctrl.h"
#include "listview.h"
#include "win.h"
#include "debug.h"
#define LISTVIEW_GetInfoPtr(wndPtr) ((LISTVIEW_INFO *)wndPtr->wExtra[0])
static VOID
LISTVIEW_Refresh (WND *wndPtr, HDC32 hdc)
{
// LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
}
// << LISTVIEW_ApproximateViewRect >>
// << LISTVIEW_Arrange >>
// << LISTVIEW_CreateDragImage >>
static LRESULT
LISTVIEW_DeleteAllItems (WND *wndPtr)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
INT32 nItem;
LISTVIEW_ITEM *lpItem;
NMLISTVIEW nmlv;
BOOL32 bNotify;
if (infoPtr->nItemCount == 0)
return TRUE;
TRACE (listview, "\n");
/* send LVN_DELETEALLITEMS notification */
ZeroMemory (&nmlv, sizeof (NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = LVN_DELETEALLITEMS;
nmlv.iItem = -1;
bNotify =
!(BOOL32)SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
nmlv.hdr.code = LVN_DELETEITEM;
for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) {
/* send notification */
if (bNotify) {
nmlv.iItem = nItem;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
}
/* get item pointer */
lpItem = (LISTVIEW_ITEM*)DPA_GetPtr (infoPtr->hdpaItems, nItem);
/* delete item strings */
if ((lpItem->pszText) && (lpItem->pszText != LPSTR_TEXTCALLBACK32A))
COMCTL32_Free (lpItem->pszText);
/* free item data */
COMCTL32_Free (lpItem);
}
DPA_DeleteAllPtrs (infoPtr->hdpaItems);
infoPtr->nItemCount = 0;
return TRUE;
}
static LRESULT
LISTVIEW_DeleteColumn (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
INT32 nColumn = (INT32)wParam;
/* FIXME ??? */
if (infoPtr->nItemCount > 0)
return FALSE;
if (!SendMessage32A (infoPtr->hwndHeader, HDM_DELETEITEM, wParam, 0))
return FALSE;
infoPtr->nColumnCount--;
FIXME (listview, "semi stub!\n");
return TRUE;
}
static LRESULT
LISTVIEW_DeleteItem (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
INT32 nItem = (INT32)wParam;
LISTVIEW_ITEM *lpItem;
NMLISTVIEW nmlv;
if ((nItem < 0) || (nItem >= infoPtr->nItemCount))
return FALSE;
TRACE (listview, "(%d)\n", nItem);
/* send notification */
ZeroMemory (&nmlv, sizeof (NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = LVN_DELETEITEM;
nmlv.iItem = nItem;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
/* remove from item array */
lpItem = (LISTVIEW_ITEM*)DPA_DeletePtr (infoPtr->hdpaItems, nItem);
/* delete item strings */
if ((lpItem->pszText) && (lpItem->pszText != LPSTR_TEXTCALLBACK32A))
COMCTL32_Free (lpItem->pszText);
/* free item data */
COMCTL32_Free (lpItem);
infoPtr->nItemCount--;
return TRUE;
}
// << LISTVIEW_EditLabel >>
// << LISTVIEW_EnsureVisible >>
// << LISTVIEW_FindItem >>
static LRESULT
LISTVIEW_GetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
return infoPtr->clrBk;
}
// << LISTVIEW_GetBkImage >>
// << LISTVIEW_GetCallbackMask >>
static LRESULT
LISTVIEW_GetColumn32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPLVCOLUMN32A lpcol = (LPLVCOLUMN32A)lParam;
INT32 nIndex = (INT32)wParam;
HDITEM32A hdi;
if (!lpcol)
return FALSE;
TRACE (listview, "(%d %p)\n", nIndex, lpcol);
ZeroMemory (&hdi, sizeof(HDITEM32A));
if (lpcol->mask & LVCF_FMT)
hdi.mask |= HDI_FORMAT;
if (lpcol->mask & LVCF_WIDTH)
hdi.mask |= HDI_WIDTH;
if (lpcol->mask & LVCF_TEXT)
hdi.mask |= (HDI_TEXT | HDI_FORMAT);
if (lpcol->mask & LVCF_IMAGE)
hdi.mask |= HDI_IMAGE;
if (lpcol->mask & LVCF_ORDER)
hdi.mask |= HDI_ORDER;
if (!SendMessage32A (infoPtr->hwndHeader, HDM_GETITEM32A,
wParam, (LPARAM)&hdi))
return FALSE;
if (lpcol->mask & LVCF_FMT) {
lpcol->fmt = 0;
if (hdi.fmt & HDF_LEFT)
lpcol->fmt |= LVCFMT_LEFT;
else if (hdi.fmt & HDF_RIGHT)
lpcol->fmt |= LVCFMT_RIGHT;
else if (hdi.fmt & HDF_CENTER)
lpcol->fmt |= LVCFMT_CENTER;
if (hdi.fmt & HDF_IMAGE)
lpcol->fmt |= LVCFMT_COL_HAS_IMAGES;
}
if (lpcol->mask & LVCF_WIDTH)
lpcol->cx = hdi.cxy;
if ((lpcol->mask & LVCF_TEXT) && (lpcol->pszText))
lstrcpyn32A (lpcol->pszText, hdi.pszText, lpcol->cchTextMax);
if (lpcol->mask & LVCF_IMAGE)
lpcol->iImage = hdi.iImage;
if (lpcol->mask & LVCF_ORDER)
lpcol->iOrder = hdi.iOrder;
return TRUE;
}
// << LISTVIEW_GetColumn32W >>
// << LISTVIEW_GetColumnOrderArray >>
__inline__ static LRESULT
LISTVIEW_GetColumnWidth (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
HDITEM32A hdi;
hdi.mask = HDI_WIDTH;
if (SendMessage32A (infoPtr->hwndHeader, HDM_GETITEM32A,
wParam, (LPARAM)&hdi))
return hdi.cxy;
return 0;
}
// << LISTVIEW_GetCountPerPage >>
// << LISTVIEW_GetEditControl >>
// << LISTVIEW_GetExtendedListviewStyle >>
__inline__ static LRESULT
LISTVIEW_GetHeader (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
return infoPtr->hwndHeader;
}
// << LISTVIEW_GetHotCursor >>
// << LISTVIEW_GetHotItem >>
// << LISTVIEW_GetHoverTime >>
static LRESULT
LISTVIEW_GetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
TRACE (listview, "(0x%08x)\n", wParam);
switch (wParam) {
case LVSIL_NORMAL:
return (LRESULT)infoPtr->himlNormal;
case LVSIL_SMALL:
return (LRESULT)infoPtr->himlSmall;
case LVSIL_STATE:
return (LRESULT)infoPtr->himlState;
}
return (LRESULT)NULL;
}
// << LISTVIEW_GetISearchString >>
static LRESULT
LISTVIEW_GetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPLVITEM32A lpItem = (LPLVITEM32A)lParam;
LISTVIEW_ITEM *lpRow, *lpSubItem;
if (!lpItem)
return FALSE;
if ((lpItem->iItem < 0) || (lpItem->iItem >= infoPtr->nItemCount))
return FALSE;
if ((lpItem->iSubItem < 0) || (lpItem->iSubItem >= infoPtr->nColumnCount))
return FALSE;
FIXME (listview, "(%d %d %p)\n",
lpItem->iItem, lpItem->iSubItem, lpItem);
lpRow = DPA_GetPtr (infoPtr->hdpaItems, lpItem->iItem);
if (!lpRow)
return FALSE;
lpSubItem = &lpRow[lpItem->iSubItem];
if (!lpSubItem)
return FALSE;
if (lpItem->mask & LVIF_STATE)
lpItem->state = lpSubItem->state & lpItem->stateMask;
if (lpItem->mask & LVIF_TEXT) {
if (lpSubItem->pszText == LPSTR_TEXTCALLBACK32A)
lpItem->pszText = LPSTR_TEXTCALLBACK32A;
else
Str_GetPtr32A (lpSubItem->pszText, lpItem->pszText,
lpItem->cchTextMax);
}
if (lpItem->mask & LVIF_IMAGE)
lpItem->iImage = lpSubItem->iImage;
if (lpItem->mask & LVIF_PARAM)
lpItem->lParam = lpSubItem->lParam;
if (lpItem->mask & LVIF_INDENT)
lpItem->iIndent = lpSubItem->iIndent;
return TRUE;
}
// << LISTVIEW_GetItem32W >>
__inline__ static LRESULT
LISTVIEW_GetItemCount (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
return infoPtr->nItemCount;
}
static LRESULT
LISTVIEW_GetItemPosition (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPPOINT32 lpPt = (LPPOINT32)lParam;
INT32 nIndex = (INT32)wParam;
if (!lpPt)
return FALSE;
if ((nIndex < 0) || (nIndex >= infoPtr->nItemCount))
return FALSE;
FIXME (listview, "returning position [0,0]!\n");
lpPt->x = 0;
lpPt->y = 0;
return TRUE;
}
// << LISTVIEW_GetItemRect >>
// << LISTVIEW_GetItemSpacing >>
// << LISTVIEW_GetItemState >>
static LRESULT
LISTVIEW_GetItemText32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPLVITEM32A lpItem = (LPLVITEM32A)lParam;
INT32 nItem = (INT32)wParam;
LISTVIEW_ITEM *lpRow, *lpSubItem;
TRACE (listview, "(%d %p)\n", nItem, lpItem);
lpRow = DPA_GetPtr (infoPtr->hdpaItems, lpItem->iItem);
if (!lpRow)
return 0;
lpSubItem = &lpRow[lpItem->iSubItem];
if (!lpSubItem)
return 0;
if (lpSubItem->pszText == LPSTR_TEXTCALLBACK32A) {
lpItem->pszText = LPSTR_TEXTCALLBACK32A;
return 0;
}
else
return Str_GetPtr32A (lpSubItem->pszText, lpItem->pszText,
lpItem->cchTextMax);
}
// << LISTVIEW_GetItemText32A >>
static LRESULT
LISTVIEW_GetNextItem (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
INT32 nStart = (INT32)wParam;
UINT32 uFlags = (UINT32)LOWORD(lParam);
FIXME (listview, "(%d, 0x%x); empty stub!\n", nStart, uFlags);
return -1;
}
// << LISTVIEW_GetNumberOfWorkAreas >>
// << LISTVIEW_GetOrigin >>
static LRESULT
LISTVIEW_GetSelectedCount (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
TRACE (listview, ": empty stub (returns 0)!\n");
return 0;
}
// << LISTVIEW_GetSelectionMark >>
static LRESULT
LISTVIEW_GetStringWidth32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPSTR lpsz = (LPSTR)lParam;
HFONT32 hFont, hOldFont;
HDC32 hdc;
SIZE32 size;
if (!lpsz)
return 0;
TRACE (listview, "(%s)\n", lpsz);
hFont = infoPtr->hFont ? infoPtr->hFont : GetStockObject32 (SYSTEM_FONT);
hdc = GetDC32 (0);
hOldFont = SelectObject32 (hdc, hFont);
GetTextExtentPoint32A (hdc, lpsz, lstrlen32A(lpsz), &size);
SelectObject32 (hdc, hOldFont);
ReleaseDC32 (0, hdc);
TRACE (listview, "-- ret=%d\n", size.cx);
return (LRESULT)size.cx;
}
__inline__ static LRESULT
LISTVIEW_GetTextBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
return infoPtr->clrTextBk;
}
__inline__ static LRESULT
LISTVIEW_GetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
return infoPtr->clrText;
}
static LRESULT
LISTVIEW_InsertColumn32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPLVCOLUMN32A lpcol = (LPLVCOLUMN32A)lParam;
INT32 nIndex = (INT32)wParam;
HDITEM32A hdi;
INT32 nResult;
if ((!lpcol) || (infoPtr->nItemCount > 0))
return -1;
FIXME (listview, "(%d %p): semi stub!\n", nIndex, lpcol);
ZeroMemory (&hdi, sizeof(HDITEM32A));
if (lpcol->mask & LVCF_FMT) {
if (nIndex == 0)
hdi.fmt |= HDF_LEFT;
else if (lpcol->fmt & LVCFMT_LEFT)
hdi.fmt |= HDF_LEFT;
else if (lpcol->fmt & LVCFMT_RIGHT)
hdi.fmt |= HDF_RIGHT;
else if (lpcol->fmt & LVCFMT_CENTER)
hdi.fmt |= HDF_CENTER;
if (lpcol->fmt & LVCFMT_COL_HAS_IMAGES)
hdi.fmt |= HDF_IMAGE;
hdi.mask |= HDI_FORMAT;
}
if (lpcol->mask & LVCF_WIDTH) {
hdi.mask |= HDI_WIDTH;
hdi.cxy = lpcol->cx;
}
if (lpcol->mask & LVCF_TEXT) {
hdi.mask |= (HDI_TEXT | HDI_FORMAT);
hdi.pszText = lpcol->pszText;
hdi.fmt |= HDF_STRING;
}
if (lpcol->mask & LVCF_IMAGE) {
hdi.mask |= HDI_IMAGE;
hdi.iImage = lpcol->iImage;
}
if (lpcol->mask & LVCF_ORDER) {
hdi.mask |= HDI_ORDER;
hdi.iOrder = lpcol->iOrder;
}
nResult = SendMessage32A (infoPtr->hwndHeader, HDM_INSERTITEM32A,
wParam, (LPARAM)&hdi);
if (nResult == -1)
return -1;
infoPtr->nColumnCount++;
return nResult;
}
// << LISTVIEW_InsertColumn32W >>
static LRESULT
LISTVIEW_InsertItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPLVITEM32A lpItem = (LPLVITEM32A)lParam;
LISTVIEW_ITEM *lpListItem;
INT32 nIndex;
NMLISTVIEW nmlv;
if (!lpItem)
return -1;
if ((!infoPtr->nColumnCount) || (lpItem->iSubItem))
return -1;
FIXME (listview, "(%d %p)\n", lpItem->iItem, lpItem);
lpListItem = (LISTVIEW_ITEM*)COMCTL32_Alloc (infoPtr->nColumnCount * sizeof(LISTVIEW_ITEM));
nIndex = DPA_InsertPtr (infoPtr->hdpaItems, lpItem->iItem, lpListItem);
if (nIndex == -1)
return -1;
if (lpItem->mask & LVIF_STATE)
lpListItem[0].state = lpItem->state;
if (lpItem->mask & LVIF_TEXT) {
if (lpItem->pszText == LPSTR_TEXTCALLBACK32A)
lpListItem[0].pszText = LPSTR_TEXTCALLBACK32A;
else
Str_SetPtr32A (&lpListItem[0].pszText, lpItem->pszText);
}
if (lpItem->mask & LVIF_IMAGE)
lpListItem[0].iImage = lpItem->iImage;
if (lpItem->mask & LVIF_PARAM)
lpListItem[0].lParam = lpItem->lParam;
if (lpItem->mask & LVIF_INDENT)
lpListItem[0].iIndent = lpItem->iIndent;
infoPtr->nItemCount++;
/* send notification */
ZeroMemory (&nmlv, sizeof (NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = LVN_INSERTITEM;
nmlv.iItem = nIndex;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
return nIndex;
}
// << LISTVIEW_InsertItem32W >>
static LRESULT
LISTVIEW_RedrawItems (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
// LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
FIXME (listview, "(%d - %d): empty stub!\n",
(INT32)wParam, (INT32)lParam);
return TRUE;
}
static LRESULT
LISTVIEW_SetBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
if (!infoPtr)
return FALSE;
/* set background color */
TRACE (listview, "0x%06lx\n", (COLORREF)lParam);
infoPtr->clrBk = (COLORREF)lParam;
return TRUE;
}
static LRESULT
LISTVIEW_SetColumn32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPLVCOLUMN32A lpcol = (LPLVCOLUMN32A)lParam;
INT32 nIndex = (INT32)wParam;
HDITEM32A hdi;
if (!lpcol)
return -1;
FIXME (listview, "(%d %p): semi stub!\n", nIndex, lpcol);
ZeroMemory (&hdi, sizeof(HDITEM32A));
if (lpcol->mask & LVCF_FMT) {
if (nIndex == 0)
hdi.fmt |= HDF_LEFT;
else if (lpcol->fmt & LVCFMT_LEFT)
hdi.fmt |= HDF_LEFT;
else if (lpcol->fmt & LVCFMT_RIGHT)
hdi.fmt |= HDF_RIGHT;
else if (lpcol->fmt & LVCFMT_CENTER)
hdi.fmt |= HDF_CENTER;
if (lpcol->fmt & LVCFMT_COL_HAS_IMAGES)
hdi.fmt |= HDF_IMAGE;
hdi.mask |= HDI_FORMAT;
}
if (lpcol->mask & LVCF_WIDTH) {
hdi.mask |= HDI_WIDTH;
hdi.cxy = lpcol->cx;
}
if (lpcol->mask & LVCF_TEXT) {
hdi.mask |= (HDI_TEXT | HDI_FORMAT);
hdi.pszText = lpcol->pszText;
hdi.fmt |= HDF_STRING;
}
if (lpcol->mask & LVCF_IMAGE) {
hdi.mask |= HDI_IMAGE;
hdi.iImage = lpcol->iImage;
}
if (lpcol->mask & LVCF_ORDER) {
hdi.mask |= HDI_ORDER;
hdi.iOrder = lpcol->iOrder;
}
return (LRESULT)SendMessage32A (infoPtr->hwndHeader, HDM_SETITEM32A,
wParam, (LPARAM)&hdi);
}
static LRESULT
LISTVIEW_SetImageList (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
HIMAGELIST himlTemp = 0;
TRACE (listview, "(0x%08x 0x%08lx)\n", wParam, lParam);
switch (wParam) {
case LVSIL_NORMAL:
himlTemp = infoPtr->himlNormal;
infoPtr->himlNormal = (HIMAGELIST)lParam;
return (LRESULT)himlTemp;
case LVSIL_SMALL:
himlTemp = infoPtr->himlSmall;
infoPtr->himlSmall = (HIMAGELIST)lParam;
return (LRESULT)himlTemp;
case LVSIL_STATE:
himlTemp = infoPtr->himlState;
infoPtr->himlState = (HIMAGELIST)lParam;
return (LRESULT)himlTemp;
}
return (LRESULT)NULL;
}
static LRESULT
LISTVIEW_SetItem32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPLVITEM32A lpItem = (LPLVITEM32A)lParam;
LISTVIEW_ITEM *lpRow, *lpSubItem;
NMLISTVIEW nmlv;
if (!lpItem)
return FALSE;
if ((lpItem->iItem < 0) || (lpItem->iItem >= infoPtr->nItemCount))
return FALSE;
if ((lpItem->iSubItem < 0) || (lpItem->iSubItem >= infoPtr->nColumnCount))
return FALSE;
/* send LVN_ITEMCHANGING notification */
ZeroMemory (&nmlv, sizeof (NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = LVN_ITEMCHANGING;
nmlv.iItem = lpItem->iItem;
nmlv.iSubItem = lpItem->iSubItem;
nmlv.uChanged = lpItem->mask;
if (!SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv))
return FALSE;
TRACE (listview, "(%d %d %p)\n",
lpItem->iItem, lpItem->iSubItem, lpItem);
lpRow = DPA_GetPtr (infoPtr->hdpaItems, lpItem->iItem);
if (!lpRow)
return FALSE;
lpSubItem = &lpRow[lpItem->iSubItem];
if (!lpSubItem)
return FALSE;
if (lpItem->mask & LVIF_STATE)
lpSubItem->state = (lpSubItem->state & lpItem->stateMask) | lpItem->state;
if (lpItem->mask & LVIF_TEXT) {
if (lpItem->pszText == LPSTR_TEXTCALLBACK32A) {
if ((lpSubItem->pszText) &&
(lpSubItem->pszText != LPSTR_TEXTCALLBACK32A))
COMCTL32_Free (lpSubItem->pszText);
lpSubItem->pszText = LPSTR_TEXTCALLBACK32A;
}
else {
if (lpSubItem->pszText == LPSTR_TEXTCALLBACK32A)
lpSubItem->pszText = NULL;
Str_SetPtr32A (&lpSubItem->pszText, lpItem->pszText);
}
}
if (lpItem->mask & LVIF_IMAGE)
lpSubItem->iImage = lpItem->iImage;
if (lpItem->mask & LVIF_PARAM)
lpSubItem->lParam = lpItem->lParam;
if (lpItem->mask & LVIF_INDENT)
lpSubItem->iIndent = lpItem->iIndent;
/* send LVN_ITEMCHANGED notification */
nmlv.hdr.code = LVN_ITEMCHANGED;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
return TRUE;
}
// << LISTVIEW_SetItem32W >>
// << LISTVIEW_SetItemCount >>
static LRESULT
LISTVIEW_SetItemPosition (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
INT32 nIndex = (INT32)wParam;
if ((nIndex < 0) || (nIndex >= infoPtr->nItemCount))
return FALSE;
FIXME (listview, "setting position [%d, %d]!\n",
(INT32)LOWORD(lParam), (INT32)HIWORD(lParam));
/* FIXME: set position */
return TRUE;
}
static LRESULT
LISTVIEW_SetTextBkColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
if (!infoPtr)
return FALSE;
/* set text background color */
TRACE (listview, "0x%06lx\n", (COLORREF)lParam);
infoPtr->clrTextBk = (COLORREF)lParam;
return TRUE;
}
static LRESULT
LISTVIEW_SetTextColor (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
if (!infoPtr)
return FALSE;
/* set text color */
TRACE (listview, "0x%06lx\n", (COLORREF)lParam);
infoPtr->clrText = (COLORREF)lParam;
return TRUE;
}
static LRESULT
LISTVIEW_SortItems (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
// LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
FIXME (listview, "empty stub!\n");
/* fake success */
return TRUE;
}
static LRESULT
LISTVIEW_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
/* info structure is created at NCCreate */
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LOGFONT32A logFont;
DWORD dwStyle = WS_CHILD | WS_VISIBLE;
TRACE (listview, "styles 0x%08lx 0x%08lx\n",
wndPtr->dwStyle, wndPtr->dwExStyle);
/* initialize info structure */
infoPtr->clrBk = CLR_NONE;
infoPtr->clrText = RGB(0, 0, 0); /* preliminary */
infoPtr->clrTextBk = RGB(255, 255, 255); /* preliminary */
if (!(wndPtr->dwStyle & LVS_REPORT) ||
(wndPtr->dwStyle & LVS_NOCOLUMNHEADER))
dwStyle |= HDS_HIDDEN;
if (!(wndPtr->dwStyle & LVS_NOSORTHEADER))
dwStyle |= HDS_BUTTONS;
/* create header */
infoPtr->hwndHeader =
CreateWindow32A (WC_HEADER32A, "", dwStyle,
0, 0, 0, 0, wndPtr->hwndSelf,
(HMENU32)0, wndPtr->hInstance, NULL);
/* get default font (icon title) */
SystemParametersInfo32A (SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
infoPtr->hDefaultFont = CreateFontIndirect32A (&logFont);
infoPtr->hFont = infoPtr->hDefaultFont;
/* set header font */
SendMessage32A (infoPtr->hwndHeader, WM_SETFONT,
(WPARAM32)infoPtr->hFont, (LPARAM)TRUE);
infoPtr->hdpaItems = DPA_Create (10);
return 0;
}
static LRESULT
LISTVIEW_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
/* delete all items */
LISTVIEW_DeleteAllItems (wndPtr);
/* destroy dpa */
DPA_Destroy (infoPtr->hdpaItems);
/* destroy header */
if (infoPtr->hwndHeader)
DestroyWindow32 (infoPtr->hwndHeader);
/* destroy font */
infoPtr->hFont = (HFONT32)0;
if (infoPtr->hDefaultFont)
DeleteObject32 (infoPtr->hDefaultFont);
return 0;
}
static LRESULT
LISTVIEW_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
if (infoPtr->clrBk == CLR_NONE) {
return SendMessage32A (GetParent32 (wndPtr->hwndSelf),
WM_ERASEBKGND, wParam, lParam);
}
else {
HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
FillRect32 ((HDC32)wParam, &infoPtr->rcList, hBrush);
DeleteObject32 (hBrush);
return FALSE;
}
return TRUE;
}
__inline__ static LRESULT
LISTVIEW_GetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
return infoPtr->hFont;
}
// << LISTVIEW_HScroll >>
// << LISTVIEW_KeyDown >>
static LRESULT
LISTVIEW_KillFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
NMHDR nmh;
FIXME (listview, "semi stub!\n");
nmh.hwndFrom = wndPtr->hwndSelf;
nmh.idFrom = wndPtr->wIDmenu;
nmh.code = NM_KILLFOCUS;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmh);
infoPtr->bFocus = FALSE;
return 0;
}
static LRESULT
LISTVIEW_LButtonDblClk (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
NMLISTVIEW nmlv;
FIXME (listview, "semi stub!\n");
ZeroMemory (&nmlv, sizeof(NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = NM_DBLCLK;
nmlv.iItem = -1;
nmlv.iSubItem = 0;
nmlv.ptAction.x = (INT32)LOWORD(lParam);
nmlv.ptAction.y = (INT32)HIWORD(lParam);
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
return 0;
}
static LRESULT
LISTVIEW_LButtonDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
NMLISTVIEW nmlv;
FIXME (listview, "semi stub!\n");
ZeroMemory (&nmlv, sizeof(NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = NM_CLICK;
nmlv.iItem = -1;
nmlv.iSubItem = 0;
nmlv.ptAction.x = (INT32)LOWORD(lParam);
nmlv.ptAction.y = (INT32)HIWORD(lParam);
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
if (!infoPtr->bFocus)
SetFocus32 (wndPtr->hwndSelf);
return 0;
}
static LRESULT
LISTVIEW_NCCreate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr;
/* allocate memory for info structure */
infoPtr = (LISTVIEW_INFO *)COMCTL32_Alloc (sizeof(LISTVIEW_INFO));
wndPtr->wExtra[0] = (DWORD)infoPtr;
if (infoPtr == NULL) {
ERR (listview, "could not allocate info memory!\n");
return 0;
}
if ((LISTVIEW_INFO*)wndPtr->wExtra[0] != infoPtr) {
ERR (listview, "pointer assignment error!\n");
return 0;
}
return DefWindowProc32A (wndPtr->hwndSelf, WM_NCCREATE, wParam, lParam);
}
static LRESULT
LISTVIEW_NCDestroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
/* free list view info data */
COMCTL32_Free (infoPtr);
return 0;
}
static LRESULT
LISTVIEW_Notify (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
LPNMHDR lpnmh = (LPNMHDR)lParam;
if (lpnmh->hwndFrom == infoPtr->hwndHeader) {
FIXME (listview, "WM_NOTIFY from header!\n");
}
else {
FIXME (listview, "WM_NOTIFY from unknown source!\n");
}
return 0;
}
static LRESULT
LISTVIEW_Paint (WND *wndPtr, WPARAM32 wParam)
{
HDC32 hdc;
PAINTSTRUCT32 ps;
hdc = wParam==0 ? BeginPaint32 (wndPtr->hwndSelf, &ps) : (HDC32)wParam;
LISTVIEW_Refresh (wndPtr, hdc);
if (!wParam)
EndPaint32 (wndPtr->hwndSelf, &ps);
return 0;
}
static LRESULT
LISTVIEW_RButtonDblClk (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
NMLISTVIEW nmlv;
FIXME (listview, "semi stub!\n");
ZeroMemory (&nmlv, sizeof(NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = NM_RDBLCLK;
nmlv.iItem = -1;
nmlv.iSubItem = 0;
nmlv.ptAction.x = (INT32)LOWORD(lParam);
nmlv.ptAction.y = (INT32)HIWORD(lParam);
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
return 0;
}
static LRESULT
LISTVIEW_RButtonDown (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
NMLISTVIEW nmlv;
FIXME (listview, "semi stub!\n");
ZeroMemory (&nmlv, sizeof(NMLISTVIEW));
nmlv.hdr.hwndFrom = wndPtr->hwndSelf;
nmlv.hdr.idFrom = wndPtr->wIDmenu;
nmlv.hdr.code = NM_RCLICK;
nmlv.iItem = -1;
nmlv.iSubItem = 0;
nmlv.ptAction.x = (INT32)LOWORD(lParam);
nmlv.ptAction.y = (INT32)HIWORD(lParam);
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmlv);
return 0;
}
static LRESULT
LISTVIEW_SetFocus (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
NMHDR nmh;
FIXME (listview, "semi stub!\n");
nmh.hwndFrom = wndPtr->hwndSelf;
nmh.idFrom = wndPtr->wIDmenu;
nmh.code = NM_SETFOCUS;
SendMessage32A (GetParent32 (wndPtr->hwndSelf), WM_NOTIFY,
(WPARAM32)wndPtr->wIDmenu, (LPARAM)&nmh);
infoPtr->bFocus = TRUE;
return 0;
}
static LRESULT
LISTVIEW_SetFont (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
HFONT32 hFont = (HFONT32)wParam;
infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont;
/* set header font */
SendMessage32A (infoPtr->hwndHeader, WM_SETFONT, wParam, lParam);
/* reinitialize the listview */
if (lParam) {
/* force redraw */
}
return 0;
}
static LRESULT
LISTVIEW_Size (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
{
LISTVIEW_INFO *infoPtr = LISTVIEW_GetInfoPtr(wndPtr);
GetClientRect32 (wndPtr->hwndSelf, &infoPtr->rcList);
if (wndPtr->dwStyle & LVS_REPORT) {
HDLAYOUT hl;
WINDOWPOS32 wp;
RECT32 rc;
rc.top = 0;
rc.left = 0;
rc.right = LOWORD(lParam);
rc.bottom = HIWORD(lParam);
hl.prc = &rc;
hl.pwpos = &wp;
SendMessage32A (infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl);
SetWindowPos32 (infoPtr->hwndHeader, wndPtr->hwndSelf,
wp.x, wp.y, wp.cx, wp.cy, wp.flags);
infoPtr->rcList.top += wp.cy;
}
return 0;
}
LRESULT WINAPI
LISTVIEW_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
{
WND *wndPtr = WIN_FindWndPtr(hwnd);
switch (uMsg)
{
// case LVM_APPROXIMATEVIEWRECT:
// case LVM_ARRANGE:
// case LVM_CREATEDRAGIMAGE:
case LVM_DELETEALLITEMS:
return LISTVIEW_DeleteAllItems (wndPtr);
case LVM_DELETECOLUMN:
return LISTVIEW_DeleteColumn (wndPtr, wParam, lParam);
case LVM_DELETEITEM:
return LISTVIEW_DeleteItem (wndPtr, wParam, lParam);
// case LVM_EDITLABEL:
// case LVM_ENSUREVISIBLE:
// case LVM_FINDITEM:
case LVM_GETBKCOLOR:
return LISTVIEW_GetBkColor (wndPtr, wParam, lParam);
// case LVM_GETBKIMAGE:
// case LVM_GETCALLBACKMASK:
case LVM_GETCOLUMN32A:
return LISTVIEW_GetColumn32A (wndPtr, wParam, lParam);
// case LVM_GETCOLUMN32W:
// case LVM_GETCOLUMNORDERARRAY:
case LVM_GETCOLUMNWIDTH:
return LISTVIEW_GetColumnWidth (wndPtr, wParam, lParam);
// case LVM_GETCOUNTPERPAGE:
// case LVM_GETEDITCONTROL:
// case LVM_GETEXTENDEDLISTVIEWSTYLE:
case LVM_GETHEADER:
return LISTVIEW_GetHeader (wndPtr, wParam, lParam);
// case LVM_GETHOTCURSOR:
// case LVM_GETHOTITEM:
// case LVM_GETHOVERTIME:
case LVM_GETIMAGELIST:
return LISTVIEW_GetImageList (wndPtr, wParam, lParam);
// case LVM_GETISEARCHSTRING:
case LVM_GETITEM32A:
return LISTVIEW_GetItem32A (wndPtr, wParam, lParam);
// case LVM_GETITEM32W:
case LVM_GETITEMCOUNT:
return LISTVIEW_GetItemCount (wndPtr, wParam, lParam);
case LVM_GETITEMPOSITION:
return LISTVIEW_GetItemPosition (wndPtr, wParam, lParam);
// case LVM_GETITEMRECT:
// case LVM_GETITEMSPACING:
// case LVM_GETITEMSTATE:
case LVM_GETITEMTEXT32A:
return LISTVIEW_GetItemText32A (wndPtr, wParam, lParam);
// case LVM_GETITEMTEXT32W:
case LVM_GETNEXTITEM:
return LISTVIEW_GetNextItem (wndPtr, wParam, lParam);
// case LVM_GETNUMBEROFWORKAREAS:
// case LVM_GETORIGIN:
case LVM_GETSELECTEDCOUNT:
return LISTVIEW_GetSelectedCount (wndPtr, wParam, lParam);
// case LVM_GETSELECTIONMARK:
case LVM_GETSTRINGWIDTH32A:
return LISTVIEW_GetStringWidth32A (wndPtr, wParam, lParam);
// case LVM_GETSTRINGWIDTH32W:
// case LVM_GETSUBITEMRECT:
case LVM_GETTEXTBKCOLOR:
return LISTVIEW_GetTextBkColor (wndPtr, wParam, lParam);
case LVM_GETTEXTCOLOR:
return LISTVIEW_GetTextColor (wndPtr, wParam, lParam);
// case LVM_GETTOOLTIPS:
// case LVM_GETTOPINDEX:
// case LVM_GETUNICODEFORMAT:
// case LVM_GETVIEWRECT:
// case LVM_GETWORKAREAS:
// case LVM_HITTEST:
case LVM_INSERTCOLUMN32A:
return LISTVIEW_InsertColumn32A (wndPtr, wParam, lParam);
// case LVM_INSERTCOLUMN32W:
case LVM_INSERTITEM32A:
return LISTVIEW_InsertItem32A (wndPtr, wParam, lParam);
// case LVM_INSERTITEM32W:
case LVM_REDRAWITEMS:
return LISTVIEW_RedrawItems (wndPtr, wParam, lParam);
// case LVM_SCROLL:
case LVM_SETBKCOLOR:
return LISTVIEW_SetBkColor (wndPtr, wParam, lParam);
// case LVM_SETBKIMAGE:
// case LVM_SETCALLBACKMASK:
case LVM_SETCOLUMN32A:
return LISTVIEW_SetColumn32A (wndPtr, wParam, lParam);
// case LVM_SETCOLUMN32W:
// case LVM_SETCOLUMNORDERARRAY:
// case LVM_SETCOLUMNWIDTH:
// case LVM_SETEXTENDEDLISTVIEWSTYLE:
// case LVM_SETHOTCURSOR:
// case LVM_SETHOTITEM:
// case LVM_SETHOVERTIME:
// case LVM_SETICONSPACING:
case LVM_SETIMAGELIST:
return LISTVIEW_SetImageList (wndPtr, wParam, lParam);
case LVM_SETITEM32A:
return LISTVIEW_SetItem32A (wndPtr, wParam, lParam);
// case LVM_SETITEM32W:
// case LVM_SETITEMCOUNT:
case LVM_SETITEMPOSITION:
return LISTVIEW_SetItemPosition (wndPtr, wParam, lParam);
// case LVM_SETITEMPOSITION32:
// case LVM_SETITEMSTATE:
// case LVM_SETITEMTEXT:
// case LVM_SETSELECTIONMARK:
case LVM_SETTEXTBKCOLOR:
return LISTVIEW_SetTextBkColor (wndPtr, wParam, lParam);
case LVM_SETTEXTCOLOR:
return LISTVIEW_SetTextColor (wndPtr, wParam, lParam);
// case LVM_SETTOOLTIPS:
// case LVM_SETUNICODEFORMAT:
// case LVM_SETWORKAREAS:
case LVM_SORTITEMS:
return LISTVIEW_SortItems (wndPtr, wParam, lParam);
// case LVM_SUBITEMHITTEST:
// case LVM_UPDATE:
// case WM_CHAR:
// case WM_COMMAND:
case WM_CREATE:
return LISTVIEW_Create (wndPtr, wParam, lParam);
case WM_DESTROY:
return LISTVIEW_Destroy (wndPtr, wParam, lParam);
case WM_ERASEBKGND:
return LISTVIEW_EraseBackground (wndPtr, wParam, lParam);
case WM_GETDLGCODE:
return DLGC_WANTTAB | DLGC_WANTARROWS;
case WM_GETFONT:
return LISTVIEW_GetFont (wndPtr, wParam, lParam);
// case WM_HSCROLL:
// case WM_KEYDOWN:
case WM_KILLFOCUS:
return LISTVIEW_KillFocus (wndPtr, wParam, lParam);
case WM_LBUTTONDBLCLK:
return LISTVIEW_LButtonDblClk (wndPtr, wParam, lParam);
case WM_LBUTTONDOWN:
return LISTVIEW_LButtonDown (wndPtr, wParam, lParam);
// case WM_MOUSEMOVE:
// return LISTVIEW_MouseMove (wndPtr, wParam, lParam);
case WM_NCCREATE:
return LISTVIEW_NCCreate (wndPtr, wParam, lParam);
case WM_NCDESTROY:
return LISTVIEW_NCDestroy (wndPtr, wParam, lParam);
case WM_NOTIFY:
return LISTVIEW_Notify (wndPtr, wParam, lParam);
case WM_PAINT:
return LISTVIEW_Paint (wndPtr, wParam);
case WM_RBUTTONDBLCLK:
return LISTVIEW_RButtonDblClk (wndPtr, wParam, lParam);
case WM_RBUTTONDOWN:
return LISTVIEW_RButtonDown (wndPtr, wParam, lParam);
case WM_SETFOCUS:
return LISTVIEW_SetFocus (wndPtr, wParam, lParam);
case WM_SETFONT:
return LISTVIEW_SetFont (wndPtr, wParam, lParam);
// case WM_SETREDRAW:
case WM_SIZE:
return LISTVIEW_Size (wndPtr, wParam, lParam);
// case WM_TIMER:
// case WM_VSCROLL:
// case WM_WINDOWPOSCHANGED:
// case WM_WININICHANGE:
default:
if (uMsg >= WM_USER)
ERR (listview, "unknown msg %04x wp=%08x lp=%08lx\n",
uMsg, wParam, lParam);
return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
}
return 0;
}
void
LISTVIEW_Register (void)
{
WNDCLASS32A wndClass;
if (GlobalFindAtom32A (WC_LISTVIEW32A)) return;
ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC32)LISTVIEW_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *);
wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);
wndClass.hbrBackground = (HBRUSH32)(COLOR_WINDOW + 1);
wndClass.lpszClassName = WC_LISTVIEW32A;
RegisterClass32A (&wndClass);
}