ReactOS 0.4.15-dev-7842-g558ab78
listview.c File Reference
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winnt.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "uxtheme.h"
#include "wine/debug.h"
Include dependency graph for listview.c:

Go to the source code of this file.

Classes

struct  tagCOLUMN_INFO
 
struct  tagITEMHDR
 
struct  tagSUBITEM_INFO
 
struct  tagITEM_INFO
 
struct  tagITEM_ID
 
struct  tagRANGE
 
struct  tagRANGES
 
struct  tagITERATOR
 
struct  tagDELAYED_ITEM_EDIT
 
struct  tagLISTVIEW_INFO
 

Macros

#define DEBUG_BUFFERS   20
 
#define DEBUG_BUFFER_SIZE   256
 
#define SB_INTERNAL   -1
 
#define DISP_TEXT_SIZE   260
 
#define WIDTH_PADDING   12
 
#define HEIGHT_PADDING   1
 
#define REPORT_MARGINX   2
 
#define ICON_TOP_PADDING_NOTHITABLE   2
 
#define ICON_TOP_PADDING_HITABLE   2
 
#define ICON_TOP_PADDING   (ICON_TOP_PADDING_NOTHITABLE + ICON_TOP_PADDING_HITABLE)
 
#define ICON_BOTTOM_PADDING   4
 
#define LABEL_HOR_PADDING   5
 
#define LABEL_VERT_PADDING   7
 
#define ICON_LR_PADDING   16
 
#define ICON_LR_HALF   (ICON_LR_PADDING/2)
 
#define DEFAULT_LABEL_WIDTH   40
 
#define MAX_EMPTYTEXT_SELECT_WIDTH   80
 
#define DEFAULT_COLUMN_WIDTH   128
 
#define LISTVIEW_SCROLL_ICON_LINE_SIZE   37
 
#define IMAGE_PADDING   2
 
#define TRAILING_LABEL_PADDING   12
 
#define TRAILING_HEADER_PADDING   11
 
#define CAPTION_BORDER   2
 
#define LV_ML_DT_FLAGS   (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
 
#define LV_FL_DT_FLAGS   (DT_TOP | DT_NOPREFIX | DT_EDITCONTROL | DT_CENTER | DT_WORDBREAK | DT_NOCLIP)
 
#define LV_SL_DT_FLAGS   (DT_VCENTER | DT_NOPREFIX | DT_EDITCONTROL | DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_END_ELLIPSIS)
 
#define STATEIMAGEINDEX(x)   (((x) & LVIS_STATEIMAGEMASK) >> 12)
 
#define KEY_DELAY   450
 
#define LISTVIEW_DUMP(iP)
 
#define ranges_check(ranges, desc)   if (TRACE_ON(listview)) ranges_assert(ranges, desc, __FILE__, __LINE__)
 
#define SCROLL_LEFT   0x1
 
#define SCROLL_RIGHT   0x2
 
#define SCROLL_UP   0x4
 
#define SCROLL_DOWN   0x8
 

Typedefs

typedef struct tagCOLUMN_INFO COLUMN_INFO
 
typedef struct tagITEMHDR ITEMHDR
 
typedef struct tagITEMHDRLPITEMHDR
 
typedef struct tagSUBITEM_INFO SUBITEM_INFO
 
typedef struct tagITEM_ID ITEM_ID
 
typedef struct tagITEM_INFO ITEM_INFO
 
typedef struct tagRANGE RANGE
 
typedef struct tagRANGESRANGES
 
typedef struct tagITERATOR ITERATOR
 
typedef struct tagDELAYED_ITEM_EDIT DELAYED_ITEM_EDIT
 
typedef struct tagLISTVIEW_INFO LISTVIEW_INFO
 

Enumerations

enum  notification_mask { NOTIFY_MASK_ITEM_CHANGE = 0x1 , NOTIFY_MASK_END_LABEL_EDIT = 0x2 , NOTIFY_MASK_UNMASK_ALL = 0xffffffff }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (listview)
 
static BOOL LISTVIEW_GetItemT (const LISTVIEW_INFO *, LPLVITEMW, BOOL)
 
static void LISTVIEW_GetItemBox (const LISTVIEW_INFO *, INT, LPRECT)
 
static void LISTVIEW_GetItemOrigin (const LISTVIEW_INFO *, INT, LPPOINT)
 
static BOOL LISTVIEW_GetItemPosition (const LISTVIEW_INFO *, INT, LPPOINT)
 
static BOOL LISTVIEW_GetItemRect (const LISTVIEW_INFO *, INT, LPRECT)
 
static void LISTVIEW_GetOrigin (const LISTVIEW_INFO *, LPPOINT)
 
static BOOL LISTVIEW_GetViewRect (const LISTVIEW_INFO *, LPRECT)
 
static void LISTVIEW_UpdateSize (LISTVIEW_INFO *)
 
static LRESULT LISTVIEW_Command (LISTVIEW_INFO *, WPARAM, LPARAM)
 
static INT LISTVIEW_GetStringWidthT (const LISTVIEW_INFO *, LPCWSTR, BOOL)
 
static BOOL LISTVIEW_KeySelection (LISTVIEW_INFO *, INT, BOOL)
 
static UINT LISTVIEW_GetItemState (const LISTVIEW_INFO *, INT, UINT)
 
static BOOL LISTVIEW_SetItemState (LISTVIEW_INFO *, INT, const LVITEMW *)
 
static LRESULT LISTVIEW_VScroll (LISTVIEW_INFO *, INT, INT)
 
static LRESULT LISTVIEW_HScroll (LISTVIEW_INFO *, INT, INT)
 
static BOOL LISTVIEW_EnsureVisible (LISTVIEW_INFO *, INT, BOOL)
 
static HIMAGELIST LISTVIEW_SetImageList (LISTVIEW_INFO *, INT, HIMAGELIST)
 
static INT LISTVIEW_HitTest (const LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL)
 
static BOOL LISTVIEW_EndEditLabelT (LISTVIEW_INFO *, BOOL, BOOL)
 
static BOOL LISTVIEW_Scroll (LISTVIEW_INFO *, INT, INT)
 
static BOOL is_text (LPCWSTR text)
 
static int textlenT (LPCWSTR text, BOOL isW)
 
static void textcpynT (LPWSTR dest, BOOL isDestW, LPCWSTR src, BOOL isSrcW, INT max)
 
static LPWSTR textdupTtoW (LPCWSTR text, BOOL isW)
 
static void textfreeT (LPWSTR wstr, BOOL isW)
 
static BOOL textsetptrT (LPWSTR *dest, LPCWSTR src, BOOL isW)
 
static int textcmpWT (LPCWSTR aw, LPCWSTR bt, BOOL isW)
 
static int lstrncmpiW (LPCWSTR s1, LPCWSTR s2, int n)
 
static LPCSTR debugtext_t (LPCWSTR text, BOOL isW)
 
static LPCSTR debugtext_tn (LPCWSTR text, BOOL isW, INT n)
 
static chardebug_getbuf (void)
 
static const chardebugrange (const RANGE *lprng)
 
static const chardebugscrollinfo (const SCROLLINFO *pScrollInfo)
 
static const chardebugnmlistview (const NMLISTVIEW *plvnm)
 
static const chardebuglvitem_t (const LVITEMW *lpLVItem, BOOL isW)
 
static const chardebuglvcolumn_t (const LVCOLUMNW *lpColumn, BOOL isW)
 
static const chardebuglvhittestinfo (const LVHITTESTINFO *lpht)
 
static LPCSTR debugscrollcode (int nScrollCode)
 
static int get_ansi_notification (UINT unicodeNotificationCode)
 
static LRESULT notify_forward_header (const LISTVIEW_INFO *infoPtr, NMHEADERW *lpnmhW)
 
static LRESULT notify_hdr (const LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
 
static BOOL notify (const LISTVIEW_INFO *infoPtr, INT code)
 
static void notify_itemactivate (const LISTVIEW_INFO *infoPtr, const LVHITTESTINFO *htInfo)
 
static LRESULT notify_listview (const LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
 
static BOOL notify_click (const LISTVIEW_INFO *infoPtr, INT code, const LVHITTESTINFO *lvht)
 
static BOOL notify_deleteitem (const LISTVIEW_INFO *infoPtr, INT nItem)
 
static BOOL notify_dispinfoT (const LISTVIEW_INFO *infoPtr, UINT code, LPNMLVDISPINFOW pdi, BOOL isW)
 
static void customdraw_fill (NMLVCUSTOMDRAW *lpnmlvcd, const LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *rcBounds, const LVITEMW *lplvItem)
 
static DWORD notify_customdraw (const LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd)
 
static void prepaint_setup (const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd, BOOL SubItem)
 
static DWORD notify_postpaint (const LISTVIEW_INFO *infoPtr, NMLVCUSTOMDRAW *lpnmlvcd)
 
static BOOL notify_measureitem (LISTVIEW_INFO *infoPtr)
 
static RANGES ranges_create (int count)
 
static void ranges_destroy (RANGES ranges)
 
static BOOL ranges_add (RANGES ranges, RANGE range)
 
static BOOL ranges_del (RANGES ranges, RANGE range)
 
static void ranges_dump (RANGES ranges)
 
static BOOL ranges_additem (RANGES ranges, INT nItem)
 
static BOOL ranges_delitem (RANGES ranges, INT nItem)
 
static BOOL iterator_next (ITERATOR *i)
 
static BOOL iterator_prev (ITERATOR *i)
 
static RANGE iterator_range (const ITERATOR *i)
 
static void iterator_destroy (const ITERATOR *i)
 
static void iterator_empty (ITERATOR *i)
 
static void iterator_rangeitems (ITERATOR *i, RANGE range)
 
static void iterator_rangesitems (ITERATOR *i, RANGES ranges)
 
static BOOL iterator_frameditems_absolute (ITERATOR *i, const LISTVIEW_INFO *infoPtr, const RECT *frame)
 
static BOOL iterator_frameditems (ITERATOR *i, const LISTVIEW_INFO *infoPtr, const RECT *lprc)
 
static BOOL iterator_visibleitems (ITERATOR *i, const LISTVIEW_INFO *infoPtr, HDC hdc)
 
static BOOL iterator_remove_common_items (ITERATOR *iter1, ITERATOR *iter2)
 
static LRESULT CallWindowProcT (WNDPROC proc, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
 
static BOOL is_autoarrange (const LISTVIEW_INFO *infoPtr)
 
static void toggle_checkbox_state (LISTVIEW_INFO *infoPtr, INT nItem)
 
static void map_style_view (LISTVIEW_INFO *infoPtr)
 
static DWORD get_next_itemid (const LISTVIEW_INFO *infoPtr)
 
static COLUMN_INFOLISTVIEW_GetColumnInfo (const LISTVIEW_INFO *infoPtr, INT nSubItem)
 
static INT LISTVIEW_CreateHeader (LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_GetHeaderRect (const LISTVIEW_INFO *infoPtr, INT nSubItem, LPRECT lprc)
 
static BOOL LISTVIEW_IsHeaderEnabled (const LISTVIEW_INFO *infoPtr)
 
static BOOL LISTVIEW_GetItemW (const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem)
 
static BOOL LISTVIEW_DrawFocusRect (const LISTVIEW_INFO *infoPtr, HDC hdc)
 
static BOOL is_redrawing (const LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_InvalidateRect (const LISTVIEW_INFO *infoPtr, const RECT *rect)
 
static void LISTVIEW_InvalidateItem (const LISTVIEW_INFO *infoPtr, INT nItem)
 
static void LISTVIEW_InvalidateSubItem (const LISTVIEW_INFO *infoPtr, INT nItem, INT nSubItem)
 
static void LISTVIEW_InvalidateList (const LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_InvalidateColumn (const LISTVIEW_INFO *infoPtr, INT nColumn)
 
static INT LISTVIEW_GetCountPerRow (const LISTVIEW_INFO *infoPtr)
 
static INT LISTVIEW_GetCountPerColumn (const LISTVIEW_INFO *infoPtr)
 
static INT LISTVIEW_ProcessLetterKeys (LISTVIEW_INFO *infoPtr, WPARAM charCode, LPARAM keyData)
 
static void LISTVIEW_UpdateHeaderSize (const LISTVIEW_INFO *infoPtr, INT nNewScrollPos)
 
static INT LISTVIEW_UpdateHScroll (LISTVIEW_INFO *infoPtr)
 
static INT LISTVIEW_UpdateVScroll (LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_UpdateScroll (LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_ShowFocusRect (const LISTVIEW_INFO *infoPtr, BOOL fShow)
 
static void LISTVIEW_InvalidateSelectedItems (const LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_GetItemMetrics (const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, LPRECT lprcBox, LPRECT lprcSelectBox, LPRECT lprcIcon, LPRECT lprcStateIcon, LPRECT lprcLabel)
 
static INT CALLBACK MapIdSearchCompare (LPVOID p1, LPVOID p2, LPARAM lParam)
 
static INT LISTVIEW_MapIdToIndex (const LISTVIEW_INFO *infoPtr, UINT iID)
 
static DWORD LISTVIEW_MapIndexToId (const LISTVIEW_INFO *infoPtr, INT iItem)
 
static void LISTVIEW_NextIconPosTop (LISTVIEW_INFO *infoPtr, LPPOINT lpPos)
 
static void LISTVIEW_NextIconPosLeft (LISTVIEW_INFO *infoPtr, LPPOINT lpPos)
 
static BOOL LISTVIEW_MoveIconTo (const LISTVIEW_INFO *infoPtr, INT nItem, const POINT *lppt, BOOL isNew)
 
static BOOL LISTVIEW_Arrange (LISTVIEW_INFO *infoPtr, INT nAlignCode)
 
static void LISTVIEW_GetAreaRect (const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
 
static SUBITEM_INFOLISTVIEW_GetSubItemPtr (HDPA hdpaSubItems, INT nSubItem)
 
static INT LISTVIEW_CalculateItemWidth (const LISTVIEW_INFO *infoPtr)
 
static INT LISTVIEW_CalculateItemHeight (const LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_UpdateItemSize (LISTVIEW_INFO *infoPtr)
 
static void LISTVIEW_SaveTextMetrics (LISTVIEW_INFO *infoPtr)
 
static INT CALLBACK ranges_cmp (LPVOID range1, LPVOID range2, LPARAM flags)
 
static void ranges_assert (RANGES ranges, LPCSTR desc, const char *file, int line)
 
static void ranges_clear (RANGES ranges)
 
static RANGES ranges_clone (RANGES ranges)
 
static RANGES ranges_diff (RANGES ranges, RANGES sub)
 
static BOOL ranges_contain (RANGES ranges, INT nItem)
 
static INT ranges_itemcount (RANGES ranges)
 
static BOOL ranges_shift (RANGES ranges, INT nItem, INT delta, INT nUpper)
 
static BOOL LISTVIEW_DeselectAllSkipItems (LISTVIEW_INFO *infoPtr, RANGES toSkip)
 
static BOOL LISTVIEW_DeselectAllSkipItem (LISTVIEW_INFO *infoPtr, INT nItem)
 
static BOOL LISTVIEW_DeselectAll (LISTVIEW_INFO *infoPtr)
 
static INT LISTVIEW_GetSelectedCount (const LISTVIEW_INFO *infoPtr)
 
static BOOL LISTVIEW_SetItemFocus (LISTVIEW_INFO *infoPtr, INT nItem)
 
static INT shift_item (const LISTVIEW_INFO *infoPtr, INT nShiftItem, INT nItem, INT direction)
 
static void LISTVIEW_ShiftFocus (LISTVIEW_INFO *infoPtr, INT focus, INT item, INT direction)
 
static void LISTVIEW_ShiftIndices (LISTVIEW_INFO *infoPtr, INT nItem, INT direction)
 
static BOOL LISTVIEW_AddGroupSelection (LISTVIEW_INFO *infoPtr, INT nItem)
 
static void LISTVIEW_SetGroupSelection (LISTVIEW_INFO *infoPtr, INT nItem)
 
static void LISTVIEW_SetSelection (LISTVIEW_INFO *infoPtr, INT nItem)
 
static BOOL LISTVIEW_GetItemAtPt (const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, POINT pt)
 
static BOOL LISTVIEW_IsHotTracking (const LISTVIEW_INFO *infoPtr)
 
static LRESULT LISTVIEW_MouseHover (LISTVIEW_INFO *infoPtr, INT x, INT y)
 
static void LISTVIEW_MarqueeHighlight (LISTVIEW_INFO *infoPtr, const POINT *coords_orig, INT scroll)
 
static VOID CALLBACK LISTVIEW_ScrollTimer (HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
 
static LRESULT LISTVIEW_MouseMove (LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)
 
static BOOL is_assignable_item (const LVITEMW *lpLVItem, LONG lStyle)
 
static BOOL set_main_item (LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isNew, BOOL isW, BOOL *bChanged)
 
static BOOL set_sub_item (const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW, BOOL *bChanged)
 
static BOOL LISTVIEW_SetItemT (LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL isW)
 
static INT LISTVIEW_GetTopIndex (const LISTVIEW_INFO *infoPtr)
 
static BOOL LISTVIEW_FillBkgnd (const LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *lprcBox)
 
static void LISTVIEW_DrawItemPart (LISTVIEW_INFO *infoPtr, LVITEMW *item, const NMLVCUSTOMDRAW *nmlvcd, const POINT *pos)
 
static BOOL LISTVIEW_DrawItem (LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERATOR *subitems, POINT pos, DWORD cdmode)
 
static void LISTVIEW_RefreshOwnerDraw (const LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
 
static void LISTVIEW_RefreshReport (LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
 
static void LISTVIEW_RefreshReportGrid (LISTVIEW_INFO *infoPtr, HDC hdc)
 
static void LISTVIEW_RefreshList (LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
 
static void LISTVIEW_Refresh (LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcErase)
 
static DWORD LISTVIEW_ApproximateViewRect (const LISTVIEW_INFO *infoPtr, INT nItemCount, WORD wWidth, WORD wHeight)
 
static LRESULT LISTVIEW_CancelEditLabel (LISTVIEW_INFO *infoPtr)
 
static HIMAGELIST LISTVIEW_CreateDragImage (LISTVIEW_INFO *infoPtr, INT iItem, LPPOINT lppt)
 
static BOOL LISTVIEW_DeleteAllItems (LISTVIEW_INFO *infoPtr, BOOL destroy)
 
static void LISTVIEW_ScrollColumns (LISTVIEW_INFO *infoPtr, INT nColumn, INT dx)
 
static BOOL LISTVIEW_DeleteColumn (LISTVIEW_INFO *infoPtr, INT nColumn)
 
static void LISTVIEW_ScrollOnInsert (LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
 
static BOOL LISTVIEW_DeleteItem (LISTVIEW_INFO *infoPtr, INT nItem)
 
static LRESULT EditLblWndProcT (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
 
static LRESULT CALLBACK EditLblWndProcW (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK EditLblWndProcA (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static HWND CreateEditLabelT (LISTVIEW_INFO *infoPtr, LPCWSTR text, BOOL isW)
 
static HWND LISTVIEW_EditLabelT (LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
 
static INT LISTVIEW_FindItemW (const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOW *lpFindInfo)
 
static INT LISTVIEW_FindItemA (const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOA *lpFindInfo)
 
static BOOL LISTVIEW_GetColumnT (const LISTVIEW_INFO *infoPtr, INT nColumn, LPLVCOLUMNW lpColumn, BOOL isW)
 
static BOOL LISTVIEW_GetColumnOrderArray (const LISTVIEW_INFO *infoPtr, INT iCount, LPINT lpiArray)
 
static INT LISTVIEW_GetColumnWidth (const LISTVIEW_INFO *infoPtr, INT nColumn)
 
static INT LISTVIEW_GetCountPerPage (const LISTVIEW_INFO *infoPtr)
 
static HIMAGELIST LISTVIEW_GetImageList (const LISTVIEW_INFO *infoPtr, INT nImageList)
 
static BOOL LISTVIEW_GetItemExtT (const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
 
static BOOL LISTVIEW_GetSubItemRect (const LISTVIEW_INFO *infoPtr, INT item, LPRECT lprc)
 
static LONG LISTVIEW_GetItemSpacing (const LISTVIEW_INFO *infoPtr, BOOL bSmall)
 
static INT LISTVIEW_GetItemTextT (const LISTVIEW_INFO *infoPtr, INT nItem, LPLVITEMW lpLVItem, BOOL isW)
 
static INT LISTVIEW_GetNextItem (const LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
 
static INT LISTVIEW_InsertItemT (LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW)
 
static BOOL LISTVIEW_IsItemVisible (const LISTVIEW_INFO *infoPtr, INT nItem)
 
static BOOL LISTVIEW_RedrawItems (const LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast)
 
static BOOL LISTVIEW_SetBkColor (LISTVIEW_INFO *infoPtr, COLORREF color)
 
static void column_fill_hditem (const LISTVIEW_INFO *infoPtr, HDITEMW *lphdi, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
 
static INT LISTVIEW_InsertColumnT (LISTVIEW_INFO *infoPtr, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
 
static BOOL LISTVIEW_SetColumnT (const LISTVIEW_INFO *infoPtr, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
 
static BOOL LISTVIEW_SetColumnOrderArray (LISTVIEW_INFO *infoPtr, INT iCount, const INT *lpiArray)
 
static BOOL LISTVIEW_SetColumnWidth (LISTVIEW_INFO *infoPtr, INT nColumn, INT cx)
 
static HIMAGELIST LISTVIEW_CreateCheckBoxIL (const LISTVIEW_INFO *infoPtr)
 
static DWORD LISTVIEW_SetExtendedListViewStyle (LISTVIEW_INFO *infoPtr, DWORD mask, DWORD ex_style)
 
static HCURSOR LISTVIEW_SetHotCursor (LISTVIEW_INFO *infoPtr, HCURSOR hCursor)
 
static INT LISTVIEW_SetHotItem (LISTVIEW_INFO *infoPtr, INT iIndex)
 
static DWORD LISTVIEW_SetHoverTime (LISTVIEW_INFO *infoPtr, DWORD dwHoverTime)
 
static DWORD LISTVIEW_SetIconSpacing (LISTVIEW_INFO *infoPtr, INT cx, INT cy)
 
static void set_icon_size (SIZE *size, HIMAGELIST himl, BOOL is_small)
 
static BOOL LISTVIEW_SetItemCount (LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFlags)
 
static BOOL LISTVIEW_SetItemPosition (LISTVIEW_INFO *infoPtr, INT nItem, const POINT *pt)
 
static BOOL LISTVIEW_SetItemTextT (LISTVIEW_INFO *infoPtr, INT nItem, const LVITEMW *lpLVItem, BOOL isW)
 
static INT LISTVIEW_SetSelectionMark (LISTVIEW_INFO *infoPtr, INT nIndex)
 
static BOOL LISTVIEW_SetTextBkColor (LISTVIEW_INFO *infoPtr, COLORREF color)
 
static BOOL LISTVIEW_SetTextColor (LISTVIEW_INFO *infoPtr, COLORREF color)
 
static HWND LISTVIEW_SetToolTips (LISTVIEW_INFO *infoPtr, HWND hwndNewToolTip)
 
static BOOL LISTVIEW_SetUnicodeFormat (LISTVIEW_INFO *infoPtr, BOOL unicode)
 
static INT LISTVIEW_SetView (LISTVIEW_INFO *infoPtr, DWORD nView)
 
static INT WINAPI LISTVIEW_CallBackCompare (LPVOID first, LPVOID second, LPARAM lParam)
 
static INT WINAPI LISTVIEW_CallBackCompareEx (LPVOID first, LPVOID second, LPARAM lParam)
 
static BOOL LISTVIEW_SortItems (LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, LPARAM lParamSort, BOOL IsEx)
 
static LRESULT LISTVIEW_ThemeChanged (const LISTVIEW_INFO *infoPtr)
 
static BOOL LISTVIEW_Update (LISTVIEW_INFO *infoPtr, INT nItem)
 
static BOOL LISTVIEW_DrawTrackLine (const LISTVIEW_INFO *infoPtr)
 
static VOID CALLBACK LISTVIEW_DelayedEditItem (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
 
static LRESULT LISTVIEW_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
 
static LRESULT LISTVIEW_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
 
static LRESULT LISTVIEW_Destroy (LISTVIEW_INFO *infoPtr)
 
static BOOL LISTVIEW_Enable (const LISTVIEW_INFO *infoPtr)
 
static BOOL LISTVIEW_EraseBkgnd (const LISTVIEW_INFO *infoPtr, HDC hdc)
 
static void scroll_list (LISTVIEW_INFO *infoPtr, INT dx, INT dy)
 
static LRESULT LISTVIEW_MouseWheel (LISTVIEW_INFO *infoPtr, INT wheelDelta)
 
static LRESULT LISTVIEW_KeyDown (LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lKeyData)
 
static LRESULT LISTVIEW_KillFocus (LISTVIEW_INFO *infoPtr)
 
static LRESULT LISTVIEW_LButtonDblClk (LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 
static LRESULT LISTVIEW_TrackMouse (const LISTVIEW_INFO *infoPtr, POINT pt)
 
static LRESULT LISTVIEW_LButtonDown (LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 
static LRESULT LISTVIEW_LButtonUp (LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 
static LRESULT LISTVIEW_NCDestroy (LISTVIEW_INFO *infoPtr)
 
static LRESULT LISTVIEW_Notify (LISTVIEW_INFO *infoPtr, NMHDR *lpnmhdr)
 
static BOOL LISTVIEW_NCPaint (const LISTVIEW_INFO *infoPtr, HRGN region)
 
static LRESULT LISTVIEW_NotifyFormat (LISTVIEW_INFO *infoPtr, HWND hwndFrom, INT nCommand)
 
static LRESULT LISTVIEW_Paint (LISTVIEW_INFO *infoPtr, HDC hdc)
 
static LRESULT LISTVIEW_WMPaint (LISTVIEW_INFO *infoPtr, HDC hdc)
 
static LRESULT LISTVIEW_PrintClient (LISTVIEW_INFO *infoPtr, HDC hdc, DWORD options)
 
static LRESULT LISTVIEW_RButtonDblClk (const LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 
static LRESULT LISTVIEW_RButtonDown (LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
 
static BOOL LISTVIEW_SetCursor (const LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT LISTVIEW_SetFocus (LISTVIEW_INFO *infoPtr, HWND hwndLoseFocus)
 
static LRESULT LISTVIEW_SetFont (LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedraw)
 
static LRESULT LISTVIEW_SetRedraw (LISTVIEW_INFO *infoPtr, BOOL redraw)
 
static LRESULT LISTVIEW_Size (LISTVIEW_INFO *infoPtr, int Width, int Height)
 
static INT LISTVIEW_StyleChanged (LISTVIEW_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
 
static INT LISTVIEW_StyleChanging (WPARAM wStyleType, STYLESTRUCT *lpss)
 
static LRESULT LISTVIEW_ShowWindow (LISTVIEW_INFO *infoPtr, WPARAM bShown, LPARAM iStatus)
 
static LRESULT LISTVIEW_GetVersion (const LISTVIEW_INFO *infoPtr)
 
static LRESULT LISTVIEW_SetVersion (LISTVIEW_INFO *infoPtr, DWORD iVersion)
 
static LRESULT WINAPI LISTVIEW_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
void LISTVIEW_Register (void)
 
void LISTVIEW_Unregister (void)
 

Variables

static const WCHAR themeClass [] = {'L','i','s','t','V','i','e','w',0}
 

Macro Definition Documentation

◆ CAPTION_BORDER

#define CAPTION_BORDER   2

Definition at line 400 of file listview.c.

◆ DEBUG_BUFFER_SIZE

#define DEBUG_BUFFER_SIZE   256

Definition at line 343 of file listview.c.

◆ DEBUG_BUFFERS

#define DEBUG_BUFFERS   20

Definition at line 341 of file listview.c.

◆ DEFAULT_COLUMN_WIDTH

#define DEFAULT_COLUMN_WIDTH   128

Definition at line 387 of file listview.c.

◆ DEFAULT_LABEL_WIDTH

#define DEFAULT_LABEL_WIDTH   40

Definition at line 382 of file listview.c.

◆ DISP_TEXT_SIZE

#define DISP_TEXT_SIZE   260

Definition at line 349 of file listview.c.

◆ HEIGHT_PADDING

#define HEIGHT_PADDING   1

Definition at line 355 of file listview.c.

◆ ICON_BOTTOM_PADDING

#define ICON_BOTTOM_PADDING   4

Definition at line 375 of file listview.c.

◆ ICON_LR_HALF

#define ICON_LR_HALF   (ICON_LR_PADDING/2)

Definition at line 379 of file listview.c.

◆ ICON_LR_PADDING

#define ICON_LR_PADDING   16

Definition at line 378 of file listview.c.

◆ ICON_TOP_PADDING

Definition at line 374 of file listview.c.

◆ ICON_TOP_PADDING_HITABLE

#define ICON_TOP_PADDING_HITABLE   2

Definition at line 373 of file listview.c.

◆ ICON_TOP_PADDING_NOTHITABLE

#define ICON_TOP_PADDING_NOTHITABLE   2

Definition at line 372 of file listview.c.

◆ IMAGE_PADDING

#define IMAGE_PADDING   2

Definition at line 393 of file listview.c.

◆ KEY_DELAY

#define KEY_DELAY   450

Definition at line 411 of file listview.c.

◆ LABEL_HOR_PADDING

#define LABEL_HOR_PADDING   5

Definition at line 376 of file listview.c.

◆ LABEL_VERT_PADDING

#define LABEL_VERT_PADDING   7

Definition at line 377 of file listview.c.

◆ LISTVIEW_DUMP

#define LISTVIEW_DUMP (   iP)
Value:
do { \
TRACE("hwndSelf=%p, clrBk=0x%06x, clrText=0x%06x, clrTextBk=0x%06x, ItemHeight=%d, ItemWidth=%d, Style=0x%08x\n", \
iP->hwndSelf, iP->clrBk, iP->clrText, iP->clrTextBk, \
iP->nItemHeight, iP->nItemWidth, iP->dwStyle); \
TRACE("hwndSelf=%p, himlNor=%p, himlSml=%p, himlState=%p, Focused=%d, Hot=%d, exStyle=0x%08x, Focus=%d\n", \
iP->hwndSelf, iP->himlNormal, iP->himlSmall, iP->himlState, \
iP->nFocusedItem, iP->nHotItem, iP->dwLvExStyle, iP->bFocus ); \
TRACE("hwndSelf=%p, ntmH=%d, icSz.cx=%d, icSz.cy=%d, icSp.cx=%d, icSp.cy=%d, notifyFmt=%d\n", \
iP->hwndSelf, iP->ntmHeight, iP->iconSize.cx, iP->iconSize.cy, \
iP->iconSpacing.cx, iP->iconSpacing.cy, iP->notifyFormat); \
TRACE("hwndSelf=%p, rcList=%s\n", iP->hwndSelf, wine_dbgstr_rect(&iP->rcList)); \
} while(0)
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160

Definition at line 414 of file listview.c.

◆ LISTVIEW_SCROLL_ICON_LINE_SIZE

#define LISTVIEW_SCROLL_ICON_LINE_SIZE   37

Definition at line 390 of file listview.c.

◆ LV_FL_DT_FLAGS

Definition at line 404 of file listview.c.

◆ LV_ML_DT_FLAGS

Definition at line 403 of file listview.c.

◆ LV_SL_DT_FLAGS

Definition at line 405 of file listview.c.

◆ MAX_EMPTYTEXT_SELECT_WIDTH

#define MAX_EMPTYTEXT_SELECT_WIDTH   80

Definition at line 384 of file listview.c.

◆ ranges_check

#define ranges_check (   ranges,
  desc 
)    if (TRACE_ON(listview)) ranges_assert(ranges, desc, __FILE__, __LINE__)

Definition at line 3199 of file listview.c.

◆ REPORT_MARGINX

#define REPORT_MARGINX   2

Definition at line 358 of file listview.c.

◆ SB_INTERNAL

#define SB_INTERNAL   -1

Definition at line 346 of file listview.c.

◆ SCROLL_DOWN

#define SCROLL_DOWN   0x8

Definition at line 3933 of file listview.c.

◆ SCROLL_LEFT

#define SCROLL_LEFT   0x1

Definition at line 3930 of file listview.c.

◆ SCROLL_RIGHT

#define SCROLL_RIGHT   0x2

Definition at line 3931 of file listview.c.

◆ SCROLL_UP

#define SCROLL_UP   0x4

Definition at line 3932 of file listview.c.

◆ STATEIMAGEINDEX

#define STATEIMAGEINDEX (   x)    (((x) & LVIS_STATEIMAGEMASK) >> 12)

Definition at line 408 of file listview.c.

◆ TRAILING_HEADER_PADDING

#define TRAILING_HEADER_PADDING   11

Definition at line 397 of file listview.c.

◆ TRAILING_LABEL_PADDING

#define TRAILING_LABEL_PADDING   12

Definition at line 396 of file listview.c.

◆ WIDTH_PADDING

#define WIDTH_PADDING   12

Definition at line 352 of file listview.c.

Typedef Documentation

◆ COLUMN_INFO

◆ DELAYED_ITEM_EDIT

◆ ITEM_ID

Definition at line 167 of file listview.c.

◆ ITEM_INFO

◆ ITEMHDR

◆ ITERATOR

◆ LISTVIEW_INFO

◆ LPITEMHDR

◆ RANGE

◆ RANGES

typedef struct tagRANGES * RANGES

◆ SUBITEM_INFO

Enumeration Type Documentation

◆ notification_mask

Enumerator
NOTIFY_MASK_ITEM_CHANGE 
NOTIFY_MASK_END_LABEL_EDIT 
NOTIFY_MASK_UNMASK_ALL 

Definition at line 210 of file listview.c.

211{
214 NOTIFY_MASK_UNMASK_ALL = 0xffffffff
215};
@ NOTIFY_MASK_UNMASK_ALL
Definition: listview.c:214
@ NOTIFY_MASK_ITEM_CHANGE
Definition: listview.c:212
@ NOTIFY_MASK_END_LABEL_EDIT
Definition: listview.c:213

Function Documentation

◆ CallWindowProcT()

static LRESULT CallWindowProcT ( WNDPROC  proc,
HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  isW 
)
inlinestatic

Definition at line 1581 of file listview.c.

1583{
1584 if (isW) return CallWindowProcW(proc, hwnd, uMsg, wParam, lParam);
1585 else return CallWindowProcA(proc, hwnd, uMsg, wParam, lParam);
1586}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static HANDLE proc()
Definition: pdb.c:34
static const WCHAR isW[]
Definition: lex.c:62
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by EditLblWndProcT().

◆ column_fill_hditem()

static void column_fill_hditem ( const LISTVIEW_INFO infoPtr,
HDITEMW lphdi,
INT  nColumn,
const LVCOLUMNW lpColumn,
BOOL  isW 
)
static

Definition at line 8225 of file listview.c.

8227{
8228 if (lpColumn->mask & LVCF_FMT)
8229 {
8230 /* format member is valid */
8231 lphdi->mask |= HDI_FORMAT;
8232
8233 /* set text alignment (leftmost column must be left-aligned) */
8234 if (nColumn == 0 || (lpColumn->fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT)
8235 lphdi->fmt |= HDF_LEFT;
8236 else if ((lpColumn->fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT)
8237 lphdi->fmt |= HDF_RIGHT;
8238 else if ((lpColumn->fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_CENTER)
8239 lphdi->fmt |= HDF_CENTER;
8240
8241 if (lpColumn->fmt & LVCFMT_BITMAP_ON_RIGHT)
8242 lphdi->fmt |= HDF_BITMAP_ON_RIGHT;
8243
8244 if (lpColumn->fmt & LVCFMT_COL_HAS_IMAGES)
8245 {
8246 lphdi->fmt |= HDF_IMAGE;
8247 lphdi->iImage = I_IMAGECALLBACK;
8248 }
8249
8250 if (lpColumn->fmt & LVCFMT_FIXED_WIDTH)
8251 lphdi->fmt |= HDF_FIXEDWIDTH;
8252 }
8253
8254 if (lpColumn->mask & LVCF_WIDTH)
8255 {
8256 lphdi->mask |= HDI_WIDTH;
8257 if(lpColumn->cx == LVSCW_AUTOSIZE_USEHEADER)
8258 {
8259 /* make it fill the remainder of the controls width */
8260 RECT rcHeader;
8261 INT item_index;
8262
8263 for(item_index = 0; item_index < (nColumn - 1); item_index++)
8264 {
8265 LISTVIEW_GetHeaderRect(infoPtr, item_index, &rcHeader);
8266 lphdi->cxy += rcHeader.right - rcHeader.left;
8267 }
8268
8269 /* retrieve the layout of the header */
8270 GetClientRect(infoPtr->hwndSelf, &rcHeader);
8271 TRACE("start cxy=%d rcHeader=%s\n", lphdi->cxy, wine_dbgstr_rect(&rcHeader));
8272
8273 lphdi->cxy = (rcHeader.right - rcHeader.left) - lphdi->cxy;
8274 }
8275 else
8276 lphdi->cxy = lpColumn->cx;
8277 }
8278
8279 if (lpColumn->mask & LVCF_TEXT)
8280 {
8281 lphdi->mask |= HDI_TEXT | HDI_FORMAT;
8282 lphdi->fmt |= HDF_STRING;
8283 lphdi->pszText = lpColumn->pszText;
8284 lphdi->cchTextMax = textlenT(lpColumn->pszText, isW);
8285 }
8286
8287 if (lpColumn->mask & LVCF_IMAGE)
8288 {
8289 lphdi->mask |= HDI_IMAGE;
8290 lphdi->iImage = lpColumn->iImage;
8291 }
8292
8293 if (lpColumn->mask & LVCF_ORDER)
8294 {
8295 lphdi->mask |= HDI_ORDER;
8296 lphdi->iOrder = lpColumn->iOrder;
8297 }
8298}
static void LISTVIEW_GetHeaderRect(const LISTVIEW_INFO *infoPtr, INT nSubItem, LPRECT lprc)
Definition: listview.c:1701
static int textlenT(LPCWSTR text, BOOL isW)
Definition: listview.c:468
#define LVCF_ORDER
Definition: commctrl.h:2591
#define I_IMAGECALLBACK
Definition: commctrl.h:2385
#define HDF_LEFT
Definition: commctrl.h:713
#define LVCFMT_COL_HAS_IMAGES
Definition: commctrl.h:2604
#define HDI_TEXT
Definition: commctrl.h:704
#define LVCFMT_CENTER
Definition: commctrl.h:2600
#define HDF_CENTER
Definition: commctrl.h:715
#define LVCF_IMAGE
Definition: commctrl.h:2590
#define HDF_RIGHT
Definition: commctrl.h:714
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define HDF_IMAGE
Definition: commctrl.h:723
#define LVCFMT_BITMAP_ON_RIGHT
Definition: commctrl.h:2603
#define HDI_WIDTH
Definition: commctrl.h:702
#define HDF_BITMAP_ON_RIGHT
Definition: commctrl.h:722
#define HDF_STRING
Definition: commctrl.h:720
#define LVCFMT_JUSTIFYMASK
Definition: commctrl.h:2601
#define HDI_FORMAT
Definition: commctrl.h:705
#define LVCF_FMT
Definition: commctrl.h:2586
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define LVCFMT_RIGHT
Definition: commctrl.h:2599
#define HDI_IMAGE
Definition: commctrl.h:708
#define LVSCW_AUTOSIZE_USEHEADER
Definition: commctrl.h:2645
#define LVCF_TEXT
Definition: commctrl.h:2588
#define HDI_ORDER
Definition: commctrl.h:710
#define TRACE(s)
Definition: solgame.cpp:4
UINT mask
Definition: commctrl.h:684
int iImage
Definition: commctrl.h:691
int iOrder
Definition: commctrl.h:692
int fmt
Definition: commctrl.h:689
int cxy
Definition: commctrl.h:685
LPWSTR pszText
Definition: commctrl.h:686
int cchTextMax
Definition: commctrl.h:688
LPWSTR pszText
Definition: commctrl.h:2567
LONG right
Definition: windef.h:308
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetColumnT().

◆ CreateEditLabelT()

static HWND CreateEditLabelT ( LISTVIEW_INFO infoPtr,
LPCWSTR  text,
BOOL  isW 
)
static

Definition at line 6196 of file listview.c.

6197{
6200 HWND hedit;
6201
6202 TRACE("(%p, text=%s, isW=%d)\n", infoPtr, debugtext_t(text, isW), isW);
6203
6204 /* window will be resized and positioned after LVN_BEGINLABELEDIT */
6205 if (isW)
6206 hedit = CreateWindowW(WC_EDITW, text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
6207 else
6208 hedit = CreateWindowA(WC_EDITA, (LPCSTR)text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
6209
6210 if (!hedit) return 0;
6211
6212 infoPtr->EditWndProc = (WNDPROC)
6215
6216 SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE);
6218
6219 return hedit;
6220}
Arabic default style
Definition: afstyles.h:94
#define FALSE
Definition: types.h:117
static LPCSTR debugtext_t(LPCWSTR text, BOOL isW)
Definition: listview.c:554
static LRESULT CALLBACK EditLblWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6162
#define DISP_TEXT_SIZE
Definition: listview.c:349
static LRESULT CALLBACK EditLblWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6179
const WCHAR * text
Definition: package.c:1799
unsigned long DWORD
Definition: ntddk_ex.h:95
static HINSTANCE hinst
Definition: edit.c:551
#define WS_BORDER
Definition: pedump.c:625
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CHILDWINDOW
Definition: pedump.c:639
#define ES_LEFT
Definition: pedump.c:664
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WC_EDITW
Definition: commctrl.h:4687
#define WC_EDITA
Definition: commctrl.h:4686
WNDPROC EditWndProc
Definition: listview.c:267
#define GWLP_WNDPROC
Definition: treelist.c:66
HANDLE HINSTANCE
Definition: typedefs.h:77
uint32_t DWORD_PTR
Definition: typedefs.h:65
UINT_PTR WPARAM
Definition: windef.h:207
#define SetWindowLongPtrA
Definition: winuser.h:5345
#define GetWindowLongPtrW
Definition: winuser.h:4829
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
#define GWLP_HINSTANCE
Definition: winuser.h:856
#define EM_SETLIMITTEXT
Definition: winuser.h:2011
#define WM_SETFONT
Definition: winuser.h:1650
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define SetWindowLongPtrW
Definition: winuser.h:5346
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by LISTVIEW_EditLabelT().

◆ customdraw_fill()

static void customdraw_fill ( NMLVCUSTOMDRAW lpnmlvcd,
const LISTVIEW_INFO infoPtr,
HDC  hdc,
const RECT rcBounds,
const LVITEMW lplvItem 
)
static

Definition at line 1035 of file listview.c.

1037{
1038 ZeroMemory(lpnmlvcd, sizeof(NMLVCUSTOMDRAW));
1039 lpnmlvcd->nmcd.hdc = hdc;
1040 lpnmlvcd->nmcd.rc = *rcBounds;
1041 lpnmlvcd->clrTextBk = infoPtr->clrTextBk;
1042 lpnmlvcd->clrText = infoPtr->clrText;
1043 if (!lplvItem) return;
1044 lpnmlvcd->nmcd.dwItemSpec = lplvItem->iItem + 1;
1045 lpnmlvcd->iSubItem = lplvItem->iSubItem;
1046 if (lplvItem->state & LVIS_SELECTED) lpnmlvcd->nmcd.uItemState |= CDIS_SELECTED;
1047 if (lplvItem->state & LVIS_FOCUSED) lpnmlvcd->nmcd.uItemState |= CDIS_FOCUS;
1048 if (lplvItem->iItem == infoPtr->nHotItem) lpnmlvcd->nmcd.uItemState |= CDIS_HOT;
1049 lpnmlvcd->nmcd.lItemlParam = lplvItem->lParam;
1050}
HDC hdc
Definition: main.c:9
#define CDIS_SELECTED
Definition: commctrl.h:291
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define CDIS_FOCUS
Definition: commctrl.h:295
#define CDIS_HOT
Definition: commctrl.h:297
#define LVIS_FOCUSED
Definition: commctrl.h:2318
COLORREF clrTextBk
Definition: listview.c:301
COLORREF clrText
Definition: listview.c:300
int iSubItem
Definition: commctrl.h:2362
UINT state
Definition: commctrl.h:2363
LPARAM lParam
Definition: commctrl.h:2368
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
COLORREF clrTextBk
Definition: commctrl.h:3064
NMCUSTOMDRAW nmcd
Definition: commctrl.h:3062
COLORREF clrText
Definition: commctrl.h:3063
#define ZeroMemory
Definition: winbase.h:1712

Referenced by LISTVIEW_DrawItem(), LISTVIEW_Refresh(), and LISTVIEW_RefreshOwnerDraw().

◆ debug_getbuf()

static char * debug_getbuf ( void  )
static

Definition at line 567 of file listview.c.

568{
569 static int index = 0;
571 return buffers[index++ % DEBUG_BUFFERS];
572}
#define DEBUG_BUFFERS
Definition: listview.c:341
#define DEBUG_BUFFER_SIZE
Definition: listview.c:343
GLuint index
Definition: glext.h:6031
const GLuint * buffers
Definition: glext.h:5916

Referenced by debuglvcolumn_t(), debuglvitem_t(), and debugscrollinfo().

◆ debuglvcolumn_t()

static const char * debuglvcolumn_t ( const LVCOLUMNW lpColumn,
BOOL  isW 
)
static

Definition at line 668 of file listview.c.

669{
670 char* buf = debug_getbuf(), *text = buf;
672
673 if (lpColumn == NULL) return "(null)";
674 len = snprintf(buf, size, "{");
675 if (len == -1) goto end;
676 buf += len; size -= len;
677 if (lpColumn->mask & LVCF_SUBITEM)
678 len = snprintf(buf, size, "iSubItem=%d, ", lpColumn->iSubItem);
679 else len = 0;
680 if (len == -1) goto end;
681 buf += len; size -= len;
682 if (lpColumn->mask & LVCF_FMT)
683 len = snprintf(buf, size, "fmt=%x, ", lpColumn->fmt);
684 else len = 0;
685 if (len == -1) goto end;
686 buf += len; size -= len;
687 if (lpColumn->mask & LVCF_WIDTH)
688 len = snprintf(buf, size, "cx=%d, ", lpColumn->cx);
689 else len = 0;
690 if (len == -1) goto end;
691 buf += len; size -= len;
692 if (lpColumn->mask & LVCF_TEXT)
693 len = snprintf(buf, size, "pszText=%s, cchTextMax=%d, ", debugtext_tn(lpColumn->pszText, isW, 80), lpColumn->cchTextMax);
694 else len = 0;
695 if (len == -1) goto end;
696 buf += len; size -= len;
697 if (lpColumn->mask & LVCF_IMAGE)
698 len = snprintf(buf, size, "iImage=%d, ", lpColumn->iImage);
699 else len = 0;
700 if (len == -1) goto end;
701 buf += len; size -= len;
702 if (lpColumn->mask & LVCF_ORDER)
703 len = snprintf(buf, size, "iOrder=%d, ", lpColumn->iOrder);
704 else len = 0;
705 if (len == -1) goto end;
706 buf += len;
707 goto undo;
708end:
709 buf = text + strlen(text);
710undo:
711 if (buf - text > 2) { buf[-2] = '}'; buf[-1] = 0; }
712 return text;
713}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define NULL
Definition: types.h:112
static LPCSTR debugtext_tn(LPCWSTR text, BOOL isW, INT n)
Definition: listview.c:560
static char * debug_getbuf(void)
Definition: listview.c:567
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define LVCF_SUBITEM
Definition: commctrl.h:2589
int cchTextMax
Definition: commctrl.h:2568
#define snprintf
Definition: wintirpc.h:48

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetColumnT().

◆ debuglvhittestinfo()

static const char * debuglvhittestinfo ( const LVHITTESTINFO lpht)
static

Definition at line 715 of file listview.c.

716{
717 if (!lpht) return "(null)";
718
719 return wine_dbg_sprintf("{pt=%s, flags=0x%x, iItem=%d, iSubItem=%d}",
720 wine_dbgstr_point(&lpht->pt), lpht->flags, lpht->iItem, lpht->iSubItem);
721}
static const char * wine_dbgstr_point(const POINT *ppt)
Definition: atltest.h:138
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296

Referenced by notify_click().

◆ debuglvitem_t()

static const char * debuglvitem_t ( const LVITEMW lpLVItem,
BOOL  isW 
)
static

Definition at line 626 of file listview.c.

627{
628 char* buf = debug_getbuf(), *text = buf;
630
631 if (lpLVItem == NULL) return "(null)";
632 len = snprintf(buf, size, "{iItem=%d, iSubItem=%d, ", lpLVItem->iItem, lpLVItem->iSubItem);
633 if (len == -1) goto end;
634 buf += len; size -= len;
635 if (lpLVItem->mask & LVIF_STATE)
636 len = snprintf(buf, size, "state=%x, stateMask=%x, ", lpLVItem->state, lpLVItem->stateMask);
637 else len = 0;
638 if (len == -1) goto end;
639 buf += len; size -= len;
640 if (lpLVItem->mask & LVIF_TEXT)
641 len = snprintf(buf, size, "pszText=%s, cchTextMax=%d, ", debugtext_tn(lpLVItem->pszText, isW, 80), lpLVItem->cchTextMax);
642 else len = 0;
643 if (len == -1) goto end;
644 buf += len; size -= len;
645 if (lpLVItem->mask & LVIF_IMAGE)
646 len = snprintf(buf, size, "iImage=%d, ", lpLVItem->iImage);
647 else len = 0;
648 if (len == -1) goto end;
649 buf += len; size -= len;
650 if (lpLVItem->mask & LVIF_PARAM)
651 len = snprintf(buf, size, "lParam=%lx, ", lpLVItem->lParam);
652 else len = 0;
653 if (len == -1) goto end;
654 buf += len; size -= len;
655 if (lpLVItem->mask & LVIF_INDENT)
656 len = snprintf(buf, size, "iIndent=%d, ", lpLVItem->iIndent);
657 else len = 0;
658 if (len == -1) goto end;
659 buf += len;
660 goto undo;
661end:
662 buf = text + strlen(text);
663undo:
664 if (buf - text > 2) { buf[-2] = '}'; buf[-1] = 0; }
665 return text;
666}
#define LVIF_STATE
Definition: commctrl.h:2312
#define LVIF_INDENT
Definition: commctrl.h:2313
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LVIF_IMAGE
Definition: commctrl.h:2310
LPWSTR pszText
Definition: commctrl.h:2365
int cchTextMax
Definition: commctrl.h:2366
UINT mask
Definition: commctrl.h:2360
UINT stateMask
Definition: commctrl.h:2364
int iImage
Definition: commctrl.h:2367
int iIndent
Definition: commctrl.h:2369

Referenced by LISTVIEW_DrawItem(), LISTVIEW_GetItemMetrics(), LISTVIEW_GetItemT(), LISTVIEW_InsertItemT(), LISTVIEW_RefreshOwnerDraw(), LISTVIEW_SetItemState(), LISTVIEW_SetItemT(), LISTVIEW_SetItemTextT(), and notify_dispinfoT().

◆ debugnmlistview()

static const char * debugnmlistview ( const NMLISTVIEW plvnm)
static

Definition at line 617 of file listview.c.

618{
619 if (!plvnm) return "(null)";
620 return wine_dbg_sprintf("iItem=%d, iSubItem=%d, uNewState=0x%x,"
621 " uOldState=0x%x, uChanged=0x%x, ptAction=%s, lParam=%ld",
622 plvnm->iItem, plvnm->iSubItem, plvnm->uNewState, plvnm->uOldState,
623 plvnm->uChanged, wine_dbgstr_point(&plvnm->ptAction), plvnm->lParam);
624}
POINT ptAction
Definition: commctrl.h:3039
UINT uNewState
Definition: commctrl.h:3036
LPARAM lParam
Definition: commctrl.h:3040
UINT uOldState
Definition: commctrl.h:3037

Referenced by notify_listview().

◆ debugrange()

static const char * debugrange ( const RANGE lprng)
inlinestatic

Definition at line 574 of file listview.c.

575{
576 if (!lprng) return "(null)";
577 return wine_dbg_sprintf("[%d, %d]", lprng->lower, lprng->upper);
578}

Referenced by iterator_frameditems_absolute(), ranges_add(), ranges_cmp(), ranges_del(), and ranges_dump().

◆ debugscrollcode()

static LPCSTR debugscrollcode ( int  nScrollCode)
inlinestatic

Definition at line 724 of file listview.c.

725{
726 switch(nScrollCode)
727 {
728 case SB_LINELEFT: return "SB_LINELEFT";
729 case SB_LINERIGHT: return "SB_LINERIGHT";
730 case SB_PAGELEFT: return "SB_PAGELEFT";
731 case SB_PAGERIGHT: return "SB_PAGERIGHT";
732 case SB_THUMBPOSITION: return "SB_THUMBPOSITION";
733 case SB_THUMBTRACK: return "SB_THUMBTRACK";
734 case SB_ENDSCROLL: return "SB_ENDSCROLL";
735 case SB_INTERNAL: return "SB_INTERNAL";
736 default: return "unknown";
737 }
738}
#define SB_INTERNAL
Definition: listview.c:346
#define SB_THUMBTRACK
Definition: winuser.h:573
#define SB_PAGERIGHT
Definition: winuser.h:571
#define SB_LINERIGHT
Definition: winuser.h:567
#define SB_LINELEFT
Definition: winuser.h:566
#define SB_ENDSCROLL
Definition: winuser.h:574
#define SB_PAGELEFT
Definition: winuser.h:570
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by LISTVIEW_HScroll(), and LISTVIEW_VScroll().

◆ debugscrollinfo()

static const char * debugscrollinfo ( const SCROLLINFO pScrollInfo)
static

Definition at line 580 of file listview.c.

581{
582 char* buf = debug_getbuf(), *text = buf;
584
585 if (pScrollInfo == NULL) return "(null)";
586 len = snprintf(buf, size, "{cbSize=%u, ", pScrollInfo->cbSize);
587 if (len == -1) goto end;
588 buf += len; size -= len;
589 if (pScrollInfo->fMask & SIF_RANGE)
590 len = snprintf(buf, size, "nMin=%d, nMax=%d, ", pScrollInfo->nMin, pScrollInfo->nMax);
591 else len = 0;
592 if (len == -1) goto end;
593 buf += len; size -= len;
594 if (pScrollInfo->fMask & SIF_PAGE)
595 len = snprintf(buf, size, "nPage=%u, ", pScrollInfo->nPage);
596 else len = 0;
597 if (len == -1) goto end;
598 buf += len; size -= len;
599 if (pScrollInfo->fMask & SIF_POS)
600 len = snprintf(buf, size, "nPos=%d, ", pScrollInfo->nPos);
601 else len = 0;
602 if (len == -1) goto end;
603 buf += len; size -= len;
604 if (pScrollInfo->fMask & SIF_TRACKPOS)
605 len = snprintf(buf, size, "nTrackPos=%d, ", pScrollInfo->nTrackPos);
606 else len = 0;
607 if (len == -1) goto end;
608 buf += len;
609 goto undo;
610end:
611 buf = text + strlen(text);
612undo:
613 if (buf - text > 2) { buf[-2] = '}'; buf[-1] = 0; }
614 return text;
615}
#define SIF_RANGE
Definition: winuser.h:1235
#define SIF_PAGE
Definition: winuser.h:1233
#define SIF_TRACKPOS
Definition: winuser.h:1237
#define SIF_POS
Definition: winuser.h:1234

Referenced by LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateVScroll().

◆ debugtext_t()

static LPCSTR debugtext_t ( LPCWSTR  text,
BOOL  isW 
)
inlinestatic

Definition at line 554 of file listview.c.

555{
556 if (text == LPSTR_TEXTCALLBACKW) return "(callback)";
557 return isW ? debugstr_w(text) : debugstr_a((LPCSTR)text);
558}
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2380

Referenced by CreateEditLabelT(), LISTVIEW_EditLabelT(), and LISTVIEW_EndEditLabelT().

◆ debugtext_tn()

static LPCSTR debugtext_tn ( LPCWSTR  text,
BOOL  isW,
INT  n 
)
inlinestatic

Definition at line 560 of file listview.c.

561{
562 if (text == LPSTR_TEXTCALLBACKW) return "(callback)";
563 n = min(textlenT(text, isW), n);
564 return isW ? debugstr_wn(text, n) : debugstr_an((LPCSTR)text, n);
565}
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
GLdouble n
Definition: glext.h:7729
#define debugstr_wn
Definition: kernel32.h:33
#define min(a, b)
Definition: monoChain.cc:55

Referenced by debuglvcolumn_t(), and debuglvitem_t().

◆ EditLblWndProcA()

static LRESULT CALLBACK EditLblWndProcA ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6179 of file listview.c.

6180{
6181 return EditLblWndProcT(hwnd, uMsg, wParam, lParam, FALSE);
6182}
static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
Definition: listview.c:6108

Referenced by CreateEditLabelT().

◆ EditLblWndProcT()

static LRESULT EditLblWndProcT ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  isW 
)
static

Definition at line 6108 of file listview.c.

6109{
6111 BOOL save = TRUE;
6112
6113 TRACE("(hwnd=%p, uMsg=%x, wParam=%lx, lParam=%lx, isW=%d)\n",
6114 hwnd, uMsg, wParam, lParam, isW);
6115
6116 switch (uMsg)
6117 {
6118 case WM_GETDLGCODE:
6120
6121 case WM_DESTROY:
6122 {
6123 WNDPROC editProc = infoPtr->EditWndProc;
6124 infoPtr->EditWndProc = 0;
6126 return CallWindowProcT(editProc, hwnd, uMsg, wParam, lParam, isW);
6127 }
6128
6129 case WM_KEYDOWN:
6130 if (VK_ESCAPE == (INT)wParam)
6131 {
6132 save = FALSE;
6133 break;
6134 }
6135 else if (VK_RETURN == (INT)wParam)
6136 break;
6137
6138 default:
6139 return CallWindowProcT(infoPtr->EditWndProc, hwnd, uMsg, wParam, lParam, isW);
6140 }
6141
6142 /* kill the edit */
6143 if (infoPtr->hwndEdit)
6144 LISTVIEW_EndEditLabelT(infoPtr, save, isW);
6145
6146 SendMessageW(hwnd, WM_CLOSE, 0, 0);
6147 return 0;
6148}
#define TRUE
Definition: types.h:120
static LRESULT CallWindowProcT(WNDPROC proc, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
Definition: listview.c:1581
static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *, BOOL, BOOL)
Definition: listview.c:5989
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_CLOSE
Definition: winuser.h:1621
#define DLGC_WANTALLKEYS
Definition: winuser.h:2612
#define VK_RETURN
Definition: winuser.h:2201
#define DLGC_WANTARROWS
Definition: winuser.h:2610
HWND WINAPI GetParent(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1609
#define WM_KEYDOWN
Definition: winuser.h:1715
#define VK_ESCAPE
Definition: winuser.h:2214
#define WM_GETDLGCODE
Definition: winuser.h:1689

Referenced by EditLblWndProcA(), and EditLblWndProcW().

◆ EditLblWndProcW()

static LRESULT CALLBACK EditLblWndProcW ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6162 of file listview.c.

6163{
6164 return EditLblWndProcT(hwnd, uMsg, wParam, lParam, TRUE);
6165}

Referenced by CreateEditLabelT().

◆ get_ansi_notification()

static int get_ansi_notification ( UINT  unicodeNotificationCode)
static

Definition at line 743 of file listview.c.

744{
745 switch (unicodeNotificationCode)
746 {
751 case LVN_GETDISPINFOA:
753 case LVN_SETDISPINFOA:
755 case LVN_ODFINDITEMA:
756 case LVN_ODFINDITEMW: return LVN_ODFINDITEMA;
757 case LVN_GETINFOTIPA:
758 case LVN_GETINFOTIPW: return LVN_GETINFOTIPA;
759 /* header forwards */
760 case HDN_TRACKA:
761 case HDN_TRACKW: return HDN_TRACKA;
762 case HDN_ENDTRACKA:
763 case HDN_ENDTRACKW: return HDN_ENDTRACKA;
764 case HDN_BEGINDRAG: return HDN_BEGINDRAG;
765 case HDN_ENDDRAG: return HDN_ENDDRAG;
768 case HDN_ITEMCHANGEDA:
770 case HDN_ITEMCLICKA:
771 case HDN_ITEMCLICKW: return HDN_ITEMCLICKA;
774 default: break;
775 }
776 FIXME("unknown notification %x\n", unicodeNotificationCode);
777 return unicodeNotificationCode;
778}
#define FIXME(fmt,...)
Definition: debug.h:111
#define LVN_GETDISPINFOA
Definition: commctrl.h:3153
#define LVN_ODFINDITEMW
Definition: commctrl.h:3145
#define HDN_ITEMCHANGEDW
Definition: commctrl.h:840
#define LVN_GETINFOTIPA
Definition: commctrl.h:3222
#define LVN_SETDISPINFOW
Definition: commctrl.h:3156
#define LVN_GETINFOTIPW
Definition: commctrl.h:3223
#define HDN_BEGINDRAG
Definition: commctrl.h:855
#define HDN_ENDTRACKW
Definition: commctrl.h:850
#define HDN_ITEMCHANGINGA
Definition: commctrl.h:837
#define LVN_BEGINLABELEDITA
Definition: commctrl.h:3135
#define HDN_ITEMCLICKA
Definition: commctrl.h:841
#define HDN_ENDTRACKA
Definition: commctrl.h:849
#define HDN_TRACKW
Definition: commctrl.h:852
#define HDN_ENDDRAG
Definition: commctrl.h:856
#define LVN_ENDLABELEDITW
Definition: commctrl.h:3138
#define LVN_SETDISPINFOA
Definition: commctrl.h:3155
#define LVN_BEGINLABELEDITW
Definition: commctrl.h:3136
#define HDN_ITEMCHANGINGW
Definition: commctrl.h:838
#define LVN_ENDLABELEDITA
Definition: commctrl.h:3137
#define HDN_DIVIDERDBLCLICKW
Definition: commctrl.h:846
#define LVN_ODFINDITEMA
Definition: commctrl.h:3144
#define LVN_GETDISPINFOW
Definition: commctrl.h:3154
#define HDN_TRACKA
Definition: commctrl.h:851
#define HDN_ITEMCHANGEDA
Definition: commctrl.h:839
#define HDN_ITEMCLICKW
Definition: commctrl.h:842
#define HDN_DIVIDERDBLCLICKA
Definition: commctrl.h:845

Referenced by notify_dispinfoT(), and notify_forward_header().

◆ get_next_itemid()

static DWORD get_next_itemid ( const LISTVIEW_INFO infoPtr)
static

Definition at line 1628 of file listview.c.

1629{
1631
1632 if (count > 0)
1633 {
1634 ITEM_ID *lpID = DPA_GetPtr(infoPtr->hdpaItemIds, count - 1);
1635 return lpID->id + 1;
1636 }
1637 return 0;
1638}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define DPA_GetPtrCount(hdpa)
Definition: commctrl.h:4955
#define DPA_GetPtr
Definition: commctrl.h:5
UINT id
Definition: listview.c:180

Referenced by LISTVIEW_InsertItemT().

◆ is_assignable_item()

static BOOL is_assignable_item ( const LVITEMW lpLVItem,
LONG  lStyle 
)
inlinestatic

Definition at line 4278 of file listview.c.

4279{
4280 if ( (lpLVItem->mask & LVIF_TEXT) &&
4281 (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) &&
4282 (lStyle & (LVS_SORTASCENDING | LVS_SORTDESCENDING)) ) return FALSE;
4283
4284 return TRUE;
4285}
#define LVS_SORTASCENDING
Definition: commctrl.h:2268
#define LVS_SORTDESCENDING
Definition: commctrl.h:2269

Referenced by LISTVIEW_InsertItemT(), and LISTVIEW_SetItemT().

◆ is_autoarrange()

static BOOL is_autoarrange ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1588 of file listview.c.

1589{
1590 return (infoPtr->dwStyle & LVS_AUTOARRANGE) &&
1591 (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON);
1592}
#define LV_VIEW_SMALLICON
Definition: commctrl.h:2842
#define LV_VIEW_ICON
Definition: commctrl.h:2840
#define LVS_AUTOARRANGE
Definition: commctrl.h:2272

Referenced by LISTVIEW_GetNextItem(), LISTVIEW_ScrollOnInsert(), LISTVIEW_SetItemPosition(), LISTVIEW_SetRedraw(), LISTVIEW_Size(), and LISTVIEW_Update().

◆ is_redrawing()

◆ is_text()

◆ iterator_destroy()

static void iterator_destroy ( const ITERATOR i)
inlinestatic

Definition at line 1309 of file listview.c.

1310{
1311 ranges_destroy(i->ranges);
1312}
static void ranges_destroy(RANGES ranges)
Definition: listview.c:3245
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by LISTVIEW_DeselectAllSkipItems(), LISTVIEW_HitTest(), LISTVIEW_InvalidateSelectedItems(), LISTVIEW_MarqueeHighlight(), LISTVIEW_Refresh(), LISTVIEW_RefreshReport(), LISTVIEW_RefreshReportGrid(), and LISTVIEW_SetGroupSelection().

◆ iterator_empty()

static void iterator_empty ( ITERATOR i)
inlinestatic

Definition at line 1317 of file listview.c.

1318{
1319 ZeroMemory(i, sizeof(*i));
1320 i->nItem = i->nSpecial = i->range.lower = i->range.upper = -1;
1321}

Referenced by iterator_frameditems_absolute(), iterator_rangeitems(), iterator_rangesitems(), and iterator_visibleitems().

◆ iterator_frameditems()

static BOOL iterator_frameditems ( ITERATOR i,
const LISTVIEW_INFO infoPtr,
const RECT lprc 
)
static

Definition at line 1446 of file listview.c.

1447{
1448 RECT frame = *lprc;
1449 POINT Origin;
1450
1451 TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc));
1452
1453 LISTVIEW_GetOrigin(infoPtr, &Origin);
1454 OffsetRect(&frame, -Origin.x, -Origin.y);
1455
1456 return iterator_frameditems_absolute(i, infoPtr, &frame);
1457}
static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *, LPPOINT)
Definition: listview.c:7665
static BOOL iterator_frameditems_absolute(ITERATOR *i, const LISTVIEW_INFO *infoPtr, const RECT *frame)
Definition: listview.c:1347
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4466
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by iterator_visibleitems(), LISTVIEW_HitTest(), LISTVIEW_InvalidateSelectedItems(), and LISTVIEW_SetGroupSelection().

◆ iterator_frameditems_absolute()

static BOOL iterator_frameditems_absolute ( ITERATOR i,
const LISTVIEW_INFO infoPtr,
const RECT frame 
)
static

Definition at line 1347 of file listview.c.

1348{
1349 RECT rcItem, rcTemp;
1350 RANGES ranges;
1351
1352 TRACE("(frame=%s)\n", wine_dbgstr_rect(frame));
1353
1354 /* in case we fail, we want to return an empty iterator */
1356
1357 if (infoPtr->nItemCount == 0)
1358 return TRUE;
1359
1360 if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)
1361 {
1362 INT nItem;
1363
1364 if (infoPtr->uView == LV_VIEW_ICON && infoPtr->nFocusedItem != -1)
1365 {
1366 LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcItem);
1367 if (IntersectRect(&rcTemp, &rcItem, frame))
1368 i->nSpecial = infoPtr->nFocusedItem;
1369 }
1370 if (!(ranges = ranges_create(50))) return FALSE;
1371 iterator_rangesitems(i, ranges);
1372 /* to do better here, we need to have PosX, and PosY sorted */
1373 TRACE("building icon ranges:\n");
1374 for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
1375 {
1376 rcItem.left = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
1377 rcItem.top = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
1378 rcItem.right = rcItem.left + infoPtr->nItemWidth;
1379 rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
1380 if (IntersectRect(&rcTemp, &rcItem, frame))
1381 ranges_additem(i->ranges, nItem);
1382 }
1383 return TRUE;
1384 }
1385 else if (infoPtr->uView == LV_VIEW_DETAILS)
1386 {
1387 RANGE range;
1388
1389 if (frame->left >= infoPtr->nItemWidth) return TRUE;
1390 if (frame->top >= infoPtr->nItemHeight * infoPtr->nItemCount) return TRUE;
1391
1392 range.lower = max(frame->top / infoPtr->nItemHeight, 0);
1393 range.upper = min((frame->bottom - 1) / infoPtr->nItemHeight, infoPtr->nItemCount - 1) + 1;
1394 if (range.upper <= range.lower) return TRUE;
1396 TRACE(" report=%s\n", debugrange(&i->range));
1397 }
1398 else
1399 {
1400 INT nPerCol = max((infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight, 1);
1401 INT nFirstRow = max(frame->top / infoPtr->nItemHeight, 0);
1402 INT nLastRow = min((frame->bottom - 1) / infoPtr->nItemHeight, nPerCol - 1);
1403 INT nFirstCol;
1404 INT nLastCol;
1405 INT lower;
1406 RANGE item_range;
1407 INT nCol;
1408
1409 if (infoPtr->nItemWidth)
1410 {
1411 nFirstCol = max(frame->left / infoPtr->nItemWidth, 0);
1412 nLastCol = min((frame->right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
1413 }
1414 else
1415 {
1416 nFirstCol = max(frame->left, 0);
1417 nLastCol = min(frame->right - 1, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
1418 }
1419
1420 lower = nFirstCol * nPerCol + nFirstRow;
1421
1422 TRACE("nPerCol=%d, nFirstRow=%d, nLastRow=%d, nFirstCol=%d, nLastCol=%d, lower=%d\n",
1423 nPerCol, nFirstRow, nLastRow, nFirstCol, nLastCol, lower);
1424
1425 if (nLastCol < nFirstCol || nLastRow < nFirstRow) return TRUE;
1426
1427 if (!(ranges = ranges_create(nLastCol - nFirstCol + 1))) return FALSE;
1428 iterator_rangesitems(i, ranges);
1429 TRACE("building list ranges:\n");
1430 for (nCol = nFirstCol; nCol <= nLastCol; nCol++)
1431 {
1432 item_range.lower = nCol * nPerCol + nFirstRow;
1433 if(item_range.lower >= infoPtr->nItemCount) break;
1434 item_range.upper = min(nCol * nPerCol + nLastRow + 1, infoPtr->nItemCount);
1435 TRACE(" list=%s\n", debugrange(&item_range));
1436 ranges_add(i->ranges, item_range);
1437 }
1438 }
1439
1440 return TRUE;
1441}
static void iterator_rangeitems(ITERATOR *i, RANGE range)
Definition: listview.c:1326
static RANGES ranges_create(int count)
Definition: listview.c:3225
static BOOL ranges_add(RANGES ranges, RANGE range)
Definition: listview.c:3338
static BOOL ranges_additem(RANGES ranges, INT nItem)
Definition: listview.c:1139
static void iterator_empty(ITERATOR *i)
Definition: listview.c:1317
static void iterator_rangesitems(ITERATOR *i, RANGES ranges)
Definition: listview.c:1337
static const char * debugrange(const RANGE *lprng)
Definition: listview.c:574
static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *, INT, LPRECT)
Definition: listview.c:2616
GLenum GLint * range
Definition: glext.h:7539
#define LV_VIEW_DETAILS
Definition: commctrl.h:2841
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
#define max(a, b)
Definition: svc.c:63
#define LONG_PTR
Definition: treelist.c:79
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)

Referenced by iterator_frameditems(), and LISTVIEW_MarqueeHighlight().

◆ iterator_next()

static BOOL iterator_next ( ITERATOR i)
inlinestatic

Definition at line 1214 of file listview.c.

1215{
1216 if (i->nItem == -1)
1217 {
1218 i->nItem = i->nSpecial;
1219 if (i->nItem != -1) return TRUE;
1220 }
1221 if (i->nItem == i->nSpecial)
1222 {
1223 if (i->ranges) i->index = 0;
1224 goto pickarange;
1225 }
1226
1227 i->nItem++;
1228testitem:
1229 if (i->nItem == i->nSpecial) i->nItem++;
1230 if (i->nItem < i->range.upper) return TRUE;
1231
1232pickarange:
1233 if (i->ranges)
1234 {
1235 if (i->index < DPA_GetPtrCount(i->ranges->hdpa))
1236 i->range = *(RANGE*)DPA_GetPtr(i->ranges->hdpa, i->index++);
1237 else goto end;
1238 }
1239 else if (i->nItem >= i->range.upper) goto end;
1240
1241 i->nItem = i->range.lower;
1242 if (i->nItem >= 0) goto testitem;
1243end:
1244 i->nItem = -1;
1245 return FALSE;
1246}

Referenced by iterator_remove_common_items(), iterator_visibleitems(), LISTVIEW_DeselectAllSkipItems(), LISTVIEW_DrawItem(), LISTVIEW_HitTest(), LISTVIEW_InvalidateSelectedItems(), LISTVIEW_MarqueeHighlight(), LISTVIEW_RefreshOwnerDraw(), LISTVIEW_RefreshReport(), LISTVIEW_RefreshReportGrid(), and LISTVIEW_SetGroupSelection().

◆ iterator_prev()

static BOOL iterator_prev ( ITERATOR i)
inlinestatic

Definition at line 1254 of file listview.c.

1255{
1256 BOOL start = FALSE;
1257
1258 if (i->nItem == -1)
1259 {
1260 start = TRUE;
1261 if (i->ranges) i->index = DPA_GetPtrCount(i->ranges->hdpa);
1262 goto pickarange;
1263 }
1264 if (i->nItem == i->nSpecial)
1265 {
1266 i->nItem = -1;
1267 return FALSE;
1268 }
1269
1270testitem:
1271 i->nItem--;
1272 if (i->nItem == i->nSpecial) i->nItem--;
1273 if (i->nItem >= i->range.lower) return TRUE;
1274
1275pickarange:
1276 if (i->ranges)
1277 {
1278 if (i->index > 0)
1279 i->range = *(RANGE*)DPA_GetPtr(i->ranges->hdpa, --i->index);
1280 else goto end;
1281 }
1282 else if (!start && i->nItem < i->range.lower) goto end;
1283
1284 i->nItem = i->range.upper;
1285 if (i->nItem > 0) goto testitem;
1286end:
1287 return (i->nItem = i->nSpecial) != -1;
1288}
GLuint start
Definition: gl.h:1545

Referenced by iterator_remove_common_items(), and LISTVIEW_RefreshList().

◆ iterator_range()

static RANGE iterator_range ( const ITERATOR i)
static

Definition at line 1290 of file listview.c.

1291{
1292 RANGE range;
1293
1294 if (!i->ranges) return i->range;
1295
1296 if (DPA_GetPtrCount(i->ranges->hdpa) > 0)
1297 {
1298 range.lower = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, 0)).lower;
1299 range.upper = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, DPA_GetPtrCount(i->ranges->hdpa) - 1)).upper;
1300 }
1301 else range.lower = range.upper = 0;
1302
1303 return range;
1304}

Referenced by LISTVIEW_Refresh().

◆ iterator_rangeitems()

static void iterator_rangeitems ( ITERATOR i,
RANGE  range 
)
inlinestatic

Definition at line 1326 of file listview.c.

1327{
1329 i->range = range;
1330}

Referenced by iterator_frameditems_absolute().

◆ iterator_rangesitems()

static void iterator_rangesitems ( ITERATOR i,
RANGES  ranges 
)
inlinestatic

◆ iterator_remove_common_items()

static BOOL iterator_remove_common_items ( ITERATOR iter1,
ITERATOR iter2 
)
static

Definition at line 1517 of file listview.c.

1518{
1519 if(!iter1->ranges || !iter2->ranges) {
1520 int lower, upper;
1521
1522 if(iter1->ranges || iter2->ranges ||
1523 (iter1->range.lower<iter2->range.lower && iter1->range.upper>iter2->range.upper) ||
1524 (iter1->range.lower>iter2->range.lower && iter1->range.upper<iter2->range.upper)) {
1525 ERR("result is not a one range iterator\n");
1526 return FALSE;
1527 }
1528
1529 if(iter1->range.lower==-1 || iter2->range.lower==-1)
1530 return TRUE;
1531
1532 lower = iter1->range.lower;
1533 upper = iter1->range.upper;
1534
1535 if(lower < iter2->range.lower)
1536 iter1->range.upper = iter2->range.lower;
1537 else if(upper > iter2->range.upper)
1538 iter1->range.lower = iter2->range.upper;
1539 else
1540 iter1->range.lower = iter1->range.upper = -1;
1541
1542 if(iter2->range.lower < lower)
1543 iter2->range.upper = lower;
1544 else if(iter2->range.upper > upper)
1545 iter2->range.lower = upper;
1546 else
1547 iter2->range.lower = iter2->range.upper = -1;
1548
1549 return TRUE;
1550 }
1551
1552 iterator_next(iter1);
1553 iterator_next(iter2);
1554
1555 while(1) {
1556 if(iter1->nItem==-1 || iter2->nItem==-1)
1557 break;
1558
1559 if(iter1->nItem == iter2->nItem) {
1560 int delete = iter1->nItem;
1561
1562 iterator_prev(iter1);
1563 iterator_prev(iter2);
1564 ranges_delitem(iter1->ranges, delete);
1565 ranges_delitem(iter2->ranges, delete);
1566 iterator_next(iter1);
1567 iterator_next(iter2);
1568 } else if(iter1->nItem > iter2->nItem)
1569 iterator_next(iter2);
1570 else
1571 iterator_next(iter1);
1572 }
1573
1574 iter1->nItem = iter1->range.lower = iter1->range.upper = -1;
1575 iter2->nItem = iter2->range.lower = iter2->range.upper = -1;
1576 return TRUE;
1577}
#define ERR(fmt,...)
Definition: debug.h:110
static BOOL iterator_next(ITERATOR *i)
Definition: listview.c:1214
static BOOL ranges_delitem(RANGES ranges, INT nItem)
Definition: listview.c:1146
static BOOL iterator_prev(ITERATOR *i)
Definition: listview.c:1254
RANGES ranges
Definition: listview.c:200
RANGE range
Definition: listview.c:199
INT upper
Definition: listview.c:187
INT lower
Definition: listview.c:186

Referenced by LISTVIEW_MarqueeHighlight().

◆ iterator_visibleitems()

static BOOL iterator_visibleitems ( ITERATOR i,
const LISTVIEW_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 1462 of file listview.c.

1463{
1464 POINT Origin, Position;
1465 RECT rcItem, rcClip;
1466 INT rgntype;
1467
1468 rgntype = GetClipBox(hdc, &rcClip);
1469 if (rgntype == NULLREGION)
1470 {
1472 return TRUE;
1473 }
1474 if (!iterator_frameditems(i, infoPtr, &rcClip)) return FALSE;
1475 if (rgntype == SIMPLEREGION) return TRUE;
1476
1477 /* first deal with the special item */
1478 if (i->nSpecial != -1)
1479 {
1480 LISTVIEW_GetItemBox(infoPtr, i->nSpecial, &rcItem);
1481 if (!RectVisible(hdc, &rcItem)) i->nSpecial = -1;
1482 }
1483
1484 /* if we can't deal with the region, we'll just go with the simple range */
1485 LISTVIEW_GetOrigin(infoPtr, &Origin);
1486 TRACE("building visible range:\n");
1487 if (!i->ranges && i->range.lower < i->range.upper)
1488 {
1489 if (!(i->ranges = ranges_create(50))) return TRUE;
1490 if (!ranges_add(i->ranges, i->range))
1491 {
1492 ranges_destroy(i->ranges);
1493 i->ranges = 0;
1494 return TRUE;
1495 }
1496 }
1497
1498 /* now delete the invisible items from the list */
1499 while(iterator_next(i))
1500 {
1501 LISTVIEW_GetItemOrigin(infoPtr, i->nItem, &Position);
1502 rcItem.left = (infoPtr->uView == LV_VIEW_DETAILS) ? Origin.x : Position.x + Origin.x;
1503 rcItem.top = Position.y + Origin.y;
1504 rcItem.right = rcItem.left + infoPtr->nItemWidth;
1505 rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
1506 if (!RectVisible(hdc, &rcItem))
1507 ranges_delitem(i->ranges, i->nItem);
1508 }
1509 /* the iterator should restart on the next iterator_next */
1510 TRACE("done\n");
1511
1512 return TRUE;
1513}
static BOOL iterator_frameditems(ITERATOR *i, const LISTVIEW_INFO *infoPtr, const RECT *lprc)
Definition: listview.c:1446
static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *, INT, LPPOINT)
Definition: listview.c:2307
if(dx< 0)
Definition: linetemp.h:194
static COORD Position
Definition: mouse.c:34
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
#define NULLREGION
Definition: wingdi.h:361
BOOL WINAPI RectVisible(_In_ HDC, _In_ LPCRECT)
#define SIMPLEREGION
Definition: wingdi.h:362

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_AddGroupSelection()

static BOOL LISTVIEW_AddGroupSelection ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

DESCRIPTION: Adds a block of selections.

PARAMETER(S): [I] infoPtr : valid pointer to the listview structure [I] nItem : item index

RETURN: Whether the window is still valid.

Definition at line 3663 of file listview.c.

3664{
3665 INT nFirst = min(infoPtr->nSelectionMark, nItem);
3666 INT nLast = max(infoPtr->nSelectionMark, nItem);
3667 HWND hwndSelf = infoPtr->hwndSelf;
3668 NMLVODSTATECHANGE nmlv;
3669 DWORD old_mask;
3670 LVITEMW item;
3671 INT i;
3672
3673 /* Temporarily disable change notification
3674 * If the control is LVS_OWNERDATA, we need to send
3675 * only one LVN_ODSTATECHANGED notification.
3676 * See MSDN documentation for LVN_ITEMCHANGED.
3677 */
3678 old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE;
3679 if (infoPtr->dwStyle & LVS_OWNERDATA)
3680 infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE;
3681
3682 if (nFirst == -1) nFirst = nItem;
3683
3684 item.state = LVIS_SELECTED;
3685 item.stateMask = LVIS_SELECTED;
3686
3687 for (i = nFirst; i <= nLast; i++)
3688 LISTVIEW_SetItemState(infoPtr,i,&item);
3689
3690 ZeroMemory(&nmlv, sizeof(nmlv));
3691 nmlv.iFrom = nFirst;
3692 nmlv.iTo = nLast;
3693 nmlv.uOldState = 0;
3694 nmlv.uNewState = item.state;
3695
3696 notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv);
3697 if (!IsWindow(hwndSelf))
3698 return FALSE;
3699 infoPtr->notify_mask |= old_mask;
3700 return TRUE;
3701}
static LRESULT notify_hdr(const LISTVIEW_INFO *infoPtr, INT code, LPNMHDR pnmh)
Definition: listview.c:832
static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *, INT, const LVITEMW *)
Definition: listview.c:9131
static ATOM item
Definition: dde.c:856
#define LVS_OWNERDATA
Definition: commctrl.h:2274
#define LVN_ODSTATECHANGED
Definition: commctrl.h:3148
DWORD notify_mask
Definition: listview.c:231
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by LISTVIEW_LButtonDown().

◆ LISTVIEW_ApproximateViewRect()

static DWORD LISTVIEW_ApproximateViewRect ( const LISTVIEW_INFO infoPtr,
INT  nItemCount,
WORD  wWidth,
WORD  wHeight 
)
static

Definition at line 5412 of file listview.c.

5414{
5415 DWORD dwViewRect = 0;
5416
5417 if (nItemCount == -1)
5418 nItemCount = infoPtr->nItemCount;
5419
5420 if (infoPtr->uView == LV_VIEW_LIST)
5421 {
5422 INT nItemCountPerColumn = 1;
5423 INT nColumnCount = 0;
5424
5425 if (wHeight == 0xFFFF)
5426 {
5427 /* use current height */
5428 wHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
5429 }
5430
5431 if (wHeight < infoPtr->nItemHeight)
5432 wHeight = infoPtr->nItemHeight;
5433
5434 if (nItemCount > 0)
5435 {
5436 if (infoPtr->nItemHeight > 0)
5437 {
5438 nItemCountPerColumn = wHeight / infoPtr->nItemHeight;
5439 if (nItemCountPerColumn == 0)
5440 nItemCountPerColumn = 1;
5441
5442 if (nItemCount % nItemCountPerColumn != 0)
5443 nColumnCount = nItemCount / nItemCountPerColumn;
5444 else
5445 nColumnCount = nItemCount / nItemCountPerColumn + 1;
5446 }
5447 }
5448
5449 /* Microsoft padding magic */
5450 wHeight = nItemCountPerColumn * infoPtr->nItemHeight + 2;
5451 wWidth = nColumnCount * infoPtr->nItemWidth + 2;
5452
5453 dwViewRect = MAKELONG(wWidth, wHeight);
5454 }
5455 else if (infoPtr->uView == LV_VIEW_DETAILS)
5456 {
5457 RECT rcBox;
5458
5459 if (infoPtr->nItemCount > 0)
5460 {
5461 LISTVIEW_GetItemBox(infoPtr, 0, &rcBox);
5462 wWidth = rcBox.right - rcBox.left;
5463 wHeight = (rcBox.bottom - rcBox.top) * nItemCount;
5464 }
5465 else
5466 {
5467 /* use current height and width */
5468 if (wHeight == 0xffff)
5469 wHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
5470 if (wWidth == 0xffff)
5471 wWidth = infoPtr->rcList.right - infoPtr->rcList.left;
5472 }
5473
5474 dwViewRect = MAKELONG(wWidth, wHeight);
5475 }
5476 else if (infoPtr->uView == LV_VIEW_ICON)
5477 {
5478 UINT rows,cols;
5479 UINT nItemWidth;
5480 UINT nItemHeight;
5481
5482 nItemWidth = infoPtr->iconSpacing.cx;
5483 nItemHeight = infoPtr->iconSpacing.cy;
5484
5485 if (wWidth == 0xffff)
5486 wWidth = infoPtr->rcList.right - infoPtr->rcList.left;
5487
5488 if (wWidth < nItemWidth)
5489 wWidth = nItemWidth;
5490
5491 cols = wWidth / nItemWidth;
5492 if (cols > nItemCount)
5493 cols = nItemCount;
5494 if (cols < 1)
5495 cols = 1;
5496
5497 if (nItemCount)
5498 {
5499 rows = nItemCount / cols;
5500 if (nItemCount % cols)
5501 rows++;
5502 }
5503 else
5504 rows = 0;
5505
5506 wHeight = (nItemHeight * rows)+2;
5507 wWidth = (nItemWidth * cols)+2;
5508
5509 dwViewRect = MAKELONG(wWidth, wHeight);
5510 }
5511 else if (infoPtr->uView == LV_VIEW_SMALLICON)
5512 FIXME("uView == LV_VIEW_SMALLICON: not implemented\n");
5513
5514 return dwViewRect;
5515}
unsigned int UINT
Definition: ndis.h:50
#define LV_VIEW_LIST
Definition: commctrl.h:2843
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
#define MAKELONG(a, b)
Definition: typedefs.h:249

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Arrange()

static BOOL LISTVIEW_Arrange ( LISTVIEW_INFO infoPtr,
INT  nAlignCode 
)
static

Definition at line 2872 of file listview.c.

2873{
2874#ifdef __REACTOS__
2875 void (*next_pos)(LISTVIEW_INFO *, LPPOINT, INT);
2876#else
2877 void (*next_pos)(LISTVIEW_INFO *, LPPOINT);
2878#endif
2879 POINT pos;
2880 INT i;
2881
2882 if (infoPtr->uView != LV_VIEW_ICON && infoPtr->uView != LV_VIEW_SMALLICON) return FALSE;
2883
2884 TRACE("nAlignCode=%d\n", nAlignCode);
2885
2886 if (nAlignCode == LVA_DEFAULT)
2887 {
2888 if (infoPtr->dwStyle & LVS_ALIGNLEFT) nAlignCode = LVA_ALIGNLEFT;
2889 else nAlignCode = LVA_ALIGNTOP;
2890 }
2891
2892 switch (nAlignCode)
2893 {
2894 case LVA_ALIGNLEFT: next_pos = LISTVIEW_NextIconPosLeft; break;
2895 case LVA_ALIGNTOP: next_pos = LISTVIEW_NextIconPosTop; break;
2896#ifdef __REACTOS__
2897 case LVA_SNAPTOGRID: next_pos = LISTVIEW_NextIconPosSnap; break;
2898#else
2899 case LVA_SNAPTOGRID: next_pos = LISTVIEW_NextIconPosTop; break; /* FIXME */
2900#endif
2901 default: return FALSE;
2902 }
2903
2904 infoPtr->currIconPos.x = infoPtr->currIconPos.y = 0;
2905 for (i = 0; i < infoPtr->nItemCount; i++)
2906 {
2907#ifdef __REACTOS__
2908 next_pos(infoPtr, &pos, i);
2909#else
2910 next_pos(infoPtr, &pos);
2911#endif
2912 LISTVIEW_MoveIconTo(infoPtr, i, &pos, FALSE);
2913 }
2914
2915 return TRUE;
2916}
static void LISTVIEW_NextIconPosLeft(LISTVIEW_INFO *infoPtr, LPPOINT lpPos)
Definition: listview.c:2769
static BOOL LISTVIEW_MoveIconTo(const LISTVIEW_INFO *infoPtr, INT nItem, const POINT *lppt, BOOL isNew)
Definition: listview.c:2837
static void LISTVIEW_NextIconPosTop(LISTVIEW_INFO *infoPtr, LPPOINT lpPos)
Definition: listview.c:2738
#define INT
Definition: polytest.cpp:20
#define LVA_DEFAULT
Definition: commctrl.h:2527
#define LVA_ALIGNLEFT
Definition: commctrl.h:2528
#define LVA_ALIGNTOP
Definition: commctrl.h:2529
#define LVA_SNAPTOGRID
Definition: commctrl.h:2530
#define LVS_ALIGNLEFT
Definition: commctrl.h:2280
POINT currIconPos
Definition: listview.c:279
#define LPPOINT
Definition: precomp.h:31

Referenced by LISTVIEW_DeleteAllItems(), LISTVIEW_Paint(), LISTVIEW_ScrollOnInsert(), LISTVIEW_SetExtendedListViewStyle(), LISTVIEW_SetRedraw(), LISTVIEW_SetView(), LISTVIEW_Size(), LISTVIEW_StyleChanged(), LISTVIEW_Update(), and LISTVIEW_WindowProc().

◆ LISTVIEW_CalculateItemHeight()

static INT LISTVIEW_CalculateItemHeight ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3097 of file listview.c.

3098{
3099 INT nItemHeight;
3100
3101 TRACE("uView=%d\n", infoPtr->uView);
3102
3103 if (infoPtr->uView == LV_VIEW_ICON)
3104 nItemHeight = infoPtr->iconSpacing.cy;
3105 else
3106 {
3107 nItemHeight = infoPtr->ntmHeight;
3108 if (infoPtr->himlState)
3109 nItemHeight = max(nItemHeight, infoPtr->iconStateSize.cy);
3110 if (infoPtr->himlSmall)
3111 nItemHeight = max(nItemHeight, infoPtr->iconSize.cy);
3112 nItemHeight += HEIGHT_PADDING;
3113 if (infoPtr->nMeasureItemHeight > 0)
3114 nItemHeight = infoPtr->nMeasureItemHeight;
3115 }
3116
3117 return max(nItemHeight, 1);
3118}
#define HEIGHT_PADDING
Definition: listview.c:355
HIMAGELIST himlSmall
Definition: listview.c:273
SIZE iconStateSize
Definition: listview.c:278
INT nMeasureItemHeight
Definition: listview.c:330
HIMAGELIST himlState
Definition: listview.c:274

Referenced by LISTVIEW_RefreshReportGrid(), LISTVIEW_SetFont(), LISTVIEW_SetImageList(), and LISTVIEW_UpdateItemSize().

◆ LISTVIEW_CalculateItemWidth()

static INT LISTVIEW_CalculateItemWidth ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3037 of file listview.c.

3038{
3039 INT nItemWidth = 0;
3040
3041 TRACE("uView=%d\n", infoPtr->uView);
3042
3043 if (infoPtr->uView == LV_VIEW_ICON)
3044 nItemWidth = infoPtr->iconSpacing.cx;
3045 else if (infoPtr->uView == LV_VIEW_DETAILS)
3046 {
3047 if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
3048 {
3049 RECT rcHeader;
3050 INT index;
3051
3053 DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
3054
3055 LISTVIEW_GetHeaderRect(infoPtr, index, &rcHeader);
3056 nItemWidth = rcHeader.right;
3057 }
3058 }
3059 else /* LV_VIEW_SMALLICON, or LV_VIEW_LIST */
3060 {
3061 WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
3062 LVITEMW lvItem;
3063 INT i;
3064
3065 lvItem.mask = LVIF_TEXT;
3066 lvItem.iSubItem = 0;
3067
3068 for (i = 0; i < infoPtr->nItemCount; i++)
3069 {
3070 lvItem.iItem = i;
3071 lvItem.pszText = szDispText;
3072 lvItem.cchTextMax = DISP_TEXT_SIZE;
3073 if (LISTVIEW_GetItemW(infoPtr, &lvItem))
3074 nItemWidth = max(LISTVIEW_GetStringWidthT(infoPtr, lvItem.pszText, TRUE),
3075 nItemWidth);
3076 }
3077
3078 if (infoPtr->himlSmall) nItemWidth += infoPtr->iconSize.cx;
3079 if (infoPtr->himlState) nItemWidth += infoPtr->iconStateSize.cx;
3080
3081 nItemWidth = max(DEFAULT_COLUMN_WIDTH, nItemWidth + WIDTH_PADDING);
3082 }
3083
3084 return nItemWidth;
3085}
#define index(s, c)
Definition: various.h:29
static BOOL LISTVIEW_GetItemW(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem)
Definition: listview.c:1713
#define WIDTH_PADDING
Definition: listview.c:352
#define DEFAULT_COLUMN_WIDTH
Definition: listview.c:387
static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *, LPCWSTR, BOOL)
Definition: listview.c:7706
#define HDM_ORDERTOINDEX
Definition: commctrl.h:800
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by LISTVIEW_UpdateItemSize().

◆ LISTVIEW_CallBackCompare()

static INT WINAPI LISTVIEW_CallBackCompare ( LPVOID  first,
LPVOID  second,
LPARAM  lParam 
)
static

Definition at line 9412 of file listview.c.

9413{
9414 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
9415 ITEM_INFO* lv_first = DPA_GetPtr( first, 0 );
9416 ITEM_INFO* lv_second = DPA_GetPtr( second, 0 );
9417
9418 /* Forward the call to the client defined callback */
9419 return (infoPtr->pfnCompare)( lv_first->lParam , lv_second->lParam, infoPtr->lParamSort );
9420}
const GLint * first
Definition: glext.h:5794
LPARAM lParam
Definition: listview.c:173
LPARAM lParamSort
Definition: listview.c:258
PFNLVCOMPARE pfnCompare
Definition: listview.c:257

Referenced by LISTVIEW_SortItems().

◆ LISTVIEW_CallBackCompareEx()

static INT WINAPI LISTVIEW_CallBackCompareEx ( LPVOID  first,
LPVOID  second,
LPARAM  lParam 
)
static

Definition at line 9436 of file listview.c.

9437{
9438 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
9439 INT first_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, first );
9440 INT second_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, second );
9441
9442 /* Forward the call to the client defined callback */
9443 return (infoPtr->pfnCompare)( first_idx, second_idx, infoPtr->lParamSort );
9444}
INT WINAPI DPA_GetPtrIndex(HDPA hdpa, LPCVOID p)
Definition: dpa.c:561

Referenced by LISTVIEW_SortItems().

◆ LISTVIEW_CancelEditLabel()

static LRESULT LISTVIEW_CancelEditLabel ( LISTVIEW_INFO infoPtr)
static

Definition at line 5527 of file listview.c.

5528{
5529 if (infoPtr->hwndEdit)
5530 {
5531 /* handle value will be lost after LISTVIEW_EndEditLabelT */
5532 HWND edit = infoPtr->hwndEdit;
5533
5535 SendMessageW(edit, WM_CLOSE, 0, 0);
5536 }
5537
5538 return TRUE;
5539}
BOOL WINAPI IsWindowUnicode(_In_ HWND)

Referenced by LISTVIEW_Command(), and LISTVIEW_WindowProc().

◆ LISTVIEW_Command()

static LRESULT LISTVIEW_Command ( LISTVIEW_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 12058 of file listview.c.

12059{
12060
12061 TRACE("(%p %x %x %lx)\n", infoPtr, HIWORD(wParam), LOWORD(wParam), lParam);
12062
12063 if (!infoPtr->hwndEdit) return 0;
12064
12065 switch (HIWORD(wParam))
12066 {
12067 case EN_UPDATE:
12068 {
12069 /*
12070 * Adjust the edit window size
12071 */
12072 WCHAR buffer[1024];
12073 HDC hdc = GetDC(infoPtr->hwndEdit);
12074 HFONT hFont, hOldFont = 0;
12075 RECT rect;
12076 SIZE sz;
12077
12078 if (!infoPtr->hwndEdit || !hdc) return 0;
12080 GetWindowRect(infoPtr->hwndEdit, &rect);
12081
12082 /* Select font to get the right dimension of the string */
12083 hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0);
12084 if (hFont)
12085 {
12086 hOldFont = SelectObject(hdc, hFont);
12087 }
12088
12090 {
12091 TEXTMETRICW textMetric;
12092
12093 /* Add Extra spacing for the next character */
12094 GetTextMetricsW(hdc, &textMetric);
12095 sz.cx += (textMetric.tmMaxCharWidth * 2);
12096
12097 SetWindowPos(infoPtr->hwndEdit, NULL, 0, 0, sz.cx,
12098 rect.bottom - rect.top, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOZORDER);
12099 }
12100 if (hFont)
12101 SelectObject(hdc, hOldFont);
12102
12103 ReleaseDC(infoPtr->hwndEdit, hdc);
12104
12105 break;
12106 }
12107 case EN_KILLFOCUS:
12108 {
12110 LISTVIEW_CancelEditLabel(infoPtr);
12111 break;
12112 }
12113
12114 default:
12115 return SendMessageW (infoPtr->hwndNotify, WM_COMMAND, wParam, lParam);
12116 }
12117
12118 return 0;
12119}
HFONT hFont
Definition: main.c:53
#define ARRAY_SIZE(A)
Definition: main.h:33
static LRESULT LISTVIEW_CancelEditLabel(LISTVIEW_INFO *infoPtr)
Definition: listview.c:5527
#define lstrlenW
Definition: compat.h:750
GLuint buffer
Definition: glext.h:5915
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define LOWORD(l)
Definition: pedump.c:82
& rect
Definition: startmenu.cpp:1413
LONG tmMaxCharWidth
Definition: wingdi.h:2389
#define HIWORD(l)
Definition: typedefs.h:247
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define EN_KILLFOCUS
Definition: winuser.h:2025
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define EN_UPDATE
Definition: winuser.h:2028
#define SWP_DRAWFRAME
Definition: winuser.h:1239
#define SWP_NOMOVE
Definition: winuser.h:1244
#define WM_COMMAND
Definition: winuser.h:1740
#define WM_GETFONT
Definition: winuser.h:1651
HDC WINAPI GetDC(_In_opt_ HWND)
#define SWP_NOZORDER
Definition: winuser.h:1247

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Create()

static LRESULT LISTVIEW_Create ( HWND  hwnd,
const CREATESTRUCTW lpcs 
)
static

Definition at line 9717 of file listview.c.

9718{
9720
9721 TRACE("(lpcs=%p, style=0x%08x)\n", lpcs, lpcs->style);
9722
9723 infoPtr->dwStyle = lpcs->style;
9724 map_style_view(infoPtr);
9725
9726 infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT,
9727 (WPARAM)infoPtr->hwndSelf, NF_QUERY);
9728 /* on error defaulting to ANSI notifications */
9729 if (infoPtr->notifyFormat == 0) infoPtr->notifyFormat = NFR_ANSI;
9730 TRACE("notify format=%d\n", infoPtr->notifyFormat);
9731
9732 if ((infoPtr->uView == LV_VIEW_DETAILS) && (lpcs->style & WS_VISIBLE))
9733 {
9734 if (LISTVIEW_CreateHeader(infoPtr) < 0) return -1;
9735 }
9736 else
9737 infoPtr->hwndHeader = 0;
9738
9739 /* init item size to avoid division by 0 */
9740 LISTVIEW_UpdateItemSize (infoPtr);
9741 LISTVIEW_UpdateSize (infoPtr);
9742
9743 if (infoPtr->uView == LV_VIEW_DETAILS)
9744 {
9745 if (!(LVS_NOCOLUMNHEADER & lpcs->style) && (WS_VISIBLE & lpcs->style))
9746 {
9748 }
9749 LISTVIEW_UpdateScroll(infoPtr);
9750 /* send WM_MEASUREITEM notification */
9751 if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED) notify_measureitem(infoPtr);
9752 }
9753
9755
9756 /* initialize the icon sizes */
9757 set_icon_size(&infoPtr->iconSize, infoPtr->himlNormal, infoPtr->uView != LV_VIEW_ICON);
9758 set_icon_size(&infoPtr->iconStateSize, infoPtr->himlState, TRUE);
9759 return 0;
9760}
static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
Definition: listview.c:2172
static void map_style_view(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1609
static BOOL notify_measureitem(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1113
static const WCHAR themeClass[]
Definition: listview.c:427
static void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL is_small)
Definition: listview.c:8891
static void LISTVIEW_UpdateItemSize(LISTVIEW_INFO *infoPtr)
Definition: listview.c:3130
static INT LISTVIEW_CreateHeader(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1666
static void LISTVIEW_UpdateSize(LISTVIEW_INFO *)
Definition: listview.c:11230
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2284
#define LVS_OWNERDRAWFIXED
Definition: commctrl.h:2283
HIMAGELIST himlNormal
Definition: listview.c:272
SHORT notifyFormat
Definition: listview.c:229
#define SW_SHOWNORMAL
Definition: winuser.h:770
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define NFR_ANSI
Definition: winuser.h:2458
#define NF_QUERY
Definition: winuser.h:2460

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateCheckBoxIL()

static HIMAGELIST LISTVIEW_CreateCheckBoxIL ( const LISTVIEW_INFO infoPtr)
static

Definition at line 8635 of file listview.c.

8636{
8637 HDC hdc_wnd, hdc;
8638 HBITMAP hbm_im, hbm_mask, hbm_orig;
8639 RECT rc;
8640 HBRUSH hbr_white = GetStockObject(WHITE_BRUSH);
8641 HBRUSH hbr_black = GetStockObject(BLACK_BRUSH);
8643
8645 ILC_COLOR | ILC_MASK, 2, 2);
8646 hdc_wnd = GetDC(infoPtr->hwndSelf);
8647 hdc = CreateCompatibleDC(hdc_wnd);
8650 ReleaseDC(infoPtr->hwndSelf, hdc_wnd);
8651
8653 hbm_orig = SelectObject(hdc, hbm_mask);
8654 FillRect(hdc, &rc, hbr_white);
8655 InflateRect(&rc, -2, -2);
8656 FillRect(hdc, &rc, hbr_black);
8657
8658 SelectObject(hdc, hbm_im);
8660 SelectObject(hdc, hbm_orig);
8661 ImageList_Add(himl, hbm_im, hbm_mask);
8662
8663 SelectObject(hdc, hbm_im);
8665 SelectObject(hdc, hbm_orig);
8666 ImageList_Add(himl, hbm_im, hbm_mask);
8667
8668 DeleteObject(hbm_mask);
8669 DeleteObject(hbm_im);
8670 DeleteDC(hdc);
8671
8672 return himl;
8673}
HIMAGELIST himl
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:448
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
pKey DeleteObject()
static HBITMAP
Definition: button.c:44
#define ILC_MASK
Definition: commctrl.h:351
#define ILC_COLOR
Definition: commctrl.h:352
HGDIOBJ WINAPI GetStockObject(_In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define BLACK_BRUSH
Definition: wingdi.h:896
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
#define DFC_BUTTON
Definition: winuser.h:476
#define SM_CYSMICON
Definition: winuser.h:1013
#define DFCS_MONO
Definition: winuser.h:511
#define SM_CXSMICON
Definition: winuser.h:1012
#define DFCS_CHECKED
Definition: winuser.h:504
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by LISTVIEW_SetExtendedListViewStyle().

◆ LISTVIEW_CreateDragImage()

static HIMAGELIST LISTVIEW_CreateDragImage ( LISTVIEW_INFO infoPtr,
INT  iItem,
LPPOINT  lppt 
)
static

Definition at line 5553 of file listview.c.

5554{
5555 RECT rcItem;
5556 SIZE size;
5557 POINT pos;
5558 HDC hdc, hdcOrig;
5559 HBITMAP hbmp, hOldbmp;
5560 HFONT hOldFont;
5561 HIMAGELIST dragList = 0;
5562 TRACE("iItem=%d Count=%d\n", iItem, infoPtr->nItemCount);
5563
5564 if (iItem < 0 || iItem >= infoPtr->nItemCount || !lppt)
5565 return 0;
5566
5567 rcItem.left = LVIR_BOUNDS;
5568 if (!LISTVIEW_GetItemRect(infoPtr, iItem, &rcItem))
5569 return 0;
5570
5571 lppt->x = rcItem.left;
5572 lppt->y = rcItem.top;
5573
5574 size.cx = rcItem.right - rcItem.left;
5575 size.cy = rcItem.bottom - rcItem.top;
5576
5577 hdcOrig = GetDC(infoPtr->hwndSelf);
5578 hdc = CreateCompatibleDC(hdcOrig);
5579 hbmp = CreateCompatibleBitmap(hdcOrig, size.cx, size.cy);
5580 hOldbmp = SelectObject(hdc, hbmp);
5581 hOldFont = SelectObject(hdc, infoPtr->hFont);
5582
5583 SetRect(&rcItem, 0, 0, size.cx, size.cy);
5584 FillRect(hdc, &rcItem, infoPtr->hBkBrush);
5585
5586 pos.x = pos.y = 0;
5587 if (LISTVIEW_DrawItem(infoPtr, hdc, iItem, NULL, pos, CDRF_DODEFAULT))
5588 {
5589 dragList = ImageList_Create(size.cx, size.cy, ILC_COLOR, 10, 10);
5590 SelectObject(hdc, hOldbmp);
5591 ImageList_Add(dragList, hbmp, 0);
5592 }
5593 else
5594 SelectObject(hdc, hOldbmp);
5595
5596 SelectObject(hdc, hOldFont);
5598 DeleteDC(hdc);
5599 ReleaseDC(infoPtr->hwndSelf, hdcOrig);
5600
5601 TRACE("ret=%p\n", dragList);
5602
5603 return dragList;
5604}
HBITMAP hbmp
static BOOL LISTVIEW_DrawItem(LISTVIEW_INFO *infoPtr, HDC hdc, INT nItem, ITERATOR *subitems, POINT pos, DWORD cdmode)
Definition: listview.c:4842
static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *, INT, LPRECT)
Definition: listview.c:7193
#define CDRF_DODEFAULT
Definition: commctrl.h:268
#define LVIR_BOUNDS
Definition: commctrl.h:2472
HBRUSH hBkBrush
Definition: listview.c:298

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateHeader()

static INT LISTVIEW_CreateHeader ( LISTVIEW_INFO infoPtr)
static

Definition at line 1666 of file listview.c.

1667{
1670
1671 if (infoPtr->hwndHeader) return 0;
1672
1673 TRACE("Creating header for list %p\n", infoPtr->hwndSelf);
1674
1675 /* setup creation flags */
1676 dFlags |= (LVS_NOSORTHEADER & infoPtr->dwStyle) ? 0 : HDS_BUTTONS;
1677 dFlags |= (LVS_NOCOLUMNHEADER & infoPtr->dwStyle) ? HDS_HIDDEN : 0;
1678
1680
1681 /* create header */
1682 infoPtr->hwndHeader = CreateWindowW(WC_HEADERW, NULL, dFlags,
1683 0, 0, 0, 0, infoPtr->hwndSelf, NULL, hInst, NULL);
1684 if (!infoPtr->hwndHeader) return -1;
1685
1686 /* set header unicode format */
1688
1689 /* set header font */
1690 SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, TRUE);
1691
1692 /* set header image list */
1693 if (infoPtr->himlSmall)
1694 SendMessageW(infoPtr->hwndHeader, HDM_SETIMAGELIST, 0, (LPARAM)infoPtr->himlSmall);
1695
1696 LISTVIEW_UpdateSize(infoPtr);
1697
1698 return 0;
1699}
HINSTANCE hInst
Definition: dxdiag.c:13
#define WS_CHILD
Definition: pedump.c:617
#define HDS_BUTTONS
Definition: commctrl.h:629
#define HDS_HIDDEN
Definition: commctrl.h:631
#define HDM_SETUNICODEFORMAT
Definition: commctrl.h:821
#define HDS_FULLDRAG
Definition: commctrl.h:633
#define HDS_DRAGDROP
Definition: commctrl.h:632
#define HDM_SETIMAGELIST
Definition: commctrl.h:794
#define WC_HEADERW
Definition: commctrl.h:624
#define LVS_NOSORTHEADER
Definition: commctrl.h:2285
#define HDS_HORZ
Definition: commctrl.h:628
LONG_PTR LPARAM
Definition: windef.h:208

Referenced by LISTVIEW_Create(), LISTVIEW_InsertColumnT(), LISTVIEW_SetExtendedListViewStyle(), LISTVIEW_SetView(), LISTVIEW_ShowWindow(), and LISTVIEW_StyleChanged().

◆ LISTVIEW_DelayedEditItem()

static VOID CALLBACK LISTVIEW_DelayedEditItem ( HWND  hwnd,
UINT  uMsg,
UINT_PTR  idEvent,
DWORD  dwTime 
)
static

Definition at line 9603 of file listview.c.

9604{
9605 DELAYED_ITEM_EDIT *editItem = (DELAYED_ITEM_EDIT *)idEvent;
9607
9608 KillTimer(hwnd, idEvent);
9609 editItem->fEnabled = FALSE;
9610 /* check if the item is still selected */
9611 if (infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, editItem->iItem, LVIS_SELECTED))
9612 LISTVIEW_EditLabelT(infoPtr, editItem->iItem, TRUE);
9613}
static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT)
Definition: listview.c:7399
static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
Definition: listview.c:6235
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by LISTVIEW_LButtonUp().

◆ LISTVIEW_DeleteAllItems()

static BOOL LISTVIEW_DeleteAllItems ( LISTVIEW_INFO infoPtr,
BOOL  destroy 
)
static

Definition at line 5618 of file listview.c.

5619{
5620 HDPA hdpaSubItems = NULL;
5622 ITEMHDR *hdrItem;
5623 ITEM_INFO *lpItem;
5624 ITEM_ID *lpID;
5625 INT i, j;
5626
5627 TRACE("()\n");
5628
5629 /* we do it directly, to avoid notifications */
5630 ranges_clear(infoPtr->selectionRanges);
5631 infoPtr->nSelectionMark = -1;
5632 infoPtr->nFocusedItem = -1;
5633 SetRectEmpty(&infoPtr->rcFocus);
5634 /* But we are supposed to leave nHotItem as is! */
5635
5636 /* send LVN_DELETEALLITEMS notification */
5637 if (!(infoPtr->dwStyle & LVS_OWNERDATA) || !destroy)
5638 {
5639 NMLISTVIEW nmlv;
5640
5641 memset(&nmlv, 0, sizeof(NMLISTVIEW));
5642 nmlv.iItem = -1;
5643 suppress = notify_listview(infoPtr, LVN_DELETEALLITEMS, &nmlv);
5644 }
5645
5646 for (i = infoPtr->nItemCount - 1; i >= 0; i--)
5647 {
5648 if (!(infoPtr->dwStyle & LVS_OWNERDATA))
5649 {
5650 /* send LVN_DELETEITEM notification, if not suppressed
5651 and if it is not a virtual listview */
5652 if (!suppress) notify_deleteitem(infoPtr, i);
5653 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i);
5654 lpItem = DPA_GetPtr(hdpaSubItems, 0);
5655 /* free id struct */
5656 j = DPA_GetPtrIndex(infoPtr->hdpaItemIds, lpItem->id);
5657 lpID = DPA_GetPtr(infoPtr->hdpaItemIds, j);
5658 DPA_DeletePtr(infoPtr->hdpaItemIds, j);
5659 Free(lpID);
5660 /* both item and subitem start with ITEMHDR header */
5661 for (j = 0; j < DPA_GetPtrCount(hdpaSubItems); j++)
5662 {
5663 hdrItem = DPA_GetPtr(hdpaSubItems, j);
5664 if (is_text(hdrItem->pszText)) Free(hdrItem->pszText);
5665 Free(hdrItem);
5666 }
5667 DPA_Destroy(hdpaSubItems);
5668 DPA_DeletePtr(infoPtr->hdpaItems, i);
5669 }
5670 DPA_DeletePtr(infoPtr->hdpaPosX, i);
5671 DPA_DeletePtr(infoPtr->hdpaPosY, i);
5672 infoPtr->nItemCount --;
5673 }
5674
5675 if (!destroy)
5676 {
5677 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
5678 LISTVIEW_UpdateScroll(infoPtr);
5679 }
5680 LISTVIEW_InvalidateList(infoPtr);
5681
5682 return TRUE;
5683}
void destroy(_Tp *__pointer)
Definition: _construct.h:278
LPVOID WINAPI DPA_DeletePtr(HDPA hdpa, INT i)
Definition: dpa.c:677
BOOL WINAPI DPA_Destroy(HDPA hdpa)
Definition: dpa.c:396
static BOOL is_text(LPCWSTR text)
Definition: listview.c:463
static void ranges_clear(RANGES ranges)
Definition: listview.c:3235
static LRESULT notify_listview(const LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
Definition: listview.c:888
static BOOL LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode)
Definition: listview.c:2872
static BOOL notify_deleteitem(const LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:915
static void LISTVIEW_InvalidateList(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1782
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
boolean suppress
Definition: jpeglib.h:1006
#define LVN_DELETEALLITEMS
Definition: commctrl.h:3134
#define memset(x, y, z)
Definition: compat.h:39
Definition: dpa.c:49
LPWSTR pszText
Definition: listview.c:157
ITEM_ID * id
Definition: listview.c:175
RANGES selectionRanges
Definition: listview.c:243
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815

Referenced by LISTVIEW_Destroy(), and LISTVIEW_WindowProc().

◆ LISTVIEW_DeleteColumn()

static BOOL LISTVIEW_DeleteColumn ( LISTVIEW_INFO infoPtr,
INT  nColumn 
)
static

Definition at line 5755 of file listview.c.

5756{
5757 RECT rcCol;
5758
5759 TRACE("nColumn=%d\n", nColumn);
5760
5761 if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns))
5762 return FALSE;
5763
5764 /* While the MSDN specifically says that column zero should not be deleted,
5765 what actually happens is that the column itself is deleted but no items or subitems
5766 are removed.
5767 */
5768
5769 LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol);
5770
5771 if (!SendMessageW(infoPtr->hwndHeader, HDM_DELETEITEM, nColumn, 0))
5772 return FALSE;
5773
5774 Free(DPA_GetPtr(infoPtr->hdpaColumns, nColumn));
5775 DPA_DeletePtr(infoPtr->hdpaColumns, nColumn);
5776
5777 if (!(infoPtr->dwStyle & LVS_OWNERDATA) && nColumn)
5778 {
5779 SUBITEM_INFO *lpSubItem, *lpDelItem;
5780 HDPA hdpaSubItems;
5781 INT nItem, nSubItem, i;
5782
5783 for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
5784 {
5785 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, nItem);
5786 nSubItem = 0;
5787 lpDelItem = 0;
5788 for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++)
5789 {
5790 lpSubItem = DPA_GetPtr(hdpaSubItems, i);
5791 if (lpSubItem->iSubItem == nColumn)
5792 {
5793 nSubItem = i;
5794 lpDelItem = lpSubItem;
5795 }
5796 else if (lpSubItem->iSubItem > nColumn)
5797 {
5798 lpSubItem->iSubItem--;
5799 }
5800 }
5801
5802 /* if we found our subitem, zap it */
5803 if (nSubItem > 0)
5804 {
5805 /* free string */
5806 if (is_text(lpDelItem->hdr.pszText))
5807 Free(lpDelItem->hdr.pszText);
5808
5809 /* free item */
5810 Free(lpDelItem);
5811
5812 /* free dpa memory */
5813 DPA_DeletePtr(hdpaSubItems, nSubItem);
5814 }
5815 }
5816 }
5817
5818 /* update the other column info */
5819 if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0)
5820 LISTVIEW_InvalidateList(infoPtr);
5821 else
5822 LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
5823 LISTVIEW_UpdateItemSize(infoPtr);
5824
5825 return TRUE;
5826}
static void LISTVIEW_ScrollColumns(LISTVIEW_INFO *infoPtr, INT nColumn, INT dx)
Definition: listview.c:5697
#define HDM_DELETEITEM
Definition: commctrl.h:743
ITEMHDR hdr
Definition: listview.c:163

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_DeleteItem()

static BOOL LISTVIEW_DeleteItem ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 5912 of file listview.c.

5913{
5914 LVITEMW item;
5915 const BOOL is_icon = (infoPtr->uView == LV_VIEW_SMALLICON || infoPtr->uView == LV_VIEW_ICON);
5916 INT focus = infoPtr->nFocusedItem;
5917
5918 TRACE("(nItem=%d)\n", nItem);
5919
5920 if (nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE;
5921
5922 /* remove selection, and focus */
5923 item.state = 0;
5924 item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
5925 LISTVIEW_SetItemState(infoPtr, nItem, &item);
5926
5927 /* send LVN_DELETEITEM notification. */
5928 if (!notify_deleteitem(infoPtr, nItem)) return FALSE;
5929
5930 /* we need to do this here, because we'll be deleting stuff */
5931 if (is_icon)
5932 LISTVIEW_InvalidateItem(infoPtr, nItem);
5933
5934 if (!(infoPtr->dwStyle & LVS_OWNERDATA))
5935 {
5936 HDPA hdpaSubItems;
5937 ITEMHDR *hdrItem;
5938 ITEM_INFO *lpItem;
5939 ITEM_ID *lpID;
5940 INT i;
5941
5942 hdpaSubItems = DPA_DeletePtr(infoPtr->hdpaItems, nItem);
5943 lpItem = DPA_GetPtr(hdpaSubItems, 0);
5944
5945 /* free id struct */
5946 i = DPA_GetPtrIndex(infoPtr->hdpaItemIds, lpItem->id);
5947 lpID = DPA_GetPtr(infoPtr->hdpaItemIds, i);
5948 DPA_DeletePtr(infoPtr->hdpaItemIds, i);
5949 Free(lpID);
5950 for (i = 0; i < DPA_GetPtrCount(hdpaSubItems); i++)
5951 {
5952 hdrItem = DPA_GetPtr(hdpaSubItems, i);
5953 if (is_text(hdrItem->pszText)) Free(hdrItem->pszText);
5954 Free(hdrItem);
5955 }
5956 DPA_Destroy(hdpaSubItems);
5957 }
5958
5959 if (is_icon)
5960 {
5961 DPA_DeletePtr(infoPtr->hdpaPosX, nItem);
5962 DPA_DeletePtr(infoPtr->hdpaPosY, nItem);
5963 }
5964
5965 infoPtr->nItemCount--;
5966 LISTVIEW_ShiftIndices(infoPtr, nItem, -1);
5967 LISTVIEW_ShiftFocus(infoPtr, focus, nItem, -1);
5968
5969 /* now is the invalidation fun */
5970 if (!is_icon)
5971 LISTVIEW_ScrollOnInsert(infoPtr, nItem, -1);
5972 return TRUE;
5973}
static void LISTVIEW_InvalidateItem(const LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:1755
static void LISTVIEW_ShiftFocus(LISTVIEW_INFO *infoPtr, INT focus, INT item, INT direction)
Definition: listview.c:3618
static void LISTVIEW_ShiftIndices(LISTVIEW_INFO *infoPtr, INT nItem, INT direction)
Definition: listview.c:3641
static void LISTVIEW_ScrollOnInsert(LISTVIEW_INFO *infoPtr, INT nItem, INT dir)
Definition: listview.c:5840
FORCEINLINE BOOL is_icon(PCURICON_OBJECT object)
Definition: cursoricon.c:194

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_DeselectAll()

static BOOL LISTVIEW_DeselectAll ( LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 3539 of file listview.c.

3540{
3541 return LISTVIEW_DeselectAllSkipItem(infoPtr, -1);
3542}
static BOOL LISTVIEW_DeselectAllSkipItem(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:3528

Referenced by LISTVIEW_LButtonDown(), and LISTVIEW_RButtonDown().

◆ LISTVIEW_DeselectAllSkipItem()

static BOOL LISTVIEW_DeselectAllSkipItem ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
inlinestatic

Definition at line 3528 of file listview.c.

3529{
3530 RANGES toSkip;
3531
3532 if (!(toSkip = ranges_create(1))) return FALSE;
3533 if (nItem != -1) ranges_additem(toSkip, nItem);
3534 LISTVIEW_DeselectAllSkipItems(infoPtr, toSkip);
3535 ranges_destroy(toSkip);
3536 return TRUE;
3537}
static BOOL LISTVIEW_DeselectAllSkipItems(LISTVIEW_INFO *infoPtr, RANGES toSkip)
Definition: listview.c:3506

Referenced by LISTVIEW_DeselectAll(), LISTVIEW_SetSelection(), and set_main_item().

◆ LISTVIEW_DeselectAllSkipItems()

static BOOL LISTVIEW_DeselectAllSkipItems ( LISTVIEW_INFO infoPtr,
RANGES  toSkip 
)
static

Definition at line 3506 of file listview.c.

3507{
3508 LVITEMW lvItem;
3509 ITERATOR i;
3510 RANGES clone;
3511
3512 TRACE("()\n");
3513
3514 lvItem.state = 0;
3515 lvItem.stateMask = LVIS_SELECTED;
3516
3517 /* need to clone the DPA because callbacks can change it */
3518 if (!(clone = ranges_clone(infoPtr->selectionRanges))) return FALSE;
3519 iterator_rangesitems(&i, ranges_diff(clone, toSkip));
3520 while(iterator_next(&i))
3521 LISTVIEW_SetItemState(infoPtr, i.nItem, &lvItem);
3522 /* note that the iterator destructor will free the cloned range */
3524
3525 return TRUE;
3526}
static RANGES ranges_diff(RANGES ranges, RANGES sub)
Definition: listview.c:3279
static void iterator_destroy(const ITERATOR *i)
Definition: listview.c:1309
static RANGES ranges_clone(RANGES ranges)
Definition: listview.c:3253

Referenced by LISTVIEW_DeselectAllSkipItem(), and LISTVIEW_SetGroupSelection().

◆ LISTVIEW_Destroy()

static LRESULT LISTVIEW_Destroy ( LISTVIEW_INFO infoPtr)
static

Definition at line 9773 of file listview.c.

9774{
9775 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
9776 CloseThemeData(theme);
9777
9778 /* delete all items */
9779 LISTVIEW_DeleteAllItems(infoPtr, TRUE);
9780
9781 return 0;
9782}
static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy)
Definition: listview.c:5618
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_DrawFocusRect()

static BOOL LISTVIEW_DrawFocusRect ( const LISTVIEW_INFO infoPtr,
HDC  hdc 
)
inlinestatic

Definition at line 1719 of file listview.c.

1720{
1721#ifdef __REACTOS__
1722 BOOL Ret = FALSE;
1723
1724 if (infoPtr->rcFocus.left < infoPtr->rcFocus.right)
1725 {
1726 DWORD dwOldBkColor, dwOldTextColor;
1727
1728 dwOldBkColor = SetBkColor(hdc, RGB(255, 255, 255));
1729 dwOldTextColor = SetBkColor(hdc, RGB(0, 0, 0));
1730 Ret = DrawFocusRect(hdc, &infoPtr->rcFocus);
1731 SetBkColor(hdc, dwOldBkColor);
1732 SetBkColor(hdc, dwOldTextColor);
1733 }
1734 return Ret;
1735#else
1736 return (infoPtr->rcFocus.left < infoPtr->rcFocus.right) ?
1737 DrawFocusRect(hdc, &infoPtr->rcFocus) : FALSE;
1738#endif
1739}
#define RGB(r, g, b)
Definition: precomp.h:71
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI DrawFocusRect(_In_ HDC, _In_ LPCRECT)

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_DrawItem()

static BOOL LISTVIEW_DrawItem ( LISTVIEW_INFO infoPtr,
HDC  hdc,
INT  nItem,
ITERATOR subitems,
POINT  pos,
DWORD  cdmode 
)
static

Definition at line 4842 of file listview.c.

4843{
4844 WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
4845 static WCHAR callbackW[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
4846 DWORD cdsubitemmode = CDRF_DODEFAULT;
4847 RECT *focus, rcBox;
4848 NMLVCUSTOMDRAW nmlvcd;
4849 LVITEMW lvItem;
4850
4851 TRACE("(hdc=%p, nItem=%d, subitems=%p, pos=%s)\n", hdc, nItem, subitems, wine_dbgstr_point(&pos));
4852
4853 /* get information needed for drawing the item */
4855 if (infoPtr->uView == LV_VIEW_DETAILS) lvItem.mask |= LVIF_INDENT;
4857 lvItem.iItem = nItem;
4858 lvItem.iSubItem = 0;
4859 lvItem.state = 0;
4860 lvItem.lParam = 0;
4861 lvItem.cchTextMax = DISP_TEXT_SIZE;
4862 lvItem.pszText = szDispText;
4863 if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
4864 if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = callbackW;
4865 TRACE(" lvItem=%s\n", debuglvitem_t(&lvItem, TRUE));
4866
4867 /* now check if we need to update the focus rectangle */
4868 focus = infoPtr->bFocus && (lvItem.state & LVIS_FOCUSED) ? &infoPtr->rcFocus : 0;
4869 if (!focus) lvItem.state &= ~LVIS_FOCUSED;
4870
4871 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, &rcBox, NULL, NULL, NULL, NULL);
4872 OffsetRect(&rcBox, pos.x, pos.y);
4873
4874 /* Full custom draw stage sequence looks like this:
4875
4876 LV_VIEW_DETAILS:
4877
4878 - CDDS_ITEMPREPAINT
4879 - CDDS_ITEMPREPAINT|CDDS_SUBITEM | => sent n times, where n is number of subitems,
4880 CDDS_ITEMPOSTPAINT|CDDS_SUBITEM | including item itself
4881 - CDDS_ITEMPOSTPAINT
4882
4883 other styles:
4884
4885 - CDDS_ITEMPREPAINT
4886 - CDDS_ITEMPOSTPAINT
4887 */
4888
4889 /* fill in the custom draw structure */
4890 customdraw_fill(&nmlvcd, infoPtr, hdc, &rcBox, &lvItem);
4891 if (cdmode & CDRF_NOTIFYITEMDRAW)
4892 cdsubitemmode = notify_customdraw(infoPtr, CDDS_ITEMPREPAINT, &nmlvcd);
4893 if (cdsubitemmode & CDRF_SKIPDEFAULT) goto postpaint;
4894
4895 if (subitems)
4896 {
4897 while (iterator_next(subitems))
4898 {
4899 DWORD subitemstage = CDRF_DODEFAULT;
4900 NMLVCUSTOMDRAW temp_nmlvcd;
4901
4902 /* We need to query for each subitem, item's data (subitem == 0) is already here at this point */
4903 if (subitems->nItem)
4904 {
4907 lvItem.iItem = nItem;
4908 lvItem.iSubItem = subitems->nItem;
4909 lvItem.state = 0;
4910 lvItem.lParam = 0;
4911 lvItem.cchTextMax = DISP_TEXT_SIZE;
4912 lvItem.pszText = szDispText;
4913 if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
4914 if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
4915 lvItem.state = LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED);
4916 if (lvItem.pszText == LPSTR_TEXTCALLBACKW) lvItem.pszText = callbackW;
4917 TRACE(" lvItem=%s\n", debuglvitem_t(&lvItem, TRUE));
4918
4919 /* update custom draw data */
4920 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, &nmlvcd.nmcd.rc, NULL, NULL, NULL, NULL);
4921 OffsetRect(&nmlvcd.nmcd.rc, pos.x, pos.y);
4922 nmlvcd.iSubItem = subitems->nItem;
4923 }
4924
4925 if (cdsubitemmode & CDRF_NOTIFYSUBITEMDRAW)
4926 subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPREPAINT, &nmlvcd);
4927
4928 /*
4929 * A selection should neither affect the colors in the post paint notification nor
4930 * affect the colors of the next drawn subitem. Copy the structure to prevent this.
4931 */
4932 temp_nmlvcd = nmlvcd;
4933 prepaint_setup(infoPtr, hdc, &temp_nmlvcd, subitems->nItem);
4934
4935 if (!(subitemstage & CDRF_SKIPDEFAULT))
4936 LISTVIEW_DrawItemPart(infoPtr, &lvItem, &temp_nmlvcd, &pos);
4937
4938 if (subitemstage & CDRF_NOTIFYPOSTPAINT)
4939 subitemstage = notify_customdraw(infoPtr, CDDS_SUBITEM | CDDS_ITEMPOSTPAINT, &nmlvcd);
4940 }
4941 }
4942 else
4943 {
4944 prepaint_setup(infoPtr, hdc, &nmlvcd, FALSE);
4945 LISTVIEW_DrawItemPart(infoPtr, &lvItem, &nmlvcd, &pos);
4946 }
4947
4948postpaint:
4949 if (cdsubitemmode & CDRF_NOTIFYPOSTPAINT)
4950 {
4951 nmlvcd.iSubItem = 0;
4952 notify_customdraw(infoPtr, CDDS_ITEMPOSTPAINT, &nmlvcd);
4953 }
4954
4955 return TRUE;
4956}
static DWORD notify_customdraw(const LISTVIEW_INFO *infoPtr, DWORD dwDrawStage, NMLVCUSTOMDRAW *lpnmlvcd)
Definition: listview.c:1052
static void prepaint_setup(const LISTVIEW_INFO *infoPtr, HDC hdc, NMLVCUSTOMDRAW *lpnmlvcd, BOOL SubItem)
Definition: listview.c:1066
static void LISTVIEW_DrawItemPart(LISTVIEW_INFO *infoPtr, LVITEMW *item, const NMLVCUSTOMDRAW *nmlvcd, const POINT *pos)
Definition: listview.c:4682
static void LISTVIEW_GetItemMetrics(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, LPRECT lprcBox, LPRECT lprcSelectBox, LPRECT lprcIcon, LPRECT lprcStateIcon, LPRECT lprcLabel)
Definition: listview.c:2374
static const char * debuglvitem_t(const LVITEMW *lpLVItem, BOOL isW)
Definition: listview.c:626
static void customdraw_fill(NMLVCUSTOMDRAW *lpnmlvcd, const LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *rcBounds, const LVITEMW *lplvItem)
Definition: listview.c:1035
static BOOL CALLBACK callbackW(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA data, LPVOID context)
Definition: propset.c:144
#define CDDS_ITEMPOSTPAINT
Definition: commctrl.h:286
#define LVIS_OVERLAYMASK
Definition: commctrl.h:2325
#define CDDS_ITEMPREPAINT
Definition: commctrl.h:285
#define CDDS_SUBITEM
Definition: commctrl.h:289
#define CDRF_NOTIFYSUBITEMDRAW
Definition: commctrl.h:276
#define CDRF_NOTIFYITEMDRAW
Definition: commctrl.h:275
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define CDRF_SKIPDEFAULT
Definition: commctrl.h:270
#define LVIS_STATEIMAGEMASK
Definition: commctrl.h:2326
#define LVIS_CUT
Definition: commctrl.h:2320
DWORD dwLvExStyle
Definition: listview.c:262

Referenced by LISTVIEW_CreateDragImage(), LISTVIEW_RefreshList(), and LISTVIEW_RefreshReport().

◆ LISTVIEW_DrawItemPart()

static void LISTVIEW_DrawItemPart ( LISTVIEW_INFO infoPtr,
LVITEMW item,
const NMLVCUSTOMDRAW nmlvcd,
const POINT pos 
)
static

Definition at line 4682 of file listview.c.

4683{
4684 RECT rcSelect, rcLabel, rcBox, rcStateIcon, rcIcon;
4685 const RECT *background;
4687 UINT format;
4688 RECT *focus;
4689
4690 /* now check if we need to update the focus rectangle */
4691 focus = infoPtr->bFocus && (item->state & LVIS_FOCUSED) ? &infoPtr->rcFocus : 0;
4692 if (!focus) item->state &= ~LVIS_FOCUSED;
4693
4694 LISTVIEW_GetItemMetrics(infoPtr, item, &rcBox, &rcSelect, &rcIcon, &rcStateIcon, &rcLabel);
4695 OffsetRect(&rcBox, pos->x, pos->y);
4696 OffsetRect(&rcSelect, pos->x, pos->y);
4697 OffsetRect(&rcIcon, pos->x, pos->y);
4698 OffsetRect(&rcStateIcon, pos->x, pos->y);
4699 OffsetRect(&rcLabel, pos->x, pos->y);
4700 TRACE("%d: box=%s, select=%s, icon=%s. label=%s\n", item->iSubItem,
4701 wine_dbgstr_rect(&rcBox), wine_dbgstr_rect(&rcSelect),
4702 wine_dbgstr_rect(&rcIcon), wine_dbgstr_rect(&rcLabel));
4703
4704 /* FIXME: temporary hack */
4705 rcSelect.left = rcLabel.left;
4706
4707 if (infoPtr->uView == LV_VIEW_DETAILS && item->iSubItem == 0)
4708 {
4709 if (!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
4710 OffsetRect(&rcSelect, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4711 OffsetRect(&rcIcon, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4712 OffsetRect(&rcStateIcon, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4713 OffsetRect(&rcLabel, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4714 }
4715
4716 /* in icon mode, the label rect is really what we want to draw the
4717 * background for */
4718 /* in detail mode, we want to paint background for label rect when
4719 * item is not selected or listview has full row select; otherwise paint
4720 * background for text only */
4721 if ( infoPtr->uView == LV_VIEW_ICON ||
4722 (infoPtr->uView == LV_VIEW_DETAILS && (!(item->state & LVIS_SELECTED) ||
4723 (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))))
4724 background = &rcLabel;
4725 else
4726 background = &rcSelect;
4727
4728 if (nmlvcd->clrTextBk != CLR_NONE)
4729 ExtTextOutW(nmlvcd->nmcd.hdc, background->left, background->top, ETO_OPAQUE, background, NULL, 0, NULL);
4730
4731 if (item->state & LVIS_FOCUSED)
4732 {
4733 if (infoPtr->uView == LV_VIEW_DETAILS)
4734 {
4735 if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
4736 {
4737 /* we have to update left focus bound too if item isn't in leftmost column
4738 and reduce right box bound */
4739 if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
4740 {
4741 INT leftmost;
4742
4743 if ((leftmost = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, 0, 0)))
4744 {
4745 INT Originx = pos->x - LISTVIEW_GetColumnInfo(infoPtr, leftmost)->rcHeader.left;
4746 INT rightmost = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX,
4747 DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
4748
4749 rcBox.right = LISTVIEW_GetColumnInfo(infoPtr, rightmost)->rcHeader.right + Originx;
4750 rcSelect.left = LISTVIEW_GetColumnInfo(infoPtr, leftmost)->rcHeader.left + Originx;
4751 }
4752 }
4753 rcSelect.right = rcBox.right;
4754 }
4755 infoPtr->rcFocus = rcSelect;
4756 }
4757 else
4758 infoPtr->rcFocus = rcLabel;
4759 }
4760
4761 /* state icons */
4762 if (infoPtr->himlState && STATEIMAGEINDEX(item->state) && (item->iSubItem == 0))
4763 {
4764 UINT stateimage = STATEIMAGEINDEX(item->state);
4765 if (stateimage)
4766 {
4767 TRACE("stateimage=%d\n", stateimage);
4768 ImageList_Draw(infoPtr->himlState, stateimage-1, nmlvcd->nmcd.hdc, rcStateIcon.left, rcStateIcon.top, ILD_NORMAL);
4769 }
4770 }
4771
4772 /* item icons */
4773 himl = (infoPtr->uView == LV_VIEW_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
4774 if (himl && item->iImage >= 0 && !IsRectEmpty(&rcIcon))
4775 {
4776 UINT style;
4777
4778 TRACE("iImage=%d\n", item->iImage);
4779
4780 if (item->state & (LVIS_SELECTED | LVIS_CUT) && infoPtr->bFocus)
4782 else
4783 style = ILD_NORMAL;
4784
4785 ImageList_DrawEx(himl, item->iImage, nmlvcd->nmcd.hdc, rcIcon.left, rcIcon.top,
4786 rcIcon.right - rcIcon.left, rcIcon.bottom - rcIcon.top, infoPtr->clrBk,
4787 item->state & LVIS_CUT ? RGB(255, 255, 255) : CLR_DEFAULT,
4788 style | (item->state & LVIS_OVERLAYMASK));
4789 }
4790
4791 /* Don't bother painting item being edited */
4792 if (infoPtr->hwndEdit && item->iItem == infoPtr->nEditLabelItem && item->iSubItem == 0) return;
4793
4794 /* figure out the text drawing flags */
4795 format = (infoPtr->uView == LV_VIEW_ICON ? (focus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS) : LV_SL_DT_FLAGS);
4796 if (infoPtr->uView == LV_VIEW_ICON)
4797 format = (focus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS);
4798 else if (item->iSubItem)
4799 {
4800 switch (LISTVIEW_GetColumnInfo(infoPtr, item->iSubItem)->fmt & LVCFMT_JUSTIFYMASK)
4801 {
4802 case LVCFMT_RIGHT: format |= DT_RIGHT; break;
4803 case LVCFMT_CENTER: format |= DT_CENTER; break;
4804 default: format |= DT_LEFT;
4805 }
4806 }
4807 if (!(format & (DT_RIGHT | DT_CENTER)))
4808 {
4809 if (himl && item->iImage >= 0 && !IsRectEmpty(&rcIcon)) rcLabel.left += IMAGE_PADDING;
4810 else rcLabel.left += LABEL_HOR_PADDING;
4811 }
4812 else if (format & DT_RIGHT) rcLabel.right -= LABEL_HOR_PADDING;
4813
4814 /* for GRIDLINES reduce the bottom so the text formats correctly */
4815 if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
4816 rcLabel.bottom--;
4817
4818#ifdef __REACTOS__
4819 if ((!(item->state & LVIS_SELECTED) || !infoPtr->bFocus) && (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTSHADOWTEXT))
4820 DrawShadowText(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format, RGB(255, 255, 255), RGB(0, 0, 0), 2, 2);
4821 else
4822#endif
4823 DrawTextW(nmlvcd->nmcd.hdc, item->pszText, -1, &rcLabel, format);
4824}
int WINAPI DrawShadowText(HDC hdc, LPCWSTR pszText, UINT cch, RECT *prc, DWORD dwFlags, COLORREF crText, COLORREF crShadow, int ixOffset, int iyOffset)
Definition: commctrl.c:1845
BOOL WINAPI ImageList_Draw(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, UINT fStyle)
Definition: imagelist.c:1228
BOOL WINAPI ImageList_DrawEx(HIMAGELIST himl, INT i, HDC hdc, INT x, INT y, INT dx, INT dy, COLORREF rgbBk, COLORREF rgbFg, UINT fStyle)
Definition: imagelist.c:1264
#define LV_FL_DT_FLAGS
Definition: listview.c:404
#define IMAGE_PADDING
Definition: listview.c:393
#define LV_SL_DT_FLAGS
Definition: listview.c:405
#define LABEL_HOR_PADDING
Definition: listview.c:376
#define LV_ML_DT_FLAGS
Definition: listview.c:403
static COLUMN_INFO * LISTVIEW_GetColumnInfo(const LISTVIEW_INFO *infoPtr, INT nSubItem)
Definition: listview.c:1642
#define STATEIMAGEINDEX(x)
Definition: listview.c:408
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
#define ILD_NORMAL
Definition: commctrl.h:417
#define LVS_EX_GRIDLINES
Definition: commctrl.h:2729
#define CLR_NONE
Definition: commctrl.h:319
#define CLR_DEFAULT
Definition: commctrl.h:320
#define ILD_SELECTED
Definition: commctrl.h:430
COLORREF clrBk
Definition: listview.c:299
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define ETO_OPAQUE
Definition: wingdi.h:647
#define DT_CENTER
Definition: winuser.h:527
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define DT_LEFT
Definition: winuser.h:534
#define DT_RIGHT
Definition: winuser.h:538

Referenced by LISTVIEW_DrawItem().

◆ LISTVIEW_DrawTrackLine()

static BOOL LISTVIEW_DrawTrackLine ( const LISTVIEW_INFO infoPtr)
static

Definition at line 9574 of file listview.c.

9575{
9576 HDC hdc;
9577
9578 if (infoPtr->xTrackLine == -1)
9579 return FALSE;
9580
9581 if (!(hdc = GetDC(infoPtr->hwndSelf)))
9582 return FALSE;
9583 PatBlt( hdc, infoPtr->xTrackLine, infoPtr->rcList.top,
9584 1, infoPtr->rcList.bottom - infoPtr->rcList.top, DSTINVERT );
9585 ReleaseDC(infoPtr->hwndSelf, hdc);
9586 return TRUE;
9587}
#define DSTINVERT
Definition: wingdi.h:327
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)

Referenced by LISTVIEW_Notify().

◆ LISTVIEW_EditLabelT()

static HWND LISTVIEW_EditLabelT ( LISTVIEW_INFO infoPtr,
INT  nItem,
BOOL  isW 
)
static

Definition at line 6235 of file listview.c.

6236{
6237 WCHAR disptextW[DISP_TEXT_SIZE] = { 0 };
6238 HWND hwndSelf = infoPtr->hwndSelf;
6239 NMLVDISPINFOW dispInfo;
6240 HFONT hOldFont = NULL;
6242 RECT rect;
6243 SIZE sz;
6244 HDC hdc;
6245
6246 TRACE("(nItem=%d, isW=%d)\n", nItem, isW);
6247
6248 if (~infoPtr->dwStyle & LVS_EDITLABELS) return 0;
6249
6250 /* remove existing edit box */
6251 if (infoPtr->hwndEdit)
6252 {
6253 SetFocus(infoPtr->hwndSelf);
6254 infoPtr->hwndEdit = 0;
6255 }
6256
6257 if (nItem < 0 || nItem >= infoPtr->nItemCount) return 0;
6258
6259 infoPtr->nEditLabelItem = nItem;
6260
6261 LISTVIEW_SetSelection(infoPtr, nItem);
6262 LISTVIEW_SetItemFocus(infoPtr, nItem);
6263 LISTVIEW_InvalidateItem(infoPtr, nItem);
6264
6265 rect.left = LVIR_LABEL;
6266 if (!LISTVIEW_GetItemRect(infoPtr, nItem, &rect)) return 0;
6267
6268 ZeroMemory(&dispInfo, sizeof(dispInfo));
6269 dispInfo.item.mask = LVIF_PARAM | LVIF_STATE | LVIF_TEXT;
6270 dispInfo.item.iItem = nItem;
6271 dispInfo.item.iSubItem = 0;
6272 dispInfo.item.stateMask = ~0;
6273 dispInfo.item.pszText = disptextW;
6274 dispInfo.item.cchTextMax = DISP_TEXT_SIZE;
6275 if (!LISTVIEW_GetItemT(infoPtr, &dispInfo.item, isW)) return 0;
6276
6277 infoPtr->hwndEdit = CreateEditLabelT(infoPtr, dispInfo.item.pszText, isW);
6278 if (!infoPtr->hwndEdit) return 0;
6279
6280 if (notify_dispinfoT(infoPtr, LVN_BEGINLABELEDITW, &dispInfo, isW))
6281 {
6282 if (!IsWindow(hwndSelf))
6283 return 0;
6284 SendMessageW(infoPtr->hwndEdit, WM_CLOSE, 0, 0);
6285 infoPtr->hwndEdit = 0;
6286 return 0;
6287 }
6288
6289 TRACE("disp text=%s\n", debugtext_t(dispInfo.item.pszText, isW));
6290
6291 /* position and display edit box */
6292 hdc = GetDC(infoPtr->hwndSelf);
6293
6294 /* select the font to get appropriate metric dimensions */
6295 if (infoPtr->hFont)
6296 hOldFont = SelectObject(hdc, infoPtr->hFont);
6297
6298 /* use real edit box content, it could be altered during LVN_BEGINLABELEDIT notification */
6299 GetWindowTextW(infoPtr->hwndEdit, disptextW, DISP_TEXT_SIZE);
6300 TRACE("edit box text=%s\n", debugstr_w(disptextW));
6301
6302 /* get string length in pixels */
6303 GetTextExtentPoint32W(hdc, disptextW, lstrlenW(disptextW), &sz);
6304
6305 /* add extra spacing for the next character */
6307 sz.cx += tm.tmMaxCharWidth * 2;
6308
6309 if (infoPtr->hFont)
6310 SelectObject(hdc, hOldFont);
6311
6312 ReleaseDC(infoPtr->hwndSelf, hdc);
6313
6314 sz.cy = rect.bottom - rect.top + 2;
6315 rect.left -= 2;
6316 rect.top -= 1;
6317 TRACE("moving edit=(%d,%d)-(%d,%d)\n", rect.left, rect.top, sz.cx, sz.cy);
6318 MoveWindow(infoPtr->hwndEdit, rect.left, rect.top, sz.cx, sz.cy, FALSE);
6319 ShowWindow(infoPtr->hwndEdit, SW_NORMAL);
6320 SetFocus(infoPtr->hwndEdit);
6321 SendMessageW(infoPtr->hwndEdit, EM_SETSEL, 0, -1);
6322 return infoPtr->hwndEdit;
6323}
static void LISTVIEW_SetSelection(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:3798
static HWND CreateEditLabelT(LISTVIEW_INFO *infoPtr, LPCWSTR text, BOOL isW)
Definition: listview.c:6196
static BOOL LISTVIEW_SetItemFocus(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:3586
static BOOL notify_dispinfoT(const LISTVIEW_INFO *infoPtr, UINT code, LPNMLVDISPINFOW pdi, BOOL isW)
Definition: listview.c:939
static BOOL LISTVIEW_GetItemT(const LISTVIEW_INFO *, LPLVITEMW, BOOL)
Definition: listview.c:6786
#define LVIR_LABEL
Definition: commctrl.h:2474
#define LVS_EDITLABELS
Definition: commctrl.h:2273
LVITEMW item
Definition: commctrl.h:3179
Definition: time.h:68
HWND WINAPI SetFocus(_In_opt_ HWND)
#define EM_SETSEL
Definition: winuser.h:2018
#define SW_NORMAL
Definition: winuser.h:769
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by LISTVIEW_DelayedEditItem(), and LISTVIEW_WindowProc().

◆ LISTVIEW_Enable()

static BOOL LISTVIEW_Enable ( const LISTVIEW_INFO infoPtr)
static

Definition at line 9796 of file listview.c.

9797{
9798 if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED)
9799 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
9800 return TRUE;
9801}
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_EndEditLabelT()

static BOOL LISTVIEW_EndEditLabelT ( LISTVIEW_INFO infoPtr,
BOOL  storeText,
BOOL  isW 
)
static

Definition at line 5989 of file listview.c.

5990{
5991 HWND hwndSelf = infoPtr->hwndSelf;
5992 WCHAR szDispText[DISP_TEXT_SIZE] = { 0 };
5993 NMLVDISPINFOW dispInfo;
5994 INT editedItem = infoPtr->nEditLabelItem;
5995 BOOL same;
5996 WCHAR *pszText = NULL;
5997 BOOL res;
5998
5999 if (storeText)
6000 {
6002
6003 if (len++)
6004 {
6005 if (!(pszText = Alloc(len * (isW ? sizeof(WCHAR) : sizeof(CHAR)))))
6006 return FALSE;
6007
6008 if (isW)
6009 GetWindowTextW(infoPtr->hwndEdit, pszText, len);
6010 else
6011 GetWindowTextA(infoPtr->hwndEdit, (CHAR*)pszText, len);
6012 }
6013 }
6014
6015 TRACE("(pszText=%s, isW=%d)\n", debugtext_t(pszText, isW), isW);
6016
6017 ZeroMemory(&dispInfo, sizeof(dispInfo));
6018 dispInfo.item.mask = LVIF_PARAM | LVIF_STATE | LVIF_TEXT;
6019 dispInfo.item.iItem = editedItem;
6020 dispInfo.item.iSubItem = 0;
6021 dispInfo.item.stateMask = ~0;
6022 dispInfo.item.pszText = szDispText;
6023 dispInfo.item.cchTextMax = DISP_TEXT_SIZE;
6024 if (!LISTVIEW_GetItemT(infoPtr, &dispInfo.item, isW))
6025 {
6026 res = FALSE;
6027 goto cleanup;
6028 }
6029
6030 if (isW)
6031 same = (lstrcmpW(dispInfo.item.pszText, pszText) == 0);
6032 else
6033 {
6034 LPWSTR tmp = textdupTtoW(pszText, FALSE);
6035 same = (lstrcmpW(dispInfo.item.pszText, tmp) == 0);
6036 textfreeT(tmp, FALSE);
6037 }
6038
6039 /* add the text from the edit in */
6040 dispInfo.item.mask |= LVIF_TEXT;
6041 dispInfo.item.pszText = same ? NULL : pszText;
6042 dispInfo.item.cchTextMax = textlenT(dispInfo.item.pszText, isW);
6043
6044 infoPtr->notify_mask &= ~NOTIFY_MASK_END_LABEL_EDIT;
6045
6046 /* Do we need to update the Item Text */
6047 res = notify_dispinfoT(infoPtr, LVN_ENDLABELEDITW, &dispInfo, isW);
6048
6050
6051 infoPtr->nEditLabelItem = -1;
6052 infoPtr->hwndEdit = 0;
6053
6054 if (!res) goto cleanup;
6055
6056 if (!IsWindow(hwndSelf))
6057 {
6058 res = FALSE;
6059 goto cleanup;
6060 }
6061 if (!pszText) return TRUE;
6062 if (same)
6063 {
6064 res = TRUE;
6065 goto cleanup;
6066 }
6067
6068 if (!(infoPtr->dwStyle & LVS_OWNERDATA))
6069 {
6070 HDPA hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, editedItem);
6071 ITEM_INFO* lpItem = DPA_GetPtr(hdpaSubItems, 0);
6072 if (lpItem && lpItem->hdr.pszText == LPSTR_TEXTCALLBACKW)
6073 {
6074 LISTVIEW_InvalidateItem(infoPtr, editedItem);
6075 res = TRUE;
6076 goto cleanup;
6077 }
6078 }
6079
6080 ZeroMemory(&dispInfo, sizeof(dispInfo));
6081 dispInfo.item.mask = LVIF_TEXT;
6082 dispInfo.item.iItem = editedItem;
6083 dispInfo.item.iSubItem = 0;
6084 dispInfo.item.pszText = pszText;
6085 dispInfo.item.cchTextMax = textlenT(pszText, isW);
6086 res = LISTVIEW_SetItemT(infoPtr, &dispInfo.item, isW);
6087
6088cleanup:
6089 Free(pszText);
6090
6091 return res;
6092}
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
HWND hwndEdit
Definition: combotst.c:65
static LPWSTR textdupTtoW(LPCWSTR text, BOOL isW)
Definition: listview.c:484
static void textfreeT(LPWSTR wstr, BOOL isW)
Definition: listview.c:498
static BOOL LISTVIEW_SetItemT(LISTVIEW_INFO *infoPtr, LVITEMW *lpLVItem, BOOL isW)
Definition: listview.c:4563
static void cleanup(void)
Definition: main.c:1335
GLuint res
Definition: glext.h:9613
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
ITEMHDR hdr
Definition: listview.c:171
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1330
int WINAPI GetWindowTextLengthA(_In_ HWND)
int WINAPI GetWindowTextLengthW(_In_ HWND)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
char CHAR
Definition: xmlstorage.h:175

Referenced by EditLblWndProcT(), and LISTVIEW_CancelEditLabel().

◆ LISTVIEW_EnsureVisible()

static BOOL LISTVIEW_EnsureVisible ( LISTVIEW_INFO infoPtr,
INT  nItem,
BOOL  bPartial 
)
static

Definition at line 6339 of file listview.c.

6340{
6341 INT nScrollPosHeight = 0;
6342 INT nScrollPosWidth = 0;
6343 INT nHorzAdjust = 0;
6344 INT nVertAdjust = 0;
6345 INT nHorzDiff = 0;
6346 INT nVertDiff = 0;
6347 RECT rcItem, rcTemp;
6348
6349 rcItem.left = LVIR_BOUNDS;
6350 if (!LISTVIEW_GetItemRect(infoPtr, nItem, &rcItem)) return FALSE;
6351
6352 if (bPartial && IntersectRect(&rcTemp, &infoPtr->rcList, &rcItem)) return TRUE;
6353
6354 if (rcItem.left < infoPtr->rcList.left || rcItem.right > infoPtr->rcList.right)
6355 {
6356 /* scroll left/right, but in LV_VIEW_DETAILS mode */
6357 if (infoPtr->uView == LV_VIEW_LIST)
6358 nScrollPosWidth = infoPtr->nItemWidth;
6359 else if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
6360 nScrollPosWidth = 1;
6361
6362 if (rcItem.left < infoPtr->rcList.left)
6363 {
6364 nHorzAdjust = -1;
6365 if (infoPtr->uView != LV_VIEW_DETAILS) nHorzDiff = rcItem.left - infoPtr->rcList.left;
6366 }
6367 else
6368 {
6369 nHorzAdjust = 1;
6370 if (infoPtr->uView != LV_VIEW_DETAILS) nHorzDiff = rcItem.right - infoPtr->rcList.right;
6371 }
6372 }
6373
6374 if (rcItem.top < infoPtr->rcList.top || rcItem.bottom > infoPtr->rcList.bottom)
6375 {
6376 /* scroll up/down, but not in LVS_LIST mode */
6377 if (infoPtr->uView == LV_VIEW_DETAILS)
6378 nScrollPosHeight = infoPtr->nItemHeight;
6379 else if ((infoPtr->uView == LV_VIEW_ICON) || (infoPtr->uView == LV_VIEW_SMALLICON))
6380 nScrollPosHeight = 1;
6381
6382 if (rcItem.top < infoPtr->rcList.top)
6383 {
6384 nVertAdjust = -1;
6385 if (infoPtr->uView != LV_VIEW_LIST) nVertDiff = rcItem.top - infoPtr->rcList.top;
6386 }
6387 else
6388 {
6389 nVertAdjust = 1;
6390 if (infoPtr->uView != LV_VIEW_LIST) nVertDiff = rcItem.bottom - infoPtr->rcList.bottom;
6391 }
6392 }
6393
6394 if (!nScrollPosWidth && !nScrollPosHeight) return TRUE;
6395
6396 if (nScrollPosWidth)
6397 {
6398 INT diff = nHorzDiff / nScrollPosWidth;
6399 if (nHorzDiff % nScrollPosWidth) diff += nHorzAdjust;
6400 LISTVIEW_HScroll(infoPtr, SB_INTERNAL, diff);
6401 }
6402
6403 if (nScrollPosHeight)
6404 {
6405 INT diff = nVertDiff / nScrollPosHeight;
6406 if (nVertDiff % nScrollPosHeight) diff += nVertAdjust;
6407 LISTVIEW_VScroll(infoPtr, SB_INTERNAL, diff);
6408 }
6409
6410 return TRUE;
6411}
static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *, INT, INT)
Definition: listview.c:9879
static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *, INT, INT)
Definition: listview.c:9983

Referenced by LISTVIEW_KeySelection(), LISTVIEW_SetItemCount(), LISTVIEW_WindowProc(), and set_main_item().

◆ LISTVIEW_EraseBkgnd()

static BOOL LISTVIEW_EraseBkgnd ( const LISTVIEW_INFO infoPtr,
HDC  hdc 
)
inlinestatic

Definition at line 9815 of file listview.c.

9816{
9817 RECT rc;
9818
9819 TRACE("(hdc=%p)\n", hdc);
9820
9821 if (!GetClipBox(hdc, &rc)) return FALSE;
9822
9823 if (infoPtr->clrBk == CLR_NONE)
9824 {
9825 if (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTBKGND)
9826 return SendMessageW(infoPtr->hwndNotify, WM_PRINTCLIENT,
9828 else
9829 return SendMessageW(infoPtr->hwndNotify, WM_ERASEBKGND, (WPARAM)hdc, 0);
9830 }
9831
9832 /* for double buffered controls we need to do this during refresh */
9833 if (infoPtr->dwLvExStyle & LVS_EX_DOUBLEBUFFER) return FALSE;
9834
9835 return LISTVIEW_FillBkgnd(infoPtr, hdc, &rc);
9836}
static BOOL LISTVIEW_FillBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *lprcBox)
Definition: listview.c:4672
#define LVS_EX_DOUBLEBUFFER
Definition: commctrl.h:2745
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_ERASEBKGND
Definition: winuser.h:1625
#define PRF_ERASEBKGND
Definition: winuser.h:2526

Referenced by LISTVIEW_PrintClient(), and LISTVIEW_WindowProc().

◆ LISTVIEW_FillBkgnd()

static BOOL LISTVIEW_FillBkgnd ( const LISTVIEW_INFO infoPtr,
HDC  hdc,
const RECT lprcBox 
)
inlinestatic

Definition at line 4672 of file listview.c.

4673{
4674 if (!infoPtr->hBkBrush) return FALSE;
4675
4676 TRACE("(hdc=%p, lprcBox=%s, hBkBrush=%p)\n", hdc, wine_dbgstr_rect(lprcBox), infoPtr->hBkBrush);
4677
4678 return FillRect(hdc, lprcBox, infoPtr->hBkBrush);
4679}

Referenced by LISTVIEW_EraseBkgnd(), and LISTVIEW_Refresh().

◆ LISTVIEW_FindItemA()

static INT LISTVIEW_FindItemA ( const LISTVIEW_INFO infoPtr,
INT  nStart,
const LVFINDINFOA lpFindInfo 
)
static

Definition at line 6571 of file listview.c.

6573{
6574 LVFINDINFOW fiw;
6575 INT res;
6576 LPWSTR strW = NULL;
6577
6578 memcpy(&fiw, lpFindInfo, sizeof(fiw));
6579 if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL | LVFI_SUBSTRING))
6580 fiw.psz = strW = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE);
6581 res = LISTVIEW_FindItemW(infoPtr, nStart, &fiw);
6583 return res;
6584}
static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOW *lpFindInfo)
Definition: listview.c:6426
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR strW[12]
Definition: clipboard.c:2029
#define LVFI_STRING
Definition: commctrl.h:2437
#define LVFI_SUBSTRING
Definition: commctrl.h:2438
#define LVFI_PARTIAL
Definition: commctrl.h:2439
LPCWSTR psz
Definition: commctrl.h:2457
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_FindItemW()

static INT LISTVIEW_FindItemW ( const LISTVIEW_INFO infoPtr,
INT  nStart,
const LVFINDINFOW lpFindInfo 
)
static

Definition at line 6426 of file listview.c.

6428{
6429 WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
6430 BOOL bWrap = FALSE, bNearest = FALSE;
6431 INT nItem = nStart + 1, nLast = infoPtr->nItemCount, nNearestItem = -1;
6432 ULONG xdist, ydist, dist, mindist = 0x7fffffff;
6434 LVITEMW lvItem;
6435
6436 /* Search in virtual listviews should be done by application, not by
6437 listview control, so we just send LVN_ODFINDITEMW and return the result */
6438 if (infoPtr->dwStyle & LVS_OWNERDATA)
6439 {
6440 NMLVFINDITEMW nmlv;
6441
6442 nmlv.iStart = nStart;
6443 nmlv.lvfi = *lpFindInfo;
6444 return notify_hdr(infoPtr, LVN_ODFINDITEMW, (LPNMHDR)&nmlv.hdr);
6445 }
6446
6447 if (!lpFindInfo || nItem < 0) return -1;
6448
6449 lvItem.mask = 0;
6450 if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL | LVFI_SUBSTRING))
6451 {
6452 lvItem.mask |= LVIF_TEXT;
6453 lvItem.pszText = szDispText;
6454 lvItem.cchTextMax = DISP_TEXT_SIZE;
6455 }
6456
6457 if (lpFindInfo->flags & LVFI_WRAP)
6458 bWrap = TRUE;
6459
6460 if ((lpFindInfo->flags & LVFI_NEARESTXY) &&
6461 (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON))
6462 {
6463 POINT Origin;
6464 RECT rcArea;
6465
6466 LISTVIEW_GetOrigin(infoPtr, &Origin);
6467 Destination.x = lpFindInfo->pt.x - Origin.x;
6468 Destination.y = lpFindInfo->pt.y - Origin.y;
6469 switch(lpFindInfo->vkDirection)
6470 {
6471 case VK_DOWN: Destination.y += infoPtr->nItemHeight; break;
6472 case VK_UP: Destination.y -= infoPtr->nItemHeight; break;
6473 case VK_RIGHT: Destination.x += infoPtr->nItemWidth; break;
6474 case VK_LEFT: Destination.x -= infoPtr->nItemWidth; break;
6475 case VK_HOME: Destination.x = Destination.y = 0; break;
6476 case VK_NEXT: Destination.y += infoPtr->rcList.bottom - infoPtr->rcList.top; break;
6477 case VK_PRIOR: Destination.y -= infoPtr->rcList.bottom - infoPtr->rcList.top; break;
6478 case VK_END:
6479 LISTVIEW_GetAreaRect(infoPtr, &rcArea);
6480 Destination.x = rcArea.right;
6481 Destination.y = rcArea.bottom;
6482 break;
6483 default: ERR("Unknown vkDirection=%d\n", lpFindInfo->vkDirection);
6484 }
6485 bNearest = TRUE;
6486 }
6487 else Destination.x = Destination.y = 0;
6488
6489 /* if LVFI_PARAM is specified, all other flags are ignored */
6490 if (lpFindInfo->flags & LVFI_PARAM)
6491 {
6492 lvItem.mask |= LVIF_PARAM;
6493 bNearest = FALSE;
6494 lvItem.mask &= ~LVIF_TEXT;
6495 }
6496
6497 nItem = bNearest ? -1 : nStart + 1;
6498
6499again:
6500 for (; nItem < nLast; nItem++)
6501 {
6502 lvItem.iItem = nItem;
6503 lvItem.iSubItem = 0;
6504 lvItem.pszText = szDispText;
6505 if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) continue;
6506
6507 if (lvItem.mask & LVIF_PARAM)
6508 {
6509 if (lpFindInfo->lParam == lvItem.lParam)
6510 return nItem;
6511 else
6512 continue;
6513 }
6514
6515 if (lvItem.mask & LVIF_TEXT)
6516 {
6517 if (lpFindInfo->flags & (LVFI_PARTIAL | LVFI_SUBSTRING))
6518 {
6519 WCHAR *p = wcsstr(lvItem.pszText, lpFindInfo->psz);
6520 if (!p || p != lvItem.pszText) continue;
6521 }
6522 else
6523 {
6524 if (lstrcmpW(lvItem.pszText, lpFindInfo->psz) != 0) continue;
6525 }
6526 }
6527
6528 if (!bNearest) return nItem;
6529
6530 /* This is very inefficient. To do a good job here,
6531 * we need a sorted array of (x,y) item positions */
6532 LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
6533
6534 /* compute the distance^2 to the destination */
6535 xdist = Destination.x - Position.x;
6536 ydist = Destination.y - Position.y;
6537 dist = xdist * xdist + ydist * ydist;
6538
6539 /* remember the distance, and item if it's closer */
6540 if (dist < mindist)
6541 {
6542 mindist = dist;
6543 nNearestItem = nItem;
6544 }
6545 }
6546
6547 if (bWrap)
6548 {
6549 nItem = 0;
6550 nLast = min(nStart + 1, infoPtr->nItemCount);
6551 bWrap = FALSE;
6552 goto again;
6553 }
6554
6555 return nNearestItem;
6556}
static void LISTVIEW_GetAreaRect(const LISTVIEW_INFO *infoPtr, LPRECT lprcView)
Definition: listview.c:2931
GLfloat GLfloat p
Definition: glext.h:8902
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3004
#define LVFI_WRAP
Definition: commctrl.h:2440
#define LVFI_PARAM
Definition: commctrl.h:2436
#define LVFI_NEARESTXY
Definition: commctrl.h:2441
UINT vkDirection
Definition: commctrl.h:2460
LPARAM lParam
Definition: commctrl.h:2458
LVFINDINFOW lvfi
Definition: commctrl.h:3101
uint32_t ULONG
Definition: typedefs.h:59
#define VK_UP
Definition: winuser.h:2225
#define VK_NEXT
Definition: winuser.h:2221
#define VK_END
Definition: winuser.h:2222
#define VK_HOME
Definition: winuser.h:2223
#define VK_LEFT
Definition: winuser.h:2224
#define VK_RIGHT
Definition: winuser.h:2226
#define VK_DOWN
Definition: winuser.h:2227
#define VK_PRIOR
Definition: winuser.h:2220

Referenced by LISTVIEW_FindItemA(), LISTVIEW_GetNextItem(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetAreaRect()

static void LISTVIEW_GetAreaRect ( const LISTVIEW_INFO infoPtr,
LPRECT  lprcView 
)
static

Definition at line 2931 of file listview.c.

2932{
2933 INT i, x, y;
2934
2935 SetRectEmpty(lprcView);
2936
2937 switch (infoPtr->uView)
2938 {
2939 case LV_VIEW_ICON:
2940 case LV_VIEW_SMALLICON:
2941 for (i = 0; i < infoPtr->nItemCount; i++)
2942 {
2943 x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, i);
2944 y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, i);
2945 lprcView->right = max(lprcView->right, x);
2946 lprcView->bottom = max(lprcView->bottom, y);
2947 }
2948 if (infoPtr->nItemCount > 0)
2949 {
2950 lprcView->right += infoPtr->nItemWidth;
2951 lprcView->bottom += infoPtr->nItemHeight;
2952 }
2953 break;
2954
2955 case LV_VIEW_LIST:
2956 y = LISTVIEW_GetCountPerColumn(infoPtr);
2957 x = infoPtr->nItemCount / y;
2958 if (infoPtr->nItemCount % y) x++;
2959 lprcView->right = x * infoPtr->nItemWidth;
2960 lprcView->bottom = y * infoPtr->nItemHeight;
2961 break;
2962 }
2963}
static INT LISTVIEW_GetCountPerColumn(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1826
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by LISTVIEW_FindItemW(), and LISTVIEW_GetViewRect().

◆ LISTVIEW_GetColumnInfo()

static COLUMN_INFO * LISTVIEW_GetColumnInfo ( const LISTVIEW_INFO infoPtr,
INT  nSubItem 
)
inlinestatic

Definition at line 1642 of file listview.c.

1643{
1644 static COLUMN_INFO mainItem;
1645
1646 if (nSubItem == 0 && DPA_GetPtrCount(infoPtr->hdpaColumns) == 0) return &mainItem;
1647 assert (nSubItem >= 0 && nSubItem < DPA_GetPtrCount(infoPtr->hdpaColumns));
1648
1649 /* update cached column rectangles */
1650 if (infoPtr->colRectsDirty)
1651 {
1653 LISTVIEW_INFO *Ptr = (LISTVIEW_INFO*)infoPtr;
1654 INT i;
1655
1656 for (i = 0; i < DPA_GetPtrCount(infoPtr->hdpaColumns); i++) {
1657 info = DPA_GetPtr(infoPtr->hdpaColumns, i);
1658 SendMessageW(infoPtr->hwndHeader, HDM_GETITEMRECT, i, (LPARAM)&info->rcHeader);
1659 }
1660 Ptr->colRectsDirty = FALSE;
1661 }
1662
1663 return DPA_GetPtr(infoPtr->hdpaColumns, nSubItem);
1664}
#define assert(x)
Definition: debug.h:53
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define HDM_GETITEMRECT
Definition: commctrl.h:791
BOOL colRectsDirty
Definition: listview.c:249

Referenced by LISTVIEW_DrawItemPart(), LISTVIEW_GetColumnT(), LISTVIEW_GetHeaderRect(), LISTVIEW_GetItemMetrics(), LISTVIEW_GetItemOrigin(), LISTVIEW_GetItemRect(), LISTVIEW_HitTest(), LISTVIEW_Notify(), LISTVIEW_ScrollColumns(), LISTVIEW_SetColumnT(), and LISTVIEW_SetColumnWidth().

◆ LISTVIEW_GetColumnOrderArray()

static BOOL LISTVIEW_GetColumnOrderArray ( const LISTVIEW_INFO infoPtr,
INT  iCount,
LPINT  lpiArray 
)
inlinestatic

Definition at line 6651 of file listview.c.

6652{
6653 if (!infoPtr->hwndHeader) return FALSE;
6654 return SendMessageW(infoPtr->hwndHeader, HDM_GETORDERARRAY, iCount, (LPARAM)lpiArray);
6655}
#define HDM_GETORDERARRAY
Definition: commctrl.h:806

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetColumnT()

static BOOL LISTVIEW_GetColumnT ( const LISTVIEW_INFO infoPtr,
INT  nColumn,
LPLVCOLUMNW  lpColumn,
BOOL  isW 
)
static

Definition at line 6601 of file listview.c.

6602{
6603 COLUMN_INFO *lpColumnInfo;
6604 HDITEMW hdi;
6605
6606 if (!lpColumn || nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
6607 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nColumn);
6608
6609 /* initialize memory */
6610 ZeroMemory(&hdi, sizeof(hdi));
6611
6612 if (lpColumn->mask & LVCF_TEXT)
6613 {
6614 hdi.mask |= HDI_TEXT;
6615 hdi.pszText = lpColumn->pszText;
6616 hdi.cchTextMax = lpColumn->cchTextMax;
6617 }
6618
6619 if (lpColumn->mask & LVCF_IMAGE)
6620 hdi.mask |= HDI_IMAGE;
6621
6622 if (lpColumn->mask & LVCF_ORDER)
6623 hdi.mask |= HDI_ORDER;
6624
6625 if (lpColumn->mask & LVCF_SUBITEM)
6626 hdi.mask |= HDI_LPARAM;
6627
6628 if (!SendMessageW(infoPtr->hwndHeader, isW ? HDM_GETITEMW : HDM_GETITEMA, nColumn, (LPARAM)&hdi)) return FALSE;
6629
6630 if (lpColumn->mask & LVCF_FMT)
6631 lpColumn->fmt = lpColumnInfo->fmt;
6632
6633 if (lpColumn->mask & LVCF_WIDTH)
6634 lpColumn->cx = lpColumnInfo->rcHeader.right - lpColumnInfo->rcHeader.left;
6635
6636 if (lpColumn->mask & LVCF_IMAGE)
6637 lpColumn->iImage = hdi.iImage;
6638
6639 if (lpColumn->mask & LVCF_ORDER)
6640 lpColumn->iOrder = hdi.iOrder;
6641
6642 if (lpColumn->mask & LVCF_SUBITEM)
6643 lpColumn->iSubItem = hdi.lParam;
6644
6645 if (lpColumn->mask & LVCF_MINWIDTH)
6646 lpColumn->cxMin = lpColumnInfo->cxMin;
6647
6648 return TRUE;
6649}
#define HDM_GETITEMA
Definition: commctrl.h:746
#define HDM_GETITEMW
Definition: commctrl.h:747
#define HDI_LPARAM
Definition: commctrl.h:706

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetColumnWidth()

static INT LISTVIEW_GetColumnWidth ( const LISTVIEW_INFO infoPtr,
INT  nColumn 
)
static

Definition at line 6669 of file listview.c.

6670{
6671 INT nColumnWidth = 0;
6672 HDITEMW hdItem;
6673
6674 TRACE("nColumn=%d\n", nColumn);
6675
6676 /* we have a 'column' in LIST and REPORT mode only */
6677 switch(infoPtr->uView)
6678 {
6679 case LV_VIEW_LIST:
6680 nColumnWidth = infoPtr->nItemWidth;
6681 break;
6682 case LV_VIEW_DETAILS:
6683 /* We are not using LISTVIEW_GetHeaderRect as this data is updated only after a HDN_ITEMCHANGED.
6684 * There is an application that subclasses the listview, calls LVM_GETCOLUMNWIDTH in the
6685 * HDN_ITEMCHANGED handler and goes into infinite recursion if it receives old data.
6686 */
6687 hdItem.mask = HDI_WIDTH;
6688 if (!SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nColumn, (LPARAM)&hdItem))
6689 {
6690 WARN("(%p): HDM_GETITEMW failed for item %d\n", infoPtr->hwndSelf, nColumn);
6691 return 0;
6692 }
6693 nColumnWidth = hdItem.cxy;
6694 break;
6695 }
6696
6697 TRACE("nColumnWidth=%d\n", nColumnWidth);
6698 return nColumnWidth;
6699}
#define WARN(fmt,...)
Definition: debug.h:112

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetCountPerColumn()

static INT LISTVIEW_GetCountPerColumn ( const LISTVIEW_INFO infoPtr)
inlinestatic

◆ LISTVIEW_GetCountPerPage()

static INT LISTVIEW_GetCountPerPage ( const LISTVIEW_INFO infoPtr)
static

Definition at line 6713 of file listview.c.

6714{
6715 switch (infoPtr->uView)
6716 {
6717 case LV_VIEW_ICON:
6718 case LV_VIEW_SMALLICON:
6719 return infoPtr->nItemCount;
6720 case LV_VIEW_DETAILS:
6721 return LISTVIEW_GetCountPerColumn(infoPtr);
6722 case LV_VIEW_LIST:
6723 return LISTVIEW_GetCountPerRow(infoPtr) * LISTVIEW_GetCountPerColumn(infoPtr);
6724 }
6725 assert(FALSE);
6726 return 0;
6727}
static INT LISTVIEW_GetCountPerRow(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1808

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetCountPerRow()

static INT LISTVIEW_GetCountPerRow ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1808 of file listview.c.

1809{
1810 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
1811
1812 return max(nListWidth/(infoPtr->nItemWidth ? infoPtr->nItemWidth : 1), 1);
1813}

Referenced by LISTVIEW_GetCountPerPage(), LISTVIEW_GetNextItem(), LISTVIEW_GetTopIndex(), and LISTVIEW_KeyDown().

◆ LISTVIEW_GetHeaderRect()

◆ LISTVIEW_GetImageList()

static HIMAGELIST LISTVIEW_GetImageList ( const LISTVIEW_INFO infoPtr,
INT  nImageList 
)
static

Definition at line 6741 of file listview.c.

6742{
6743 switch (nImageList)
6744 {
6745 case LVSIL_NORMAL: return infoPtr->himlNormal;
6746 case LVSIL_SMALL: return infoPtr->himlSmall;
6747 case LVSIL_STATE: return infoPtr->himlState;
6748 case LVSIL_GROUPHEADER:
6749 FIXME("LVSIL_GROUPHEADER not supported\n");
6750 break;
6751 default:
6752 WARN("got unknown imagelist index - %d\n", nImageList);
6753 }
6754 return NULL;
6755}
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define LVSIL_GROUPHEADER
Definition: commctrl.h:2301
#define LVSIL_STATE
Definition: commctrl.h:2300
#define LVSIL_NORMAL
Definition: commctrl.h:2298

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemAtPt()

static BOOL LISTVIEW_GetItemAtPt ( const LISTVIEW_INFO infoPtr,
LPLVITEMW  lpLVItem,
POINT  pt 
)
static

Definition at line 3865 of file listview.c.

3866{
3867 LVHITTESTINFO lvHitTestInfo;
3868
3869 ZeroMemory(&lvHitTestInfo, sizeof(lvHitTestInfo));
3870 lvHitTestInfo.pt.x = pt.x;
3871 lvHitTestInfo.pt.y = pt.y;
3872
3873 LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
3874
3875 lpLVItem->mask = LVIF_PARAM;
3876 lpLVItem->iItem = lvHitTestInfo.iItem;
3877 lpLVItem->iSubItem = 0;
3878
3879 return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE);
3880}
static INT LISTVIEW_HitTest(const LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL)
Definition: listview.c:7746
#define pt(x, y)
Definition: drawing.c:79

Referenced by LISTVIEW_MouseHover().

◆ LISTVIEW_GetItemBox()

static void LISTVIEW_GetItemBox ( const LISTVIEW_INFO infoPtr,
INT  nItem,
LPRECT  lprcBox 
)
static

Definition at line 2616 of file listview.c.

2617{
2618 WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
2619 POINT Position, Origin;
2620 LVITEMW lvItem;
2621
2622 LISTVIEW_GetOrigin(infoPtr, &Origin);
2623 LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
2624
2625 /* Be smart and try to figure out the minimum we have to do */
2626 lvItem.mask = 0;
2627 if (infoPtr->uView == LV_VIEW_ICON && infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, nItem, LVIS_FOCUSED))
2628 lvItem.mask |= LVIF_TEXT;
2629 lvItem.iItem = nItem;
2630 lvItem.iSubItem = 0;
2631 lvItem.pszText = szDispText;
2632 lvItem.cchTextMax = DISP_TEXT_SIZE;
2633 if (lvItem.mask) LISTVIEW_GetItemW(infoPtr, &lvItem);
2634 if (infoPtr->uView == LV_VIEW_ICON)
2635 {
2636 lvItem.mask |= LVIF_STATE;
2637 lvItem.stateMask = LVIS_FOCUSED;
2638 lvItem.state = (lvItem.mask & LVIF_TEXT ? LVIS_FOCUSED : 0);
2639 }
2640 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, lprcBox, 0, 0, 0, 0);
2641
2642 if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT &&
2643 SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, 0, 0))
2644 {
2645 OffsetRect(lprcBox, Origin.x, Position.y + Origin.y);
2646 }
2647 else
2648 OffsetRect(lprcBox, Position.x + Origin.x, Position.y + Origin.y);
2649}

Referenced by iterator_frameditems_absolute(), iterator_visibleitems(), LISTVIEW_ApproximateViewRect(), LISTVIEW_InvalidateItem(), LISTVIEW_SetItemT(), and LISTVIEW_ShowFocusRect().

◆ LISTVIEW_GetItemExtT()

static BOOL LISTVIEW_GetItemExtT ( const LISTVIEW_INFO infoPtr,
LPLVITEMW  lpLVItem,
BOOL  isW 
)
static

Definition at line 7070 of file listview.c.

7071{
7072 LPWSTR pszText;
7073 BOOL bResult;
7074
7075 if (!lpLVItem || lpLVItem->iItem < 0 || lpLVItem->iItem >= infoPtr->nItemCount)
7076 return FALSE;
7077
7078 pszText = lpLVItem->pszText;
7079 bResult = LISTVIEW_GetItemT(infoPtr, lpLVItem, isW);
7080 if (bResult && (lpLVItem->mask & LVIF_TEXT) && lpLVItem->pszText != pszText)
7081 {
7082 if (lpLVItem->pszText != LPSTR_TEXTCALLBACKW)
7083 textcpynT(pszText, isW, lpLVItem->pszText, isW, lpLVItem->cchTextMax);
7084 else
7085 pszText = LPSTR_TEXTCALLBACKW;
7086 }
7087 lpLVItem->pszText = pszText;
7088
7089 return bResult;
7090}
static void textcpynT(LPWSTR dest, BOOL isDestW, LPCWSTR src, BOOL isSrcW, INT max)
Definition: listview.c:474

Referenced by LISTVIEW_GetItemTextT(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemMetrics()

static void LISTVIEW_GetItemMetrics ( const LISTVIEW_INFO infoPtr,
const LVITEMW lpLVItem,
LPRECT  lprcBox,
LPRECT  lprcSelectBox,
LPRECT  lprcIcon,
LPRECT  lprcStateIcon,
LPRECT  lprcLabel 
)
static

Definition at line 2374 of file listview.c.

2377{
2378 BOOL doSelectBox = FALSE, doIcon = FALSE, doLabel = FALSE, oversizedBox = FALSE;
2379 RECT Box, SelectBox, Icon, Label;
2380 COLUMN_INFO *lpColumnInfo = NULL;
2381 SIZE labelSize = { 0, 0 };
2382
2383 TRACE("(lpLVItem=%s)\n", debuglvitem_t(lpLVItem, TRUE));
2384
2385 /* Be smart and try to figure out the minimum we have to do */
2386 if (lpLVItem->iSubItem) assert(infoPtr->uView == LV_VIEW_DETAILS);
2387 if (infoPtr->uView == LV_VIEW_ICON && (lprcBox || lprcLabel))
2388 {
2389 assert((lpLVItem->mask & LVIF_STATE) && (lpLVItem->stateMask & LVIS_FOCUSED));
2390 if (lpLVItem->state & LVIS_FOCUSED) oversizedBox = doLabel = TRUE;
2391 }
2392 if (lprcSelectBox) doSelectBox = TRUE;
2393 if (lprcLabel) doLabel = TRUE;
2394 if (doLabel || lprcIcon || lprcStateIcon) doIcon = TRUE;
2395 if (doSelectBox)
2396 {
2397 doIcon = TRUE;
2398 doLabel = TRUE;
2399 }
2400
2401 /************************************************************/
2402 /* compute the box rectangle (it should be cheap to do) */
2403 /************************************************************/
2404 if (lpLVItem->iSubItem || infoPtr->uView == LV_VIEW_DETAILS)
2405 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, lpLVItem->iSubItem);
2406
2407 if (lpLVItem->iSubItem)
2408 {
2409 Box = lpColumnInfo->rcHeader;
2410 }
2411 else
2412 {
2413 Box.left = 0;
2414 Box.right = infoPtr->nItemWidth;
2415 }
2416 Box.top = 0;
2417 Box.bottom = infoPtr->nItemHeight;
2418
2419 /******************************************************************/
2420 /* compute ICON bounding box (ala LVM_GETITEMRECT) and STATEICON */
2421 /******************************************************************/
2422 if (doIcon)
2423 {
2424 LONG state_width = 0;
2425
2426 if (infoPtr->himlState && lpLVItem->iSubItem == 0)
2427 state_width = infoPtr->iconStateSize.cx;
2428
2429 if (infoPtr->uView == LV_VIEW_ICON)
2430 {
2431 Icon.left = Box.left + state_width;
2432 if (infoPtr->himlNormal)
2433 Icon.left += (infoPtr->nItemWidth - infoPtr->iconSize.cx - state_width) / 2;
2434 Icon.top = Box.top + ICON_TOP_PADDING;
2435 Icon.right = Icon.left;
2436 Icon.bottom = Icon.top;
2437 if (infoPtr->himlNormal)
2438 {
2439 Icon.right += infoPtr->iconSize.cx;
2440 Icon.bottom += infoPtr->iconSize.cy;
2441 }
2442 }
2443 else /* LV_VIEW_SMALLICON, LV_VIEW_LIST or LV_VIEW_DETAILS */
2444 {
2445 Icon.left = Box.left + state_width;
2446
2447 if (infoPtr->uView == LV_VIEW_DETAILS && lpLVItem->iSubItem == 0)
2448 {
2449 /* we need the indent in report mode */
2450 assert(lpLVItem->mask & LVIF_INDENT);
2451 Icon.left += infoPtr->iconSize.cx * lpLVItem->iIndent + REPORT_MARGINX;
2452 }
2453
2454 Icon.top = Box.top;
2455 Icon.right = Icon.left;
2456 if (infoPtr->himlSmall &&
2457 (!lpColumnInfo || lpLVItem->iSubItem == 0 ||
2458 ((infoPtr->dwLvExStyle & LVS_EX_SUBITEMIMAGES) && lpLVItem->iImage != I_IMAGECALLBACK)))
2459 Icon.right += infoPtr->iconSize.cx;
2460 Icon.bottom = Icon.top + infoPtr->iconSize.cy;
2461 }
2462 if(lprcIcon) *lprcIcon = Icon;
2463 TRACE(" - icon=%s\n", wine_dbgstr_rect(&Icon));
2464
2465 /* TODO: is this correct? */
2466 if (lprcStateIcon)
2467 {
2468 lprcStateIcon->left = Icon.left - state_width;
2469 lprcStateIcon->right = Icon.left;
2470 lprcStateIcon->top = Icon.top;
2471 lprcStateIcon->bottom = lprcStateIcon->top + infoPtr->iconSize.cy;
2472 TRACE(" - state icon=%s\n", wine_dbgstr_rect(lprcStateIcon));
2473 }
2474 }
2475 else Icon.right = 0;
2476
2477 /************************************************************/
2478 /* compute LABEL bounding box (ala LVM_GETITEMRECT) */
2479 /************************************************************/
2480 if (doLabel)
2481 {
2482 /* calculate how far to the right can the label stretch */
2483 Label.right = Box.right;
2484 if (infoPtr->uView == LV_VIEW_DETAILS)
2485 {
2486 if (lpLVItem->iSubItem == 0)
2487 {
2488 /* we need a zero based rect here */
2489 Label = lpColumnInfo->rcHeader;
2490 OffsetRect(&Label, -Label.left, 0);
2491 }
2492 }
2493
2494 if (lpLVItem->iSubItem || ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && infoPtr->uView == LV_VIEW_DETAILS))
2495 {
2496 labelSize.cx = infoPtr->nItemWidth;
2497 labelSize.cy = infoPtr->nItemHeight;
2498 goto calc_label;
2499 }
2500
2501 /* we need the text in non owner draw mode */
2502 assert(lpLVItem->mask & LVIF_TEXT);
2503 if (is_text(lpLVItem->pszText))
2504 {
2505 HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
2506 HDC hdc = GetDC(infoPtr->hwndSelf);
2507 HFONT hOldFont = SelectObject(hdc, hFont);
2508 UINT uFormat;
2509 RECT rcText;
2510
2511 /* compute rough rectangle where the label will go */
2512 SetRectEmpty(&rcText);
2513 rcText.right = infoPtr->nItemWidth - TRAILING_LABEL_PADDING;
2514 rcText.bottom = infoPtr->nItemHeight;
2515 if (infoPtr->uView == LV_VIEW_ICON)
2516 rcText.bottom -= ICON_TOP_PADDING + infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
2517
2518 /* now figure out the flags */
2519 if (infoPtr->uView == LV_VIEW_ICON)
2520 uFormat = oversizedBox ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS;
2521 else
2522 uFormat = LV_SL_DT_FLAGS;
2523
2524 DrawTextW (hdc, lpLVItem->pszText, -1, &rcText, uFormat | DT_CALCRECT);
2525
2526 if (rcText.right != rcText.left)
2527 labelSize.cx = min(rcText.right - rcText.left + TRAILING_LABEL_PADDING, infoPtr->nItemWidth);
2528
2529 labelSize.cy = rcText.bottom - rcText.top;
2530
2531 SelectObject(hdc, hOldFont);
2532 ReleaseDC(infoPtr->hwndSelf, hdc);
2533 }
2534
2535calc_label:
2536 if (infoPtr->uView == LV_VIEW_ICON)
2537 {
2538 Label.left = Box.left + (infoPtr->nItemWidth - labelSize.cx) / 2;
2539 Label.top = Box.top + ICON_TOP_PADDING_HITABLE +
2540 infoPtr->iconSize.cy + ICON_BOTTOM_PADDING;
2541 Label.right = Label.left + labelSize.cx;
2542 Label.bottom = Label.top + infoPtr->nItemHeight;
2543 if (!oversizedBox && labelSize.cy > infoPtr->ntmHeight)
2544 {
2545 labelSize.cy = min(Box.bottom - Label.top, labelSize.cy);
2546 labelSize.cy /= infoPtr->ntmHeight;
2547 labelSize.cy = max(labelSize.cy, 1);
2548 labelSize.cy *= infoPtr->ntmHeight;
2549 }
2550 Label.bottom = Label.top + labelSize.cy + HEIGHT_PADDING;
2551 }
2552 else if (infoPtr->uView == LV_VIEW_DETAILS)
2553 {
2554 Label.left = Icon.right;
2555 Label.top = Box.top;
2556 Label.right = lpLVItem->iSubItem ? lpColumnInfo->rcHeader.right :
2557 lpColumnInfo->rcHeader.right - lpColumnInfo->rcHeader.left;
2558 Label.bottom = Label.top + infoPtr->nItemHeight;
2559 }
2560 else /* LV_VIEW_SMALLICON or LV_VIEW_LIST */
2561 {
2562 Label.left = Icon.right;
2563 Label.top = Box.top;
2564 Label.right = min(Label.left + labelSize.cx, Label.right);
2565 Label.bottom = Label.top + infoPtr->nItemHeight;
2566 }
2567
2568 if (lprcLabel) *lprcLabel = Label;
2569 TRACE(" - label=%s\n", wine_dbgstr_rect(&Label));
2570 }
2571
2572 /************************************************************/
2573 /* compute SELECT bounding box */
2574 /************************************************************/
2575 if (doSelectBox)
2576 {
2577 if (infoPtr->uView == LV_VIEW_DETAILS)
2578 {
2579 SelectBox.left = Icon.left;
2580 SelectBox.top = Box.top;
2581 SelectBox.bottom = Box.bottom;
2582
2583 if (labelSize.cx)
2584 SelectBox.right = min(Label.left + labelSize.cx, Label.right);
2585 else
2586 SelectBox.right = min(Label.left + MAX_EMPTYTEXT_SELECT_WIDTH, Label.right);
2587 }
2588 else
2589 {
2590 UnionRect(&SelectBox, &Icon, &Label);
2591 }
2592 if (lprcSelectBox) *lprcSelectBox = SelectBox;
2593 TRACE(" - select box=%s\n", wine_dbgstr_rect(&SelectBox));
2594 }
2595
2596 /* Fix the Box if necessary */
2597 if (lprcBox)
2598 {
2599 if (oversizedBox) UnionRect(lprcBox, &Box, &Label);
2600 else *lprcBox = Box;
2601 }
2602 TRACE(" - box=%s\n", wine_dbgstr_rect(&Box));
2603}
PWCHAR Label
Definition: format.c:70
#define MAX_EMPTYTEXT_SELECT_WIDTH
Definition: listview.c:384
#define ICON_BOTTOM_PADDING
Definition: listview.c:375
#define REPORT_MARGINX
Definition: listview.c:358
#define ICON_TOP_PADDING_HITABLE
Definition: listview.c:373
#define ICON_TOP_PADDING
Definition: listview.c:374
#define TRAILING_LABEL_PADDING
Definition: listview.c:396
long LONG
Definition: pedump.c:60
#define LVS_EX_SUBITEMIMAGES
Definition: commctrl.h:2730
Definition: globals.h:96
HFONT hDefaultFont
Definition: listview.c:307
#define DT_CALCRECT
Definition: winuser.h:526
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)

Referenced by LISTVIEW_DrawItem(), LISTVIEW_DrawItemPart(), LISTVIEW_GetItemBox(), LISTVIEW_GetItemRect(), and LISTVIEW_HitTest().

◆ LISTVIEW_GetItemOrigin()

static void LISTVIEW_GetItemOrigin ( const LISTVIEW_INFO infoPtr,
INT  nItem,
LPPOINT  lpptPosition 
)
static

Definition at line 2307 of file listview.c.

2308{
2309 assert(nItem >= 0 && nItem < infoPtr->nItemCount);
2310
2311 if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
2312 {
2313 lpptPosition->x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
2314 lpptPosition->y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
2315 }
2316 else if (infoPtr->uView == LV_VIEW_LIST)
2317 {
2318 INT nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
2319 lpptPosition->x = nItem / nCountPerColumn * infoPtr->nItemWidth;
2320 lpptPosition->y = nItem % nCountPerColumn * infoPtr->nItemHeight;
2321 }
2322 else /* LV_VIEW_DETAILS */
2323 {
2324 lpptPosition->x = REPORT_MARGINX;
2325 /* item is always at zero indexed column */
2326 if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
2327 lpptPosition->x += LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left;
2328 lpptPosition->y = nItem * infoPtr->nItemHeight;
2329 }
2330}

Referenced by iterator_visibleitems(), LISTVIEW_FindItemW(), LISTVIEW_GetItemBox(), LISTVIEW_GetItemPosition(), LISTVIEW_GetItemRect(), LISTVIEW_HitTest(), LISTVIEW_InvalidateSubItem(), LISTVIEW_IsItemVisible(), LISTVIEW_RefreshList(), LISTVIEW_RefreshOwnerDraw(), and LISTVIEW_RefreshReport().

◆ LISTVIEW_GetItemPosition()

static BOOL LISTVIEW_GetItemPosition ( const LISTVIEW_INFO infoPtr,
INT  nItem,
LPPOINT  lpptPosition 
)
static

Definition at line 7108 of file listview.c.

7109{
7110 POINT Origin;
7111
7112 TRACE("(nItem=%d, lpptPosition=%p)\n", nItem, lpptPosition);
7113
7114 if (!lpptPosition || nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE;
7115
7116 LISTVIEW_GetOrigin(infoPtr, &Origin);
7117 LISTVIEW_GetItemOrigin(infoPtr, nItem, lpptPosition);
7118
7119 if (infoPtr->uView == LV_VIEW_ICON)
7120 {
7121 lpptPosition->x += (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2;
7122 lpptPosition->y += ICON_TOP_PADDING;
7123 }
7124 lpptPosition->x += Origin.x;
7125 lpptPosition->y += Origin.y;
7126
7127 TRACE (" lpptPosition=%s\n", wine_dbgstr_point(lpptPosition));
7128 return TRUE;
7129}

Referenced by LISTVIEW_GetNextItem(), LISTVIEW_SetGroupSelection(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemRect()

static BOOL LISTVIEW_GetItemRect ( const LISTVIEW_INFO infoPtr,
INT  nItem,
LPRECT  lprc 
)
static

Definition at line 7193 of file listview.c.

7194{
7195 WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
7196 BOOL doLabel = TRUE, oversizedBox = FALSE;
7197 POINT Position, Origin;
7198 LVITEMW lvItem;
7199 LONG mode;
7200
7201 TRACE("(hwnd=%p, nItem=%d, lprc=%p)\n", infoPtr->hwndSelf, nItem, lprc);
7202
7203 if (!lprc || nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE;
7204
7205 LISTVIEW_GetOrigin(infoPtr, &Origin);
7206 LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
7207
7208 /* Be smart and try to figure out the minimum we have to do */
7209 if (lprc->left == LVIR_ICON) doLabel = FALSE;
7210 if (infoPtr->uView == LV_VIEW_DETAILS && lprc->left == LVIR_BOUNDS) doLabel = FALSE;
7211 if (infoPtr->uView == LV_VIEW_ICON && lprc->left != LVIR_ICON &&
7212 infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, nItem, LVIS_FOCUSED))
7213 oversizedBox = TRUE;
7214
7215 /* get what we need from the item before hand, so we make
7216 * only one request. This can speed up things, if data
7217 * is stored on the app side */
7218 lvItem.mask = 0;
7219 if (infoPtr->uView == LV_VIEW_DETAILS) lvItem.mask |= LVIF_INDENT;
7220 if (doLabel) lvItem.mask |= LVIF_TEXT;
7221 lvItem.iItem = nItem;
7222 lvItem.iSubItem = 0;
7223 lvItem.pszText = szDispText;
7224 lvItem.cchTextMax = DISP_TEXT_SIZE;
7225 if (lvItem.mask && !LISTVIEW_GetItemW(infoPtr, &lvItem)) return FALSE;
7226 /* we got the state already up, simulate it here, to avoid a reget */
7227 if (infoPtr->uView == LV_VIEW_ICON && (lprc->left != LVIR_ICON))
7228 {
7229 lvItem.mask |= LVIF_STATE;
7230 lvItem.stateMask = LVIS_FOCUSED;
7231 lvItem.state = (oversizedBox ? LVIS_FOCUSED : 0);
7232 }
7233
7234 if (infoPtr->uView == LV_VIEW_DETAILS && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) && lprc->left == LVIR_SELECTBOUNDS)
7236
7237 mode = lprc->left;
7238 switch(lprc->left)
7239 {
7240 case LVIR_ICON:
7241 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, NULL, NULL, lprc, NULL, NULL);
7242 break;
7243
7244 case LVIR_LABEL:
7245 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, NULL, NULL, NULL, NULL, lprc);
7246 break;
7247
7248 case LVIR_BOUNDS:
7249 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, lprc, NULL, NULL, NULL, NULL);
7250 break;
7251
7252 case LVIR_SELECTBOUNDS:
7253 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, NULL, lprc, NULL, NULL, NULL);
7254 break;
7255
7256 default:
7257 WARN("Unknown value: %d\n", lprc->left);
7258 return FALSE;
7259 }
7260
7261 if (infoPtr->uView == LV_VIEW_DETAILS)
7262 {
7263 if (mode != LVIR_BOUNDS)
7264 OffsetRect(lprc, Origin.x + LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left,
7265 Position.y + Origin.y);
7266 else
7267 OffsetRect(lprc, Origin.x, Position.y + Origin.y);
7268 }
7269 else
7270 OffsetRect(lprc, Position.x + Origin.x, Position.y + Origin.y);
7271
7272 TRACE(" rect=%s\n", wine_dbgstr_rect(lprc));
7273
7274 return TRUE;
7275}
GLenum mode
Definition: glext.h:6217
#define LVIR_ICON
Definition: commctrl.h:2473
#define LVIR_SELECTBOUNDS
Definition: commctrl.h:2475

Referenced by LISTVIEW_CreateDragImage(), LISTVIEW_EditLabelT(), LISTVIEW_EnsureVisible(), LISTVIEW_GetSubItemRect(), LISTVIEW_SetGroupSelection(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemSpacing()

static LONG LISTVIEW_GetItemSpacing ( const LISTVIEW_INFO infoPtr,
BOOL  bSmall 
)
static

Definition at line 7369 of file listview.c.

7370{
7371 LONG lResult;
7372
7373 if (!bSmall)
7374 {
7375 lResult = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
7376 }
7377 else
7378 {
7379 if (infoPtr->uView == LV_VIEW_ICON)
7381 else
7382 lResult = MAKELONG(infoPtr->nItemWidth, infoPtr->nItemHeight);
7383 }
7384 return lResult;
7385}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemState()

static UINT LISTVIEW_GetItemState ( const LISTVIEW_INFO infoPtr,
INT  nItem,
UINT  uMask 
)
static

Definition at line 7399 of file listview.c.

7400{
7401 LVITEMW lvItem;
7402
7403 if (nItem < 0 || nItem >= infoPtr->nItemCount) return 0;
7404
7405 lvItem.iItem = nItem;
7406 lvItem.iSubItem = 0;
7407 lvItem.mask = LVIF_STATE;
7408 lvItem.stateMask = uMask;
7409 if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return 0;
7410
7411 return lvItem.state & uMask;
7412}

Referenced by LISTVIEW_DelayedEditItem(), LISTVIEW_DrawItem(), LISTVIEW_GetItemBox(), LISTVIEW_GetItemRect(), LISTVIEW_GetNextItem(), LISTVIEW_GetSelectedCount(), LISTVIEW_InvalidateSelectedItems(), LISTVIEW_LButtonDown(), LISTVIEW_MarqueeHighlight(), LISTVIEW_MouseMove(), LISTVIEW_RButtonDown(), LISTVIEW_WindowProc(), and toggle_checkbox_state().

◆ LISTVIEW_GetItemT()

static BOOL LISTVIEW_GetItemT ( const LISTVIEW_INFO infoPtr,
LPLVITEMW  lpLVItem,
BOOL  isW 
)
static

Definition at line 6786 of file listview.c.

6787{
6788 ITEMHDR callbackHdr = { LPSTR_TEXTCALLBACKW, I_IMAGECALLBACK };
6789 NMLVDISPINFOW dispInfo;
6790 ITEM_INFO *lpItem;
6791 ITEMHDR* pItemHdr;
6792 HDPA hdpaSubItems;
6793 INT isubitem;
6794
6795 TRACE("(item=%s, isW=%d)\n", debuglvitem_t(lpLVItem, isW), isW);
6796
6797 if (!lpLVItem || lpLVItem->iItem < 0 || lpLVItem->iItem >= infoPtr->nItemCount)
6798 return FALSE;
6799
6800 if (lpLVItem->mask == 0) return TRUE;
6801 TRACE("mask=%x\n", lpLVItem->mask);
6802
6803 /* make a local copy */
6804 isubitem = lpLVItem->iSubItem;
6805
6806 if (isubitem && (lpLVItem->mask & LVIF_STATE))
6807 lpLVItem->state = 0;
6808
6809 /* a quick optimization if all we're asked is the focus state
6810 * these queries are worth optimising since they are common,
6811 * and can be answered in constant time, without the heavy accesses */
6812 if ( (lpLVItem->mask == LVIF_STATE) && (lpLVItem->stateMask == LVIS_FOCUSED) &&
6813 !(infoPtr->uCallbackMask & LVIS_FOCUSED) )
6814 {
6815 lpLVItem->state = 0;
6816 if (infoPtr->nFocusedItem == lpLVItem->iItem && isubitem == 0)
6817 lpLVItem->state |= LVIS_FOCUSED;
6818 return TRUE;
6819 }
6820
6821 ZeroMemory(&dispInfo, sizeof(dispInfo));
6822
6823 /* if the app stores all the data, handle it separately */
6824 if (infoPtr->dwStyle & LVS_OWNERDATA)
6825 {
6826 dispInfo.item.state = 0;
6827
6828 /* apparently, we should not callback for lParam in LVS_OWNERDATA */
6829 if ((lpLVItem->mask & ~(LVIF_STATE | LVIF_PARAM)) ||
6830 ((lpLVItem->mask & LVIF_STATE) && (infoPtr->uCallbackMask & lpLVItem->stateMask)))
6831 {
6832 UINT mask = lpLVItem->mask;
6833
6834 /* NOTE: copy only fields which we _know_ are initialized, some apps
6835 * depend on the uninitialized fields being 0 */
6836 dispInfo.item.mask = lpLVItem->mask & ~LVIF_PARAM;
6837 dispInfo.item.iItem = lpLVItem->iItem;
6838 dispInfo.item.iSubItem = isubitem;
6839 if (lpLVItem->mask & LVIF_TEXT)
6840 {
6841 if (lpLVItem->mask & LVIF_NORECOMPUTE)
6842 /* reset mask */
6843 dispInfo.item.mask &= ~(LVIF_TEXT | LVIF_NORECOMPUTE);
6844 else
6845 {
6846 dispInfo.item.pszText = lpLVItem->pszText;
6847 dispInfo.item.cchTextMax = lpLVItem->cchTextMax;
6848 }
6849 }
6850 if (lpLVItem->mask & LVIF_STATE)
6851 dispInfo.item.stateMask = lpLVItem->stateMask & infoPtr->uCallbackMask;
6852 /* could be zeroed on LVIF_NORECOMPUTE case */
6853 if (dispInfo.item.mask)
6854 {
6855 notify_dispinfoT(infoPtr, LVN_GETDISPINFOW, &dispInfo, isW);
6856 dispInfo.item.stateMask = lpLVItem->stateMask;
6857 if (lpLVItem->mask & (LVIF_GROUPID|LVIF_COLUMNS))
6858 {
6859 /* full size structure expected - _WIN32IE >= 0x560 */
6860 *lpLVItem = dispInfo.item;
6861 }
6862 else if (lpLVItem->mask & LVIF_INDENT)
6863 {
6864 /* indent member expected - _WIN32IE >= 0x300 */
6865 memcpy(lpLVItem, &dispInfo.item, offsetof( LVITEMW, iGroupId ));
6866 }
6867 else
6868 {
6869 /* minimal structure expected */
6870 memcpy(lpLVItem, &dispInfo.item, offsetof( LVITEMW, iIndent ));
6871 }
6872 lpLVItem->mask = mask;
6873 TRACE(" getdispinfo(1):lpLVItem=%s\n", debuglvitem_t(lpLVItem, isW));
6874 }
6875 }
6876
6877 /* make sure lParam is zeroed out */
6878 if (lpLVItem->mask & LVIF_PARAM) lpLVItem->lParam = 0;
6879
6880 /* callback marked pointer required here */
6881 if ((lpLVItem->mask & LVIF_TEXT) && (lpLVItem->mask & LVIF_NORECOMPUTE))
6882 lpLVItem->pszText = LPSTR_TEXTCALLBACKW;
6883
6884 /* we store only a little state, so if we're not asked, we're done */
6885 if (!(lpLVItem->mask & LVIF_STATE) || isubitem) return TRUE;
6886
6887 /* if focus is handled by us, report it */
6888 if ( lpLVItem->stateMask & ~infoPtr->uCallbackMask & LVIS_FOCUSED )
6889 {
6890 lpLVItem->state &= ~LVIS_FOCUSED;
6891 if (infoPtr->nFocusedItem == lpLVItem->iItem)
6892 lpLVItem->state |= LVIS_FOCUSED;
6893 }
6894
6895 /* and do the same for selection, if we handle it */
6896 if ( lpLVItem->stateMask & ~infoPtr->uCallbackMask & LVIS_SELECTED )
6897 {
6898 lpLVItem->state &= ~LVIS_SELECTED;
6899 if (ranges_contain(infoPtr->selectionRanges, lpLVItem->iItem))
6900 lpLVItem->state |= LVIS_SELECTED;
6901 }
6902
6903 return TRUE;
6904 }
6905
6906 /* find the item and subitem structures before we proceed */
6907 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem);
6908 lpItem = DPA_GetPtr(hdpaSubItems, 0);
6909 assert (lpItem);
6910
6911 if (isubitem)
6912 {
6913 SUBITEM_INFO *lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, isubitem);
6914 pItemHdr = lpSubItem ? &lpSubItem->hdr : &callbackHdr;
6915 if (!lpSubItem)
6916 {
6917 WARN(" iSubItem invalid (%08x), ignored.\n", isubitem);
6918 isubitem = 0;
6919 }
6920 }
6921 else
6922 pItemHdr = &lpItem->hdr;
6923
6924 /* Do we need to query the state from the app? */
6925 if ((lpLVItem->mask & LVIF_STATE) && infoPtr->uCallbackMask && isubitem == 0)
6926 {
6927 dispInfo.item.mask |= LVIF_STATE;
6928 dispInfo.item.stateMask = infoPtr->uCallbackMask;
6929 }
6930
6931 /* Do we need to enquire about the image? */
6932 if ((lpLVItem->mask & LVIF_IMAGE) && pItemHdr->iImage == I_IMAGECALLBACK &&
6933 (isubitem == 0 || (infoPtr->dwLvExStyle & LVS_EX_SUBITEMIMAGES)))
6934 {
6935 dispInfo.item.mask |= LVIF_IMAGE;
6936 dispInfo.item.iImage = I_IMAGECALLBACK;
6937 }
6938
6939 /* Only items support indentation */
6940 if ((lpLVItem->mask & LVIF_INDENT) && lpItem->iIndent == I_INDENTCALLBACK &&
6941 (isubitem == 0))
6942 {
6943 dispInfo.item.mask |= LVIF_INDENT;
6944 dispInfo.item.iIndent = I_INDENTCALLBACK;
6945 }
6946
6947 /* Apps depend on calling back for text if it is NULL or LPSTR_TEXTCALLBACKW */
6948 if ((lpLVItem->mask & LVIF_TEXT) && !(lpLVItem->mask & LVIF_NORECOMPUTE) &&
6949 !is_text(pItemHdr->pszText))
6950 {
6951 dispInfo.item.mask |= LVIF_TEXT;
6952 dispInfo.item.pszText = lpLVItem->pszText;
6953 dispInfo.item.cchTextMax = lpLVItem->cchTextMax;
6954 if (dispInfo.item.pszText && dispInfo.item.cchTextMax > 0)
6955 *dispInfo.item.pszText = '\0';
6956 }
6957
6958 /* If we don't have all the requested info, query the application */
6959 if (dispInfo.item.mask)
6960 {
6961 dispInfo.item.iItem = lpLVItem->iItem;
6962 dispInfo.item.iSubItem = lpLVItem->iSubItem; /* yes: the original subitem */
6963 dispInfo.item.lParam = lpItem->lParam;
6964 notify_dispinfoT(infoPtr, LVN_GETDISPINFOW, &dispInfo, isW);
6965 TRACE(" getdispinfo(2):item=%s\n", debuglvitem_t(&dispInfo.item, isW));
6966 }
6967
6968 /* we should not store values for subitems */
6969 if (isubitem) dispInfo.item.mask &= ~LVIF_DI_SETITEM;
6970
6971 /* Now, handle the iImage field */
6972 if (dispInfo.item.mask & LVIF_IMAGE)
6973 {
6974 lpLVItem->iImage = dispInfo.item.iImage;
6975 if ((dispInfo.item.mask & LVIF_DI_SETITEM) && pItemHdr->iImage == I_IMAGECALLBACK)
6976 pItemHdr->iImage = dispInfo.item.iImage;
6977 }
6978 else if (lpLVItem->mask & LVIF_IMAGE)
6979 {
6980 if(isubitem == 0 || (infoPtr->dwLvExStyle & LVS_EX_SUBITEMIMAGES))
6981 lpLVItem->iImage = pItemHdr->iImage;
6982 else
6983 lpLVItem->iImage = 0;
6984 }
6985
6986 /* The pszText field */
6987 if (dispInfo.item.mask & LVIF_TEXT)
6988 {
6989 if ((dispInfo.item.mask & LVIF_DI_SETITEM) && pItemHdr->pszText)
6990 textsetptrT(&pItemHdr->pszText, dispInfo.item.pszText, isW);
6991
6992 lpLVItem->pszText = dispInfo.item.pszText;
6993 }
6994 else if (lpLVItem->mask & LVIF_TEXT)
6995 {
6996 /* if LVN_GETDISPINFO's disabled with LVIF_NORECOMPUTE return callback placeholder */
6997 if (isW || !is_text(pItemHdr->pszText)) lpLVItem->pszText = pItemHdr->pszText;
6998 else textcpynT(lpLVItem->pszText, isW, pItemHdr->pszText, TRUE, lpLVItem->cchTextMax);
6999 }
7000
7001 /* Next is the lParam field */
7002 if (dispInfo.item.mask & LVIF_PARAM)
7003 {
7004 lpLVItem->lParam = dispInfo.item.lParam;
7005 if ((dispInfo.item.mask & LVIF_DI_SETITEM))
7006 lpItem->lParam = dispInfo.item.lParam;
7007 }
7008 else if (lpLVItem->mask & LVIF_PARAM)
7009 lpLVItem->lParam = lpItem->lParam;
7010
7011 /* if this is a subitem, we're done */
7012 if (isubitem) return TRUE;
7013
7014 /* ... the state field (this one is different due to uCallbackmask) */
7015 if (lpLVItem->mask & LVIF_STATE)
7016 {
7017 lpLVItem->state = lpItem->state & lpLVItem->stateMask;
7018 if (dispInfo.item.mask & LVIF_STATE)
7019 {
7020 lpLVItem->state &= ~dispInfo.item.stateMask;
7021 lpLVItem->state |= (dispInfo.item.state & dispInfo.item.stateMask);
7022 }
7023 if ( lpLVItem->stateMask & ~infoPtr->uCallbackMask & LVIS_FOCUSED )
7024 {
7025 lpLVItem->state &= ~LVIS_FOCUSED;
7026 if (infoPtr->nFocusedItem == lpLVItem->iItem)
7027 lpLVItem->state |= LVIS_FOCUSED;
7028 }
7029 if ( lpLVItem->stateMask & ~infoPtr->uCallbackMask & LVIS_SELECTED )
7030 {
7031 lpLVItem->state &= ~LVIS_SELECTED;
7032 if (ranges_contain(infoPtr->selectionRanges, lpLVItem->iItem))
7033 lpLVItem->state |= LVIS_SELECTED;
7034 }
7035 }
7036
7037 /* and last, but not least, the indent field */
7038 if (dispInfo.item.mask & LVIF_INDENT)
7039 {
7040 lpLVItem->iIndent = dispInfo.item.iIndent;
7041 if ((dispInfo.item.mask & LVIF_DI_SETITEM) && lpItem->iIndent == I_INDENTCALLBACK)
7042 lpItem->iIndent = dispInfo.item.iIndent;
7043 }
7044 else if (lpLVItem->mask & LVIF_INDENT)
7045 {
7046 lpLVItem->iIndent = lpItem->iIndent;
7047 }
7048
7049 return TRUE;
7050}
static BOOL ranges_contain(RANGES ranges, INT nItem)
Definition: listview.c:3297
static BOOL textsetptrT(LPWSTR *dest, LPCWSTR src, BOOL isW)
Definition: listview.c:507
static SUBITEM_INFO * LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem)
Definition: listview.c:3010
GLenum GLint GLuint mask
Definition: glext.h:6028
#define LVIF_NORECOMPUTE
Definition: commctrl.h:2314
#define LVIF_COLUMNS
Definition: commctrl.h:2316
#define LVIF_DI_SETITEM
Definition: commctrl.h:3166
#define LVIF_GROUPID
Definition: commctrl.h:2315
#define I_INDENTCALLBACK
Definition: commctrl.h:2330
#define offsetof(TYPE, MEMBER)
INT iImage
Definition: listview.c:158
UINT state
Definition: listview.c:172
UINT uCallbackMask
Definition: listview.c:232

Referenced by LISTVIEW_EditLabelT(), LISTVIEW_EndEditLabelT(), LISTVIEW_GetItemAtPt(), LISTVIEW_GetItemExtT(), LISTVIEW_GetItemW(), notify_click(), notify_deleteitem(), and notify_itemactivate().

◆ LISTVIEW_GetItemTextT()

static INT LISTVIEW_GetItemTextT ( const LISTVIEW_INFO infoPtr,
INT  nItem,
LPLVITEMW  lpLVItem,
BOOL  isW 
)
static

Definition at line 7428 of file listview.c.

7429{
7430 if (!lpLVItem || nItem < 0 || nItem >= infoPtr->nItemCount) return 0;
7431
7432 lpLVItem->mask = LVIF_TEXT;
7433 lpLVItem->iItem = nItem;
7434 if (!LISTVIEW_GetItemExtT(infoPtr, lpLVItem, isW)) return 0;
7435
7436 return textlenT(lpLVItem->pszText, isW);
7437}
static BOOL LISTVIEW_GetItemExtT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
Definition: listview.c:7070

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemW()

◆ LISTVIEW_GetNextItem()

static INT LISTVIEW_GetNextItem ( const LISTVIEW_INFO infoPtr,
INT  nItem,
UINT  uFlags 
)
static

Definition at line 7452 of file listview.c.

7453{
7454 UINT uMask = 0;
7455 LVFINDINFOW lvFindInfo;
7456 INT nCountPerColumn;
7457#ifndef __REACTOS__
7458 INT nCountPerRow;
7459#endif
7460 INT i;
7461
7462 TRACE("nItem=%d, uFlags=%x, nItemCount=%d\n", nItem, uFlags, infoPtr->nItemCount);
7463 if (nItem < -1 || nItem >= infoPtr->nItemCount) return -1;
7464
7465 ZeroMemory(&lvFindInfo, sizeof(lvFindInfo));
7466
7467 if (uFlags & LVNI_CUT)
7468 uMask |= LVIS_CUT;
7469
7471 uMask |= LVIS_DROPHILITED;
7472
7473 if (uFlags & LVNI_FOCUSED)
7474 uMask |= LVIS_FOCUSED;
7475
7476 if (uFlags & LVNI_SELECTED)
7477 uMask |= LVIS_SELECTED;
7478
7479 /* if we're asked for the focused item, that's only one,
7480 * so it's worth optimizing */
7481 if (uFlags & LVNI_FOCUSED)
7482 {
7483 if ((LISTVIEW_GetItemState(infoPtr, infoPtr->nFocusedItem, uMask) & uMask) != uMask) return -1;
7484 return (infoPtr->nFocusedItem == nItem) ? -1 : infoPtr->nFocusedItem;
7485 }
7486
7487 if (uFlags & LVNI_ABOVE)
7488 {
7489 if ((infoPtr->uView == LV_VIEW_LIST) || (infoPtr->uView == LV_VIEW_DETAILS))
7490 {
7491 while (nItem >= 0)
7492 {
7493 nItem--;
7494 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7495 return nItem;
7496 }
7497 }
7498 else
7499 {
7500#ifndef __REACTOS__
7501 /* Special case for autoarrange - move 'til the top of a list */
7502 if (is_autoarrange(infoPtr))
7503 {
7504 nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
7505 while (nItem - nCountPerRow >= 0)
7506 {
7507 nItem -= nCountPerRow;
7508 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7509 return nItem;
7510 }
7511 return -1;
7512 }
7513#endif
7514 lvFindInfo.flags = LVFI_NEARESTXY;
7515 lvFindInfo.vkDirection = VK_UP;
7516 LISTVIEW_GetItemPosition(infoPtr, nItem, &lvFindInfo.pt);
7517 while ((nItem = LISTVIEW_FindItemW(infoPtr, nItem, &lvFindInfo)) != -1)
7518 {
7519 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7520 return nItem;
7521 }
7522 }
7523 }
7524 else if (uFlags & LVNI_BELOW)
7525 {
7526 if ((infoPtr->uView == LV_VIEW_LIST) || (infoPtr->uView == LV_VIEW_DETAILS))
7527 {
7528 while (nItem < infoPtr->nItemCount)
7529 {
7530 nItem++;
7531 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7532 return nItem;
7533 }
7534 }
7535 else
7536 {
7537#ifndef __REACTOS__
7538 /* Special case for autoarrange - move 'til the bottom of a list */
7539 if (is_autoarrange(infoPtr))
7540 {
7541 nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
7542 while (nItem + nCountPerRow < infoPtr->nItemCount )
7543 {
7544 nItem += nCountPerRow;
7545 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7546 return nItem;
7547 }
7548 return -1;
7549 }
7550#endif
7551 lvFindInfo.flags = LVFI_NEARESTXY;
7552 lvFindInfo.vkDirection = VK_DOWN;
7553 LISTVIEW_GetItemPosition(infoPtr, nItem, &lvFindInfo.pt);
7554 while ((nItem = LISTVIEW_FindItemW(infoPtr, nItem, &lvFindInfo)) != -1)
7555 {
7556 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7557 return nItem;
7558 }
7559 }
7560 }
7561 else if (uFlags & LVNI_TOLEFT)
7562 {
7563 if (infoPtr->uView == LV_VIEW_LIST)
7564 {
7565 nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
7566 while (nItem - nCountPerColumn >= 0)
7567 {
7568 nItem -= nCountPerColumn;
7569 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7570 return nItem;
7571 }
7572 }
7573 else if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
7574 {
7575#ifndef __REACTOS__
7576 /* Special case for autoarrange - move 'til the beginning of a row */
7577 if (is_autoarrange(infoPtr))
7578 {
7579 nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
7580 while (nItem % nCountPerRow > 0)
7581 {
7582 nItem --;
7583 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7584 return nItem;
7585 }
7586 return -1;
7587 }
7588#endif
7589 lvFindInfo.flags = LVFI_NEARESTXY;
7590 lvFindInfo.vkDirection = VK_LEFT;
7591 LISTVIEW_GetItemPosition(infoPtr, nItem, &lvFindInfo.pt);
7592 while ((nItem = LISTVIEW_FindItemW(infoPtr, nItem, &lvFindInfo)) != -1)
7593 {
7594 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7595 return nItem;
7596 }
7597 }
7598 }
7599 else if (uFlags & LVNI_TORIGHT)
7600 {
7601 if (infoPtr->uView == LV_VIEW_LIST)
7602 {
7603 nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
7604 while (nItem + nCountPerColumn < infoPtr->nItemCount)
7605 {
7606 nItem += nCountPerColumn;
7607 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7608 return nItem;
7609 }
7610 }
7611 else if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
7612 {
7613#ifndef __REACTOS__
7614 /* Special case for autoarrange - move 'til the end of a row */
7615 if (is_autoarrange(infoPtr))
7616 {
7617 nCountPerRow = LISTVIEW_GetCountPerRow(infoPtr);
7618 while (nItem % nCountPerRow < nCountPerRow - 1 )
7619 {
7620 nItem ++;
7621 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7622 return nItem;
7623 }
7624 return -1;
7625 }
7626#endif
7627 lvFindInfo.flags = LVFI_NEARESTXY;
7628 lvFindInfo.vkDirection = VK_RIGHT;
7629 LISTVIEW_GetItemPosition(infoPtr, nItem, &lvFindInfo.pt);
7630 while ((nItem = LISTVIEW_FindItemW(infoPtr, nItem, &lvFindInfo)) != -1)
7631 {
7632 if ((LISTVIEW_GetItemState(infoPtr, nItem, uMask) & uMask) == uMask)
7633 return nItem;
7634 }
7635 }
7636 }
7637 else
7638 {
7639 nItem++;
7640
7641 /* search by index */
7642 for (i = nItem; i < infoPtr->nItemCount; i++)
7643 {
7644 if ((LISTVIEW_GetItemState(infoPtr, i, uMask) & uMask) == uMask)
7645 return i;
7646 }
7647 }
7648
7649 return -1;
7650}
UINT uFlags
Definition: api.c:59
static BOOL is_autoarrange(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1588
static BOOL LISTVIEW_GetItemPosition(const LISTVIEW_INFO *, INT, LPPOINT)
Definition: listview.c:7108
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define LVNI_TOLEFT
Definition: commctrl.h:2430
#define LVNI_TORIGHT
Definition: commctrl.h:2431
#define LVNI_FOCUSED
Definition: commctrl.h:2423
#define LVNI_BELOW
Definition: commctrl.h:2429
#define LVIS_DROPHILITED
Definition: commctrl.h:2321
#define LVNI_DROPHILITED
Definition: commctrl.h:2426
#define LVNI_CUT
Definition: commctrl.h:2425
#define LVNI_ABOVE
Definition: commctrl.h:2428

Referenced by LISTVIEW_KeyDown(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetOrigin()

static void LISTVIEW_GetOrigin ( const LISTVIEW_INFO infoPtr,
LPPOINT  lpptOrigin 
)
static

Definition at line 7665 of file listview.c.

7666{
7667 INT nHorzPos = 0, nVertPos = 0;
7668 SCROLLINFO scrollInfo;
7669
7670 scrollInfo.cbSize = sizeof(SCROLLINFO);
7671 scrollInfo.fMask = SIF_POS;
7672
7673 if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo))
7674 nHorzPos = scrollInfo.nPos;
7675 if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo))
7676 nVertPos = scrollInfo.nPos;
7677
7678 TRACE("nHorzPos=%d, nVertPos=%d\n", nHorzPos, nVertPos);
7679
7680 lpptOrigin->x = infoPtr->rcList.left;
7681 lpptOrigin->y = infoPtr->rcList.top;
7682 if (infoPtr->uView == LV_VIEW_LIST)
7683 nHorzPos *= infoPtr->nItemWidth;
7684 else if (infoPtr->uView == LV_VIEW_DETAILS)
7685 nVertPos *= infoPtr->nItemHeight;
7686
7687 lpptOrigin->x -= nHorzPos;
7688 lpptOrigin->y -= nVertPos;
7689
7690 TRACE(" origin=%s\n", wine_dbgstr_point(lpptOrigin));
7691}
struct tagSCROLLINFO SCROLLINFO
#define SB_VERT
Definition: winuser.h:553
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)
#define SB_HORZ
Definition: winuser.h:552

Referenced by iterator_frameditems(), iterator_visibleitems(), LISTVIEW_FindItemW(), LISTVIEW_GetItemBox(), LISTVIEW_GetItemPosition(), LISTVIEW_GetItemRect(), LISTVIEW_GetSubItemRect(), LISTVIEW_GetViewRect(), LISTVIEW_HitTest(), LISTVIEW_InvalidateSubItem(), LISTVIEW_IsItemVisible(), LISTVIEW_MarqueeHighlight(), LISTVIEW_MouseMove(), LISTVIEW_Notify(), LISTVIEW_RefreshList(), LISTVIEW_RefreshOwnerDraw(), LISTVIEW_RefreshReport(), LISTVIEW_RefreshReportGrid(), LISTVIEW_ScrollColumns(), LISTVIEW_ScrollOnInsert(), LISTVIEW_SetColumnWidth(), LISTVIEW_SetItemCount(), LISTVIEW_SetItemPosition(), LISTVIEW_UpdateSize(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetSelectedCount()

static INT LISTVIEW_GetSelectedCount ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3554 of file listview.c.

3555{
3556 INT nSelectedCount = 0;
3557
3558 if (infoPtr->uCallbackMask & LVIS_SELECTED)
3559 {
3560 INT i;
3561 for (i = 0; i < infoPtr->nItemCount; i++)
3562 {
3563 if (LISTVIEW_GetItemState(infoPtr, i, LVIS_SELECTED))
3564 nSelectedCount++;
3565 }
3566 }
3567 else
3568 nSelectedCount = ranges_itemcount(infoPtr->selectionRanges);
3569
3570 TRACE("nSelectedCount=%d\n", nSelectedCount);
3571 return nSelectedCount;
3572}
static INT ranges_itemcount(RANGES ranges)
Definition: listview.c:3306

Referenced by LISTVIEW_SetItemState(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetStringWidthT()

static INT LISTVIEW_GetStringWidthT ( const LISTVIEW_INFO infoPtr,
LPCWSTR  lpszText,
BOOL  isW 
)
static

Definition at line 7706 of file listview.c.

7707{
7708 SIZE stringSize;
7709
7710 stringSize.cx = 0;
7711 if (is_text(lpszText))
7712 {
7713 HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
7714 HDC hdc = GetDC(infoPtr->hwndSelf);
7715 HFONT hOldFont = SelectObject(hdc, hFont);
7716
7717 if (isW)
7718 GetTextExtentPointW(hdc, lpszText, lstrlenW(lpszText), &stringSize);
7719 else
7720 GetTextExtentPointA(hdc, (LPCSTR)lpszText, lstrlenA((LPCSTR)lpszText), &stringSize);
7721 SelectObject(hdc, hOldFont);
7722 ReleaseDC(infoPtr->hwndSelf, hdc);
7723 }
7724 return stringSize.cx;
7725}
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
BOOL WINAPI GetTextExtentPointA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)

Referenced by LISTVIEW_CalculateItemWidth(), LISTVIEW_SetColumnWidth(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetSubItemPtr()

static SUBITEM_INFO * LISTVIEW_GetSubItemPtr ( HDPA  hdpaSubItems,
INT  nSubItem 
)
static

Definition at line 3010 of file listview.c.

3011{
3012 SUBITEM_INFO *lpSubItem;
3013 INT i;
3014
3015 /* we should binary search here if need be */
3016 for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++)
3017 {
3018 lpSubItem = DPA_GetPtr(hdpaSubItems, i);
3019 if (lpSubItem->iSubItem == nSubItem)
3020 return lpSubItem;
3021 }
3022
3023 return NULL;
3024}

Referenced by LISTVIEW_GetItemT(), and set_sub_item().

◆ LISTVIEW_GetSubItemRect()

static BOOL LISTVIEW_GetSubItemRect ( const LISTVIEW_INFO infoPtr,
INT  item,
LPRECT  lprc 
)
static

Definition at line 7294 of file listview.c.

7295{
7296 RECT rect = { 0, 0, 0, 0 };
7297 POINT origin;
7298 INT y;
7299
7300 if (!lprc) return FALSE;
7301
7302 TRACE("(item=%d, subitem=%d, type=%d)\n", item, lprc->top, lprc->left);
7303 /* Subitem of '0' means item itself, and this works for all control view modes */
7304 if (lprc->top == 0)
7305 return LISTVIEW_GetItemRect(infoPtr, item, lprc);
7306
7307 if (infoPtr->uView != LV_VIEW_DETAILS) return FALSE;
7308
7309 LISTVIEW_GetOrigin(infoPtr, &origin);
7310 /* this works for any item index, no matter if it exists or not */
7311 y = item * infoPtr->nItemHeight + origin.y;
7312
7313 if (infoPtr->hwndHeader && SendMessageW(infoPtr->hwndHeader, HDM_GETITEMRECT, lprc->top, (LPARAM)&rect))
7314 {
7315 rect.top = 0;
7316 rect.bottom = infoPtr->nItemHeight;
7317 }
7318 else
7319 {
7320 /* Native implementation is broken for this case and garbage is left for left and right fields,
7321 we zero them to get predictable output */
7322 lprc->left = lprc->right = lprc->top = 0;
7323 lprc->bottom = infoPtr->nItemHeight;
7324 OffsetRect(lprc, origin.x, y);
7325 TRACE("return rect %s\n", wine_dbgstr_rect(lprc));
7326 return TRUE;
7327 }
7328
7329 switch (lprc->left)
7330 {
7331 case LVIR_ICON:
7332 {
7333 /* it doesn't matter if main item actually has an icon, if imagelist is set icon width is returned */
7334 if (infoPtr->himlSmall)
7335 rect.right = rect.left + infoPtr->iconSize.cx;
7336 else
7337 rect.right = rect.left;
7338
7339 rect.bottom = rect.top + infoPtr->iconSize.cy;
7340 break;
7341 }
7342 case LVIR_LABEL:
7343 case LVIR_BOUNDS:
7344 break;
7345
7346 default:
7347 ERR("Unknown bounds=%d\n", lprc->left);
7348 return FALSE;
7349 }
7350
7351 OffsetRect(&rect, origin.x, y);
7352 *lprc = rect;
7353 TRACE("return rect %s\n", wine_dbgstr_rect(lprc));
7354
7355 return TRUE;
7356}
voidpf uLong int origin
Definition: ioapi.h:144

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetTopIndex()

static INT LISTVIEW_GetTopIndex ( const LISTVIEW_INFO infoPtr)
static

Definition at line 4629 of file listview.c.

4630{
4631 INT nItem = 0;
4632 SCROLLINFO scrollInfo;
4633
4634 scrollInfo.cbSize = sizeof(SCROLLINFO);
4635 scrollInfo.fMask = SIF_POS;
4636
4637 if (infoPtr->uView == LV_VIEW_LIST)
4638 {
4639 if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo))
4640 nItem = scrollInfo.nPos * LISTVIEW_GetCountPerColumn(infoPtr);
4641 }
4642 else if (infoPtr->uView == LV_VIEW_DETAILS)
4643 {
4644 if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo))
4645 nItem = scrollInfo.nPos;
4646 }
4647 else
4648 {
4649 if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo))
4650 nItem = LISTVIEW_GetCountPerRow(infoPtr) * (scrollInfo.nPos / infoPtr->nItemHeight);
4651 }
4652
4653 TRACE("nItem=%d\n", nItem);
4654
4655 return nItem;
4656}

Referenced by LISTVIEW_KeyDown(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetVersion()

static LRESULT LISTVIEW_GetVersion ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 11460 of file listview.c.

11461{
11462 return infoPtr->iVersion;
11463}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetViewRect()

static BOOL LISTVIEW_GetViewRect ( const LISTVIEW_INFO infoPtr,
LPRECT  lprcView 
)
static

Definition at line 2977 of file listview.c.

2978{
2979 POINT ptOrigin;
2980
2981 TRACE("(lprcView=%p)\n", lprcView);
2982
2983 if (!lprcView) return FALSE;
2984
2985 LISTVIEW_GetAreaRect(infoPtr, lprcView);
2986
2987 if (infoPtr->uView != LV_VIEW_DETAILS)
2988 {
2989 LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
2990 OffsetRect(lprcView, ptOrigin.x, ptOrigin.y);
2991 }
2992
2993 TRACE("lprcView=%s\n", wine_dbgstr_rect(lprcView));
2994
2995 return TRUE;
2996}

Referenced by LISTVIEW_UpdateHScroll(), LISTVIEW_UpdateVScroll(), and LISTVIEW_WindowProc().

◆ LISTVIEW_HitTest()

static INT LISTVIEW_HitTest ( const LISTVIEW_INFO infoPtr,
LPLVHITTESTINFO  lpht,
BOOL  subitem,
BOOL  select 
)
static

Definition at line 7746 of file listview.c.

7747{
7748 WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
7749 RECT rcBox, rcBounds, rcState, rcIcon, rcLabel, rcSearch;
7750 POINT Origin, Position, opt;
7751 BOOL is_fullrow;
7752 LVITEMW lvItem;
7753 ITERATOR i;
7754 INT iItem;
7755
7756 TRACE("(pt=%s, subitem=%d, select=%d)\n", wine_dbgstr_point(&lpht->pt), subitem, select);
7757
7758 lpht->flags = 0;
7759 lpht->iItem = -1;
7760 if (subitem) lpht->iSubItem = 0;
7761
7762 LISTVIEW_GetOrigin(infoPtr, &Origin);
7763
7764 /* set whole list relation flags */
7765 if (subitem && infoPtr->uView == LV_VIEW_DETAILS)
7766 {
7767 /* LVM_SUBITEMHITTEST checks left bound of possible client area */
7768 if (infoPtr->rcList.left > lpht->pt.x && Origin.x < lpht->pt.x)
7769 lpht->flags |= LVHT_TOLEFT;
7770
7771 if (lpht->pt.y < infoPtr->rcList.top && lpht->pt.y >= 0)
7772 opt.y = lpht->pt.y + infoPtr->rcList.top;
7773 else
7774 opt.y = lpht->pt.y;
7775
7776 if (infoPtr->rcList.bottom < opt.y)
7777 lpht->flags |= LVHT_BELOW;
7778 }
7779 else
7780 {
7781 if (infoPtr->rcList.left > lpht->pt.x)
7782 lpht->flags |= LVHT_TOLEFT;
7783 else if (infoPtr->rcList.right < lpht->pt.x)
7784 lpht->flags |= LVHT_TORIGHT;
7785
7786 if (infoPtr->rcList.top > lpht->pt.y)
7787 lpht->flags |= LVHT_ABOVE;
7788 else if (infoPtr->rcList.bottom < lpht->pt.y)
7789 lpht->flags |= LVHT_BELOW;
7790 }
7791
7792 /* even if item is invalid try to find subitem */
7793 if (infoPtr->uView == LV_VIEW_DETAILS && subitem)
7794 {
7795 RECT *pRect;
7796 INT j;
7797
7798 opt.x = lpht->pt.x - Origin.x;
7799
7800 lpht->iSubItem = -1;
7801 for (j = 0; j < DPA_GetPtrCount(infoPtr->hdpaColumns); j++)
7802 {
7803 pRect = &LISTVIEW_GetColumnInfo(infoPtr, j)->rcHeader;
7804
7805 if ((opt.x >= pRect->left) && (opt.x < pRect->right))
7806 {
7807 lpht->iSubItem = j;
7808 break;
7809 }
7810 }
7811 TRACE("lpht->iSubItem=%d\n", lpht->iSubItem);
7812
7813 /* if we're outside horizontal columns bounds there's nothing to test further */
7814 if (lpht->iSubItem == -1)
7815 {
7816 lpht->iItem = -1;
7817 lpht->flags = LVHT_NOWHERE;
7818 return -1;
7819 }
7820 }
7821
7822 TRACE("lpht->flags=0x%x\n", lpht->flags);
7823 if (lpht->flags) return -1;
7824
7825 lpht->flags |= LVHT_NOWHERE;
7826
7827 /* first deal with the large items */
7828 rcSearch.left = lpht->pt.x;
7829 rcSearch.top = lpht->pt.y;
7830 rcSearch.right = rcSearch.left + 1;
7831 rcSearch.bottom = rcSearch.top + 1;
7832
7833 iterator_frameditems(&i, infoPtr, &rcSearch);
7834 iterator_next(&i); /* go to first item in the sequence */
7835 iItem = i.nItem;
7837
7838 TRACE("lpht->iItem=%d\n", iItem);
7839 if (iItem == -1) return -1;
7840
7841 lvItem.mask = LVIF_STATE | LVIF_TEXT;
7842 if (infoPtr->uView == LV_VIEW_DETAILS) lvItem.mask |= LVIF_INDENT;
7844 if (infoPtr->uView == LV_VIEW_ICON) lvItem.stateMask |= LVIS_FOCUSED;
7845 lvItem.iItem = iItem;
7846 lvItem.iSubItem = subitem ? lpht->iSubItem : 0;
7847 lvItem.pszText = szDispText;
7848 lvItem.cchTextMax = DISP_TEXT_SIZE;
7849 if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return -1;
7850 if (!infoPtr->bFocus) lvItem.state &= ~LVIS_FOCUSED;
7851
7852 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, &rcBox, NULL, &rcIcon, &rcState, &rcLabel);
7853 LISTVIEW_GetItemOrigin(infoPtr, iItem, &Position);
7854 opt.x = lpht->pt.x - Position.x - Origin.x;
7855
7856 if (lpht->pt.y < infoPtr->rcList.top && lpht->pt.y >= 0)
7857 opt.y = lpht->pt.y - Position.y - Origin.y + infoPtr->rcList.top;
7858 else
7859 opt.y = lpht->pt.y - Position.y - Origin.y;
7860
7861 if (infoPtr->uView == LV_VIEW_DETAILS)
7862 {
7863 rcBounds = rcBox;
7864 if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
7865 opt.x = lpht->pt.x - Origin.x;
7866 }
7867 else
7868 {
7869 UnionRect(&rcBounds, &rcIcon, &rcLabel);
7870 UnionRect(&rcBounds, &rcBounds, &rcState);
7871 }
7872 TRACE("rcBounds=%s\n", wine_dbgstr_rect(&rcBounds));
7873 if (!PtInRect(&rcBounds, opt)) return -1;
7874
7875 /* That's a special case - row rectangle is used as item rectangle and
7876 returned flags contain all item parts. */
7877 is_fullrow = (infoPtr->uView == LV_VIEW_DETAILS) && ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) || (infoPtr->dwStyle & LVS_OWNERDRAWFIXED));
7878
7879 if (PtInRect(&rcIcon, opt))
7880 lpht->flags |= LVHT_ONITEMICON;
7881 else if (PtInRect(&rcLabel, opt))
7882 lpht->flags |= LVHT_ONITEMLABEL;
7883 else if (infoPtr->himlState && PtInRect(&rcState, opt))
7884 lpht->flags |= LVHT_ONITEMSTATEICON;
7885 if (is_fullrow && !(lpht->flags & LVHT_ONITEM))
7886 {
7887 lpht->flags = LVHT_ONITEM | LVHT_ABOVE;
7888 }
7889 if (lpht->flags & LVHT_ONITEM)
7890 lpht->flags &= ~LVHT_NOWHERE;
7891 TRACE("lpht->flags=0x%x\n", lpht->flags);
7892
7893 if (select && !is_fullrow)
7894 {
7895 if (infoPtr->uView == LV_VIEW_DETAILS)
7896 {
7897 /* get main item bounds */
7898 lvItem.iSubItem = 0;
7899 LISTVIEW_GetItemMetrics(infoPtr, &lvItem, &rcBox, NULL, &rcIcon, &rcState, &rcLabel);
7900 UnionRect(&rcBounds, &rcIcon, &rcLabel);
7901 UnionRect(&rcBounds, &rcBounds, &rcState);
7902 }
7903 if (!PtInRect(&rcBounds, opt)) iItem = -1;
7904 }
7905 return lpht->iItem = iItem;
7906}
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
Definition: select.c:41
#define LVHT_BELOW
Definition: commctrl.h:2500
#define LVHT_ONITEM
Definition: commctrl.h:2497
#define LVHT_TOLEFT
Definition: commctrl.h:2502
#define LVHT_TORIGHT
Definition: commctrl.h:2501
#define LVHT_ONITEMICON
Definition: commctrl.h:2494
#define LVHT_ABOVE
Definition: commctrl.h:2499
#define LVHT_ONITEMSTATEICON
Definition: commctrl.h:2496
#define LVHT_NOWHERE
Definition: commctrl.h:2493
#define LVHT_ONITEMLABEL
Definition: commctrl.h:2495
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by LISTVIEW_GetItemAtPt(), LISTVIEW_LButtonDblClk(), LISTVIEW_LButtonDown(), LISTVIEW_LButtonUp(), LISTVIEW_MouseMove(), LISTVIEW_RButtonDblClk(), LISTVIEW_RButtonDown(), LISTVIEW_SetCursor(), and LISTVIEW_WindowProc().

◆ LISTVIEW_HScroll()

static LRESULT LISTVIEW_HScroll ( LISTVIEW_INFO infoPtr,
INT  nScrollCode,
INT  nScrollDiff 
)
static

Definition at line 9983 of file listview.c.

9985{
9986 INT nOldScrollPos, nNewScrollPos;
9987 SCROLLINFO scrollInfo;
9988 BOOL is_an_icon;
9989
9990 TRACE("(nScrollCode=%d(%s), nScrollDiff=%d)\n", nScrollCode,
9991 debugscrollcode(nScrollCode), nScrollDiff);
9992
9993 if (infoPtr->hwndEdit) SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
9994
9995 scrollInfo.cbSize = sizeof(SCROLLINFO);
9996 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS;
9997
9998 is_an_icon = ((infoPtr->uView == LV_VIEW_ICON) || (infoPtr->uView == LV_VIEW_SMALLICON));
9999
10000 if (!GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo)) return 1;
10001
10002 nOldScrollPos = scrollInfo.nPos;
10003
10004 switch (nScrollCode)
10005 {
10006 case SB_INTERNAL:
10007 break;
10008
10009 case SB_LINELEFT:
10010 nScrollDiff = (is_an_icon) ? -LISTVIEW_SCROLL_ICON_LINE_SIZE : -1;
10011 break;
10012
10013 case SB_LINERIGHT:
10014 nScrollDiff = (is_an_icon) ? LISTVIEW_SCROLL_ICON_LINE_SIZE : 1;
10015 break;
10016
10017 case SB_PAGELEFT:
10018 nScrollDiff = -scrollInfo.nPage;
10019 break;
10020
10021 case SB_PAGERIGHT:
10022 nScrollDiff = scrollInfo.nPage;
10023 break;
10024
10025 case SB_THUMBPOSITION:
10026 case SB_THUMBTRACK:
10027 nScrollDiff = scrollInfo.nTrackPos - scrollInfo.nPos;
10028 break;
10029
10030 default:
10031 nScrollDiff = 0;
10032 }
10033
10034 /* quit right away if pos isn't changing */
10035 if (nScrollDiff == 0) return 0;
10036
10037 /* calculate new position, and handle overflows */
10038 nNewScrollPos = scrollInfo.nPos + nScrollDiff;
10039 if (nScrollDiff > 0) {
10040 if (nNewScrollPos < nOldScrollPos ||
10041 nNewScrollPos > scrollInfo.nMax)
10042 nNewScrollPos = scrollInfo.nMax;
10043 } else {
10044 if (nNewScrollPos > nOldScrollPos ||
10045 nNewScrollPos < scrollInfo.nMin)
10046 nNewScrollPos = scrollInfo.nMin;
10047 }
10048
10049 /* set the new position, and reread in case it changed */
10050 scrollInfo.fMask = SIF_POS;
10051 scrollInfo.nPos = nNewScrollPos;
10052 nNewScrollPos = SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo, TRUE);
10053
10054 /* carry on only if it really changed */
10055 if (nNewScrollPos == nOldScrollPos) return 0;
10056
10057 LISTVIEW_UpdateHeaderSize(infoPtr, nNewScrollPos);
10058
10059 /* now adjust to client coordinates */
10060 nScrollDiff = nOldScrollPos - nNewScrollPos;
10061 if (infoPtr->uView == LV_VIEW_LIST) nScrollDiff *= infoPtr->nItemWidth;
10062
10063 /* and scroll the window */
10064 scroll_list(infoPtr, nScrollDiff, 0);
10065
10066 return 0;
10067}
#define LISTVIEW_SCROLL_ICON_LINE_SIZE
Definition: listview.c:390
static void LISTVIEW_UpdateHeaderSize(const LISTVIEW_INFO *infoPtr, INT nNewScrollPos)
Definition: listview.c:2015
static void scroll_list(LISTVIEW_INFO *infoPtr, INT dx, INT dy)
Definition: listview.c:9849
static LPCSTR debugscrollcode(int nScrollCode)
Definition: listview.c:724
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
#define WM_KILLFOCUS
Definition: winuser.h:1614

Referenced by LISTVIEW_EnsureVisible(), LISTVIEW_MouseWheel(), LISTVIEW_Scroll(), and LISTVIEW_WindowProc().

◆ LISTVIEW_InsertColumnT()

static INT LISTVIEW_InsertColumnT ( LISTVIEW_INFO infoPtr,
INT  nColumn,
const LVCOLUMNW lpColumn,
BOOL  isW 
)
static

Definition at line 8315 of file listview.c.

8317{
8318 COLUMN_INFO *lpColumnInfo;
8319 INT nNewColumn;
8320 HDITEMW hdi;
8321
8322 TRACE("(nColumn=%d, lpColumn=%s, isW=%d)\n", nColumn, debuglvcolumn_t(lpColumn, isW), isW);
8323
8324 if (!lpColumn || nColumn < 0) return -1;
8325 nColumn = min(nColumn, DPA_GetPtrCount(infoPtr->hdpaColumns));
8326
8327 ZeroMemory(&hdi, sizeof(HDITEMW));
8328 column_fill_hditem(infoPtr, &hdi, nColumn, lpColumn, isW);
8329
8330 /*
8331 * A mask not including LVCF_WIDTH turns into a mask of width, width 10
8332 * (can be seen in SPY) otherwise column never gets added.
8333 */
8334 if (!(lpColumn->mask & LVCF_WIDTH)) {
8335 hdi.mask |= HDI_WIDTH;
8336 hdi.cxy = 10;
8337 }
8338
8339 /*
8340 * when the iSubItem is available Windows copies it to the header lParam. It seems
8341 * to happen only in LVM_INSERTCOLUMN - not in LVM_SETCOLUMN
8342 */
8343 if (lpColumn->mask & LVCF_SUBITEM)
8344 {
8345 hdi.mask |= HDI_LPARAM;
8346 hdi.lParam = lpColumn->iSubItem;
8347 }
8348
8349 /* create header if not present */
8350 LISTVIEW_CreateHeader(infoPtr);
8351 if (!(LVS_NOCOLUMNHEADER & infoPtr->dwStyle) &&
8352 (infoPtr->uView == LV_VIEW_DETAILS) && (WS_VISIBLE & infoPtr->dwStyle))
8353 {
8355 }
8356
8357 /* insert item in header control */
8358 nNewColumn = SendMessageW(infoPtr->hwndHeader,
8360 nColumn, (LPARAM)&hdi);
8361 if (nNewColumn == -1) return -1;
8362 if (nNewColumn != nColumn) ERR("nColumn=%d, nNewColumn=%d\n", nColumn, nNewColumn);
8363
8364 /* create our own column info */
8365 if (!(lpColumnInfo = Alloc(sizeof(COLUMN_INFO)))) goto fail;
8366 if (DPA_InsertPtr(infoPtr->hdpaColumns, nNewColumn, lpColumnInfo) == -1) goto fail;
8367
8368 if (lpColumn->mask & LVCF_FMT) lpColumnInfo->fmt = lpColumn->fmt;
8369 if (lpColumn->mask & LVCF_MINWIDTH) lpColumnInfo->cxMin = lpColumn->cxMin;
8370 if (!SendMessageW(infoPtr->hwndHeader, HDM_GETITEMRECT, nNewColumn, (LPARAM)&lpColumnInfo->rcHeader))
8371 goto fail;
8372
8373 /* now we have to actually adjust the data */
8374 if (!(infoPtr->dwStyle & LVS_OWNERDATA) && infoPtr->nItemCount > 0)
8375 {
8376 SUBITEM_INFO *lpSubItem;
8377 HDPA hdpaSubItems;
8378 INT nItem, i;
8379 LVITEMW item;
8380 BOOL changed;
8381
8382 item.iSubItem = nNewColumn;
8383 item.mask = LVIF_TEXT | LVIF_IMAGE;
8384 item.iImage = I_IMAGECALLBACK;
8385 item.pszText = LPSTR_TEXTCALLBACKW;
8386
8387 for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
8388 {
8389 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, nItem);
8390 for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++)
8391 {
8392 lpSubItem = DPA_GetPtr(hdpaSubItems, i);
8393 if (lpSubItem->iSubItem >= nNewColumn)
8394 lpSubItem->iSubItem++;
8395 }
8396
8397 /* add new subitem for each item */
8398 item.iItem = nItem;
8399 set_sub_item(infoPtr, &item, isW, &changed);
8400 }
8401 }
8402
8403 /* make space for the new column */
8404 LISTVIEW_ScrollColumns(infoPtr, nNewColumn + 1, lpColumnInfo->rcHeader.right - lpColumnInfo->rcHeader.left);
8405 LISTVIEW_UpdateItemSize(infoPtr);
8406
8407 return nNewColumn;
8408
8409fail:
8410 if (nNewColumn != -1) SendMessageW(infoPtr->hwndHeader, HDM_DELETEITEM, nNewColumn, 0);
8411 if (lpColumnInfo)
8412 {
8413 DPA_DeletePtr(infoPtr->hdpaColumns, nNewColumn);
8414 Free(lpColumnInfo);
8415 }
8416 return -1;
8417}
INT WINAPI DPA_InsertPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:591
static BOOL set_sub_item(const LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW, BOOL *bChanged)
Definition: listview.c:4488
static void column_fill_hditem(const LISTVIEW_INFO *infoPtr, HDITEMW *lphdi, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
Definition: listview.c:8225
static const char * debuglvcolumn_t(const LVCOLUMNW *lpColumn, BOOL isW)
Definition: listview.c:668
#define HDM_INSERTITEMA
Definition: commctrl.h:736
#define HDM_INSERTITEMW
Definition: commctrl.h:737
LPARAM lParam
Definition: commctrl.h:690

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_InsertItemT()

static INT LISTVIEW_InsertItemT ( LISTVIEW_INFO infoPtr,
const LVITEMW lpLVItem,
BOOL  isW 
)
static

Definition at line 7921 of file listview.c.

7922{
7923 INT nItem;
7924 HDPA hdpaSubItems;
7925 NMLISTVIEW nmlv;
7926 ITEM_INFO *lpItem;
7927 ITEM_ID *lpID;
7928 BOOL is_sorted, has_changed;
7929 LVITEMW item;
7930 HWND hwndSelf = infoPtr->hwndSelf;
7931
7932 TRACE("(item=%s, isW=%d)\n", debuglvitem_t(lpLVItem, isW), isW);
7933
7934 if (infoPtr->dwStyle & LVS_OWNERDATA) return infoPtr->nItemCount++;
7935
7936 /* make sure it's an item, and not a subitem; cannot insert a subitem */
7937 if (!lpLVItem || lpLVItem->iSubItem) return -1;
7938
7939 if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return -1;
7940
7941 if (!(lpItem = Alloc(sizeof(ITEM_INFO)))) return -1;
7942
7943 /* insert item in listview control data structure */
7944 if ( !(hdpaSubItems = DPA_Create(8)) ) goto fail;
7945 if ( !DPA_SetPtr(hdpaSubItems, 0, lpItem) ) assert (FALSE);
7946
7947 /* link with id struct */
7948 if (!(lpID = Alloc(sizeof(ITEM_ID)))) goto fail;
7949 lpItem->id = lpID;
7950 lpID->item = hdpaSubItems;
7951 lpID->id = get_next_itemid(infoPtr);
7952 if ( DPA_InsertPtr(infoPtr->hdpaItemIds, infoPtr->nItemCount, lpID) == -1) goto fail;
7953
7955 !(infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (LPSTR_TEXTCALLBACKW != lpLVItem->pszText);
7956
7957 if (lpLVItem->iItem < 0 && !is_sorted) return -1;
7958
7959 /* calculate new item index */
7960 if (is_sorted)
7961 {
7962 HDPA hItem;
7963 ITEM_INFO *item_s;
7964 INT i = 0, cmpv;
7965 WCHAR *textW;
7966
7967 textW = textdupTtoW(lpLVItem->pszText, isW);
7968
7969 while (i < infoPtr->nItemCount)
7970 {
7971 hItem = DPA_GetPtr( infoPtr->hdpaItems, i);
7972 item_s = DPA_GetPtr(hItem, 0);
7973
7974 cmpv = textcmpWT(item_s->hdr.pszText, textW, TRUE);
7975 if (infoPtr->dwStyle & LVS_SORTDESCENDING) cmpv *= -1;
7976
7977 if (cmpv >= 0) break;
7978 i++;
7979 }
7980
7982
7983 nItem = i;
7984 }
7985 else
7986 nItem = min(lpLVItem->iItem, infoPtr->nItemCount);
7987
7988 TRACE("inserting at %d, sorted=%d, count=%d, iItem=%d\n", nItem, is_sorted, infoPtr->nItemCount, lpLVItem->iItem);
7989 nItem = DPA_InsertPtr( infoPtr->hdpaItems, nItem, hdpaSubItems );
7990 if (nItem == -1) goto fail;
7991 infoPtr->nItemCount++;
7992
7993 /* shift indices first so they don't get tangled */
7994 LISTVIEW_ShiftIndices(infoPtr, nItem, 1);
7995
7996 /* set the item attributes */
7997 if (lpLVItem->mask & (LVIF_GROUPID|LVIF_COLUMNS))
7998 {
7999 /* full size structure expected - _WIN32IE >= 0x560 */
8000 item = *lpLVItem;
8001 }
8002 else if (lpLVItem->mask & LVIF_INDENT)
8003 {
8004 /* indent member expected - _WIN32IE >= 0x300 */
8005 memcpy(&item, lpLVItem, offsetof( LVITEMW, iGroupId ));
8006 }
8007 else
8008 {
8009 /* minimal structure expected */
8010 memcpy(&item, lpLVItem, offsetof( LVITEMW, iIndent ));
8011 }
8012 item.iItem = nItem;
8013 if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
8014 {
8015 if (item.mask & LVIF_STATE)
8016 {
8017 item.stateMask |= LVIS_STATEIMAGEMASK;
8018 item.state &= ~LVIS_STATEIMAGEMASK;
8019 item.state |= INDEXTOSTATEIMAGEMASK(1);
8020 }
8021 else
8022 {
8023 item.mask |= LVIF_STATE;
8024 item.stateMask = LVIS_STATEIMAGEMASK;
8025 item.state = INDEXTOSTATEIMAGEMASK(1);
8026 }
8027 }
8028
8029 if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo;
8030
8031 /* make room for the position, if we are in the right mode */
8032 if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
8033 {
8034 if (DPA_InsertPtr(infoPtr->hdpaPosX, nItem, 0) == -1)
8035 goto undo;
8036 if (DPA_InsertPtr(infoPtr->hdpaPosY, nItem, 0) == -1)
8037 {
8038 DPA_DeletePtr(infoPtr->hdpaPosX, nItem);
8039 goto undo;
8040 }
8041 }
8042
8043 /* send LVN_INSERTITEM notification */
8044 memset(&nmlv, 0, sizeof(NMLISTVIEW));
8045 nmlv.iItem = nItem;
8046 nmlv.lParam = lpItem->lParam;
8047 notify_listview(infoPtr, LVN_INSERTITEM, &nmlv);
8048 if (!IsWindow(hwndSelf))
8049 return -1;
8050
8051 /* align items (set position of each item) */
8052 if (infoPtr->uView == LV_VIEW_SMALLICON || infoPtr->uView == LV_VIEW_ICON)
8053 {
8054 POINT pt;
8055
8056#ifdef __REACTOS__
8057 if (infoPtr->dwStyle & LVS_ALIGNLEFT)
8058 LISTVIEW_NextIconPosLeft(infoPtr, &pt, nItem);
8059 else
8060 LISTVIEW_NextIconPosTop(infoPtr, &pt, nItem);
8061#else
8062 if (infoPtr->dwStyle & LVS_ALIGNLEFT)
8063 LISTVIEW_NextIconPosLeft(infoPtr, &pt);
8064 else
8065 LISTVIEW_NextIconPosTop(infoPtr, &pt);
8066#endif
8067
8068 LISTVIEW_MoveIconTo(infoPtr, nItem, &pt, TRUE);
8069 }
8070
8071 /* now is the invalidation fun */
8072 LISTVIEW_ScrollOnInsert(infoPtr, nItem, 1);
8073 return nItem;
8074
8075undo:
8076 LISTVIEW_ShiftIndices(infoPtr, nItem, -1);
8077 LISTVIEW_ShiftFocus(infoPtr, infoPtr->nFocusedItem, nItem, -1);
8078 DPA_DeletePtr(infoPtr->hdpaItems, nItem);
8079 infoPtr->nItemCount--;
8080fail:
8081 DPA_DeletePtr(hdpaSubItems, 0);
8082 DPA_Destroy (hdpaSubItems);
8083 Free (lpItem);
8084 return -1;
8085}
_STLP_MOVE_TO_STD_NAMESPACE bool is_sorted(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.h:722
BOOL WINAPI DPA_SetPtr(HDPA hdpa, INT i, LPVOID p)
Definition: dpa.c:626
HDPA WINAPI DPA_Create(INT nGrow)
Definition: dpa.c:950
static int textcmpWT(LPCWSTR aw, LPCWSTR bt, BOOL isW)
Definition: listview.c:529
static BOOL set_main_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isNew, BOOL isW, BOOL *bChanged)
Definition: listview.c:4303
static DWORD get_next_itemid(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1628
static BOOL is_assignable_item(const LVITEMW *lpLVItem, LONG lStyle)
Definition: listview.c:4278
static const WCHAR textW[]
Definition: itemdlg.c:1559
#define LVN_INSERTITEM
Definition: commctrl.h:3132
#define LVS_EX_CHECKBOXES
Definition: commctrl.h:2731
#define INDEXTOSTATEIMAGEMASK(i)
Definition: commctrl.h:2328
HDPA item
Definition: listview.c:181
HTREEITEM hItem
Definition: treelist.h:37

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_InvalidateColumn()

static void LISTVIEW_InvalidateColumn ( const LISTVIEW_INFO infoPtr,
INT  nColumn 
)
inlinestatic

Definition at line 1787 of file listview.c.

1788{
1789 RECT rcCol;
1790
1791 if(!is_redrawing(infoPtr)) return;
1792 LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol);
1793 rcCol.top = infoPtr->rcList.top;
1794 rcCol.bottom = infoPtr->rcList.bottom;
1795 LISTVIEW_InvalidateRect(infoPtr, &rcCol);
1796}
static BOOL is_redrawing(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1743
static void LISTVIEW_InvalidateRect(const LISTVIEW_INFO *infoPtr, const RECT *rect)
Definition: listview.c:1748

Referenced by LISTVIEW_SetColumnT().

◆ LISTVIEW_InvalidateItem()

static void LISTVIEW_InvalidateItem ( const LISTVIEW_INFO infoPtr,
INT  nItem 
)
inlinestatic

Definition at line 1755 of file listview.c.

1756{
1757 RECT rcBox;
1758
1759 if (!is_redrawing(infoPtr) || nItem < 0 || nItem >= infoPtr->nItemCount)
1760 return;
1761
1762 LISTVIEW_GetItemBox(infoPtr, nItem, &rcBox);
1763 LISTVIEW_InvalidateRect(infoPtr, &rcBox);
1764}

Referenced by LISTVIEW_DeleteItem(), LISTVIEW_EditLabelT(), LISTVIEW_EndEditLabelT(), LISTVIEW_InvalidateSelectedItems(), LISTVIEW_MoveIconTo(), LISTVIEW_RedrawItems(), LISTVIEW_SetItemT(), LISTVIEW_ShowFocusRect(), and LISTVIEW_Update().

◆ LISTVIEW_InvalidateList()

◆ LISTVIEW_InvalidateRect()

static void LISTVIEW_InvalidateRect ( const LISTVIEW_INFO infoPtr,
const RECT rect 
)
inlinestatic

◆ LISTVIEW_InvalidateSelectedItems()

static void LISTVIEW_InvalidateSelectedItems ( const LISTVIEW_INFO infoPtr)
static

Definition at line 2272 of file listview.c.

2273{
2274 ITERATOR i;
2275
2276 iterator_frameditems(&i, infoPtr, &infoPtr->rcList);
2277 while(iterator_next(&i))
2278 {
2279#ifdef __REACTOS__
2280 if (LISTVIEW_GetItemState(infoPtr, i.nItem, LVIS_SELECTED | LVIS_CUT))
2281#else
2282 if (LISTVIEW_GetItemState(infoPtr, i.nItem, LVIS_SELECTED))
2283#endif
2284 LISTVIEW_InvalidateItem(infoPtr, i.nItem);
2285 }
2287}

Referenced by LISTVIEW_KillFocus(), and LISTVIEW_SetFocus().

◆ LISTVIEW_InvalidateSubItem()

static void LISTVIEW_InvalidateSubItem ( const LISTVIEW_INFO infoPtr,
INT  nItem,
INT  nSubItem 
)
inlinestatic

Definition at line 1766 of file listview.c.

1767{
1768 POINT Origin, Position;
1769 RECT rcBox;
1770
1771 if(!is_redrawing(infoPtr)) return;
1772 assert (infoPtr->uView == LV_VIEW_DETAILS);
1773 LISTVIEW_GetOrigin(infoPtr, &Origin);
1774 LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
1775 LISTVIEW_GetHeaderRect(infoPtr, nSubItem, &rcBox);
1776 rcBox.top = 0;
1777 rcBox.bottom = infoPtr->nItemHeight;
1778 OffsetRect(&rcBox, Origin.x, Origin.y + Position.y);
1779 LISTVIEW_InvalidateRect(infoPtr, &rcBox);
1780}

Referenced by LISTVIEW_SetItemT().

◆ LISTVIEW_IsHeaderEnabled()

static BOOL LISTVIEW_IsHeaderEnabled ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1706 of file listview.c.

1707{
1708 return (infoPtr->uView == LV_VIEW_DETAILS ||
1709 infoPtr->dwLvExStyle & LVS_EX_HEADERINALLVIEWS) &&
1710 !(infoPtr->dwStyle & LVS_NOCOLUMNHEADER);
1711}

Referenced by LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateSize().

◆ LISTVIEW_IsHotTracking()

static BOOL LISTVIEW_IsHotTracking ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 3882 of file listview.c.

3883{
3884 return ((infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) ||
3885 (infoPtr->dwLvExStyle & LVS_EX_ONECLICKACTIVATE) ||
3887}
#define LVS_EX_ONECLICKACTIVATE
Definition: commctrl.h:2735
#define LVS_EX_TWOCLICKACTIVATE
Definition: commctrl.h:2736
#define LVS_EX_TRACKSELECT
Definition: commctrl.h:2732

Referenced by LISTVIEW_MouseHover(), LISTVIEW_MouseMove(), and LISTVIEW_SetCursor().

◆ LISTVIEW_IsItemVisible()

static BOOL LISTVIEW_IsItemVisible ( const LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 8099 of file listview.c.

8100{
8101 POINT Origin, Position;
8102 RECT rcItem;
8103 HDC hdc;
8104 BOOL ret;
8105
8106 TRACE("nItem=%d\n", nItem);
8107
8108 if (nItem < 0 || nItem >= DPA_GetPtrCount(infoPtr->hdpaItems)) return FALSE;
8109
8110 LISTVIEW_GetOrigin(infoPtr, &Origin);
8111 LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
8112 rcItem.left = Position.x + Origin.x;
8113 rcItem.top = Position.y + Origin.y;
8114 rcItem.right = rcItem.left + infoPtr->nItemWidth;
8115 rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
8116
8117 hdc = GetDC(infoPtr->hwndSelf);
8118 if (!hdc) return FALSE;
8119 ret = RectVisible(hdc, &rcItem);
8120 ReleaseDC(infoPtr->hwndSelf, hdc);
8121
8122 return ret;
8123}
int ret

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_KeyDown()

static LRESULT LISTVIEW_KeyDown ( LISTVIEW_INFO infoPtr,
INT  nVirtualKey,
LONG  lKeyData 
)
static

Definition at line 10125 of file listview.c.

10126{
10127 HWND hwndSelf = infoPtr->hwndSelf;
10128 INT nItem = -1;
10129 NMLVKEYDOWN nmKeyDown;
10130
10131 TRACE("(nVirtualKey=%d, lKeyData=%d)\n", nVirtualKey, lKeyData);
10132
10133 /* send LVN_KEYDOWN notification */
10134 nmKeyDown.wVKey = nVirtualKey;
10135 nmKeyDown.flags = 0;
10136 notify_hdr(infoPtr, LVN_KEYDOWN, &nmKeyDown.hdr);
10137 if (!IsWindow(hwndSelf))
10138 return 0;
10139
10140 switch (nVirtualKey)
10141 {
10142 case VK_SPACE:
10143 nItem = infoPtr->nFocusedItem;
10144 if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
10145 toggle_checkbox_state(infoPtr, infoPtr->nFocusedItem);
10146 break;
10147
10148 case VK_RETURN:
10149 if ((infoPtr->nItemCount > 0) && (infoPtr->nFocusedItem != -1))
10150 {
10151 if (!notify(infoPtr, NM_RETURN)) return 0;
10152 if (!notify(infoPtr, LVN_ITEMACTIVATE)) return 0;
10153 }
10154 break;
10155
10156 case VK_HOME:
10157 if (infoPtr->nItemCount > 0)
10158 nItem = 0;
10159 break;
10160
10161 case VK_END:
10162 if (infoPtr->nItemCount > 0)
10163 nItem = infoPtr->nItemCount - 1;
10164 break;
10165
10166 case VK_LEFT:
10167 nItem = LISTVIEW_GetNextItem(infoPtr, infoPtr->nFocusedItem, LVNI_TOLEFT);
10168 break;
10169
10170 case VK_UP:
10171 nItem = LISTVIEW_GetNextItem(infoPtr, infoPtr->nFocusedItem, LVNI_ABOVE);
10172 break;
10173
10174 case VK_RIGHT:
10175 nItem = LISTVIEW_GetNextItem(infoPtr, infoPtr->nFocusedItem, LVNI_TORIGHT);
10176 break;
10177
10178 case VK_DOWN:
10179 nItem = LISTVIEW_GetNextItem(infoPtr, infoPtr->nFocusedItem, LVNI_BELOW);
10180 break;
10181
10182 case VK_PRIOR:
10183 if (infoPtr->uView == LV_VIEW_DETAILS)
10184 {
10185 INT topidx = LISTVIEW_GetTopIndex(infoPtr);
10186 if (infoPtr->nFocusedItem == topidx)
10187 nItem = topidx - LISTVIEW_GetCountPerColumn(infoPtr) + 1;
10188 else
10189 nItem = topidx;
10190 }
10191 else
10192 nItem = infoPtr->nFocusedItem - LISTVIEW_GetCountPerColumn(infoPtr)
10193 * LISTVIEW_GetCountPerRow(infoPtr);
10194 if(nItem < 0) nItem = 0;
10195 break;
10196
10197 case VK_NEXT:
10198 if (infoPtr->uView == LV_VIEW_DETAILS)
10199 {
10200 INT topidx = LISTVIEW_GetTopIndex(infoPtr);
10201 INT cnt = LISTVIEW_GetCountPerColumn(infoPtr);
10202 if (infoPtr->nFocusedItem == topidx + cnt - 1)
10203 nItem = infoPtr->nFocusedItem + cnt - 1;
10204 else
10205 nItem = topidx + cnt - 1;
10206 }
10207 else
10208 nItem = infoPtr->nFocusedItem + LISTVIEW_GetCountPerColumn(infoPtr)
10209 * LISTVIEW_GetCountPerRow(infoPtr);
10210 if(nItem >= infoPtr->nItemCount) nItem = infoPtr->nItemCount - 1;
10211 break;
10212 }
10213
10214 if ((nItem != -1) && (nItem != infoPtr->nFocusedItem || nVirtualKey == VK_SPACE))
10215 LISTVIEW_KeySelection(infoPtr, nItem, nVirtualKey == VK_SPACE);
10216
10217 return 0;
10218}
static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *, INT, BOOL)
Definition: listview.c:3826
static INT LISTVIEW_GetNextItem(const LISTVIEW_INFO *infoPtr, INT nItem, UINT uFlags)
Definition: listview.c:7452
static INT LISTVIEW_GetTopIndex(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:4629
static void toggle_checkbox_state(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:1594
int notify
Definition: msacm.c:1366
#define NM_RETURN
Definition: commctrl.h:132
#define LVN_KEYDOWN
Definition: commctrl.h:3184
#define LVN_ITEMACTIVATE
Definition: commctrl.h:3147
#define VK_SPACE
Definition: winuser.h:2219

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_KeySelection()

static BOOL LISTVIEW_KeySelection ( LISTVIEW_INFO infoPtr,
INT  nItem,
BOOL  space 
)
static

Definition at line 3826 of file listview.c.

3827{
3828 /* FIXME: pass in the state */
3829 WORD wShift = GetKeyState(VK_SHIFT) & 0x8000;
3830 WORD wCtrl = GetKeyState(VK_CONTROL) & 0x8000;
3831 BOOL bResult = FALSE;
3832
3833 TRACE("nItem=%d, wShift=%d, wCtrl=%d\n", nItem, wShift, wCtrl);
3834 if ((nItem >= 0) && (nItem < infoPtr->nItemCount))
3835 {
3836 bResult = TRUE;
3837
3838 if (infoPtr->dwStyle & LVS_SINGLESEL || (wShift == 0 && wCtrl == 0))
3839 LISTVIEW_SetSelection(infoPtr, nItem);
3840 else
3841 {
3842 if (wShift)
3843 LISTVIEW_SetGroupSelection(infoPtr, nItem);
3844 else if (wCtrl)
3845 {
3846 LVITEMW lvItem;
3847 lvItem.state = ~LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED);
3848 lvItem.stateMask = LVIS_SELECTED;
3849 if (space)
3850 {
3851 LISTVIEW_SetItemState(infoPtr, nItem, &lvItem);
3852 if (lvItem.state & LVIS_SELECTED)
3853 infoPtr->nSelectionMark = nItem;
3854 }
3855 bResult = LISTVIEW_SetItemFocus(infoPtr, nItem);
3856 }
3857 }
3858 LISTVIEW_EnsureVisible(infoPtr, nItem, FALSE);
3859 }
3860
3861 UpdateWindow(infoPtr->hwndSelf); /* update client area */
3862 return bResult;
3863}
static void LISTVIEW_SetGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:3715
static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *, INT, BOOL)
Definition: listview.c:6339
unsigned short WORD
Definition: ntddk_ex.h:93
#define LVS_SINGLESEL
Definition: commctrl.h:2266
#define VK_CONTROL
Definition: winuser.h:2203
BOOL WINAPI UpdateWindow(_In_ HWND)
#define VK_SHIFT
Definition: winuser.h:2202
SHORT WINAPI GetKeyState(_In_ int)

Referenced by LISTVIEW_KeyDown(), and LISTVIEW_ProcessLetterKeys().

◆ LISTVIEW_KillFocus()

static LRESULT LISTVIEW_KillFocus ( LISTVIEW_INFO infoPtr)
static

Definition at line 10230 of file listview.c.

10231{
10232 TRACE("()\n");
10233
10234 /* drop any left over scroll amount */
10235 infoPtr->cWheelRemainder = 0;
10236
10237 /* if we did not have the focus, there's nothing more to do */
10238 if (!infoPtr->bFocus) return 0;
10239
10240 /* send NM_KILLFOCUS notification */
10241 if (!notify(infoPtr, NM_KILLFOCUS)) return 0;
10242
10243 /* if we have a focus rectangle, get rid of it */
10244 LISTVIEW_ShowFocusRect(infoPtr, FALSE);
10245
10246 /* if have a marquee selection, stop it */
10247 if (infoPtr->bMarqueeSelect)
10248 {
10249 /* Remove the marquee rectangle and release our mouse capture */
10250 LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeRect);
10252
10253 SetRectEmpty(&infoPtr->marqueeRect);
10254
10255 infoPtr->bMarqueeSelect = FALSE;
10256 infoPtr->bScrolling = FALSE;
10257 KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
10258 }
10259
10260 /* set window focus flag */
10261 infoPtr->bFocus = FALSE;
10262
10263 /* invalidate the selected items before resetting focus flag */
10265
10266 return 0;
10267}
static void LISTVIEW_InvalidateSelectedItems(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:2272
static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
Definition: listview.c:2210
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define NM_KILLFOCUS
Definition: commctrl.h:136
BOOL bMarqueeSelect
Definition: listview.c:286
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_LButtonDblClk()

static LRESULT LISTVIEW_LButtonDblClk ( LISTVIEW_INFO infoPtr,
WORD  wKey,
INT  x,
INT  y 
)
static

Definition at line 10281 of file listview.c.

10282{
10283 LVHITTESTINFO htInfo;
10284
10285 TRACE("(key=%hu, X=%u, Y=%u)\n", wKey, x, y);
10286
10287 /* Cancel the item edition if any */
10288 if (infoPtr->itemEdit.fEnabled)
10289 {
10290 KillTimer(infoPtr->hwndSelf, (UINT_PTR)&infoPtr->itemEdit);
10291 infoPtr->itemEdit.fEnabled = FALSE;
10292 }
10293
10294 /* send NM_RELEASEDCAPTURE notification */
10295 if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0;
10296
10297 htInfo.pt.x = x;
10298 htInfo.pt.y = y;
10299
10300 /* send NM_DBLCLK notification */
10301 LISTVIEW_HitTest(infoPtr, &htInfo, TRUE, FALSE);
10302 if (!notify_click(infoPtr, NM_DBLCLK, &htInfo)) return 0;
10303
10304 /* To send the LVN_ITEMACTIVATE, it must be on an Item */
10305 if(htInfo.iItem != -1) notify_itemactivate(infoPtr,&htInfo);
10306
10307 return 0;
10308}
static BOOL notify_click(const LISTVIEW_INFO *infoPtr, INT code, const LVHITTESTINFO *lvht)
Definition: listview.c:895
static void notify_itemactivate(const LISTVIEW_INFO *infoPtr, const LVHITTESTINFO *htInfo)
Definition: listview.c:856
#define NM_RELEASEDCAPTURE
Definition: commctrl.h:141
#define NM_DBLCLK
Definition: commctrl.h:131
DELAYED_ITEM_EDIT itemEdit
Definition: listview.c:269

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_LButtonDown()

static LRESULT LISTVIEW_LButtonDown ( LISTVIEW_INFO infoPtr,
WORD  wKey,
INT  x,
INT  y 
)
static

Definition at line 10368 of file listview.c.

10369{
10370 LVHITTESTINFO lvHitTestInfo;
10371 static BOOL bGroupSelect = TRUE;
10372 POINT pt = { x, y };
10373 INT nItem;
10374
10375 TRACE("(key=%hu, X=%u, Y=%u)\n", wKey, x, y);
10376
10377 /* send NM_RELEASEDCAPTURE notification */
10378 if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0;
10379
10380 /* set left button down flag and record the click position */
10381 infoPtr->bLButtonDown = TRUE;
10382 infoPtr->ptClickPos = pt;
10383 infoPtr->bDragging = FALSE;
10384 infoPtr->bMarqueeSelect = FALSE;
10385 infoPtr->bScrolling = FALSE;
10386
10387 lvHitTestInfo.pt.x = x;
10388 lvHitTestInfo.pt.y = y;
10389
10390 nItem = LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE);
10391 TRACE("at %s, nItem=%d\n", wine_dbgstr_point(&pt), nItem);
10392 if ((nItem >= 0) && (nItem < infoPtr->nItemCount))
10393 {
10394 if ((infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) && (lvHitTestInfo.flags & LVHT_ONITEMSTATEICON))
10395 {
10396 notify_click(infoPtr, NM_CLICK, &lvHitTestInfo);
10397 toggle_checkbox_state(infoPtr, nItem);
10398 infoPtr->bLButtonDown = FALSE;
10399 return 0;
10400 }
10401
10402 if (infoPtr->dwStyle & LVS_SINGLESEL)
10403 {
10404 if (LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED))
10405 infoPtr->nEditLabelItem = nItem;
10406 else
10407 LISTVIEW_SetSelection(infoPtr, nItem);
10408 }
10409 else
10410 {
10411 if ((wKey & MK_CONTROL) && (wKey & MK_SHIFT))
10412 {
10413 if (bGroupSelect)
10414 {
10415 if (!LISTVIEW_AddGroupSelection(infoPtr, nItem)) return 0;
10416 LISTVIEW_SetItemFocus(infoPtr, nItem);
10417 infoPtr->nSelectionMark = nItem;
10418 }
10419 else
10420 {
10421 LVITEMW item;
10422
10424 item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
10425
10426 LISTVIEW_SetItemState(infoPtr,nItem,&item);
10427 infoPtr->nSelectionMark = nItem;
10428 }
10429 }
10430 else if (wKey & MK_CONTROL)
10431 {
10432 LVITEMW item;
10433
10434 bGroupSelect = (LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED) == 0);
10435
10436 item.state = (bGroupSelect ? LVIS_SELECTED : 0) | LVIS_FOCUSED;
10437 item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
10438 LISTVIEW_SetItemState(infoPtr, nItem, &item);
10439 infoPtr->nSelectionMark = nItem;
10440 }
10441 else if (wKey & MK_SHIFT)
10442 {
10443 LISTVIEW_SetGroupSelection(infoPtr, nItem);
10444 }
10445 else
10446 {
10447 if (LISTVIEW_GetItemState(infoPtr, nItem, LVIS_SELECTED))
10448 {
10449 infoPtr->nEditLabelItem = nItem;
10450 infoPtr->nLButtonDownItem = nItem;
10451
10452 LISTVIEW_SetItemFocus(infoPtr, nItem);
10453 }
10454 else
10455 /* set selection (clears other pre-existing selections) */
10456 LISTVIEW_SetSelection(infoPtr, nItem);
10457 }
10458 }
10459
10460 if (!infoPtr->bFocus)
10461 SetFocus(infoPtr->hwndSelf);
10462
10463 if (infoPtr->dwLvExStyle & LVS_EX_ONECLICKACTIVATE)
10464 if(lvHitTestInfo.iItem != -1) notify_itemactivate(infoPtr,&lvHitTestInfo);
10465 }
10466 else
10467 {
10468 if (!infoPtr->bFocus)
10469 SetFocus(infoPtr->hwndSelf);
10470
10471 /* remove all selections */
10472 if (!(wKey & MK_CONTROL) && !(wKey & MK_SHIFT))
10473 LISTVIEW_DeselectAll(infoPtr);
10475 }
10476
10477 return 0;
10478}
static BOOL LISTVIEW_DeselectAll(LISTVIEW_INFO *infoPtr)
Definition: listview.c:3539
static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:3663
#define NM_CLICK
Definition: commctrl.h:130
INT nLButtonDownItem
Definition: listview.c:317
POINT ptClickPos
Definition: listview.c:316
#define MK_SHIFT
Definition: winuser.h:2369
#define MK_CONTROL
Definition: winuser.h:2370

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_LButtonUp()

static LRESULT LISTVIEW_LButtonUp ( LISTVIEW_INFO infoPtr,
WORD  wKey,
INT  x,
INT  y 
)
static

Definition at line 10492 of file listview.c.

10493{
10494 LVHITTESTINFO lvHitTestInfo;
10495
10496 TRACE("(key=%hu, X=%u, Y=%u)\n", wKey, x, y);
10497
10498 if (!infoPtr->bLButtonDown) return 0;
10499
10500 lvHitTestInfo.pt.x = x;
10501 lvHitTestInfo.pt.y = y;
10502
10503 /* send NM_CLICK notification */
10504 LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
10505 if (!notify_click(infoPtr, NM_CLICK, &lvHitTestInfo)) return 0;
10506
10507 /* set left button flag */
10508 infoPtr->bLButtonDown = FALSE;
10509
10510 /* set a single selection, reset others */
10511 if(lvHitTestInfo.iItem == infoPtr->nLButtonDownItem && lvHitTestInfo.iItem != -1)
10512 LISTVIEW_SetSelection(infoPtr, infoPtr->nLButtonDownItem);
10513 infoPtr->nLButtonDownItem = -1;
10514
10515 if (infoPtr->bDragging || infoPtr->bMarqueeSelect)
10516 {
10517 /* Remove the marquee rectangle and release our mouse capture */
10518 if (infoPtr->bMarqueeSelect)
10519 {
10520 LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeDrawRect);
10522 }
10523
10524 SetRectEmpty(&infoPtr->marqueeRect);
10525 SetRectEmpty(&infoPtr->marqueeDrawRect);
10526
10527 infoPtr->bDragging = FALSE;
10528 infoPtr->bMarqueeSelect = FALSE;
10529 infoPtr->bScrolling = FALSE;
10530
10531 KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
10532 return 0;
10533 }
10534
10535 /* if we clicked on a selected item, edit the label */
10536 if(lvHitTestInfo.iItem == infoPtr->nEditLabelItem && (lvHitTestInfo.flags & LVHT_ONITEMLABEL))
10537 {
10538 /* we want to make sure the user doesn't want to do a double click. So we will
10539 * delay the edit. WM_LBUTTONDBLCLICK will cancel the timer
10540 */
10541 infoPtr->itemEdit.fEnabled = TRUE;
10542 infoPtr->itemEdit.iItem = lvHitTestInfo.iItem;
10543 SetTimer(infoPtr->hwndSelf,
10544 (UINT_PTR)&infoPtr->itemEdit,
10547 }
10548
10549 return 0;
10550}
static VOID CALLBACK LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: listview.c:9603
RECT marqueeDrawRect
Definition: listview.c:289
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MapIdToIndex()

static INT LISTVIEW_MapIdToIndex ( const LISTVIEW_INFO infoPtr,
UINT  iID 
)
static

Definition at line 2673 of file listview.c.

2674{
2675 ITEM_ID ID;
2676 INT index;
2677
2678 TRACE("iID=%d\n", iID);
2679
2680 if (infoPtr->dwStyle & LVS_OWNERDATA) return -1;
2681 if (infoPtr->nItemCount == 0) return -1;
2682
2683 ID.id = iID;
2685
2686 if (index != -1)
2687 {
2688 ITEM_ID *lpID = DPA_GetPtr(infoPtr->hdpaItemIds, index);
2689 return DPA_GetPtrIndex(infoPtr->hdpaItems, lpID->item);
2690 }
2691
2692 return -1;
2693}
INT WINAPI DPA_Search(HDPA hdpa, LPVOID pFind, INT nStart, PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions)
Definition: dpa.c:845
static INT CALLBACK MapIdSearchCompare(LPVOID p1, LPVOID p2, LPARAM lParam)
Definition: listview.c:2652
#define DPAS_SORTED
Definition: commctrl.h:4862
#define ID
Definition: ruserpass.c:36

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MapIndexToId()

static DWORD LISTVIEW_MapIndexToId ( const LISTVIEW_INFO infoPtr,
INT  iItem 
)
static

Definition at line 2706 of file listview.c.

2707{
2708 ITEM_INFO *lpItem;
2709 HDPA hdpaSubItems;
2710
2711 TRACE("iItem=%d\n", iItem);
2712
2713 if (infoPtr->dwStyle & LVS_OWNERDATA) return -1;
2714 if (iItem < 0 || iItem >= infoPtr->nItemCount) return -1;
2715
2716 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, iItem);
2717 lpItem = DPA_GetPtr(hdpaSubItems, 0);
2718
2719 return lpItem->id->id;
2720}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MarqueeHighlight()

static void LISTVIEW_MarqueeHighlight ( LISTVIEW_INFO infoPtr,
const POINT coords_orig,
INT  scroll 
)
static

Definition at line 3949 of file listview.c.

3951{
3952 BOOL controlDown = FALSE;
3953 LVITEMW item;
3954 ITERATOR old_elems, new_elems;
3955 RECT rect;
3956 POINT coords_offs, offset;
3957
3958 /* Ensure coordinates are within client bounds */
3959 coords_offs.x = max(min(coords_orig->x, infoPtr->rcList.right), 0);
3960 coords_offs.y = max(min(coords_orig->y, infoPtr->rcList.bottom), 0);
3961
3962 /* Get offset */
3963 LISTVIEW_GetOrigin(infoPtr, &offset);
3964
3965 /* Offset coordinates by the appropriate amount */
3966 coords_offs.x -= offset.x;
3967 coords_offs.y -= offset.y;
3968
3969 if (coords_offs.x > infoPtr->marqueeOrigin.x)
3970 {
3971 rect.left = infoPtr->marqueeOrigin.x;
3972 rect.right = coords_offs.x;
3973 }
3974 else
3975 {
3976 rect.left = coords_offs.x;
3977 rect.right = infoPtr->marqueeOrigin.x;
3978 }
3979
3980 if (coords_offs.y > infoPtr->marqueeOrigin.y)
3981 {
3982 rect.top = infoPtr->marqueeOrigin.y;
3983 rect.bottom = coords_offs.y;
3984 }
3985 else
3986 {
3987 rect.top = coords_offs.y;
3988 rect.bottom = infoPtr->marqueeOrigin.y;
3989 }
3990
3991 /* Cancel out the old marquee rectangle and draw the new one */
3992 LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeDrawRect);
3993
3994 /* Scroll by the appropriate distance if applicable - speed up scrolling as
3995 the cursor is further away */
3996
3997 if ((scroll & SCROLL_LEFT) && (coords_orig->x <= 0))
3998 LISTVIEW_Scroll(infoPtr, coords_orig->x, 0);
3999
4000 if ((scroll & SCROLL_RIGHT) && (coords_orig->x >= infoPtr->rcList.right))
4001 LISTVIEW_Scroll(infoPtr, (coords_orig->x - infoPtr->rcList.right), 0);
4002
4003 if ((scroll & SCROLL_UP) && (coords_orig->y <= 0))
4004 LISTVIEW_Scroll(infoPtr, 0, coords_orig->y);
4005
4006 if ((scroll & SCROLL_DOWN) && (coords_orig->y >= infoPtr->rcList.bottom))
4007 LISTVIEW_Scroll(infoPtr, 0, (coords_orig->y - infoPtr->rcList.bottom));
4008
4009 iterator_frameditems_absolute(&old_elems, infoPtr, &infoPtr->marqueeRect);
4010
4011 infoPtr->marqueeRect = rect;
4012 infoPtr->marqueeDrawRect = rect;
4013 OffsetRect(&infoPtr->marqueeDrawRect, offset.x, offset.y);
4014
4015 iterator_frameditems_absolute(&new_elems, infoPtr, &infoPtr->marqueeRect);
4016 iterator_remove_common_items(&old_elems, &new_elems);
4017
4018 /* Iterate over no longer selected items */
4019 while (iterator_next(&old_elems))
4020 {
4021 if (old_elems.nItem > -1)
4022 {
4023 if (LISTVIEW_GetItemState(infoPtr, old_elems.nItem, LVIS_SELECTED) == LVIS_SELECTED)
4024 item.state = 0;
4025 else
4026 item.state = LVIS_SELECTED;
4027
4028 item.stateMask = LVIS_SELECTED;
4029
4030 LISTVIEW_SetItemState(infoPtr, old_elems.nItem, &item);
4031 }
4032 }
4033 iterator_destroy(&old_elems);
4034
4035
4036 /* Iterate over newly selected items */
4037 if (GetKeyState(VK_CONTROL) & 0x8000)
4038 controlDown = TRUE;
4039
4040 while (iterator_next(&new_elems))
4041 {
4042 if (new_elems.nItem > -1)
4043 {
4044 /* If CTRL is pressed, invert. If not, always select the item. */
4045 if ((controlDown) && (LISTVIEW_GetItemState(infoPtr, new_elems.nItem, LVIS_SELECTED)))
4046 item.state = 0;
4047 else
4048 item.state = LVIS_SELECTED;
4049
4050 item.stateMask = LVIS_SELECTED;
4051
4052 LISTVIEW_SetItemState(infoPtr, new_elems.nItem, &item);
4053 }
4054 }
4055 iterator_destroy(&new_elems);
4056
4057 LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeDrawRect);
4058}
static BOOL iterator_remove_common_items(ITERATOR *iter1, ITERATOR *iter2)
Definition: listview.c:1517
#define SCROLL_DOWN
Definition: listview.c:3933
#define SCROLL_LEFT
Definition: listview.c:3930
static BOOL LISTVIEW_Scroll(LISTVIEW_INFO *, INT, INT)
Definition: listview.c:8168
#define SCROLL_RIGHT
Definition: listview.c:3931
#define SCROLL_UP
Definition: listview.c:3932
GLintptr offset
Definition: glext.h:5920
POINT marqueeOrigin
Definition: listview.c:290

Referenced by LISTVIEW_MouseMove(), and LISTVIEW_ScrollTimer().

◆ LISTVIEW_MouseHover()

static LRESULT LISTVIEW_MouseHover ( LISTVIEW_INFO infoPtr,
INT  x,
INT  y 
)
static

Definition at line 3907 of file listview.c.

3908{
3909 NMHDR hdr;
3910
3911 if (notify_hdr(infoPtr, NM_HOVER, &hdr)) return 0;
3912
3913 if (LISTVIEW_IsHotTracking(infoPtr))
3914 {
3915 LVITEMW item;
3916 POINT pt;
3917
3918 pt.x = x;
3919 pt.y = y;
3920
3921 if (LISTVIEW_GetItemAtPt(infoPtr, &item, pt))
3922 LISTVIEW_SetSelection(infoPtr, item.iItem);
3923
3924 SetFocus(infoPtr->hwndSelf);
3925 }
3926
3927 return 0;
3928}
static BOOL LISTVIEW_GetItemAtPt(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, POINT pt)
Definition: listview.c:3865
static BOOL LISTVIEW_IsHotTracking(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:3882
char hdr[14]
Definition: iptest.cpp:33
#define NM_HOVER
Definition: commctrl.h:138

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MouseMove()

static LRESULT LISTVIEW_MouseMove ( LISTVIEW_INFO infoPtr,
WORD  fwKeys,
INT  x,
INT  y 
)
static

Definition at line 4133 of file listview.c.

4134{
4136 RECT rect;
4137 POINT pt;
4138
4139 pt.x = x;
4140 pt.y = y;
4141
4142 if (!(fwKeys & MK_LBUTTON))
4143 infoPtr->bLButtonDown = FALSE;
4144
4145 if (infoPtr->bLButtonDown)
4146 {
4147 rect.left = rect.right = infoPtr->ptClickPos.x;
4148 rect.top = rect.bottom = infoPtr->ptClickPos.y;
4149
4151
4152 if (infoPtr->bMarqueeSelect)
4153 {
4154 /* Enable the timer if we're going outside our bounds, in case the user doesn't
4155 move the mouse again */
4156
4157 if ((x <= 0) || (y <= 0) || (x >= infoPtr->rcList.right) ||
4158 (y >= infoPtr->rcList.bottom))
4159 {
4160 if (!infoPtr->bScrolling)
4161 {
4162 infoPtr->bScrolling = TRUE;
4163 SetTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr, 1, LISTVIEW_ScrollTimer);
4164 }
4165 }
4166 else
4167 {
4168 infoPtr->bScrolling = FALSE;
4169 KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
4170 }
4171
4172 LISTVIEW_MarqueeHighlight(infoPtr, &pt, 0);
4173 return 0;
4174 }
4175
4176 ht.pt = pt;
4177 LISTVIEW_HitTest(infoPtr, &ht, TRUE, TRUE);
4178
4179 /* reset item marker */
4180 if (infoPtr->nLButtonDownItem != ht.iItem)
4181 infoPtr->nLButtonDownItem = -1;
4182
4183 if (!PtInRect(&rect, pt))
4184 {
4185 /* this path covers the following:
4186 1. WM_LBUTTONDOWN over selected item (sets focus on it)
4187 2. change focus with keys
4188 3. move mouse over item from step 1 selects it and moves focus on it */
4189 if (infoPtr->nLButtonDownItem != -1 &&
4191 {
4192 LVITEMW lvItem;
4193
4194 lvItem.state = LVIS_FOCUSED | LVIS_SELECTED;
4196
4197 LISTVIEW_SetItemState(infoPtr, infoPtr->nLButtonDownItem, &lvItem);
4198 infoPtr->nLButtonDownItem = -1;
4199 }
4200
4201 if (!infoPtr->bDragging)
4202 {
4203 ht.pt = infoPtr->ptClickPos;
4204 LISTVIEW_HitTest(infoPtr, &ht, TRUE, TRUE);
4205
4206 /* If the click is outside the range of an item, begin a
4207 highlight. If not, begin an item drag. */
4208 if (ht.iItem == -1)
4209 {
4210 NMHDR hdr;
4211
4212 /* If we're allowing multiple selections, send notification.
4213 If return value is non-zero, cancel. */
4214 if (!(infoPtr->dwStyle & LVS_SINGLESEL) && (notify_hdr(infoPtr, LVN_MARQUEEBEGIN, &hdr) == 0))
4215 {
4216 /* Store the absolute coordinates of the click */
4217 POINT offset;
4218 LISTVIEW_GetOrigin(infoPtr, &offset);
4219
4220 infoPtr->marqueeOrigin.x = infoPtr->ptClickPos.x - offset.x;
4221 infoPtr->marqueeOrigin.y = infoPtr->ptClickPos.y - offset.y;
4222
4223 /* Begin selection and capture mouse */
4224 infoPtr->bMarqueeSelect = TRUE;
4225 infoPtr->marqueeRect = rect;
4226 SetCapture(infoPtr->hwndSelf);
4227 }
4228 }
4229 else
4230 {
4231 NMLISTVIEW nmlv;
4232
4233 ZeroMemory(&nmlv, sizeof(nmlv));
4234 nmlv.iItem = ht.iItem;
4235 nmlv.ptAction = infoPtr->ptClickPos;
4236
4237 notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv);
4238 infoPtr->bDragging = TRUE;
4239 }
4240 }
4241
4242 return 0;
4243 }
4244 }
4245
4246 /* see if we are supposed to be tracking mouse hovering */
4247 if (LISTVIEW_IsHotTracking(infoPtr)) {
4248 TRACKMOUSEEVENT trackinfo;
4249 DWORD flags;
4250
4251 trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
4252 trackinfo.dwFlags = TME_QUERY;
4253
4254 /* see if we are already tracking this hwnd */
4255 _TrackMouseEvent(&trackinfo);
4256
4257 flags = TME_LEAVE;
4258 if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
4259 flags |= TME_HOVER;
4260
4261 if((trackinfo.dwFlags & flags) != flags || trackinfo.hwndTrack != infoPtr->hwndSelf) {
4262 trackinfo.dwFlags = flags;
4263 trackinfo.dwHoverTime = infoPtr->dwHoverTime;
4264 trackinfo.hwndTrack = infoPtr->hwndSelf;
4265
4266 /* call TRACKMOUSEEVENT so we receive WM_MOUSEHOVER messages */
4267 _TrackMouseEvent(&trackinfo);
4268 }
4269 }
4270
4271 return 0;
4272}
BOOL WINAPI _TrackMouseEvent(TRACKMOUSEEVENT *ptme)
Definition: commctrl.c:1207
static VOID CALLBACK LISTVIEW_ScrollTimer(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: listview.c:4074
static void LISTVIEW_MarqueeHighlight(LISTVIEW_INFO *infoPtr, const POINT *coords_orig, INT scroll)
Definition: listview.c:3949
GLbitfield flags
Definition: glext.h:7161
static const struct newhuff ht[]
Definition: huffman.h:296
#define TME_LEAVE
Definition: commctrl.h:4981
#define LVN_BEGINDRAG
Definition: commctrl.h:3140
struct tagTRACKMOUSEEVENT TRACKMOUSEEVENT
#define TME_QUERY
Definition: commctrl.h:4983
#define LVN_MARQUEEBEGIN
Definition: commctrl.h:3198
#define TME_HOVER
Definition: commctrl.h:4980
DWORD dwHoverTime
Definition: listview.c:318
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define SM_CXDRAG
Definition: winuser.h:1028
#define MK_LBUTTON
Definition: winuser.h:2367
#define SM_CYDRAG
Definition: winuser.h:1029

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MouseWheel()

static LRESULT LISTVIEW_MouseWheel ( LISTVIEW_INFO infoPtr,
INT  wheelDelta 
)
static

Definition at line 10069 of file listview.c.

10070{
10071 INT pulScrollLines = 3;
10072
10073 TRACE("(wheelDelta=%d)\n", wheelDelta);
10074
10075 switch(infoPtr->uView)
10076 {
10077 case LV_VIEW_ICON:
10078 case LV_VIEW_SMALLICON:
10079 /*
10080 * listview should be scrolled by a multiple of 37 dependently on its dimension or its visible item number
10081 * should be fixed in the future.
10082 */
10083 LISTVIEW_VScroll(infoPtr, SB_INTERNAL, (wheelDelta > 0) ?
10085 break;
10086
10087 case LV_VIEW_DETAILS:
10088 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
10089
10090 /* if scrolling changes direction, ignore left overs */
10091 if ((wheelDelta < 0 && infoPtr->cWheelRemainder < 0) ||
10092 (wheelDelta > 0 && infoPtr->cWheelRemainder > 0))
10093 infoPtr->cWheelRemainder += wheelDelta;
10094 else
10095 infoPtr->cWheelRemainder = wheelDelta;
10096 if (infoPtr->cWheelRemainder && pulScrollLines)
10097 {
10098 int cLineScroll;
10099 pulScrollLines = min((UINT)LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines);
10100 cLineScroll = pulScrollLines * infoPtr->cWheelRemainder / WHEEL_DELTA;
10101 infoPtr->cWheelRemainder -= WHEEL_DELTA * cLineScroll / pulScrollLines;
10102 LISTVIEW_VScroll(infoPtr, SB_INTERNAL, -cLineScroll);
10103 }
10104 break;
10105
10106 case LV_VIEW_LIST:
10107 LISTVIEW_HScroll(infoPtr, (wheelDelta > 0) ? SB_LINELEFT : SB_LINERIGHT, 0);
10108 break;
10109 }
10110 return 0;
10111}
#define WHEEL_DELTA
Definition: treelist.c:99
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MoveIconTo()

static BOOL LISTVIEW_MoveIconTo ( const LISTVIEW_INFO infoPtr,
INT  nItem,
const POINT lppt,
BOOL  isNew 
)
static

Definition at line 2837 of file listview.c.

2838{
2839 POINT old;
2840
2841 if (!isNew)
2842 {
2843 old.x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
2844 old.y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
2845
2846 if (lppt->x == old.x && lppt->y == old.y) return TRUE;
2847 LISTVIEW_InvalidateItem(infoPtr, nItem);
2848 }
2849
2850 /* Allocating a POINTER for every item is too resource intensive,
2851 * so we'll keep the (x,y) in different arrays */
2852 if (!DPA_SetPtr(infoPtr->hdpaPosX, nItem, (void *)(LONG_PTR)lppt->x)) return FALSE;
2853 if (!DPA_SetPtr(infoPtr->hdpaPosY, nItem, (void *)(LONG_PTR)lppt->y)) return FALSE;
2854
2855 LISTVIEW_InvalidateItem(infoPtr, nItem);
2856
2857 return TRUE;
2858}
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by LISTVIEW_Arrange(), LISTVIEW_InsertItemT(), and LISTVIEW_SetItemPosition().

◆ LISTVIEW_NCCreate()

static LRESULT LISTVIEW_NCCreate ( HWND  hwnd,
WPARAM  wParam,
const CREATESTRUCTW lpcs 
)
static

Definition at line 9627 of file listview.c.

9628{
9629 LISTVIEW_INFO *infoPtr;
9630 LOGFONTW logFont;
9631
9632 TRACE("(lpcs=%p)\n", lpcs);
9633
9634 /* initialize info pointer */
9635 infoPtr = Alloc(sizeof(LISTVIEW_INFO));
9636 if (!infoPtr) return FALSE;
9637
9638 SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
9639
9640 infoPtr->hwndSelf = hwnd;
9641 infoPtr->dwStyle = lpcs->style; /* Note: may be changed in WM_CREATE */
9642 map_style_view(infoPtr);
9643 /* determine the type of structures to use */
9644 infoPtr->hwndNotify = lpcs->hwndParent;
9645 /* infoPtr->notifyFormat will be filled in WM_CREATE */
9646
9647 /* initialize color information */
9648 infoPtr->clrBk = CLR_NONE;
9649 infoPtr->clrText = CLR_DEFAULT;
9650 infoPtr->clrTextBk = CLR_DEFAULT;
9652#ifdef __REACTOS__
9653 infoPtr->bDefaultBkColor = TRUE;
9654#endif
9655
9656 /* set default values */
9657 infoPtr->nFocusedItem = -1;
9658 infoPtr->nSelectionMark = -1;
9659 infoPtr->nHotItem = -1;
9660 infoPtr->redraw = TRUE;
9661 infoPtr->bNoItemMetrics = TRUE;
9663 infoPtr->autoSpacing = TRUE;
9666 infoPtr->nEditLabelItem = -1;
9667 infoPtr->nLButtonDownItem = -1;
9668 infoPtr->dwHoverTime = HOVER_DEFAULT; /* default system hover time */
9669 infoPtr->cWheelRemainder = 0;
9670 infoPtr->nMeasureItemHeight = 0;
9671 infoPtr->xTrackLine = -1; /* no track line */
9672 infoPtr->itemEdit.fEnabled = FALSE;
9673 infoPtr->iVersion = COMCTL32_VERSION;
9674 infoPtr->colRectsDirty = FALSE;
9675
9676 /* get default font (icon title) */
9678 infoPtr->hDefaultFont = CreateFontIndirectW(&logFont);
9679 infoPtr->hFont = infoPtr->hDefaultFont;
9680 LISTVIEW_SaveTextMetrics(infoPtr);
9681
9682 /* allocate memory for the data structure */
9683 if (!(infoPtr->selectionRanges = ranges_create(10))) goto fail;
9684 if (!(infoPtr->hdpaItems = DPA_Create(10))) goto fail;
9685 if (!(infoPtr->hdpaItemIds = DPA_Create(10))) goto fail;
9686 if (!(infoPtr->hdpaPosX = DPA_Create(10))) goto fail;
9687 if (!(infoPtr->hdpaPosY = DPA_Create(10))) goto fail;
9688 if (!(infoPtr->hdpaColumns = DPA_Create(10))) goto fail;
9689
9690 return DefWindowProcW(hwnd, WM_NCCREATE, wParam, (LPARAM)lpcs);
9691
9692fail:
9693 DestroyWindow(infoPtr->hwndHeader);
9695 DPA_Destroy(infoPtr->hdpaItems);
9696 DPA_Destroy(infoPtr->hdpaItemIds);
9697 DPA_Destroy(infoPtr->hdpaPosX);
9698 DPA_Destroy(infoPtr->hdpaPosY);
9699 DPA_Destroy(infoPtr->hdpaColumns);
9700 Free(infoPtr);
9701 return FALSE;
9702}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
static void LISTVIEW_SaveTextMetrics(LISTVIEW_INFO *infoPtr)
Definition: listview.c:3146
static BOOL LISTVIEW_SetBkColor(LISTVIEW_INFO *infoPtr, COLORREF color)
Definition: listview.c:8200
#define COMCTL32_VERSION
Definition: resource.h:72
#define HOVER_DEFAULT
Definition: commctrl.h:4986
COLORREF clrWindow
Definition: comctl32.h:176
BOOL bNoItemMetrics
Definition: listview.c:252
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SM_CYICONSPACING
Definition: winuser.h:1002
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1380
#define WM_NCCREATE
Definition: winuser.h:1683
#define SM_CYICON
Definition: winuser.h:973
#define SM_CXICON
Definition: winuser.h:972
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SM_CXICONSPACING
Definition: winuser.h:1001

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_NCDestroy()

static LRESULT LISTVIEW_NCDestroy ( LISTVIEW_INFO infoPtr)
static

Definition at line 10562 of file listview.c.

10563{
10564 INT i;
10565
10566 TRACE("()\n");
10567
10568 /* destroy data structure */
10569 DPA_Destroy(infoPtr->hdpaItems);
10570 DPA_Destroy(infoPtr->hdpaItemIds);
10571 DPA_Destroy(infoPtr->hdpaPosX);
10572 DPA_Destroy(infoPtr->hdpaPosY);
10573 /* columns */
10574 for (i = 0; i < DPA_GetPtrCount(infoPtr->hdpaColumns); i++)
10575 Free(DPA_GetPtr(infoPtr->hdpaColumns, i));
10576 DPA_Destroy(infoPtr->hdpaColumns);
10578
10579 /* destroy image lists */
10580 if (!(infoPtr->dwStyle & LVS_SHAREIMAGELISTS))
10581 {
10582 ImageList_Destroy(infoPtr->himlNormal);
10583 ImageList_Destroy(infoPtr->himlSmall);
10584 ImageList_Destroy(infoPtr->himlState);
10585 }
10586
10587 /* destroy font, bkgnd brush */
10588 infoPtr->hFont = 0;
10589 if (infoPtr->hDefaultFont) DeleteObject(infoPtr->hDefaultFont);
10590 if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
10591
10592 SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
10593
10594 /* free listview info pointer*/
10595 Free(infoPtr);
10596
10597 return 0;
10598}
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2270

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_NCPaint()

static BOOL LISTVIEW_NCPaint ( const LISTVIEW_INFO infoPtr,
HRGN  region 
)
static

Definition at line 10783 of file listview.c.

10784{
10785 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
10786 HDC dc;
10787 RECT r;
10788 HRGN cliprgn;
10789 int cxEdge = GetSystemMetrics (SM_CXEDGE),
10790 cyEdge = GetSystemMetrics (SM_CYEDGE);
10791
10792 if (!theme)
10793 return DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)region, 0);
10794
10795 GetWindowRect(infoPtr->hwndSelf, &r);
10796
10797 cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
10798 r.right - cxEdge, r.bottom - cyEdge);
10799 if (region != (HRGN)1)
10800 CombineRgn (cliprgn, cliprgn, region, RGN_AND);
10801 OffsetRect(&r, -r.left, -r.top);
10802
10803#ifdef __REACTOS__ /* r73789 */
10804 dc = GetWindowDC(infoPtr->hwndSelf);
10805 /* Exclude client part */
10806 ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge,
10807 r.right - cxEdge, r.bottom -cyEdge);
10808#else
10809 dc = GetDCEx(infoPtr->hwndSelf, region, DCX_WINDOW|DCX_INTERSECTRGN);
10810 OffsetRect(&r, -r.left, -r.top);
10811#endif
10812
10813 if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
10815 DrawThemeBackground (theme, dc, 0, 0, &r, 0);
10816 ReleaseDC(infoPtr->hwndSelf, dc);
10817
10818 /* Call default proc to get the scrollbars etc. painted */
10819 DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)cliprgn, 0);
10820 DeleteObject(cliprgn);
10821
10822 return FALSE;
10823}
HRESULT WINAPI DrawThemeBackground(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect)
Definition: draw.c:128
BOOL WINAPI IsThemeBackgroundPartiallyTransparent(HTHEME hTheme, int iPartId, int iStateId)
Definition: draw.c:1883
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR dc[]
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI ExcludeClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define RGN_AND
Definition: wingdi.h:356
HDC WINAPI GetWindowDC(_In_opt_ HWND)
#define SM_CYEDGE
Definition: winuser.h:1009
#define DCX_WINDOW
Definition: winuser.h:2113
#define SM_CXEDGE
Definition: winuser.h:1008
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define DCX_INTERSECTRGN
Definition: winuser.h:2122
#define WM_NCPAINT
Definition: winuser.h:1687

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_NextIconPosLeft()

static void LISTVIEW_NextIconPosLeft ( LISTVIEW_INFO infoPtr,
LPPOINT  lpPos 
)
static

Definition at line 2769 of file listview.c.

2771{
2772 INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
2773
2774 *lpPos = infoPtr->currIconPos;
2775
2776 infoPtr->currIconPos.y += infoPtr->nItemHeight;
2777 if (infoPtr->currIconPos.y + infoPtr->nItemHeight <= nListHeight) return;
2778
2779 infoPtr->currIconPos.x += infoPtr->nItemWidth;
2780 infoPtr->currIconPos.y = 0;
2781}

Referenced by LISTVIEW_Arrange(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_NextIconPosTop()

static void LISTVIEW_NextIconPosTop ( LISTVIEW_INFO infoPtr,
LPPOINT  lpPos 
)
static

Definition at line 2738 of file listview.c.

2740{
2741 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
2742
2743 *lpPos = infoPtr->currIconPos;
2744
2745 infoPtr->currIconPos.x += infoPtr->nItemWidth;
2746 if (infoPtr->currIconPos.x + infoPtr->nItemWidth <= nListWidth) return;
2747
2748 infoPtr->currIconPos.x = 0;
2749 infoPtr->currIconPos.y += infoPtr->nItemHeight;
2750}

Referenced by LISTVIEW_Arrange(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_Notify()

static LRESULT LISTVIEW_Notify ( LISTVIEW_INFO infoPtr,
NMHDR lpnmhdr 
)
static

Definition at line 10611 of file listview.c.

10612{
10613 NMHEADERW *lpnmh;
10614
10615 TRACE("(lpnmhdr=%p)\n", lpnmhdr);
10616
10617 if (!lpnmhdr || lpnmhdr->hwndFrom != infoPtr->hwndHeader) return 0;
10618
10619 /* remember: HDN_LAST < HDN_FIRST */
10620 if (lpnmhdr->code > HDN_FIRST || lpnmhdr->code < HDN_LAST) return 0;
10621 lpnmh = (NMHEADERW *)lpnmhdr;
10622
10623 if (lpnmh->iItem < 0 || lpnmh->iItem >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return 0;
10624
10625 switch (lpnmhdr->code)
10626 {
10627 case HDN_TRACKW:
10628 case HDN_TRACKA:
10629 {
10630 COLUMN_INFO *lpColumnInfo;
10631 POINT ptOrigin;
10632 INT x;
10633
10634 if (!lpnmh->pitem || !(lpnmh->pitem->mask & HDI_WIDTH))
10635 break;
10636
10637 /* remove the old line (if any) */
10638 LISTVIEW_DrawTrackLine(infoPtr);
10639
10640 /* compute & draw the new line */
10641 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, lpnmh->iItem);
10642 x = lpColumnInfo->rcHeader.left + lpnmh->pitem->cxy;
10643 LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
10644 infoPtr->xTrackLine = x + ptOrigin.x;
10645 LISTVIEW_DrawTrackLine(infoPtr);
10646 return notify_forward_header(infoPtr, lpnmh);
10647 }
10648
10649 case HDN_ENDTRACKA:
10650 case HDN_ENDTRACKW:
10651 /* remove the track line (if any) */
10652 LISTVIEW_DrawTrackLine(infoPtr);
10653 infoPtr->xTrackLine = -1;
10654 return notify_forward_header(infoPtr, lpnmh);
10655
10656 case HDN_BEGINDRAG:
10657 if ((infoPtr->dwLvExStyle & LVS_EX_HEADERDRAGDROP) == 0) return 1;
10658 return notify_forward_header(infoPtr, lpnmh);
10659
10660 case HDN_ENDDRAG:
10661 infoPtr->colRectsDirty = TRUE;
10662 LISTVIEW_InvalidateList(infoPtr);
10663 return notify_forward_header(infoPtr, lpnmh);
10664
10665 case HDN_ITEMCHANGEDW:
10666 case HDN_ITEMCHANGEDA:
10667 {
10668 COLUMN_INFO *lpColumnInfo;
10669 HDITEMW hdi;
10670 INT dx, cxy;
10671
10672 if (!lpnmh->pitem || !(lpnmh->pitem->mask & HDI_WIDTH))
10673 {
10674 hdi.mask = HDI_WIDTH;
10675 if (!SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, lpnmh->iItem, (LPARAM)&hdi)) return 0;
10676 cxy = hdi.cxy;
10677 }
10678 else
10679 cxy = lpnmh->pitem->cxy;
10680
10681 /* determine how much we change since the last know position */
10682 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, lpnmh->iItem);
10683 dx = cxy - (lpColumnInfo->rcHeader.right - lpColumnInfo->rcHeader.left);
10684 if (dx != 0)
10685 {
10686 lpColumnInfo->rcHeader.right += dx;
10687
10688 hdi.mask = HDI_ORDER;
10689 SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, lpnmh->iItem, (LPARAM)&hdi);
10690
10691 /* not the rightmost one */
10692 if (hdi.iOrder + 1 < DPA_GetPtrCount(infoPtr->hdpaColumns))
10693 {
10694 INT nIndex = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX,
10695 hdi.iOrder + 1, 0);
10696 LISTVIEW_ScrollColumns(infoPtr, nIndex, dx);
10697 }
10698 else
10699 {
10700 /* only needs to update the scrolls */
10701 infoPtr->nItemWidth += dx;
10702 LISTVIEW_UpdateScroll(infoPtr);
10703 }
10704 LISTVIEW_UpdateItemSize(infoPtr);
10705 if (infoPtr->uView == LV_VIEW_DETAILS && is_redrawing(infoPtr))
10706 {
10707 POINT ptOrigin;
10708 RECT rcCol = lpColumnInfo->rcHeader;
10709
10710 LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
10711 OffsetRect(&rcCol, ptOrigin.x, 0);
10712
10713 rcCol.top = infoPtr->rcList.top;
10714 rcCol.bottom = infoPtr->rcList.bottom;
10715
10716 /* resizing left-aligned columns leaves most of the left side untouched */
10717 if ((lpColumnInfo->fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT)
10718 {
10719 INT nMaxDirty = infoPtr->nEllipsisWidth + infoPtr->ntmMaxCharWidth;
10720 if (dx > 0)
10721 nMaxDirty += dx;
10722 rcCol.left = max (rcCol.left, rcCol.right - nMaxDirty);
10723 }
10724
10725 /* when shrinking the last column clear the now unused field */
10726 if (hdi.iOrder == DPA_GetPtrCount(infoPtr->hdpaColumns) - 1)
10727 {
10728 RECT right;
10729
10730 rcCol.right -= dx;
10731
10732 /* deal with right from rightmost column area */
10733 right.left = rcCol.right;
10734 right.top = rcCol.top;
10735 right.bottom = rcCol.bottom;
10736 right.right = infoPtr->rcList.right;
10737
10738 LISTVIEW_InvalidateRect(infoPtr, &right);
10739 }
10740
10741 LISTVIEW_InvalidateRect(infoPtr, &rcCol);
10742 }
10743 }
10744 break;
10745 }
10746
10747 case HDN_ITEMCLICKW:
10748 case HDN_ITEMCLICKA:
10749 {
10750 /* Handle sorting by Header Column */
10751 NMLISTVIEW nmlv;
10752
10753 ZeroMemory(&nmlv, sizeof(NMLISTVIEW));
10754 nmlv.iItem = -1;
10755 nmlv.iSubItem = lpnmh->iItem;
10756 notify_listview(infoPtr, LVN_COLUMNCLICK, &nmlv);
10757 return notify_forward_header(infoPtr, lpnmh);
10758 }
10759
10762 /* FIXME: for LVS_EX_HEADERINALLVIEWS and not LV_VIEW_DETAILS
10763 we should use LVSCW_AUTOSIZE_USEHEADER, helper rework or
10764 split needed for that */
10766 return notify_forward_header(infoPtr, lpnmh);
10767 }
10768 return 0;
10769}
static BOOL LISTVIEW_DrawTrackLine(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:9574
static LRESULT notify_forward_header(const LISTVIEW_INFO *infoPtr, NMHEADERW *lpnmhW)
Definition: listview.c:781
static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx)
Definition: listview.c:8508
GLdouble GLdouble right
Definition: glext.h:10859
GLint dx
Definition: linetemp.h:97
#define HDN_LAST
Definition: commctrl.h:206
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2733
#define HDN_FIRST
Definition: commctrl.h:205
#define LVSCW_AUTOSIZE
Definition: commctrl.h:2644
UINT code
Definition: winuser.h:3159
HWND hwndFrom
Definition: winuser.h:3157
HDITEMW * pitem
Definition: commctrl.h:891

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_NotifyFormat()

static LRESULT LISTVIEW_NotifyFormat ( LISTVIEW_INFO infoPtr,
HWND  hwndFrom,
INT  nCommand 
)
static

Definition at line 10837 of file listview.c.

10838{
10839 TRACE("(hwndFrom=%p, nCommand=%d)\n", hwndFrom, nCommand);
10840
10841 if (nCommand == NF_REQUERY)
10842 infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
10843
10844 return infoPtr->notifyFormat;
10845}
#define NF_REQUERY
Definition: winuser.h:2461

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Paint()

static LRESULT LISTVIEW_Paint ( LISTVIEW_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 10858 of file listview.c.

10859{
10860 TRACE("(hdc=%p)\n", hdc);
10861
10862 if (infoPtr->bNoItemMetrics && infoPtr->nItemCount)
10863 {
10864 infoPtr->bNoItemMetrics = FALSE;
10865 LISTVIEW_UpdateItemSize(infoPtr);
10866 if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)
10867 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
10868 LISTVIEW_UpdateScroll(infoPtr);
10869 }
10870
10871 if (infoPtr->hwndHeader) UpdateWindow(infoPtr->hwndHeader);
10872
10873 if (hdc)
10874 LISTVIEW_Refresh(infoPtr, hdc, NULL);
10875 else
10876 {
10877 PAINTSTRUCT ps;
10878
10879 hdc = BeginPaint(infoPtr->hwndSelf, &ps);
10880 if (!hdc) return 1;
10881 LISTVIEW_Refresh(infoPtr, hdc, ps.fErase ? &ps.rcPaint : NULL);
10882 EndPaint(infoPtr->hwndSelf, &ps);
10883 }
10884
10885 return 0;
10886}
static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcErase)
Definition: listview.c:5261
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by LISTVIEW_PrintClient(), and LISTVIEW_WMPaint().

◆ LISTVIEW_PrintClient()

static LRESULT LISTVIEW_PrintClient ( LISTVIEW_INFO infoPtr,
HDC  hdc,
DWORD  options 
)
static

Definition at line 10921 of file listview.c.

10922{
10923 if ((options & PRF_CHECKVISIBLE) && !IsWindowVisible(infoPtr->hwndSelf))
10924 return 0;
10925
10927 FIXME("(hdc=%p options=0x%08x) partial stub\n", hdc, options);
10928
10929 if (options & PRF_ERASEBKGND)
10930 LISTVIEW_EraseBkgnd(infoPtr, hdc);
10931
10932 if (options & PRF_CLIENT)
10933 LISTVIEW_Paint(infoPtr, hdc);
10934
10935 return 0;
10936}
static BOOL LISTVIEW_EraseBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:9815
static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:10858
#define PRF_CLIENT
Definition: winuser.h:2525
#define PRF_CHECKVISIBLE
Definition: winuser.h:2523
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_ProcessLetterKeys()

static INT LISTVIEW_ProcessLetterKeys ( LISTVIEW_INFO infoPtr,
WPARAM  charCode,
LPARAM  keyData 
)
static

Definition at line 1875 of file listview.c.

1876{
1878 DWORD prevTime;
1879 LVITEMW item;
1880 int startidx;
1881 INT nItem;
1882 INT diff;
1883
1884 /* simple parameter checking */
1885 if (!charCode || !keyData || infoPtr->nItemCount == 0) return 0;
1886
1887 /* only allow the valid WM_CHARs through */
1888 if (!iswalnum(charCode) &&
1889 charCode != '.' && charCode != '`' && charCode != '!' &&
1890 charCode != '@' && charCode != '#' && charCode != '$' &&
1891 charCode != '%' && charCode != '^' && charCode != '&' &&
1892 charCode != '*' && charCode != '(' && charCode != ')' &&
1893 charCode != '-' && charCode != '_' && charCode != '+' &&
1894 charCode != '=' && charCode != '\\'&& charCode != ']' &&
1895 charCode != '}' && charCode != '[' && charCode != '{' &&
1896 charCode != '/' && charCode != '?' && charCode != '>' &&
1897 charCode != '<' && charCode != ',' && charCode != '~')
1898 return 0;
1899
1900 /* update the search parameters */
1901 prevTime = infoPtr->lastKeyPressTimestamp;
1903 diff = infoPtr->lastKeyPressTimestamp - prevTime;
1904
1905 if (diff >= 0 && diff < KEY_DELAY)
1906 {
1907 if (infoPtr->nSearchParamLength < MAX_PATH - 1)
1908 infoPtr->szSearchParam[infoPtr->nSearchParamLength++] = charCode;
1909
1910 if (infoPtr->charCode != charCode)
1911 infoPtr->charCode = charCode = 0;
1912 }
1913 else
1914 {
1915 infoPtr->charCode = charCode;
1916 infoPtr->szSearchParam[0] = charCode;
1917 infoPtr->nSearchParamLength = 1;
1918 }
1919
1920 /* should start from next after focused item, so next item that matches
1921 will be selected, if there isn't any and focused matches it will be selected
1922 on second search stage from beginning of the list */
1923 if (infoPtr->nFocusedItem >= 0 && infoPtr->nItemCount > 1)
1924 {
1925 /* with some accumulated search data available start with current focus, otherwise
1926 it's excluded from search */
1927 startidx = infoPtr->nSearchParamLength > 1 ? infoPtr->nFocusedItem : infoPtr->nFocusedItem + 1;
1928 if (startidx == infoPtr->nItemCount) startidx = 0;
1929 }
1930 else
1931 startidx = 0;
1932
1933 /* let application handle this for virtual listview */
1934 if (infoPtr->dwStyle & LVS_OWNERDATA)
1935 {
1936 NMLVFINDITEMW nmlv;
1937
1938 memset(&nmlv.lvfi, 0, sizeof(nmlv.lvfi));
1939 nmlv.lvfi.flags = (LVFI_WRAP | LVFI_PARTIAL);
1940 nmlv.lvfi.psz = infoPtr->szSearchParam;
1941 nmlv.iStart = startidx;
1942
1943 infoPtr->szSearchParam[infoPtr->nSearchParamLength] = 0;
1944
1945 nItem = notify_hdr(infoPtr, LVN_ODFINDITEMW, (LPNMHDR)&nmlv.hdr);
1946 }
1947 else
1948 {
1949 int i = startidx, endidx;
1950
1951 /* and search from the current position */
1952 nItem = -1;
1953 endidx = infoPtr->nItemCount;
1954
1955 /* first search in [startidx, endidx), on failure continue in [0, startidx) */
1956 while (1)
1957 {
1958 /* start from first item if not found with >= startidx */
1959 if (i == infoPtr->nItemCount && startidx > 0)
1960 {
1961 endidx = startidx;
1962 startidx = 0;
1963 }
1964
1965 for (i = startidx; i < endidx; i++)
1966 {
1967 /* retrieve text */
1968 item.mask = LVIF_TEXT;
1969 item.iItem = i;
1970 item.iSubItem = 0;
1971 item.pszText = buffer;
1972 item.cchTextMax = MAX_PATH;
1973 if (!LISTVIEW_GetItemW(infoPtr, &item)) return 0;
1974
1975 if (!lstrncmpiW(item.pszText, infoPtr->szSearchParam, infoPtr->nSearchParamLength))
1976 {
1977 nItem = i;
1978 break;
1979 }
1980 /* this is used to find first char match when search string is not available yet,
1981 otherwise every WM_CHAR will search to next item by first char, ignoring that we're
1982 already waiting for user to complete a string */
1983 else if (nItem == -1 && infoPtr->nSearchParamLength == 1 && !lstrncmpiW(item.pszText, infoPtr->szSearchParam, 1))
1984 {
1985 /* this would work but we must keep looking for a longer match */
1986 nItem = i;
1987 }
1988 }
1989
1990 if ( nItem != -1 || /* found something */
1991 endidx != infoPtr->nItemCount || /* second search done */
1992 (startidx == 0 && endidx == infoPtr->nItemCount) /* full range for first search */ )
1993 break;
1994 };
1995 }
1996
1997 if (nItem != -1)
1998 LISTVIEW_KeySelection(infoPtr, nItem, FALSE);
1999
2000 return 0;
2001}
#define KEY_DELAY
Definition: listview.c:411
static int lstrncmpiW(LPCWSTR s1, LPCWSTR s2, int n)
Definition: listview.c:546
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
#define iswalnum(_c)
Definition: ctype.h:671
WCHAR szSearchParam[MAX_PATH]
Definition: listview.c:326
INT nSearchParamLength
Definition: listview.c:325
WPARAM charCode
Definition: listview.c:324
DWORD lastKeyPressTimestamp
Definition: listview.c:323

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_RButtonDblClk()

static LRESULT LISTVIEW_RButtonDblClk ( const LISTVIEW_INFO infoPtr,
WORD  wKey,
INT  x,
INT  y 
)
static

Definition at line 10951 of file listview.c.

10952{
10953 LVHITTESTINFO lvHitTestInfo;
10954
10955 TRACE("(key=%hu,X=%u,Y=%u)\n", wKey, x, y);
10956
10957 /* send NM_RELEASEDCAPTURE notification */
10958 if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0;
10959
10960 /* send NM_RDBLCLK notification */
10961 lvHitTestInfo.pt.x = x;
10962 lvHitTestInfo.pt.y = y;
10963 LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
10964 notify_click(infoPtr, NM_RDBLCLK, &lvHitTestInfo);
10965
10966 return 0;
10967}
#define NM_RDBLCLK
Definition: commctrl.h:134

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_RButtonDown()

static LRESULT LISTVIEW_RButtonDown ( LISTVIEW_INFO infoPtr,
WORD  wKey,
INT  x,
INT  y 
)
static

Definition at line 10981 of file listview.c.

10982{
10984 INT item;
10985
10986 TRACE("(key=%hu, x=%d, y=%d)\n", wKey, x, y);
10987
10988 /* send NM_RELEASEDCAPTURE notification */
10989 if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0;
10990
10991 /* determine the index of the selected item */
10992 ht.pt.x = x;
10993 ht.pt.y = y;
10994 item = LISTVIEW_HitTest(infoPtr, &ht, TRUE, TRUE);
10995
10996 /* make sure the listview control window has the focus */
10997 if (!infoPtr->bFocus) SetFocus(infoPtr->hwndSelf);
10998
10999 if ((item >= 0) && (item < infoPtr->nItemCount))
11000 {
11001 LISTVIEW_SetItemFocus(infoPtr, item);
11002 if (!((wKey & MK_SHIFT) || (wKey & MK_CONTROL)) &&
11004 LISTVIEW_SetSelection(infoPtr, item);
11005 }
11006 else
11007 LISTVIEW_DeselectAll(infoPtr);
11008
11009 if (LISTVIEW_TrackMouse(infoPtr, ht.pt))
11010 {
11011 if (ht.iItem != -1)
11012 {
11013 NMLISTVIEW nmlv;
11014
11015 memset(&nmlv, 0, sizeof(nmlv));
11016 nmlv.iItem = ht.iItem;
11017 nmlv.ptAction = ht.pt;
11018
11019 notify_listview(infoPtr, LVN_BEGINRDRAG, &nmlv);
11020 }
11021 }
11022 else
11023 {
11024 SetFocus(infoPtr->hwndSelf);
11025
11026 ht.pt.x = x;
11027 ht.pt.y = y;
11028 LISTVIEW_HitTest(infoPtr, &ht, TRUE, FALSE);
11029
11030 if (notify_click(infoPtr, NM_RCLICK, &ht))
11031 {
11032 /* Send a WM_CONTEXTMENU message in response to the WM_RBUTTONUP */
11034 (WPARAM)infoPtr->hwndSelf, (LPARAM)GetMessagePos());
11035 }
11036 }
11037
11038 return 0;
11039}
static LRESULT LISTVIEW_TrackMouse(const LISTVIEW_INFO *infoPtr, POINT pt)
Definition: listview.c:10310
#define LVN_BEGINRDRAG
Definition: commctrl.h:3141
#define NM_RCLICK
Definition: commctrl.h:133
#define WM_CONTEXTMENU
Definition: richedit.h:64
DWORD WINAPI GetMessagePos(void)
Definition: message.c:1351

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_RedrawItems()

static BOOL LISTVIEW_RedrawItems ( const LISTVIEW_INFO infoPtr,
INT  nFirst,
INT  nLast 
)
static

Definition at line 8138 of file listview.c.

8139{
8140 INT i;
8141
8142 for (i = max(nFirst, 0); i <= min(nLast, infoPtr->nItemCount - 1); i++)
8143 LISTVIEW_InvalidateItem(infoPtr, i);
8144
8145 return TRUE;
8146}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Refresh()

static void LISTVIEW_Refresh ( LISTVIEW_INFO infoPtr,
HDC  hdc,
const RECT prcErase 
)
static

Definition at line 5261 of file listview.c.

5262{
5263 COLORREF oldTextColor = 0, oldBkColor = 0;
5264 NMLVCUSTOMDRAW nmlvcd;
5265 HFONT hOldFont = 0;
5266 DWORD cdmode;
5267 INT oldBkMode = 0;
5268 RECT rcClient;
5269 ITERATOR i;
5270 HDC hdcOrig = hdc;
5271 HBITMAP hbmp = NULL;
5272 RANGE range;
5273
5274 LISTVIEW_DUMP(infoPtr);
5275
5276 if (infoPtr->dwLvExStyle & LVS_EX_DOUBLEBUFFER) {
5277 TRACE("double buffering\n");
5278
5279 hdc = CreateCompatibleDC(hdcOrig);
5280 if (!hdc) {
5281 ERR("Failed to create DC for backbuffer\n");
5282 return;
5283 }
5284 hbmp = CreateCompatibleBitmap(hdcOrig, infoPtr->rcList.right,
5285 infoPtr->rcList.bottom);
5286 if (!hbmp) {
5287 ERR("Failed to create bitmap for backbuffer\n");
5288 DeleteDC(hdc);
5289 return;
5290 }
5291
5293 SelectObject(hdc, infoPtr->hFont);
5294
5295 if(GetClipBox(hdcOrig, &rcClient))
5296 IntersectClipRect(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
5297 } else {
5298 /* Save dc values we're gonna trash while drawing
5299 * FIXME: Should be done in LISTVIEW_DrawItem() */
5300 hOldFont = SelectObject(hdc, infoPtr->hFont);
5301 oldBkMode = GetBkMode(hdc);
5302 oldBkColor = GetBkColor(hdc);
5303 oldTextColor = GetTextColor(hdc);
5304 }
5305
5306 infoPtr->bIsDrawing = TRUE;
5307
5308 if (prcErase) {
5309 LISTVIEW_FillBkgnd(infoPtr, hdc, prcErase);
5310 } else if (infoPtr->dwLvExStyle & LVS_EX_DOUBLEBUFFER) {
5311 /* If no erasing was done (usually because RedrawWindow was called
5312 * with RDW_INVALIDATE only) we need to copy the old contents into
5313 * the backbuffer before continuing. */
5314 BitBlt(hdc, infoPtr->rcList.left, infoPtr->rcList.top,
5315 infoPtr->rcList.right - infoPtr->rcList.left,
5316 infoPtr->rcList.bottom - infoPtr->rcList.top,
5317 hdcOrig, infoPtr->rcList.left, infoPtr->rcList.top, SRCCOPY);
5318 }
5319
5320 GetClientRect(infoPtr->hwndSelf, &rcClient);
5321 customdraw_fill(&nmlvcd, infoPtr, hdc, &rcClient, 0);
5322 cdmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd);
5323 if (cdmode & CDRF_SKIPDEFAULT) goto enddraw;
5324
5325 /* nothing to draw */
5326 if(infoPtr->nItemCount == 0) goto enddraw;
5327
5328 /* figure out what we need to draw */
5329 iterator_visibleitems(&i, infoPtr, hdc);
5331
5332 /* send cache hint notification */
5333 if (infoPtr->dwStyle & LVS_OWNERDATA)
5334 {
5335 NMLVCACHEHINT nmlv;
5336
5337 ZeroMemory(&nmlv, sizeof(NMLVCACHEHINT));
5338 nmlv.iFrom = range.lower;
5339 nmlv.iTo = range.upper - 1;
5340 notify_hdr(infoPtr, LVN_ODCACHEHINT, &nmlv.hdr);
5341 }
5342
5343 if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
5344 LISTVIEW_RefreshOwnerDraw(infoPtr, &i, hdc, cdmode);
5345 else
5346 {
5347 if (infoPtr->uView == LV_VIEW_DETAILS)
5348 LISTVIEW_RefreshReport(infoPtr, &i, hdc, cdmode);
5349 else /* LV_VIEW_LIST, LV_VIEW_ICON or LV_VIEW_SMALLICON */
5350 LISTVIEW_RefreshList(infoPtr, &i, hdc, cdmode);
5351
5352 /* if we have a focus rect and it's visible, draw it */
5353 if (infoPtr->bFocus && range.lower <= infoPtr->nFocusedItem &&
5354 (range.upper - 1) >= infoPtr->nFocusedItem)
5355 LISTVIEW_DrawFocusRect(infoPtr, hdc);
5356 }
5358
5359enddraw:
5360 /* For LVS_EX_GRIDLINES go and draw lines */
5361 /* This includes the case where there were *no* items */
5362 if ((infoPtr->uView == LV_VIEW_DETAILS) && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
5364
5365 /* Draw marquee rectangle if appropriate */
5366 if (infoPtr->bMarqueeSelect)
5367#ifdef __REACTOS__
5368 {
5369 SetBkColor(hdc, RGB(255, 255, 255));
5370 SetTextColor(hdc, RGB(0, 0, 0));
5371 DrawFocusRect(hdc, &infoPtr->marqueeDrawRect);
5372 }
5373#else
5374 DrawFocusRect(hdc, &infoPtr->marqueeDrawRect);
5375#endif
5376
5377 if (cdmode & CDRF_NOTIFYPOSTPAINT)
5378 notify_postpaint(infoPtr, &nmlvcd);
5379
5380 if(hbmp) {
5381 BitBlt(hdcOrig, infoPtr->rcList.left, infoPtr->rcList.top,
5382 infoPtr->rcList.right - infoPtr->rcList.left,
5383 infoPtr->rcList.bottom - infoPtr->rcList.top,
5384 hdc, infoPtr->rcList.left, infoPtr->rcList.top, SRCCOPY);
5385
5387 DeleteDC(hdc);
5388 } else {
5389 SelectObject(hdc, hOldFont);
5390 SetBkMode(hdc, oldBkMode);
5391 SetBkColor(hdc, oldBkColor);
5392 SetTextColor(hdc, oldTextColor);
5393 }
5394
5395 infoPtr->bIsDrawing = FALSE;
5396}
#define LISTVIEW_DUMP(iP)
Definition: listview.c:414
static RANGE iterator_range(const ITERATOR *i)
Definition: listview.c:1290
static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
Definition: listview.c:5043
static BOOL LISTVIEW_DrawFocusRect(const LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:1719
static void LISTVIEW_RefreshOwnerDraw(const LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
Definition: listview.c:4969
static DWORD notify_postpaint(const LISTVIEW_INFO *infoPtr, NMLVCUSTOMDRAW *lpnmlvcd)
Definition: listview.c:1107
static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:5126
static void LISTVIEW_RefreshList(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, DWORD cdmode)
Definition: listview.c:5230
static BOOL iterator_visibleitems(ITERATOR *i, const LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:1462
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
#define LVN_ODCACHEHINT
Definition: commctrl.h:3143
#define CDDS_PREPAINT
Definition: commctrl.h:280
DWORD COLORREF
Definition: windef.h:300
int WINAPI GetBkMode(_In_ HDC)
COLORREF WINAPI GetTextColor(_In_ HDC)
Definition: text.c:861
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define SRCCOPY
Definition: wingdi.h:333
COLORREF WINAPI GetBkColor(_In_ HDC)
Definition: dc.c:978
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918

Referenced by LISTVIEW_Paint().

◆ LISTVIEW_RefreshList()

static void LISTVIEW_RefreshList ( LISTVIEW_INFO infoPtr,
ITERATOR i,
HDC  hdc,
DWORD  cdmode 
)
static

Definition at line 5230 of file listview.c.

5231{
5232 POINT Origin, Position;
5233
5234 /* Get scroll info once before loop */
5235 LISTVIEW_GetOrigin(infoPtr, &Origin);
5236
5237 while(iterator_prev(i))
5238 {
5239 SelectObject(hdc, infoPtr->hFont);
5240 LISTVIEW_GetItemOrigin(infoPtr, i->nItem, &Position);
5241 Position.x += Origin.x;
5242 Position.y += Origin.y;
5243
5244 LISTVIEW_DrawItem(infoPtr, hdc, i->nItem, NULL, Position, cdmode);
5245 }
5246}

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_RefreshOwnerDraw()

static void LISTVIEW_RefreshOwnerDraw ( const LISTVIEW_INFO infoPtr,
ITERATOR i,
HDC  hdc,
DWORD  cdmode 
)
static

Definition at line 4969 of file listview.c.

4970{
4971 UINT uID = (UINT)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
4972 DWORD cditemmode = CDRF_DODEFAULT;
4973 NMLVCUSTOMDRAW nmlvcd;
4974 POINT Origin, Position;
4975 DRAWITEMSTRUCT dis;
4976 LVITEMW item;
4977
4978 TRACE("()\n");
4979
4980 ZeroMemory(&dis, sizeof(dis));
4981
4982 /* Get scroll info once before loop */
4983 LISTVIEW_GetOrigin(infoPtr, &Origin);
4984
4985 /* iterate through the invalidated rows */
4986 while(iterator_next(i))
4987 {
4988 item.iItem = i->nItem;
4989 item.iSubItem = 0;
4990 item.mask = LVIF_PARAM | LVIF_STATE;
4991 item.stateMask = LVIS_SELECTED | LVIS_FOCUSED;
4992 if (!LISTVIEW_GetItemW(infoPtr, &item)) continue;
4993
4994 dis.CtlType = ODT_LISTVIEW;
4995 dis.CtlID = uID;
4996 dis.itemID = item.iItem;
4998 dis.itemState = 0;
4999 if (item.state & LVIS_SELECTED) dis.itemState |= ODS_SELECTED;
5000 if (infoPtr->bFocus && (item.state & LVIS_FOCUSED)) dis.itemState |= ODS_FOCUS;
5001 dis.hwndItem = infoPtr->hwndSelf;
5002 dis.hDC = hdc;
5003 LISTVIEW_GetItemOrigin(infoPtr, dis.itemID, &Position);
5004 dis.rcItem.left = Position.x + Origin.x;
5005 dis.rcItem.right = dis.rcItem.left + infoPtr->nItemWidth;
5006 dis.rcItem.top = Position.y + Origin.y;
5007 dis.rcItem.bottom = dis.rcItem.top + infoPtr->nItemHeight;
5008 dis.itemData = item.lParam;
5009
5010 TRACE("item=%s, rcItem=%s\n", debuglvitem_t(&item, TRUE), wine_dbgstr_rect(&dis.rcItem));
5011
5012 /*
5013 * Even if we do not send the CDRF_NOTIFYITEMDRAW we need to fill the nmlvcd
5014 * structure for the rest. of the paint cycle
5015 */
5016 customdraw_fill(&nmlvcd, infoPtr, hdc, &dis.rcItem, &item);
5017 if (cdmode & CDRF_NOTIFYITEMDRAW)
5018 cditemmode = notify_customdraw(infoPtr, CDDS_PREPAINT, &nmlvcd);
5019
5020 if (!(cditemmode & CDRF_SKIPDEFAULT))
5021 {
5022 prepaint_setup (infoPtr, hdc, &nmlvcd, FALSE);
5023 SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
5024 }
5025
5026 if (cditemmode & CDRF_NOTIFYPOSTPAINT)
5027 notify_postpaint(infoPtr, &nmlvcd);
5028 }
5029}
#define ODT_LISTVIEW
Definition: commctrl.h:80
ULONG_PTR itemData
Definition: winuser.h:3093
#define ODS_SELECTED
Definition: winuser.h:2545
#define ODA_DRAWENTIRE
Definition: winuser.h:2542
#define WM_DRAWITEM
Definition: winuser.h:1645
#define GWLP_ID
Definition: winuser.h:860
#define ODS_FOCUS
Definition: winuser.h:2549

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_RefreshReport()

static void LISTVIEW_RefreshReport ( LISTVIEW_INFO infoPtr,
ITERATOR i,
HDC  hdc,
DWORD  cdmode 
)
static

Definition at line 5043 of file listview.c.

5044{
5045 INT rgntype;
5046 RECT rcClip, rcItem;
5047 POINT Origin;
5048 RANGES colRanges;
5049 INT col;
5050 ITERATOR j;
5051
5052 TRACE("()\n");
5053
5054 /* figure out what to draw */
5055 rgntype = GetClipBox(hdc, &rcClip);
5056 if (rgntype == NULLREGION) return;
5057
5058 /* Get scroll info once before loop */
5059 LISTVIEW_GetOrigin(infoPtr, &Origin);
5060
5061 colRanges = ranges_create(DPA_GetPtrCount(infoPtr->hdpaColumns));
5062
5063 /* narrow down the columns we need to paint */
5064 for(col = 0; col < DPA_GetPtrCount(infoPtr->hdpaColumns); col++)
5065 {
5066 INT index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, col, 0);
5067
5068 LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem);
5069 if ((rcItem.right + Origin.x >= rcClip.left) && (rcItem.left + Origin.x < rcClip.right))
5070 ranges_additem(colRanges, index);
5071 }
5072 iterator_rangesitems(&j, colRanges);
5073
5074 /* in full row select, we _have_ to draw the main item */
5075 if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
5076 j.nSpecial = 0;
5077
5078 /* iterate through the invalidated rows */
5079 while(iterator_next(i))
5080 {
5081 RANGES subitems;
5083 ITERATOR k;
5084
5085 SelectObject(hdc, infoPtr->hFont);
5086 LISTVIEW_GetItemOrigin(infoPtr, i->nItem, &Position);
5087 Position.x = Origin.x;
5088 Position.y += Origin.y;
5089
5090 subitems = ranges_create(DPA_GetPtrCount(infoPtr->hdpaColumns));
5091
5092 /* iterate through the invalidated columns */
5093 while(iterator_next(&j))
5094 {
5095 LISTVIEW_GetHeaderRect(infoPtr, j.nItem, &rcItem);
5096
5097 if (rgntype == COMPLEXREGION && !((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) && j.nItem == 0))
5098 {
5099 rcItem.top = 0;
5100 rcItem.bottom = infoPtr->nItemHeight;
5101 OffsetRect(&rcItem, Origin.x, Position.y);
5102 if (!RectVisible(hdc, &rcItem)) continue;
5103 }
5104
5105 ranges_additem(subitems, j.nItem);
5106 }
5107
5108 iterator_rangesitems(&k, subitems);
5109 LISTVIEW_DrawItem(infoPtr, hdc, i->nItem, &k, Position, cdmode);
5111 }
5113}
int k
Definition: mpi.c:3369
#define COMPLEXREGION
Definition: wingdi.h:363

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_RefreshReportGrid()

static void LISTVIEW_RefreshReportGrid ( LISTVIEW_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 5126 of file listview.c.

5127{
5128 INT rgntype;
5129 INT y, itemheight;
5130 INT col, index;
5131 HPEN hPen, hOldPen;
5132 RECT rcClip, rcItem = {0};
5133 POINT Origin;
5134 RANGES colRanges;
5135 ITERATOR j;
5136 BOOL rmost = FALSE;
5137
5138 TRACE("()\n");
5139
5140 /* figure out what to draw */
5141 rgntype = GetClipBox(hdc, &rcClip);
5142 if (rgntype == NULLREGION) return;
5143
5144 /* Get scroll info once before loop */
5145 LISTVIEW_GetOrigin(infoPtr, &Origin);
5146
5147 colRanges = ranges_create(DPA_GetPtrCount(infoPtr->hdpaColumns));
5148
5149 /* narrow down the columns we need to paint */
5150 for(col = 0; col < DPA_GetPtrCount(infoPtr->hdpaColumns); col++)
5151 {
5152 index = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, col, 0);
5153
5154 LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem);
5155 if ((rcItem.right + Origin.x >= rcClip.left) && (rcItem.left + Origin.x < rcClip.right))
5156 ranges_additem(colRanges, index);
5157 }
5158
5159 /* is right most vertical line visible? */
5160 if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
5161 {
5163 LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem);
5164 rmost = (rcItem.right + Origin.x < rcClip.right);
5165 }
5166
5167 if ((hPen = CreatePen( PS_SOLID, 1, comctl32_color.clr3dFace )))
5168 {
5169 hOldPen = SelectObject ( hdc, hPen );
5170
5171 /* draw the vertical lines for the columns */
5172 iterator_rangesitems(&j, colRanges);
5173 while(iterator_next(&j))
5174 {
5175 LISTVIEW_GetHeaderRect(infoPtr, j.nItem, &rcItem);
5176 if (rcItem.left == 0) continue; /* skip leftmost column */
5177 rcItem.left += Origin.x;
5178 rcItem.right += Origin.x;
5179 rcItem.top = infoPtr->rcList.top;
5180 rcItem.bottom = infoPtr->rcList.bottom;
5181 TRACE("vert col=%d, rcItem=%s\n", j.nItem, wine_dbgstr_rect(&rcItem));
5182 MoveToEx (hdc, rcItem.left, rcItem.top, NULL);
5183 LineTo (hdc, rcItem.left, rcItem.bottom);
5184 }
5186 /* draw rightmost grid line if visible */
5187 if (rmost)
5188 {
5190 DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
5191 LISTVIEW_GetHeaderRect(infoPtr, index, &rcItem);
5192
5193 rcItem.right += Origin.x;
5194
5195 MoveToEx (hdc, rcItem.right, infoPtr->rcList.top, NULL);
5196 LineTo (hdc, rcItem.right, infoPtr->rcList.bottom);
5197 }
5198
5199 /* draw the horizontal lines for the rows */
5200 itemheight = LISTVIEW_CalculateItemHeight(infoPtr);
5201 rcItem.left = infoPtr->rcList.left;
5202 rcItem.right = infoPtr->rcList.right;
5203 for(y = Origin.y > 1 ? Origin.y - 1 : itemheight - 1 + Origin.y % itemheight; y<=infoPtr->rcList.bottom; y+=itemheight)
5204 {
5205 rcItem.bottom = rcItem.top = y;
5206 TRACE("horz rcItem=%s\n", wine_dbgstr_rect(&rcItem));
5207 MoveToEx (hdc, rcItem.left, rcItem.top, NULL);
5208 LineTo (hdc, rcItem.right, rcItem.top);
5209 }
5210
5211 SelectObject( hdc, hOldPen );
5212 DeleteObject( hPen );
5213 }
5214 else
5215 ranges_destroy(colRanges);
5216}
static INT LISTVIEW_CalculateItemHeight(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:3097
COLORREF clr3dFace
Definition: comctl32.h:175
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_Register()

void LISTVIEW_Register ( void  )

Definition at line 12016 of file listview.c.

12017{
12018 WNDCLASSW wndClass;
12019
12020 ZeroMemory(&wndClass, sizeof(WNDCLASSW));
12021 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
12023 wndClass.cbClsExtra = 0;
12024 wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *);
12025 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
12026 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
12027 wndClass.lpszClassName = WC_LISTVIEWW;
12028 RegisterClassW(&wndClass);
12029}
static LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:11497
#define WC_LISTVIEWW
Definition: commctrl.h:2257
LPCWSTR lpszClassName
Definition: winuser.h:3185
HBRUSH hbrBackground
Definition: winuser.h:3183
int cbClsExtra
Definition: winuser.h:3178
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
#define COLOR_WINDOW
Definition: winuser.h:918
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2105
#define CS_GLOBALCLASS
Definition: winuser.h:652

Referenced by DllMain().

◆ LISTVIEW_SaveTextMetrics()

static void LISTVIEW_SaveTextMetrics ( LISTVIEW_INFO infoPtr)
static

Definition at line 3146 of file listview.c.

3147{
3148 HDC hdc = GetDC(infoPtr->hwndSelf);
3149 HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
3150 HFONT hOldFont = SelectObject(hdc, hFont);
3152 SIZE sz;
3153
3154 if (GetTextMetricsW(hdc, &tm))
3155 {
3156 infoPtr->ntmHeight = tm.tmHeight;
3157 infoPtr->ntmMaxCharWidth = tm.tmMaxCharWidth;
3158 }
3159
3160 if (GetTextExtentPoint32A(hdc, "...", 3, &sz))
3161 infoPtr->nEllipsisWidth = sz.cx;
3162
3163 SelectObject(hdc, hOldFont);
3164 ReleaseDC(infoPtr->hwndSelf, hdc);
3165
3166 TRACE("tmHeight=%d\n", infoPtr->ntmHeight);
3167}
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

Referenced by LISTVIEW_NCCreate(), and LISTVIEW_SetFont().

◆ LISTVIEW_Scroll()

static BOOL LISTVIEW_Scroll ( LISTVIEW_INFO infoPtr,
INT  dx,
INT  dy 
)
static

Definition at line 8168 of file listview.c.

8169{
8170 switch(infoPtr->uView) {
8171 case LV_VIEW_DETAILS:
8172 dy += (dy < 0 ? -1 : 1) * infoPtr->nItemHeight/2;
8173 dy /= infoPtr->nItemHeight;
8174 break;
8175 case LV_VIEW_LIST:
8176 if (dy != 0) return FALSE;
8177 break;
8178 default: /* icon */
8179 break;
8180 }
8181
8182 if (dx != 0) LISTVIEW_HScroll(infoPtr, SB_INTERNAL, dx);
8183 if (dy != 0) LISTVIEW_VScroll(infoPtr, SB_INTERNAL, dy);
8184
8185 return TRUE;
8186}
GLint dy
Definition: linetemp.h:97

Referenced by LISTVIEW_MarqueeHighlight(), and LISTVIEW_WindowProc().

◆ LISTVIEW_ScrollColumns()

static void LISTVIEW_ScrollColumns ( LISTVIEW_INFO infoPtr,
INT  nColumn,
INT  dx 
)
static

Definition at line 5697 of file listview.c.

5698{
5699 COLUMN_INFO *lpColumnInfo;
5700 RECT rcOld, rcCol;
5701 POINT ptOrigin;
5702 INT nCol;
5703 HDITEMW hdi;
5704
5705 if (nColumn < 0 || DPA_GetPtrCount(infoPtr->hdpaColumns) < 1) return;
5706 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, min(nColumn, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1));
5707 rcCol = lpColumnInfo->rcHeader;
5708 if (nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns))
5709 rcCol.left = rcCol.right;
5710
5711 /* adjust the other columns */
5712 hdi.mask = HDI_ORDER;
5713 if (SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nColumn, (LPARAM)&hdi))
5714 {
5715 INT nOrder = hdi.iOrder;
5716 for (nCol = 0; nCol < DPA_GetPtrCount(infoPtr->hdpaColumns); nCol++)
5717 {
5718 hdi.mask = HDI_ORDER;
5719 SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nCol, (LPARAM)&hdi);
5720 if (hdi.iOrder >= nOrder) {
5721 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nCol);
5722 lpColumnInfo->rcHeader.left += dx;
5723 lpColumnInfo->rcHeader.right += dx;
5724 }
5725 }
5726 }
5727
5728 /* do not update screen if not in report mode */
5729 if (!is_redrawing(infoPtr) || infoPtr->uView != LV_VIEW_DETAILS) return;
5730
5731 /* Need to reset the item width when inserting a new column */
5732 infoPtr->nItemWidth += dx;
5733
5734 LISTVIEW_UpdateScroll(infoPtr);
5735 LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
5736
5737 /* scroll to cover the deleted column, and invalidate for redraw */
5738 rcOld = infoPtr->rcList;
5739 rcOld.left = ptOrigin.x + rcCol.left + dx;
5740 ScrollWindowEx(infoPtr->hwndSelf, dx, 0, &rcOld, &rcOld, 0, 0, SW_ERASE | SW_INVALIDATE);
5741}
#define SW_INVALIDATE
Definition: winuser.h:2579
#define SW_ERASE
Definition: winuser.h:2580
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)

Referenced by LISTVIEW_DeleteColumn(), LISTVIEW_InsertColumnT(), and LISTVIEW_Notify().

◆ LISTVIEW_ScrollOnInsert()

static void LISTVIEW_ScrollOnInsert ( LISTVIEW_INFO infoPtr,
INT  nItem,
INT  dir 
)
static

Definition at line 5840 of file listview.c.

5841{
5842 INT nPerCol, nItemCol, nItemRow;
5843 RECT rcScroll;
5844 POINT Origin;
5845
5846 /* if we don't refresh, what's the point of scrolling? */
5847 if (!is_redrawing(infoPtr)) return;
5848
5849 assert (abs(dir) == 1);
5850
5851 /* arrange icons if autoarrange is on */
5852 if (is_autoarrange(infoPtr))
5853 {
5854 BOOL arrange = TRUE;
5855 if (dir < 0 && nItem >= infoPtr->nItemCount) arrange = FALSE;
5856 if (dir > 0 && nItem == infoPtr->nItemCount - 1) arrange = FALSE;
5857 if (arrange) LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
5858 }
5859
5860 /* scrollbars need updating */
5861 LISTVIEW_UpdateScroll(infoPtr);
5862
5863 /* figure out the item's position */
5864 if (infoPtr->uView == LV_VIEW_DETAILS)
5865 nPerCol = infoPtr->nItemCount + 1;
5866 else if (infoPtr->uView == LV_VIEW_LIST)
5867 nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
5868 else /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
5869 return;
5870
5871 nItemCol = nItem / nPerCol;
5872 nItemRow = nItem % nPerCol;
5873 LISTVIEW_GetOrigin(infoPtr, &Origin);
5874
5875 /* move the items below up a slot */
5876 rcScroll.left = nItemCol * infoPtr->nItemWidth;
5877 rcScroll.top = nItemRow * infoPtr->nItemHeight;
5878 rcScroll.right = rcScroll.left + infoPtr->nItemWidth;
5879 rcScroll.bottom = nPerCol * infoPtr->nItemHeight;
5880 OffsetRect(&rcScroll, Origin.x, Origin.y);
5881 TRACE("rcScroll=%s, dx=%d\n", wine_dbgstr_rect(&rcScroll), dir * infoPtr->nItemHeight);
5882 if (IntersectRect(&rcScroll, &rcScroll, &infoPtr->rcList))
5883 {
5884 TRACE("Invalidating rcScroll=%s, rcList=%s\n", wine_dbgstr_rect(&rcScroll), wine_dbgstr_rect(&infoPtr->rcList));
5885 InvalidateRect(infoPtr->hwndSelf, &rcScroll, TRUE);
5886 }
5887
5888 /* report has only that column, so we're done */
5889 if (infoPtr->uView == LV_VIEW_DETAILS) return;
5890
5891 /* now for LISTs, we have to deal with the columns to the right */
5892 SetRect(&rcScroll, (nItemCol + 1) * infoPtr->nItemWidth, 0,
5893 (infoPtr->nItemCount / nPerCol + 1) * infoPtr->nItemWidth,
5894 nPerCol * infoPtr->nItemHeight);
5895 OffsetRect(&rcScroll, Origin.x, Origin.y);
5896 if (IntersectRect(&rcScroll, &rcScroll, &infoPtr->rcList))
5897 InvalidateRect(infoPtr->hwndSelf, &rcScroll, TRUE);
5898}
unsigned int dir
Definition: maze.c:112
#define abs(i)
Definition: fconv.c:206

Referenced by LISTVIEW_DeleteItem(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_ScrollTimer()

static VOID CALLBACK LISTVIEW_ScrollTimer ( HWND  hWnd,
UINT  uMsg,
UINT_PTR  idEvent,
DWORD  dwTime 
)
static

Definition at line 4074 of file listview.c.

4075{
4076 LISTVIEW_INFO *infoPtr;
4077 SCROLLINFO scrollInfo;
4078 POINT coords;
4079 INT scroll = 0;
4080
4081 infoPtr = (LISTVIEW_INFO *) idEvent;
4082
4083 if (!infoPtr)
4084 return;
4085
4086 /* Get the current cursor position and convert to client coordinates */
4089
4090 scrollInfo.cbSize = sizeof(SCROLLINFO);
4091 scrollInfo.fMask = SIF_ALL;
4092
4093 /* Work out in which directions we can scroll */
4094 if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo))
4095 {
4096 if (scrollInfo.nPos != scrollInfo.nMin)
4097 scroll |= SCROLL_UP;
4098
4099 if (((scrollInfo.nPage + scrollInfo.nPos) - 1) != scrollInfo.nMax)
4100 scroll |= SCROLL_DOWN;
4101 }
4102
4103 if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo))
4104 {
4105 if (scrollInfo.nPos != scrollInfo.nMin)
4106 scroll |= SCROLL_LEFT;
4107
4108 if (((scrollInfo.nPage + scrollInfo.nPos) - 1) != scrollInfo.nMax)
4109 scroll |= SCROLL_RIGHT;
4110 }
4111
4112 if (((coords.x <= 0) && (scroll & SCROLL_LEFT)) ||
4113 ((coords.y <= 0) && (scroll & SCROLL_UP)) ||
4114 ((coords.x >= infoPtr->rcList.right) && (scroll & SCROLL_RIGHT)) ||
4115 ((coords.y >= infoPtr->rcList.bottom) && (scroll & SCROLL_DOWN)))
4116 {
4117 LISTVIEW_MarqueeHighlight(infoPtr, &coords, scroll);
4118 }
4119}
HWND hWnd
Definition: settings.c:17
GLuint coords
Definition: glext.h:7368
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2670
#define SIF_ALL
Definition: winuser.h:1232
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by LISTVIEW_MouseMove().

◆ LISTVIEW_SetBkColor()

static BOOL LISTVIEW_SetBkColor ( LISTVIEW_INFO infoPtr,
COLORREF  color 
)
static

Definition at line 8200 of file listview.c.

8201{
8202 TRACE("(color=%x)\n", color);
8203
8204#ifdef __REACTOS__
8205 infoPtr->bDefaultBkColor = FALSE;
8206#endif
8207 if(infoPtr->clrBk != color) {
8208 if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
8209 infoPtr->clrBk = color;
8210 if (color == CLR_NONE)
8211 infoPtr->hBkBrush = (HBRUSH)GetClassLongPtrW(infoPtr->hwndSelf, GCLP_HBRBACKGROUND);
8212 else
8213 {
8214 infoPtr->hBkBrush = CreateSolidBrush(color);
8215 infoPtr->dwLvExStyle &= ~LVS_EX_TRANSPARENTBKGND;
8216 }
8217 }
8218
8219 return TRUE;
8220}
GLuint color
Definition: glext.h:6243
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define GetClassLongPtrW
Definition: winuser.h:4564
#define GCLP_HBRBACKGROUND
Definition: winuser.h:672

Referenced by LISTVIEW_NCCreate(), LISTVIEW_SetExtendedListViewStyle(), and LISTVIEW_WindowProc().

◆ LISTVIEW_SetColumnOrderArray()

static BOOL LISTVIEW_SetColumnOrderArray ( LISTVIEW_INFO infoPtr,
INT  iCount,
const INT lpiArray 
)
static

Definition at line 8488 of file listview.c.

8489{
8490 if (!infoPtr->hwndHeader) return FALSE;
8491 infoPtr->colRectsDirty = TRUE;
8492 return SendMessageW(infoPtr->hwndHeader, HDM_SETORDERARRAY, iCount, (LPARAM)lpiArray);
8493}
#define HDM_SETORDERARRAY
Definition: commctrl.h:809

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetColumnT()

static BOOL LISTVIEW_SetColumnT ( const LISTVIEW_INFO infoPtr,
INT  nColumn,
const LVCOLUMNW lpColumn,
BOOL  isW 
)
static

Definition at line 8433 of file listview.c.

8435{
8436 HDITEMW hdi, hdiget;
8437 BOOL bResult;
8438
8439 TRACE("(nColumn=%d, lpColumn=%s, isW=%d)\n", nColumn, debuglvcolumn_t(lpColumn, isW), isW);
8440
8441 if (!lpColumn || nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
8442
8443 ZeroMemory(&hdi, sizeof(HDITEMW));
8444 if (lpColumn->mask & LVCF_FMT)
8445 {
8446 hdi.mask |= HDI_FORMAT;
8447 hdiget.mask = HDI_FORMAT;
8448 if (SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nColumn, (LPARAM)&hdiget))
8449 hdi.fmt = hdiget.fmt & HDF_STRING;
8450 }
8451 column_fill_hditem(infoPtr, &hdi, nColumn, lpColumn, isW);
8452
8453 /* set header item attributes */
8454 bResult = SendMessageW(infoPtr->hwndHeader, isW ? HDM_SETITEMW : HDM_SETITEMA, nColumn, (LPARAM)&hdi);
8455 if (!bResult) return FALSE;
8456
8457 if (lpColumn->mask & LVCF_FMT)
8458 {
8459 COLUMN_INFO *lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nColumn);
8460 INT oldFmt = lpColumnInfo->fmt;
8461
8462 lpColumnInfo->fmt = lpColumn->fmt;
8463 if ((oldFmt ^ lpColumn->fmt) & (LVCFMT_JUSTIFYMASK | LVCFMT_IMAGE))
8464 {
8465 if (infoPtr->uView == LV_VIEW_DETAILS) LISTVIEW_InvalidateColumn(infoPtr, nColumn);
8466 }
8467 }
8468
8469 if (lpColumn->mask & LVCF_MINWIDTH)
8470 LISTVIEW_GetColumnInfo(infoPtr, nColumn)->cxMin = lpColumn->cxMin;
8471
8472 return TRUE;
8473}
static void LISTVIEW_InvalidateColumn(const LISTVIEW_INFO *infoPtr, INT nColumn)
Definition: listview.c:1787
#define LVCFMT_IMAGE
Definition: commctrl.h:2602
#define HDM_SETITEMA
Definition: commctrl.h:753
#define HDM_SETITEMW
Definition: commctrl.h:754

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetColumnWidth()

static BOOL LISTVIEW_SetColumnWidth ( LISTVIEW_INFO infoPtr,
INT  nColumn,
INT  cx 
)
static

Definition at line 8508 of file listview.c.

8509{
8510 WCHAR szDispText[DISP_TEXT_SIZE] = { 0 };
8511 INT max_cx = 0;
8512 HDITEMW hdi;
8513
8514 TRACE("(nColumn=%d, cx=%d)\n", nColumn, cx);
8515
8516 /* set column width only if in report or list mode */
8517 if (infoPtr->uView != LV_VIEW_DETAILS && infoPtr->uView != LV_VIEW_LIST) return FALSE;
8518
8519 /* take care of invalid cx values - LVSCW_AUTOSIZE_* values are negative,
8520 with _USEHEADER being the lowest */
8522 else if (infoPtr->uView == LV_VIEW_LIST && cx <= 0) return FALSE;
8523
8524 /* resize all columns if in LV_VIEW_LIST mode */
8525 if(infoPtr->uView == LV_VIEW_LIST)
8526 {
8527 infoPtr->nItemWidth = cx;
8528 LISTVIEW_InvalidateList(infoPtr);
8529 return TRUE;
8530 }
8531
8532 if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
8533
8534 if (cx == LVSCW_AUTOSIZE || (cx == LVSCW_AUTOSIZE_USEHEADER && nColumn < DPA_GetPtrCount(infoPtr->hdpaColumns) -1))
8535 {
8536 INT nLabelWidth;
8537 LVITEMW lvItem;
8538
8539 lvItem.mask = LVIF_TEXT;
8540 lvItem.iItem = 0;
8541 lvItem.iSubItem = nColumn;
8542 lvItem.cchTextMax = DISP_TEXT_SIZE;
8543 for (; lvItem.iItem < infoPtr->nItemCount; lvItem.iItem++)
8544 {
8545 lvItem.pszText = szDispText;
8546 if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) continue;
8547 nLabelWidth = LISTVIEW_GetStringWidthT(infoPtr, lvItem.pszText, TRUE);
8548 if (max_cx < nLabelWidth) max_cx = nLabelWidth;
8549 }
8550 if (infoPtr->himlSmall && (nColumn == 0 || (LISTVIEW_GetColumnInfo(infoPtr, nColumn)->fmt & LVCFMT_IMAGE)))
8551 max_cx += infoPtr->iconSize.cx;
8552 max_cx += TRAILING_LABEL_PADDING;
8553 if (nColumn == 0 && (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES))
8554 max_cx += GetSystemMetrics(SM_CXSMICON);
8555 }
8556
8557 /* autosize based on listview items width */
8558 if(cx == LVSCW_AUTOSIZE)
8559 cx = max_cx;
8560 else if(cx == LVSCW_AUTOSIZE_USEHEADER)
8561 {
8562 /* if iCol is the last column make it fill the remainder of the controls width */
8563 if(nColumn == DPA_GetPtrCount(infoPtr->hdpaColumns) - 1)
8564 {
8565 RECT rcHeader;
8566 POINT Origin;
8567
8568 LISTVIEW_GetOrigin(infoPtr, &Origin);
8569 LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcHeader);
8570
8571 cx = infoPtr->rcList.right - Origin.x - rcHeader.left;
8572 }
8573 else
8574 {
8575 /* Despite what the MS docs say, if this is not the last
8576 column, then MS resizes the column to the width of the
8577 largest text string in the column, including headers
8578 and items. This is different from LVSCW_AUTOSIZE in that
8579 LVSCW_AUTOSIZE ignores the header string length. */
8580 cx = 0;
8581
8582 /* retrieve header text */
8585 hdi.pszText = szDispText;
8586 if (SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nColumn, (LPARAM)&hdi))
8587 {
8588 HDC hdc = GetDC(infoPtr->hwndSelf);
8589 HFONT old_font = SelectObject(hdc, (HFONT)SendMessageW(infoPtr->hwndHeader, WM_GETFONT, 0, 0));
8591 INT bitmap_margin = 0;
8592 SIZE size;
8593
8594 if (GetTextExtentPoint32W(hdc, hdi.pszText, lstrlenW(hdi.pszText), &size))
8596
8597 if (hdi.fmt & (HDF_IMAGE|HDF_BITMAP))
8598 bitmap_margin = SendMessageW(infoPtr->hwndHeader, HDM_GETBITMAPMARGIN, 0, 0);
8599
8600 if ((hdi.fmt & HDF_IMAGE) && himl)
8601 {
8602 INT icon_cx, icon_cy;
8603
8604 if (!ImageList_GetIconSize(himl, &icon_cx, &icon_cy))
8605 cx += icon_cx + 2*bitmap_margin;
8606 }
8607 else if (hdi.fmt & HDF_BITMAP)
8608 {
8609 BITMAP bmp;
8610
8611 GetObjectW(hdi.hbm, sizeof(BITMAP), &bmp);
8612 cx += bmp.bmWidth + 2*bitmap_margin;
8613 }
8614
8615 SelectObject(hdc, old_font);
8616 ReleaseDC(infoPtr->hwndSelf, hdc);
8617 }
8618 cx = max (cx, max_cx);
8619 }
8620 }
8621
8622 if (cx < 0) return FALSE;
8623
8624 /* call header to update the column change */
8625 hdi.mask = HDI_WIDTH;
8626 hdi.cxy = max(cx, LISTVIEW_GetColumnInfo(infoPtr, nColumn)->cxMin);
8627 TRACE("hdi.cxy=%d\n", hdi.cxy);
8628 return SendMessageW(infoPtr->hwndHeader, HDM_SETITEMW, nColumn, (LPARAM)&hdi);
8629}
BOOL WINAPI ImageList_GetIconSize(HIMAGELIST himl, INT *cx, INT *cy)
Definition: imagelist.c:2037
#define TRAILING_HEADER_PADDING
Definition: listview.c:397
static INT cxMin
Definition: eventvwr.c:4312
BITMAP bmp
Definition: alphablend.c:62
#define HDM_GETBITMAPMARGIN
Definition: commctrl.h:818
struct _IMAGELIST * HIMAGELIST
Definition: commctrl.h:324
_Out_opt_ int * cx
Definition: commctrl.h:585
#define HDI_BITMAP
Definition: commctrl.h:707
#define HDF_BITMAP
Definition: commctrl.h:721
#define HDM_GETIMAGELIST
Definition: commctrl.h:797
Definition: bl.h:1331
Definition: dsound.c:943
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

Referenced by LISTVIEW_Notify(), and LISTVIEW_WindowProc().

◆ LISTVIEW_SetCursor()

static BOOL LISTVIEW_SetCursor ( const LISTVIEW_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 11055 of file listview.c.

11056{
11057 LVHITTESTINFO lvHitTestInfo;
11058
11059 if (!LISTVIEW_IsHotTracking(infoPtr)) goto forward;
11060
11061 if (!infoPtr->hHotCursor) goto forward;
11062
11063 GetCursorPos(&lvHitTestInfo.pt);
11064 if (LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, FALSE, FALSE) < 0) goto forward;
11065
11066 SetCursor(infoPtr->hHotCursor);
11067
11068 return TRUE;
11069
11070forward:
11071
11072 return DefWindowProcW(infoPtr->hwndSelf, WM_SETCURSOR, wParam, lParam);
11073}
HCURSOR hHotCursor
Definition: listview.c:319
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_SETCURSOR
Definition: winuser.h:1636

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetExtendedListViewStyle()

static DWORD LISTVIEW_SetExtendedListViewStyle ( LISTVIEW_INFO infoPtr,
DWORD  mask,
DWORD  ex_style 
)
static

Definition at line 8688 of file listview.c.

8689{
8690 DWORD old_ex_style = infoPtr->dwLvExStyle;
8691
8692 TRACE("mask=0x%08x, ex_style=0x%08x\n", mask, ex_style);
8693
8694 /* set new style */
8695 if (mask)
8696 infoPtr->dwLvExStyle = (old_ex_style & ~mask) | (ex_style & mask);
8697 else
8698 infoPtr->dwLvExStyle = ex_style;
8699
8700 if((infoPtr->dwLvExStyle ^ old_ex_style) & LVS_EX_CHECKBOXES)
8701 {
8702 HIMAGELIST himl = 0;
8703 if(infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
8704 {
8705 LVITEMW item;
8706 item.mask = LVIF_STATE;
8707 item.stateMask = LVIS_STATEIMAGEMASK;
8708 item.state = INDEXTOSTATEIMAGEMASK(1);
8709 LISTVIEW_SetItemState(infoPtr, -1, &item);
8710
8712 if(!(infoPtr->dwStyle & LVS_SHAREIMAGELISTS))
8713 ImageList_Destroy(infoPtr->himlState);
8714 }
8716 /* checkbox list replaces previous custom list or... */
8717 if(((infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) &&
8718 !(infoPtr->dwStyle & LVS_SHAREIMAGELISTS)) ||
8719 /* ...previous was checkbox list */
8720 (old_ex_style & LVS_EX_CHECKBOXES))
8722 }
8723
8724 if((infoPtr->dwLvExStyle ^ old_ex_style) & LVS_EX_HEADERDRAGDROP)
8725 {
8726 DWORD style;
8727
8728 /* if not already created */
8729 LISTVIEW_CreateHeader(infoPtr);
8730
8732 if (infoPtr->dwLvExStyle & LVS_EX_HEADERDRAGDROP)
8734 else
8735 style &= ~HDS_DRAGDROP;
8737 }
8738
8739 /* GRIDLINES adds decoration at top so changes sizes */
8740 if((infoPtr->dwLvExStyle ^ old_ex_style) & LVS_EX_GRIDLINES)
8741 {
8742 LISTVIEW_CreateHeader(infoPtr);
8743 LISTVIEW_UpdateSize(infoPtr);
8744 }
8745
8746 if((infoPtr->dwLvExStyle ^ old_ex_style) & LVS_EX_FULLROWSELECT)
8747 {
8748 LISTVIEW_CreateHeader(infoPtr);
8749 }
8750
8751 if((infoPtr->dwLvExStyle ^ old_ex_style) & LVS_EX_TRANSPARENTBKGND)
8752 {
8753 if (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTBKGND)
8754 LISTVIEW_SetBkColor(infoPtr, CLR_NONE);
8755 }
8756
8757 if((infoPtr->dwLvExStyle ^ old_ex_style) & LVS_EX_HEADERINALLVIEWS)
8758 {
8759 if (infoPtr->dwLvExStyle & LVS_EX_HEADERINALLVIEWS)
8760 LISTVIEW_CreateHeader(infoPtr);
8761 else
8762 ShowWindow(infoPtr->hwndHeader, SW_HIDE);
8763 LISTVIEW_UpdateSize(infoPtr);
8764 LISTVIEW_UpdateScroll(infoPtr);
8765 }
8766
8767#ifdef __REACTOS__
8768 if ((infoPtr->dwLvExStyle & LVS_EX_SNAPTOGRID) > (old_ex_style & LVS_EX_SNAPTOGRID))
8769 {
8771 }
8772#endif
8773
8774 LISTVIEW_InvalidateList(infoPtr);
8775 return old_ex_style;
8776}
static HIMAGELIST LISTVIEW_CreateCheckBoxIL(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:8635
static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *, INT, HIMAGELIST)
Definition: listview.c:8920
#define LVS_EX_SNAPTOGRID
Definition: commctrl.h:2748
#define SW_HIDE
Definition: winuser.h:768
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define GWL_STYLE
Definition: winuser.h:852

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetFocus()

static LRESULT LISTVIEW_SetFocus ( LISTVIEW_INFO infoPtr,
HWND  hwndLoseFocus 
)
static

Definition at line 11086 of file listview.c.

11087{
11088 TRACE("(hwndLoseFocus=%p)\n", hwndLoseFocus);
11089
11090 /* if we have the focus already, there's nothing to do */
11091 if (infoPtr->bFocus) return 0;
11092
11093 /* send NM_SETFOCUS notification */
11094 if (!notify(infoPtr, NM_SETFOCUS)) return 0;
11095
11096 /* set window focus flag */
11097 infoPtr->bFocus = TRUE;
11098
11099 /* put the focus rect back on */
11100 LISTVIEW_ShowFocusRect(infoPtr, TRUE);
11101
11102 /* redraw all visible selected items */
11104
11105 return 0;
11106}
#define NM_SETFOCUS
Definition: commctrl.h:135

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetFont()

static LRESULT LISTVIEW_SetFont ( LISTVIEW_INFO infoPtr,
HFONT  hFont,
WORD  fRedraw 
)
static

Definition at line 11120 of file listview.c.

11121{
11122 HFONT oldFont = infoPtr->hFont;
11123 INT oldHeight = infoPtr->nItemHeight;
11124
11125 TRACE("(hfont=%p,redraw=%hu)\n", hFont, fRedraw);
11126
11127 infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont;
11128 if (infoPtr->hFont == oldFont) return 0;
11129
11130 LISTVIEW_SaveTextMetrics(infoPtr);
11131
11132 infoPtr->nItemHeight = LISTVIEW_CalculateItemHeight(infoPtr);
11133
11134 if (infoPtr->uView == LV_VIEW_DETAILS)
11135 {
11136 SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(fRedraw, 0));
11137 LISTVIEW_UpdateSize(infoPtr);
11138 LISTVIEW_UpdateScroll(infoPtr);
11139 }
11140 else if (infoPtr->nItemHeight != oldHeight)
11141 LISTVIEW_UpdateScroll(infoPtr);
11142
11143 if (fRedraw) LISTVIEW_InvalidateList(infoPtr);
11144
11145 return 0;
11146}
#define MAKELPARAM(l, h)
Definition: winuser.h:4008

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetGroupSelection()

static void LISTVIEW_SetGroupSelection ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 3715 of file listview.c.

3716{
3718 DWORD old_mask;
3719 LVITEMW item;
3720 ITERATOR i;
3721
3722 if (!(selection = ranges_create(100))) return;
3723
3724 item.state = LVIS_SELECTED;
3725 item.stateMask = LVIS_SELECTED;
3726
3727 if ((infoPtr->uView == LV_VIEW_LIST) || (infoPtr->uView == LV_VIEW_DETAILS))
3728 {
3729 if (infoPtr->nSelectionMark == -1)
3730 {
3731 infoPtr->nSelectionMark = nItem;
3732 ranges_additem(selection, nItem);
3733 }
3734 else
3735 {
3736 RANGE sel;
3737
3738 sel.lower = min(infoPtr->nSelectionMark, nItem);
3739 sel.upper = max(infoPtr->nSelectionMark, nItem) + 1;
3740 ranges_add(selection, sel);
3741 }
3742 }
3743 else
3744 {
3745 RECT rcItem, rcSel, rcSelMark;
3746 POINT ptItem;
3747
3748 rcItem.left = LVIR_BOUNDS;
3749 if (!LISTVIEW_GetItemRect(infoPtr, nItem, &rcItem)) {
3751 return;
3752 }
3753 rcSelMark.left = LVIR_BOUNDS;
3754 if (!LISTVIEW_GetItemRect(infoPtr, infoPtr->nSelectionMark, &rcSelMark)) {
3756 return;
3757 }
3758 UnionRect(&rcSel, &rcItem, &rcSelMark);
3759 iterator_frameditems(&i, infoPtr, &rcSel);
3760 while(iterator_next(&i))
3761 {
3762 LISTVIEW_GetItemPosition(infoPtr, i.nItem, &ptItem);
3763 if (PtInRect(&rcSel, ptItem)) ranges_additem(selection, i.nItem);
3764 }
3766 }
3767
3768 /* disable per item notifications on LVS_OWNERDATA style
3769 FIXME: single LVN_ODSTATECHANGED should be used */
3770 old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE;
3771 if (infoPtr->dwStyle & LVS_OWNERDATA)
3772 infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE;
3773
3775
3776
3778 while(iterator_next(&i))
3779 LISTVIEW_SetItemState(infoPtr, i.nItem, &item);
3780 /* this will also destroy the selection */
3782
3783 infoPtr->notify_mask |= old_mask;
3784 LISTVIEW_SetItemFocus(infoPtr, nItem);
3785}
int selection
Definition: ctm.c:92

Referenced by LISTVIEW_KeySelection(), and LISTVIEW_LButtonDown().

◆ LISTVIEW_SetHotCursor()

static HCURSOR LISTVIEW_SetHotCursor ( LISTVIEW_INFO infoPtr,
HCURSOR  hCursor 
)
static

Definition at line 8789 of file listview.c.

8790{
8791 HCURSOR oldCursor = infoPtr->hHotCursor;
8792
8793 infoPtr->hHotCursor = hCursor;
8794
8795 return oldCursor;
8796}
HICON HCURSOR
Definition: windef.h:299

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetHotItem()

static INT LISTVIEW_SetHotItem ( LISTVIEW_INFO infoPtr,
INT  iIndex 
)
static

Definition at line 8811 of file listview.c.

8812{
8813 INT iOldIndex = infoPtr->nHotItem;
8814
8815 infoPtr->nHotItem = iIndex;
8816
8817 return iOldIndex;
8818}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetHoverTime()

static DWORD LISTVIEW_SetHoverTime ( LISTVIEW_INFO infoPtr,
DWORD  dwHoverTime 
)
static

Definition at line 8832 of file listview.c.

8833{
8834 DWORD oldHoverTime = infoPtr->dwHoverTime;
8835
8836 infoPtr->dwHoverTime = dwHoverTime;
8837
8838 return oldHoverTime;
8839}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetIconSpacing()

static DWORD LISTVIEW_SetIconSpacing ( LISTVIEW_INFO infoPtr,
INT  cx,
INT  cy 
)
static

Definition at line 8853 of file listview.c.

8854{
8855 INT iconWidth = 0, iconHeight = 0;
8856 DWORD oldspacing = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
8857
8858 TRACE("requested=(%d,%d)\n", cx, cy);
8859
8860 /* set to defaults, if instructed to */
8861 if (cx == -1 && cy == -1)
8862 {
8863 infoPtr->autoSpacing = TRUE;
8864 if (infoPtr->himlNormal)
8865 ImageList_GetIconSize(infoPtr->himlNormal, &iconWidth, &iconHeight);
8868 }
8869 else
8870 infoPtr->autoSpacing = FALSE;
8871
8872 /* if 0 then keep width */
8873 if (cx != 0)
8874 infoPtr->iconSpacing.cx = cx;
8875
8876 /* if 0 then keep height */
8877 if (cy != 0)
8878 infoPtr->iconSpacing.cy = cy;
8879
8880 TRACE("old=(%d,%d), new=(%d,%d), iconSize=(%d,%d), ntmH=%d\n",
8881 LOWORD(oldspacing), HIWORD(oldspacing), infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy,
8882 infoPtr->iconSize.cx, infoPtr->iconSize.cy,
8883 infoPtr->ntmHeight);
8884
8885 /* these depend on the iconSpacing */
8886 LISTVIEW_UpdateItemSize(infoPtr);
8887
8888 return oldspacing;
8889}
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586

Referenced by LISTVIEW_SetImageList(), and LISTVIEW_WindowProc().

◆ LISTVIEW_SetImageList()

static HIMAGELIST LISTVIEW_SetImageList ( LISTVIEW_INFO infoPtr,
INT  nType,
HIMAGELIST  himl 
)
static

Definition at line 8920 of file listview.c.

8921{
8922 INT oldHeight = infoPtr->nItemHeight;
8923 HIMAGELIST himlOld = 0;
8924
8925 TRACE("(nType=%d, himl=%p)\n", nType, himl);
8926
8927 switch (nType)
8928 {
8929 case LVSIL_NORMAL:
8930 himlOld = infoPtr->himlNormal;
8931 infoPtr->himlNormal = himl;
8932 if (infoPtr->uView == LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, FALSE);
8933 if (infoPtr->autoSpacing)
8934 LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
8935 break;
8936
8937 case LVSIL_SMALL:
8938 himlOld = infoPtr->himlSmall;
8939 infoPtr->himlSmall = himl;
8940 if (infoPtr->uView != LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, TRUE);
8941 if (infoPtr->hwndHeader)
8943 break;
8944
8945 case LVSIL_STATE:
8946 himlOld = infoPtr->himlState;
8947 infoPtr->himlState = himl;
8948 set_icon_size(&infoPtr->iconStateSize, himl, TRUE);
8950 break;
8951
8952 default:
8953 ERR("Unknown icon type=%d\n", nType);
8954 return NULL;
8955 }
8956
8957 infoPtr->nItemHeight = LISTVIEW_CalculateItemHeight(infoPtr);
8958 if (infoPtr->nItemHeight != oldHeight)
8959 LISTVIEW_UpdateScroll(infoPtr);
8960
8961 return himlOld;
8962}
COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk)
Definition: imagelist.c:2889
static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
Definition: listview.c:8853

Referenced by LISTVIEW_SetExtendedListViewStyle(), and LISTVIEW_WindowProc().

◆ LISTVIEW_SetItemCount()

static BOOL LISTVIEW_SetItemCount ( LISTVIEW_INFO infoPtr,
INT  nItems,
DWORD  dwFlags 
)
static

Definition at line 8977 of file listview.c.

8978{
8979 TRACE("(nItems=%d, dwFlags=%x)\n", nItems, dwFlags);
8980
8981 if (infoPtr->dwStyle & LVS_OWNERDATA)
8982 {
8983 INT nOldCount = infoPtr->nItemCount;
8984 infoPtr->nItemCount = nItems;
8985
8986 if (nItems < nOldCount)
8987 {
8988 RANGE range = { nItems, nOldCount };
8989 ranges_del(infoPtr->selectionRanges, range);
8990 if (infoPtr->nFocusedItem >= nItems)
8991 {
8992 LISTVIEW_SetItemFocus(infoPtr, -1);
8993 infoPtr->nFocusedItem = -1;
8994 SetRectEmpty(&infoPtr->rcFocus);
8995 }
8996 }
8997
8998 LISTVIEW_UpdateScroll(infoPtr);
8999
9000 /* the flags are valid only in ownerdata report and list modes */
9001 if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON) dwFlags = 0;
9002
9003 if (!(dwFlags & LVSICF_NOSCROLL) && infoPtr->nFocusedItem != -1)
9004 LISTVIEW_EnsureVisible(infoPtr, infoPtr->nFocusedItem, FALSE);
9005
9007 LISTVIEW_InvalidateList(infoPtr);
9008 else
9009 {
9010 INT nFrom, nTo;
9011 POINT Origin;
9012 RECT rcErase;
9013
9014 LISTVIEW_GetOrigin(infoPtr, &Origin);
9015 nFrom = min(nOldCount, nItems);
9016 nTo = max(nOldCount, nItems);
9017
9018 if (infoPtr->uView == LV_VIEW_DETAILS)
9019 {
9020 SetRect(&rcErase, 0, nFrom * infoPtr->nItemHeight, infoPtr->nItemWidth,
9021 nTo * infoPtr->nItemHeight);
9022 OffsetRect(&rcErase, Origin.x, Origin.y);
9023 if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
9024 LISTVIEW_InvalidateRect(infoPtr, &rcErase);
9025 }
9026 else /* LV_VIEW_LIST */
9027 {
9028 INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
9029
9030 rcErase.left = (nFrom / nPerCol) * infoPtr->nItemWidth;
9031 rcErase.top = (nFrom % nPerCol) * infoPtr->nItemHeight;
9032 rcErase.right = rcErase.left + infoPtr->nItemWidth;
9033 rcErase.bottom = nPerCol * infoPtr->nItemHeight;
9034 OffsetRect(&rcErase, Origin.x, Origin.y);
9035 if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
9036 LISTVIEW_InvalidateRect(infoPtr, &rcErase);
9037
9038 rcErase.left = (nFrom / nPerCol + 1) * infoPtr->nItemWidth;
9039 rcErase.top = 0;
9040 rcErase.right = (nTo / nPerCol + 1) * infoPtr->nItemWidth;
9041 rcErase.bottom = nPerCol * infoPtr->nItemHeight;
9042 OffsetRect(&rcErase, Origin.x, Origin.y);
9043 if (IntersectRect(&rcErase, &rcErase, &infoPtr->rcList))
9044 LISTVIEW_InvalidateRect(infoPtr, &rcErase);
9045 }
9046 }
9047 }
9048 else
9049 {
9050 /* According to MSDN for non-LVS_OWNERDATA this is just
9051 * a performance issue. The control allocates its internal
9052 * data structures for the number of items specified. It
9053 * cuts down on the number of memory allocations. Therefore
9054 * we will just issue a WARN here
9055 */
9056 WARN("for non-ownerdata performance option not implemented.\n");
9057 }
9058
9059 return TRUE;
9060}
int nItems
Definition: appswitch.c:56
static BOOL ranges_del(RANGES ranges, RANGE range)
Definition: listview.c:3421
#define LVSICF_NOSCROLL
Definition: commctrl.h:2694
#define LVSICF_NOINVALIDATEALL
Definition: commctrl.h:2693
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetItemFocus()

static BOOL LISTVIEW_SetItemFocus ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
inlinestatic

Definition at line 3586 of file listview.c.

3587{
3588 INT oldFocus = infoPtr->nFocusedItem;
3589 LVITEMW lvItem;
3590
3591 if (nItem == infoPtr->nFocusedItem) return FALSE;
3592
3593 lvItem.state = nItem == -1 ? 0 : LVIS_FOCUSED;
3594 lvItem.stateMask = LVIS_FOCUSED;
3595 LISTVIEW_SetItemState(infoPtr, nItem == -1 ? infoPtr->nFocusedItem : nItem, &lvItem);
3596
3597 return oldFocus != infoPtr->nFocusedItem;
3598}

Referenced by LISTVIEW_EditLabelT(), LISTVIEW_KeySelection(), LISTVIEW_LButtonDown(), LISTVIEW_RButtonDown(), LISTVIEW_SetGroupSelection(), LISTVIEW_SetItemCount(), and LISTVIEW_ShiftFocus().

◆ LISTVIEW_SetItemPosition()

static BOOL LISTVIEW_SetItemPosition ( LISTVIEW_INFO infoPtr,
INT  nItem,
const POINT pt 
)
static

Definition at line 9075 of file listview.c.

9076{
9077 POINT Origin, Pt;
9078
9079 TRACE("(nItem=%d, pt=%s)\n", nItem, wine_dbgstr_point(pt));
9080
9081 if (!pt || nItem < 0 || nItem >= infoPtr->nItemCount ||
9082 !(infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)) return FALSE;
9083
9084#ifdef __REACTOS__
9085 /* FIXME: This should really call snap to grid if auto-arrange is enabled
9086 and limit the size of the grid to nItemCount elements */
9087 if (is_autoarrange(infoPtr)) return FALSE;
9088#endif
9089
9090 Pt = *pt;
9091 LISTVIEW_GetOrigin(infoPtr, &Origin);
9092
9093 /* This point value seems to be an undocumented feature.
9094 * The best guess is that it means either at the origin,
9095 * or at true beginning of the list. I will assume the origin. */
9096 if ((Pt.x == -1) && (Pt.y == -1))
9097 Pt = Origin;
9098
9099 if (infoPtr->uView == LV_VIEW_ICON)
9100 {
9101 Pt.x -= (infoPtr->nItemWidth - infoPtr->iconSize.cx) / 2;
9102 Pt.y -= ICON_TOP_PADDING;
9103 }
9104 Pt.x -= Origin.x;
9105 Pt.y -= Origin.y;
9106
9107#ifdef __REACTOS__
9108 if (infoPtr->dwLvExStyle & LVS_EX_SNAPTOGRID)
9109 {
9110 Pt.x = max(0, Pt.x + (infoPtr->nItemWidth >> 1) - (Pt.x + (infoPtr->nItemWidth >> 1)) % infoPtr->nItemWidth);
9111 Pt.y = max(0, Pt.y + (infoPtr->nItemHeight >> 1) - (Pt.y + (infoPtr->nItemHeight >> 1)) % infoPtr->nItemHeight);
9112 }
9113#endif
9114
9115 return LISTVIEW_MoveIconTo(infoPtr, nItem, &Pt, FALSE);
9116}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetItemState()

static BOOL LISTVIEW_SetItemState ( LISTVIEW_INFO infoPtr,
INT  nItem,
const LVITEMW item 
)
static

Definition at line 9131 of file listview.c.

9132{
9133 BOOL ret = TRUE;
9134 LVITEMW lvItem;
9135
9136 if (!item) return FALSE;
9137
9138 lvItem.iItem = nItem;
9139 lvItem.iSubItem = 0;
9140 lvItem.mask = LVIF_STATE;
9141 lvItem.state = item->state;
9142 lvItem.stateMask = item->stateMask;
9143 TRACE("item=%s\n", debuglvitem_t(&lvItem, TRUE));
9144
9145 if (nItem == -1)
9146 {
9147 UINT oldstate = 0;
9148 DWORD old_mask;
9149
9150 /* special case optimization for recurring attempt to deselect all */
9151 if (lvItem.state == 0 && lvItem.stateMask == LVIS_SELECTED && !LISTVIEW_GetSelectedCount(infoPtr))
9152 return TRUE;
9153
9154 /* select all isn't allowed in LVS_SINGLESEL */
9155 if ((lvItem.state & lvItem.stateMask & LVIS_SELECTED) && (infoPtr->dwStyle & LVS_SINGLESEL))
9156 return FALSE;
9157
9158 /* focus all isn't allowed */
9159 if (lvItem.state & lvItem.stateMask & LVIS_FOCUSED) return FALSE;
9160
9161 old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE;
9162 if (infoPtr->dwStyle & LVS_OWNERDATA)
9163 {
9164 infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE;
9165 if (!(lvItem.state & LVIS_SELECTED) && LISTVIEW_GetSelectedCount(infoPtr))
9166 oldstate |= LVIS_SELECTED;
9167 if (infoPtr->nFocusedItem != -1) oldstate |= LVIS_FOCUSED;
9168 }
9169
9170 /* apply to all items */
9171 for (lvItem.iItem = 0; lvItem.iItem < infoPtr->nItemCount; lvItem.iItem++)
9172 if (!LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE)) ret = FALSE;
9173
9174 if (infoPtr->dwStyle & LVS_OWNERDATA)
9175 {
9176 NMLISTVIEW nmlv;
9177
9178 infoPtr->notify_mask |= old_mask;
9179
9180 nmlv.iItem = -1;
9181 nmlv.iSubItem = 0;
9182 nmlv.uNewState = lvItem.state & lvItem.stateMask;
9183 nmlv.uOldState = oldstate & lvItem.stateMask;
9184 nmlv.uChanged = LVIF_STATE;
9185 nmlv.ptAction.x = nmlv.ptAction.y = 0;
9186 nmlv.lParam = 0;
9187
9188 notify_listview(infoPtr, LVN_ITEMCHANGED, &nmlv);
9189 }
9190 }
9191 else
9192 ret = LISTVIEW_SetItemT(infoPtr, &lvItem, TRUE);
9193
9194 return ret;
9195}
static INT LISTVIEW_GetSelectedCount(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:3554
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131

Referenced by LISTVIEW_AddGroupSelection(), LISTVIEW_DeleteItem(), LISTVIEW_DeselectAllSkipItems(), LISTVIEW_KeySelection(), LISTVIEW_LButtonDown(), LISTVIEW_MarqueeHighlight(), LISTVIEW_MouseMove(), LISTVIEW_SetExtendedListViewStyle(), LISTVIEW_SetGroupSelection(), LISTVIEW_SetItemFocus(), LISTVIEW_SetSelection(), LISTVIEW_WindowProc(), set_main_item(), and toggle_checkbox_state().

◆ LISTVIEW_SetItemT()

static BOOL LISTVIEW_SetItemT ( LISTVIEW_INFO infoPtr,
LVITEMW lpLVItem,
BOOL  isW 
)
static

Definition at line 4563 of file listview.c.

4564{
4565 HWND hwndSelf = infoPtr->hwndSelf;
4566 LPWSTR pszText = NULL;
4567 BOOL bResult, bChanged = FALSE;
4568 RECT oldItemArea;
4569
4570 TRACE("(lpLVItem=%s, isW=%d)\n", debuglvitem_t(lpLVItem, isW), isW);
4571
4572 if (!lpLVItem || lpLVItem->iItem < 0 || lpLVItem->iItem >= infoPtr->nItemCount)
4573 return FALSE;
4574
4575 /* Store old item area */
4576 LISTVIEW_GetItemBox(infoPtr, lpLVItem->iItem, &oldItemArea);
4577
4578 /* For efficiency, we transform the lpLVItem->pszText to Unicode here */
4579 if ((lpLVItem->mask & LVIF_TEXT) && is_text(lpLVItem->pszText))
4580 {
4581 pszText = lpLVItem->pszText;
4582 lpLVItem->pszText = textdupTtoW(lpLVItem->pszText, isW);
4583 }
4584
4585 /* actually set the fields */
4586 if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return FALSE;
4587
4588 if (lpLVItem->iSubItem)
4589 bResult = set_sub_item(infoPtr, lpLVItem, TRUE, &bChanged);
4590 else
4591 bResult = set_main_item(infoPtr, lpLVItem, FALSE, TRUE, &bChanged);
4592 if (!IsWindow(hwndSelf))
4593 return FALSE;
4594
4595 /* redraw item, if necessary */
4596 if (bChanged && !infoPtr->bIsDrawing)
4597 {
4598 /* this little optimization eliminates some nasty flicker */
4599 if ( infoPtr->uView == LV_VIEW_DETAILS && !(infoPtr->dwStyle & LVS_OWNERDRAWFIXED) &&
4600 !(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) &&
4601 lpLVItem->iSubItem > 0 && lpLVItem->iSubItem <= DPA_GetPtrCount(infoPtr->hdpaColumns) )
4602 LISTVIEW_InvalidateSubItem(infoPtr, lpLVItem->iItem, lpLVItem->iSubItem);
4603 else
4604 {
4605 LISTVIEW_InvalidateRect(infoPtr, &oldItemArea);
4606 LISTVIEW_InvalidateItem(infoPtr, lpLVItem->iItem);
4607 }
4608 }
4609 /* restore text */
4610 if (pszText)
4611 {
4612 textfreeT(lpLVItem->pszText, isW);
4613 lpLVItem->pszText = pszText;
4614 }
4615
4616 return bResult;
4617}
static void LISTVIEW_InvalidateSubItem(const LISTVIEW_INFO *infoPtr, INT nItem, INT nSubItem)
Definition: listview.c:1766

Referenced by LISTVIEW_EndEditLabelT(), LISTVIEW_SetItemState(), LISTVIEW_SetItemTextT(), and LISTVIEW_WindowProc().

◆ LISTVIEW_SetItemTextT()

static BOOL LISTVIEW_SetItemTextT ( LISTVIEW_INFO infoPtr,
INT  nItem,
const LVITEMW lpLVItem,
BOOL  isW 
)
static

Definition at line 9211 of file listview.c.

9212{
9213 LVITEMW lvItem;
9214
9215 if (!lpLVItem || nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE;
9216 if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
9217
9218 lvItem.iItem = nItem;
9219 lvItem.iSubItem = lpLVItem->iSubItem;
9220 lvItem.mask = LVIF_TEXT;
9221 lvItem.pszText = lpLVItem->pszText;
9222 lvItem.cchTextMax = lpLVItem->cchTextMax;
9223
9224 TRACE("(nItem=%d, lpLVItem=%s, isW=%d)\n", nItem, debuglvitem_t(&lvItem, isW), isW);
9225
9226 return LISTVIEW_SetItemT(infoPtr, &lvItem, isW);
9227}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetRedraw()

static LRESULT LISTVIEW_SetRedraw ( LISTVIEW_INFO infoPtr,
BOOL  redraw 
)
static

Definition at line 11160 of file listview.c.

11161{
11162 TRACE("old=%d, new=%d\n", infoPtr->redraw, redraw);
11163
11164 if (infoPtr->redraw == !!redraw)
11165 return 0;
11166
11167 if (!(infoPtr->redraw = !!redraw))
11168 return 0;
11169
11170 if (is_autoarrange(infoPtr))
11171 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
11172 LISTVIEW_UpdateScroll(infoPtr);
11173
11174 /* despite what the WM_SETREDRAW docs says, apps expect us
11175 * to invalidate the listview here... stupid! */
11176 LISTVIEW_InvalidateList(infoPtr);
11177
11178 return 0;
11179}
void redraw(int x, int y, int cx, int cy)
Definition: qtewin.cpp:1248

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetSelection()

static void LISTVIEW_SetSelection ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 3798 of file listview.c.

3799{
3800 LVITEMW lvItem;
3801
3802 TRACE("nItem=%d\n", nItem);
3803
3804 LISTVIEW_DeselectAllSkipItem(infoPtr, nItem);
3805
3806 lvItem.state = LVIS_FOCUSED | LVIS_SELECTED;
3808 LISTVIEW_SetItemState(infoPtr, nItem, &lvItem);
3809
3810 infoPtr->nSelectionMark = nItem;
3811}

Referenced by LISTVIEW_EditLabelT(), LISTVIEW_KeySelection(), LISTVIEW_LButtonDown(), LISTVIEW_LButtonUp(), LISTVIEW_MouseHover(), and LISTVIEW_RButtonDown().

◆ LISTVIEW_SetSelectionMark()

static INT LISTVIEW_SetSelectionMark ( LISTVIEW_INFO infoPtr,
INT  nIndex 
)
static

Definition at line 9240 of file listview.c.

9241{
9242 INT nOldIndex = infoPtr->nSelectionMark;
9243
9244 TRACE("(nIndex=%d)\n", nIndex);
9245
9246 if (nIndex >= -1 && nIndex < infoPtr->nItemCount)
9247 infoPtr->nSelectionMark = nIndex;
9248
9249 return nOldIndex;
9250}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetTextBkColor()

static BOOL LISTVIEW_SetTextBkColor ( LISTVIEW_INFO infoPtr,
COLORREF  color 
)
static

Definition at line 9264 of file listview.c.

9265{
9266 TRACE("(color=%x)\n", color);
9267
9268 infoPtr->clrTextBk = color;
9269 return TRUE;
9270}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetTextColor()

static BOOL LISTVIEW_SetTextColor ( LISTVIEW_INFO infoPtr,
COLORREF  color 
)
static

Definition at line 9284 of file listview.c.

9285{
9286 TRACE("(color=%x)\n", color);
9287
9288 infoPtr->clrText = color;
9289 return TRUE;
9290}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetToolTips()

static HWND LISTVIEW_SetToolTips ( LISTVIEW_INFO infoPtr,
HWND  hwndNewToolTip 
)
static

Definition at line 9303 of file listview.c.

9304{
9305 HWND hwndOldToolTip = infoPtr->hwndToolTip;
9306 infoPtr->hwndToolTip = hwndNewToolTip;
9307 return hwndOldToolTip;
9308}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetUnicodeFormat()

static BOOL LISTVIEW_SetUnicodeFormat ( LISTVIEW_INFO infoPtr,
BOOL  unicode 
)
static

Definition at line 9320 of file listview.c.

9321{
9322 SHORT rc = infoPtr->notifyFormat;
9323 infoPtr->notifyFormat = (unicode) ? NFR_UNICODE : NFR_ANSI;
9324 return rc == NFR_UNICODE;
9325}
short SHORT
Definition: pedump.c:59
#define NFR_UNICODE
Definition: winuser.h:2459

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetVersion()

static LRESULT LISTVIEW_SetVersion ( LISTVIEW_INFO infoPtr,
DWORD  iVersion 
)
static

Definition at line 11477 of file listview.c.

11478{
11479 INT iOldVersion = infoPtr->iVersion;
11480
11481 if (iVersion > COMCTL32_VERSION)
11482 return -1;
11483
11484 infoPtr->iVersion = iVersion;
11485
11486 TRACE("new version %d\n", iVersion);
11487
11488 return iOldVersion;
11489}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetView()

static INT LISTVIEW_SetView ( LISTVIEW_INFO infoPtr,
DWORD  nView 
)
static

Definition at line 9338 of file listview.c.

9339{
9341
9342 if (infoPtr->uView == nView) return 1;
9343
9344 if ((INT)nView < 0 || nView > LV_VIEW_MAX) return -1;
9345 if (nView == LV_VIEW_TILE)
9346 {
9347 FIXME("View LV_VIEW_TILE unimplemented\n");
9348 return -1;
9349 }
9350
9351 infoPtr->uView = nView;
9352
9353 SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
9354 ShowWindow(infoPtr->hwndHeader, SW_HIDE);
9355
9356 ShowScrollBar(infoPtr->hwndSelf, SB_BOTH, FALSE);
9357 SetRectEmpty(&infoPtr->rcFocus);
9358
9359 himl = (nView == LV_VIEW_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
9360 set_icon_size(&infoPtr->iconSize, himl, nView != LV_VIEW_ICON);
9361
9362 switch (nView)
9363 {
9364 case LV_VIEW_ICON:
9365 case LV_VIEW_SMALLICON:
9366 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
9367 break;
9368 case LV_VIEW_DETAILS:
9369 {
9370 HDLAYOUT hl;
9371 WINDOWPOS wp;
9372
9373 LISTVIEW_CreateHeader( infoPtr );
9374
9375 hl.prc = &infoPtr->rcList;
9376 hl.pwpos = &wp;
9377 SendMessageW(infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl);
9378 SetWindowPos(infoPtr->hwndHeader, infoPtr->hwndSelf, wp.x, wp.y, wp.cx, wp.cy,
9380 break;
9381 }
9382 case LV_VIEW_LIST:
9383 break;
9384 }
9385
9386 LISTVIEW_UpdateItemSize(infoPtr);
9387 LISTVIEW_UpdateSize(infoPtr);
9388 LISTVIEW_UpdateScroll(infoPtr);
9389 LISTVIEW_InvalidateList(infoPtr);
9390
9391 TRACE("nView=%d\n", nView);
9392
9393 return 1;
9394}
#define HDM_LAYOUT
Definition: commctrl.h:767
#define LV_VIEW_TILE
Definition: commctrl.h:2844
#define LV_VIEW_MAX
Definition: commctrl.h:2845
WINDOWPOS * pwpos
Definition: commctrl.h:764
RECT * prc
Definition: commctrl.h:763
UINT flags
Definition: winuser.h:3594
#define SWP_SHOWWINDOW
Definition: winuser.h:1248
#define SB_BOTH
Definition: winuser.h:555
#define SWP_HIDEWINDOW
Definition: winuser.h:1241
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_ShiftFocus()

static void LISTVIEW_ShiftFocus ( LISTVIEW_INFO infoPtr,
INT  focus,
INT  item,
INT  direction 
)
static

Definition at line 3618 of file listview.c.

3619{
3620 DWORD old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE;
3621
3622 infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE;
3623 focus = shift_item(infoPtr, focus, item, direction);
3624 if (focus != infoPtr->nFocusedItem)
3625 LISTVIEW_SetItemFocus(infoPtr, focus);
3626 infoPtr->notify_mask |= old_mask;
3627}
static INT shift_item(const LISTVIEW_INFO *infoPtr, INT nShiftItem, INT nItem, INT direction)
Definition: listview.c:3600

Referenced by LISTVIEW_DeleteItem(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_ShiftIndices()

static void LISTVIEW_ShiftIndices ( LISTVIEW_INFO infoPtr,
INT  nItem,
INT  direction 
)
static

DESCRIPTION: Updates the various indices after an item has been inserted or deleted.

PARAMETER(S): [I] infoPtr : valid pointer to the listview structure [I] nItem : item index [I] direction : Direction of shift, +1 or -1.

RETURN: None

Definition at line 3641 of file listview.c.

3642{
3643 TRACE("Shifting %i, %i steps\n", nItem, direction);
3644
3645 ranges_shift(infoPtr->selectionRanges, nItem, direction, infoPtr->nItemCount);
3646 assert(abs(direction) == 1);
3647 infoPtr->nSelectionMark = shift_item(infoPtr, infoPtr->nSelectionMark, nItem, direction);
3648
3649 /* But we are not supposed to modify nHotItem! */
3650}
static BOOL ranges_shift(RANGES ranges, INT nItem, INT delta, INT nUpper)
Definition: listview.c:3319

Referenced by LISTVIEW_DeleteItem(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_ShowFocusRect()

static void LISTVIEW_ShowFocusRect ( const LISTVIEW_INFO infoPtr,
BOOL  fShow 
)
static

Definition at line 2210 of file listview.c.

2211{
2212 HDC hdc;
2213
2214 TRACE("fShow=%d, nItem=%d\n", fShow, infoPtr->nFocusedItem);
2215
2216 if (infoPtr->nFocusedItem < 0) return;
2217
2218 /* we need some gymnastics in ICON mode to handle large items */
2219 if (infoPtr->uView == LV_VIEW_ICON)
2220 {
2221 RECT rcBox;
2222
2223 LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcBox);
2224 if ((rcBox.bottom - rcBox.top) > infoPtr->nItemHeight)
2225 {
2226 LISTVIEW_InvalidateRect(infoPtr, &rcBox);
2227 return;
2228 }
2229 }
2230
2231 if (!(hdc = GetDC(infoPtr->hwndSelf))) return;
2232
2233 /* for some reason, owner draw should work only in report mode */
2234 if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
2235 {
2236 DRAWITEMSTRUCT dis;
2237 LVITEMW item;
2238
2239 HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
2240 HFONT hOldFont = SelectObject(hdc, hFont);
2241
2242 item.iItem = infoPtr->nFocusedItem;
2243 item.iSubItem = 0;
2244 item.mask = LVIF_PARAM;
2245 if (!LISTVIEW_GetItemW(infoPtr, &item)) goto done;
2246
2247 ZeroMemory(&dis, sizeof(dis));
2248 dis.CtlType = ODT_LISTVIEW;
2249 dis.CtlID = (UINT)GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
2250 dis.itemID = item.iItem;
2251 dis.itemAction = ODA_FOCUS;
2252 if (fShow) dis.itemState |= ODS_FOCUS;
2253 dis.hwndItem = infoPtr->hwndSelf;
2254 dis.hDC = hdc;
2255 LISTVIEW_GetItemBox(infoPtr, dis.itemID, &dis.rcItem);
2256 dis.itemData = item.lParam;
2257
2258 SendMessageW(infoPtr->hwndNotify, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis);
2259
2260 SelectObject(hdc, hOldFont);
2261 }
2262 else
2263 LISTVIEW_InvalidateItem(infoPtr, infoPtr->nFocusedItem);
2264
2265done:
2266 ReleaseDC(infoPtr->hwndSelf, hdc);
2267}
#define ODA_FOCUS
Definition: winuser.h:2544

Referenced by LISTVIEW_KillFocus(), and LISTVIEW_SetFocus().

◆ LISTVIEW_ShowWindow()

static LRESULT LISTVIEW_ShowWindow ( LISTVIEW_INFO infoPtr,
WPARAM  bShown,
LPARAM  iStatus 
)
static

Definition at line 11436 of file listview.c.

11437{
11438 /* header delayed creation */
11439 if ((infoPtr->uView == LV_VIEW_DETAILS) && bShown)
11440 {
11441 LISTVIEW_CreateHeader(infoPtr);
11442
11443 if (!(LVS_NOCOLUMNHEADER & infoPtr->dwStyle))
11445 }
11446
11447 return DefWindowProcW(infoPtr->hwndSelf, WM_SHOWWINDOW, bShown, iStatus);
11448}
#define WM_SHOWWINDOW
Definition: winuser.h:1628

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Size()

static LRESULT LISTVIEW_Size ( LISTVIEW_INFO infoPtr,
int  Width,
int  Height 
)
static

Definition at line 11194 of file listview.c.

11195{
11196 RECT rcOld = infoPtr->rcList;
11197
11198 TRACE("(width=%d, height=%d)\n", Width, Height);
11199
11200 LISTVIEW_UpdateSize(infoPtr);
11201 if (EqualRect(&rcOld, &infoPtr->rcList)) return 0;
11202
11203 /* do not bother with display related stuff if we're not redrawing */
11204 if (!is_redrawing(infoPtr)) return 0;
11205
11206 if (is_autoarrange(infoPtr))
11207 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
11208
11209 LISTVIEW_UpdateScroll(infoPtr);
11210
11211 /* refresh all only for lists whose height changed significantly */
11212 if ((infoPtr->uView == LV_VIEW_LIST) &&
11213 (rcOld.bottom - rcOld.top) / infoPtr->nItemHeight !=
11214 (infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight)
11215 LISTVIEW_InvalidateList(infoPtr);
11216
11217 return 0;
11218}
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SortItems()

static BOOL LISTVIEW_SortItems ( LISTVIEW_INFO infoPtr,
PFNLVCOMPARE  pfnCompare,
LPARAM  lParamSort,
BOOL  IsEx 
)
static

Definition at line 9460 of file listview.c.

9462{
9463 HDPA hdpaSubItems;
9464 ITEM_INFO *lpItem;
9465 LPVOID selectionMarkItem = NULL;
9466 LPVOID focusedItem = NULL;
9467 int i;
9468
9469 TRACE("(pfnCompare=%p, lParamSort=%lx)\n", pfnCompare, lParamSort);
9470
9471 if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
9472
9473 if (!pfnCompare) return FALSE;
9474 if (!infoPtr->hdpaItems) return FALSE;
9475
9476 /* if there are 0 or 1 items, there is no need to sort */
9477 if (infoPtr->nItemCount < 2) return TRUE;
9478
9479 /* clear selection */
9480 ranges_clear(infoPtr->selectionRanges);
9481
9482 /* save selection mark and focused item */
9483 if (infoPtr->nSelectionMark >= 0)
9484 selectionMarkItem = DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nSelectionMark);
9485 if (infoPtr->nFocusedItem >= 0)
9486 focusedItem = DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nFocusedItem);
9487
9488 infoPtr->pfnCompare = pfnCompare;
9489 infoPtr->lParamSort = lParamSort;
9490 if (IsEx)
9492 else
9494
9495 /* restore selection ranges */
9496 for (i=0; i < infoPtr->nItemCount; i++)
9497 {
9498 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i);
9499 lpItem = DPA_GetPtr(hdpaSubItems, 0);
9500
9501 if (lpItem->state & LVIS_SELECTED)
9502 ranges_additem(infoPtr->selectionRanges, i);
9503 }
9504 /* restore selection mark and focused item */
9505 infoPtr->nSelectionMark = DPA_GetPtrIndex(infoPtr->hdpaItems, selectionMarkItem);
9506 infoPtr->nFocusedItem = DPA_GetPtrIndex(infoPtr->hdpaItems, focusedItem);
9507
9508 /* I believe nHotItem should be left alone, see LISTVIEW_ShiftIndices */
9509
9510 /* refresh the display */
9511 LISTVIEW_InvalidateList(infoPtr);
9512 return TRUE;
9513}
BOOL WINAPI DPA_Sort(HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam)
Definition: dpa.c:813
static INT WINAPI LISTVIEW_CallBackCompare(LPVOID first, LPVOID second, LPARAM lParam)
Definition: listview.c:9412
static INT WINAPI LISTVIEW_CallBackCompareEx(LPVOID first, LPVOID second, LPARAM lParam)
Definition: listview.c:9436

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_StyleChanged()

static INT LISTVIEW_StyleChanged ( LISTVIEW_INFO infoPtr,
WPARAM  wStyleType,
const STYLESTRUCT lpss 
)
static

Definition at line 11300 of file listview.c.

11302{
11303 UINT uNewView, uOldView;
11304 UINT style;
11305
11306 TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
11307 wStyleType, lpss->styleOld, lpss->styleNew);
11308
11309 if (wStyleType != GWL_STYLE || lpss->styleNew == infoPtr->dwStyle) return 0;
11310
11311 infoPtr->dwStyle = lpss->styleNew;
11312
11313 if (((lpss->styleOld & WS_HSCROLL) != 0)&&
11314 ((lpss->styleNew & WS_HSCROLL) == 0))
11315 ShowScrollBar(infoPtr->hwndSelf, SB_HORZ, FALSE);
11316
11317 if (((lpss->styleOld & WS_VSCROLL) != 0)&&
11318 ((lpss->styleNew & WS_VSCROLL) == 0))
11319 ShowScrollBar(infoPtr->hwndSelf, SB_VERT, FALSE);
11320
11321 uNewView = lpss->styleNew & LVS_TYPEMASK;
11322 uOldView = lpss->styleOld & LVS_TYPEMASK;
11323
11324 if (uNewView != uOldView)
11325 {
11327
11328 /* LVM_SETVIEW doesn't change window style bits within LVS_TYPEMASK,
11329 changing style updates current view only when view bits change. */
11330 map_style_view(infoPtr);
11331 SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
11332 ShowWindow(infoPtr->hwndHeader, SW_HIDE);
11333
11334 ShowScrollBar(infoPtr->hwndSelf, SB_BOTH, FALSE);
11335 SetRectEmpty(&infoPtr->rcFocus);
11336
11337 himl = (uNewView == LVS_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
11338 set_icon_size(&infoPtr->iconSize, himl, uNewView != LVS_ICON);
11339
11340 if (uNewView == LVS_REPORT)
11341 {
11342 HDLAYOUT hl;
11343 WINDOWPOS wp;
11344
11345 LISTVIEW_CreateHeader( infoPtr );
11346
11347 hl.prc = &infoPtr->rcList;
11348 hl.pwpos = &wp;
11349 SendMessageW( infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl );
11350 SetWindowPos(infoPtr->hwndHeader, infoPtr->hwndSelf, wp.x, wp.y, wp.cx, wp.cy,
11351 wp.flags | ((infoPtr->dwStyle & LVS_NOCOLUMNHEADER)
11353 }
11354
11355 LISTVIEW_UpdateItemSize(infoPtr);
11356 }
11357
11358 if (uNewView == LVS_REPORT || infoPtr->dwLvExStyle & LVS_EX_HEADERINALLVIEWS)
11359 {
11360 if ((lpss->styleOld ^ lpss->styleNew) & LVS_NOCOLUMNHEADER)
11361 {
11362 if (lpss->styleNew & LVS_NOCOLUMNHEADER)
11363 {
11364 /* Turn off the header control */
11366 TRACE("Hide header control, was 0x%08x\n", style);
11368 } else {
11369 /* Turn on the header control */
11370 if ((style = GetWindowLongW(infoPtr->hwndHeader, GWL_STYLE)) & HDS_HIDDEN)
11371 {
11372 TRACE("Show header control, was 0x%08x\n", style);
11374 }
11375 }
11376 }
11377 }
11378
11379 if ( (uNewView == LVS_ICON || uNewView == LVS_SMALLICON) &&
11380 (uNewView != uOldView || ((lpss->styleNew ^ lpss->styleOld) & LVS_ALIGNMASK)) )
11381 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
11382
11383 /* update the size of the client area */
11384 LISTVIEW_UpdateSize(infoPtr);
11385
11386 /* add scrollbars if needed */
11387 LISTVIEW_UpdateScroll(infoPtr);
11388
11389 /* invalidate client area + erase background */
11390 LISTVIEW_InvalidateList(infoPtr);
11391
11392 return 0;
11393}
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
#define LVS_ICON
Definition: commctrl.h:2261
#define LVS_TYPEMASK
Definition: commctrl.h:2265
#define LVS_REPORT
Definition: commctrl.h:2262
#define LVS_SMALLICON
Definition: commctrl.h:2263
#define LVS_ALIGNMASK
Definition: commctrl.h:2281
DWORD styleNew
Definition: winuser.h:3693
DWORD styleOld
Definition: winuser.h:3692

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_StyleChanging()

static INT LISTVIEW_StyleChanging ( WPARAM  wStyleType,
STYLESTRUCT lpss 
)
static

Definition at line 11406 of file listview.c.

11408{
11409 TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
11410 wStyleType, lpss->styleOld, lpss->styleNew);
11411
11412 /* don't forward LVS_OWNERDATA only if not already set to */
11413 if ((lpss->styleNew ^ lpss->styleOld) & LVS_OWNERDATA)
11414 {
11415 if (lpss->styleOld & LVS_OWNERDATA)
11416 lpss->styleNew |= LVS_OWNERDATA;
11417 else
11418 lpss->styleNew &= ~LVS_OWNERDATA;
11419 }
11420
11421 return 0;
11422}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_ThemeChanged()

static LRESULT LISTVIEW_ThemeChanged ( const LISTVIEW_INFO infoPtr)
static

Definition at line 9526 of file listview.c.

9527{
9528 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
9529 CloseThemeData(theme);
9531 return 0;
9532}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_TrackMouse()

static LRESULT LISTVIEW_TrackMouse ( const LISTVIEW_INFO infoPtr,
POINT  pt 
)
static

Definition at line 10310 of file listview.c.

10311{
10312 MSG msg;
10313 RECT r;
10314
10315 r.top = r.bottom = pt.y;
10316 r.left = r.right = pt.x;
10317
10319
10320 SetCapture(infoPtr->hwndSelf);
10321
10322 while (1)
10323 {
10324 if (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD))
10325 {
10326 if (msg.message == WM_MOUSEMOVE)
10327 {
10328 pt.x = (short)LOWORD(msg.lParam);
10329 pt.y = (short)HIWORD(msg.lParam);
10330 if (PtInRect(&r, pt))
10331 continue;
10332 else
10333 {
10335 return 1;
10336 }
10337 }
10338 else if (msg.message >= WM_LBUTTONDOWN &&
10339 msg.message <= WM_RBUTTONDBLCLK)
10340 {
10341 break;
10342 }
10343
10345 }
10346
10347 if (GetCapture() != infoPtr->hwndSelf)
10348 return 0;
10349 }
10350
10352 return 0;
10353}
#define msg(x)
Definition: auth_time.c:54
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1781
#define WM_MOUSEMOVE
Definition: winuser.h:1775
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
#define PM_NOYIELD
Definition: winuser.h:1197
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1196
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)

Referenced by LISTVIEW_RButtonDown().

◆ LISTVIEW_Unregister()

void LISTVIEW_Unregister ( void  )

Definition at line 12041 of file listview.c.

12042{
12044}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ LISTVIEW_Update()

static BOOL LISTVIEW_Update ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 9546 of file listview.c.

9547{
9548 TRACE("(nItem=%d)\n", nItem);
9549
9550 if (nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE;
9551
9552 /* rearrange with default alignment style */
9553 if (is_autoarrange(infoPtr))
9554 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
9555 else
9556 LISTVIEW_InvalidateItem(infoPtr, nItem);
9557
9558 return TRUE;
9559}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_UpdateHeaderSize()

static void LISTVIEW_UpdateHeaderSize ( const LISTVIEW_INFO infoPtr,
INT  nNewScrollPos 
)
static

Definition at line 2015 of file listview.c.

2016{
2017 RECT winRect;
2018 POINT point[2];
2019
2020 TRACE("nNewScrollPos=%d\n", nNewScrollPos);
2021
2022 if (!infoPtr->hwndHeader) return;
2023
2024 GetWindowRect(infoPtr->hwndHeader, &winRect);
2025 point[0].x = winRect.left;
2026 point[0].y = winRect.top;
2027 point[1].x = winRect.right;
2028 point[1].y = winRect.bottom;
2029
2031 point[0].x = -nNewScrollPos;
2032 point[1].x += nNewScrollPos;
2033
2034 SetWindowPos(infoPtr->hwndHeader,0,
2035 point[0].x,point[0].y,point[1].x,point[1].y,
2038}
POINTL point
Definition: edittest.c:50
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
#define SWP_NOACTIVATE
Definition: winuser.h:1242
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define HWND_DESKTOP
Definition: winuser.h:1209

Referenced by LISTVIEW_HScroll(), and LISTVIEW_UpdateHScroll().

◆ LISTVIEW_UpdateHScroll()

static INT LISTVIEW_UpdateHScroll ( LISTVIEW_INFO infoPtr)
static

Definition at line 2040 of file listview.c.

2041{
2042 SCROLLINFO horzInfo;
2043 INT dx;
2044
2045 ZeroMemory(&horzInfo, sizeof(SCROLLINFO));
2046 horzInfo.cbSize = sizeof(SCROLLINFO);
2047 horzInfo.nPage = infoPtr->rcList.right - infoPtr->rcList.left;
2048
2049 /* for now, we'll set info.nMax to the _count_, and adjust it later */
2050 if (infoPtr->uView == LV_VIEW_LIST)
2051 {
2052 INT nPerCol = LISTVIEW_GetCountPerColumn(infoPtr);
2053 horzInfo.nMax = (infoPtr->nItemCount + nPerCol - 1) / nPerCol;
2054
2055 /* scroll by at least one column per page */
2056 if(horzInfo.nPage < infoPtr->nItemWidth)
2057 horzInfo.nPage = infoPtr->nItemWidth;
2058
2059 if (infoPtr->nItemWidth)
2060 horzInfo.nPage /= infoPtr->nItemWidth;
2061 }
2062 else if (infoPtr->uView == LV_VIEW_DETAILS)
2063 {
2064 horzInfo.nMax = infoPtr->nItemWidth;
2065 }
2066 else /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
2067 {
2068 RECT rcView;
2069
2070 if (LISTVIEW_GetViewRect(infoPtr, &rcView)) horzInfo.nMax = rcView.right - rcView.left;
2071 }
2072
2073 if (LISTVIEW_IsHeaderEnabled(infoPtr))
2074 {
2075 if (DPA_GetPtrCount(infoPtr->hdpaColumns))
2076 {
2077 RECT rcHeader;
2078 INT index;
2079
2081 DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
2082
2083 LISTVIEW_GetHeaderRect(infoPtr, index, &rcHeader);
2084 horzInfo.nMax = rcHeader.right;
2085 TRACE("horzInfo.nMax=%d\n", horzInfo.nMax);
2086 }
2087 }
2088
2089 horzInfo.fMask = SIF_RANGE | SIF_PAGE;
2090 horzInfo.nMax = max(horzInfo.nMax - 1, 0);
2091#ifdef __REACTOS__ /* CORE-16466 part 1 of 4 */
2092 horzInfo.nMax = (horzInfo.nPage == 0 ? 0 : horzInfo.nMax);
2093#endif
2094 dx = GetScrollPos(infoPtr->hwndSelf, SB_HORZ);
2095 dx -= SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE);
2096 TRACE("horzInfo=%s\n", debugscrollinfo(&horzInfo));
2097
2098 /* Update the Header Control */
2099 if (infoPtr->hwndHeader)
2100 {
2101 horzInfo.fMask = SIF_POS;
2102 GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo);
2103 LISTVIEW_UpdateHeaderSize(infoPtr, horzInfo.nPos);
2104 }
2105
2106 LISTVIEW_UpdateSize(infoPtr);
2107 return dx;
2108}
static BOOL LISTVIEW_IsHeaderEnabled(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1706
static const char * debugscrollinfo(const SCROLLINFO *pScrollInfo)
Definition: listview.c:580
static BOOL LISTVIEW_GetViewRect(const LISTVIEW_INFO *, LPRECT)
Definition: listview.c:2977
int WINAPI GetScrollPos(_In_ HWND, _In_ int)

Referenced by LISTVIEW_UpdateScroll().

◆ LISTVIEW_UpdateItemSize()

static void LISTVIEW_UpdateItemSize ( LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 3130 of file listview.c.

3131{
3132 infoPtr->nItemWidth = LISTVIEW_CalculateItemWidth(infoPtr);
3133 infoPtr->nItemHeight = LISTVIEW_CalculateItemHeight(infoPtr);
3134}
static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:3037

Referenced by LISTVIEW_Create(), LISTVIEW_DeleteColumn(), LISTVIEW_InsertColumnT(), LISTVIEW_Notify(), LISTVIEW_Paint(), LISTVIEW_SetIconSpacing(), LISTVIEW_SetView(), and LISTVIEW_StyleChanged().

◆ LISTVIEW_UpdateScroll()

static void LISTVIEW_UpdateScroll ( LISTVIEW_INFO infoPtr)
static

Definition at line 2172 of file listview.c.

2173{
2174 INT dx, dy, pass;
2175
2176 if ((infoPtr->dwStyle & LVS_NOSCROLL) || !is_redrawing(infoPtr)) return;
2177
2178 /* Setting the horizontal scroll can change the listview size
2179 * (and potentially everything else) so we need to recompute
2180 * everything again for the vertical scroll and vice-versa
2181 */
2182 for (dx = 0, dy = 0, pass = 0; pass <= 1; pass++)
2183 {
2184 dx += LISTVIEW_UpdateHScroll(infoPtr);
2185 dy += LISTVIEW_UpdateVScroll(infoPtr);
2186 }
2187
2188 /* Change of the range may have changed the scroll pos. If so move the content */
2189 if (dx != 0 || dy != 0)
2190 {
2191 RECT listRect;
2192 listRect = infoPtr->rcList;
2193 ScrollWindowEx(infoPtr->hwndSelf, dx, dy, &listRect, &listRect, 0, 0,
2195 }
2196}
static INT LISTVIEW_UpdateVScroll(LISTVIEW_INFO *infoPtr)
Definition: listview.c:2110
static INT LISTVIEW_UpdateHScroll(LISTVIEW_INFO *infoPtr)
Definition: listview.c:2040
#define LVS_NOSCROLL
Definition: commctrl.h:2275
pass
Definition: typegen.h:25

Referenced by LISTVIEW_Create(), LISTVIEW_DeleteAllItems(), LISTVIEW_Notify(), LISTVIEW_Paint(), LISTVIEW_ScrollColumns(), LISTVIEW_ScrollOnInsert(), LISTVIEW_SetExtendedListViewStyle(), LISTVIEW_SetFont(), LISTVIEW_SetImageList(), LISTVIEW_SetItemCount(), LISTVIEW_SetRedraw(), LISTVIEW_SetView(), LISTVIEW_Size(), and LISTVIEW_StyleChanged().

◆ LISTVIEW_UpdateSize()

static void LISTVIEW_UpdateSize ( LISTVIEW_INFO infoPtr)
static

Definition at line 11230 of file listview.c.

11231{
11232 TRACE("uView=%d, rcList(old)=%s\n", infoPtr->uView, wine_dbgstr_rect(&infoPtr->rcList));
11233
11234 GetClientRect(infoPtr->hwndSelf, &infoPtr->rcList);
11235
11236 if (infoPtr->uView == LV_VIEW_LIST)
11237 {
11238 /* Apparently the "LIST" style is supposed to have the same
11239 * number of items in a column even if there is no scroll bar.
11240 * Since if a scroll bar already exists then the bottom is already
11241 * reduced, only reduce if the scroll bar does not currently exist.
11242 * The "2" is there to mimic the native control. I think it may be
11243 * related to either padding or edges. (GLA 7/2002)
11244 */
11245 if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & WS_HSCROLL))
11247 infoPtr->rcList.bottom = max (infoPtr->rcList.bottom - 2, 0);
11248 }
11249
11250 /* When ListView control is created invisible, header isn't created right away. */
11251 if (infoPtr->hwndHeader)
11252 {
11253 POINT origin;
11254 WINDOWPOS wp;
11255 HDLAYOUT hl;
11256 RECT rect;
11257
11258 LISTVIEW_GetOrigin(infoPtr, &origin);
11259
11260 rect = infoPtr->rcList;
11261 rect.left += origin.x;
11262
11263 hl.prc = &rect;
11264 hl.pwpos = &wp;
11265 SendMessageW( infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl );
11266 TRACE(" wp.flags=0x%08x, wp=%d,%d (%dx%d)\n", wp.flags, wp.x, wp.y, wp.cx, wp.cy);
11267
11268 if (LISTVIEW_IsHeaderEnabled(infoPtr))
11269 wp.flags |= SWP_SHOWWINDOW;
11270 else
11271 {
11272 wp.flags |= SWP_HIDEWINDOW;
11273 wp.cy = 0;
11274 }
11275
11276 SetWindowPos(wp.hwnd, wp.hwndInsertAfter, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
11277 TRACE(" after SWP wp=%d,%d (%dx%d)\n", wp.x, wp.y, wp.cx, wp.cy);
11278
11279 infoPtr->rcList.top = max(wp.cy, 0);
11280 }
11281 /* extra padding for grid */
11282 if (infoPtr->uView == LV_VIEW_DETAILS && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES)
11283 infoPtr->rcList.top += 2;
11284
11285 TRACE(" rcList=%s\n", wine_dbgstr_rect(&infoPtr->rcList));
11286}
HWND hwnd
Definition: winuser.h:3588
HWND hwndInsertAfter
Definition: winuser.h:3589
#define SM_CYHSCROLL
Definition: winuser.h:962

Referenced by LISTVIEW_Create(), LISTVIEW_CreateHeader(), LISTVIEW_SetExtendedListViewStyle(), LISTVIEW_SetFont(), LISTVIEW_SetView(), LISTVIEW_Size(), LISTVIEW_StyleChanged(), LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateVScroll().

◆ LISTVIEW_UpdateVScroll()

static INT LISTVIEW_UpdateVScroll ( LISTVIEW_INFO infoPtr)
static

Definition at line 2110 of file listview.c.

2111{
2112 SCROLLINFO vertInfo;
2113 INT dy;
2114
2115 ZeroMemory(&vertInfo, sizeof(SCROLLINFO));
2116 vertInfo.cbSize = sizeof(SCROLLINFO);
2117#ifdef __REACTOS__ /* CORE-16466 part 2 of 4 */
2118 vertInfo.nPage = max(0, infoPtr->rcList.bottom - infoPtr->rcList.top);
2119#else
2120 vertInfo.nPage = infoPtr->rcList.bottom - infoPtr->rcList.top;
2121#endif
2122
2123 if (infoPtr->uView == LV_VIEW_DETAILS)
2124 {
2125#ifdef __REACTOS__ /* CORE-16466 part 3a of 4 */
2126 if (vertInfo.nPage != 0)
2127 {
2128#endif
2129 vertInfo.nMax = infoPtr->nItemCount;
2130
2131 /* scroll by at least one page */
2132 if(vertInfo.nPage < infoPtr->nItemHeight)
2133 vertInfo.nPage = infoPtr->nItemHeight;
2134
2135 if (infoPtr->nItemHeight > 0)
2136 vertInfo.nPage /= infoPtr->nItemHeight;
2137#ifdef __REACTOS__ /* CORE-16466 part 3b of 4 */
2138 }
2139#endif
2140 }
2141 else if (infoPtr->uView != LV_VIEW_LIST) /* LV_VIEW_ICON, or LV_VIEW_SMALLICON */
2142 {
2143 RECT rcView;
2144
2145 if (LISTVIEW_GetViewRect(infoPtr, &rcView)) vertInfo.nMax = rcView.bottom - rcView.top;
2146 }
2147
2148 vertInfo.fMask = SIF_RANGE | SIF_PAGE;
2149 vertInfo.nMax = max(vertInfo.nMax - 1, 0);
2150#ifdef __REACTOS__ /* CORE-16466 part 4 of 4 */
2151 vertInfo.nMax = (vertInfo.nPage == 0 ? 0 : vertInfo.nMax);
2152#endif
2153 dy = GetScrollPos(infoPtr->hwndSelf, SB_VERT);
2154 dy -= SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE);
2155 TRACE("vertInfo=%s\n", debugscrollinfo(&vertInfo));
2156
2157 LISTVIEW_UpdateSize(infoPtr);
2158 return dy;
2159}

Referenced by LISTVIEW_UpdateScroll().

◆ LISTVIEW_VScroll()

static LRESULT LISTVIEW_VScroll ( LISTVIEW_INFO infoPtr,
INT  nScrollCode,
INT  nScrollDiff 
)
static

Definition at line 9879 of file listview.c.

9881{
9882 INT nOldScrollPos, nNewScrollPos;
9883 SCROLLINFO scrollInfo;
9884 BOOL is_an_icon;
9885
9886 TRACE("(nScrollCode=%d(%s), nScrollDiff=%d)\n", nScrollCode,
9887 debugscrollcode(nScrollCode), nScrollDiff);
9888
9889 if (infoPtr->hwndEdit) SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
9890
9891 scrollInfo.cbSize = sizeof(SCROLLINFO);
9892 scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS;
9893
9894 is_an_icon = ((infoPtr->uView == LV_VIEW_ICON) || (infoPtr->uView == LV_VIEW_SMALLICON));
9895
9896 if (!GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo)) return 1;
9897
9898 nOldScrollPos = scrollInfo.nPos;
9899 switch (nScrollCode)
9900 {
9901 case SB_INTERNAL:
9902 break;
9903
9904 case SB_LINEUP:
9905 nScrollDiff = (is_an_icon) ? -LISTVIEW_SCROLL_ICON_LINE_SIZE : -1;
9906 break;
9907
9908 case SB_LINEDOWN:
9909 nScrollDiff = (is_an_icon) ? LISTVIEW_SCROLL_ICON_LINE_SIZE : 1;
9910 break;
9911
9912 case SB_PAGEUP:
9913 nScrollDiff = -scrollInfo.nPage;
9914 break;
9915
9916 case SB_PAGEDOWN:
9917 nScrollDiff = scrollInfo.nPage;
9918 break;
9919
9920 case SB_THUMBPOSITION:
9921 case SB_THUMBTRACK:
9922 nScrollDiff = scrollInfo.nTrackPos - scrollInfo.nPos;
9923 break;
9924
9925 default:
9926 nScrollDiff = 0;
9927 }
9928
9929 /* quit right away if pos isn't changing */
9930 if (nScrollDiff == 0) return 0;
9931
9932 /* calculate new position, and handle overflows */
9933 nNewScrollPos = scrollInfo.nPos + nScrollDiff;
9934 if (nScrollDiff > 0) {
9935 if (nNewScrollPos < nOldScrollPos ||
9936 nNewScrollPos > scrollInfo.nMax)
9937 nNewScrollPos = scrollInfo.nMax;
9938 } else {
9939 if (nNewScrollPos > nOldScrollPos ||
9940 nNewScrollPos < scrollInfo.nMin)
9941 nNewScrollPos = scrollInfo.nMin;
9942 }
9943
9944 /* set the new position, and reread in case it changed */
9945 scrollInfo.fMask = SIF_POS;
9946 scrollInfo.nPos = nNewScrollPos;
9947 nNewScrollPos = SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo, TRUE);
9948
9949 /* carry on only if it really changed */
9950 if (nNewScrollPos == nOldScrollPos) return 0;
9951
9952 /* now adjust to client coordinates */
9953 nScrollDiff = nOldScrollPos - nNewScrollPos;
9954 if (infoPtr->uView == LV_VIEW_DETAILS) nScrollDiff *= infoPtr->nItemHeight;
9955
9956 /* and scroll the window */
9957 scroll_list(infoPtr, 0, nScrollDiff);
9958
9959 return 0;
9960}
#define SB_LINEUP
Definition: winuser.h:564
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_PAGEUP
Definition: winuser.h:568

Referenced by LISTVIEW_EnsureVisible(), LISTVIEW_MouseWheel(), LISTVIEW_Scroll(), and LISTVIEW_WindowProc().

◆ LISTVIEW_WindowProc()

static LRESULT WINAPI LISTVIEW_WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 11497 of file listview.c.

11498{
11500
11501 TRACE("(hwnd=%p uMsg=%x wParam=%lx lParam=%lx)\n", hwnd, uMsg, wParam, lParam);
11502
11503 if (!infoPtr && (uMsg != WM_NCCREATE))
11504 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
11505
11506 switch (uMsg)
11507 {
11509 return LISTVIEW_ApproximateViewRect(infoPtr, (INT)wParam,
11511 case LVM_ARRANGE:
11512 return LISTVIEW_Arrange(infoPtr, (INT)wParam);
11513
11515 return LISTVIEW_CancelEditLabel(infoPtr);
11516
11519
11520 case LVM_DELETEALLITEMS:
11521 return LISTVIEW_DeleteAllItems(infoPtr, FALSE);
11522
11523 case LVM_DELETECOLUMN:
11524 return LISTVIEW_DeleteColumn(infoPtr, (INT)wParam);
11525
11526 case LVM_DELETEITEM:
11527 return LISTVIEW_DeleteItem(infoPtr, (INT)wParam);
11528
11529 case LVM_EDITLABELA:
11530 case LVM_EDITLABELW:
11531 return (LRESULT)LISTVIEW_EditLabelT(infoPtr, (INT)wParam,
11532 uMsg == LVM_EDITLABELW);
11533 /* case LVM_ENABLEGROUPVIEW: */
11534
11535 case LVM_ENSUREVISIBLE:
11536 return LISTVIEW_EnsureVisible(infoPtr, (INT)wParam, (BOOL)lParam);
11537
11538 case LVM_FINDITEMW:
11539 return LISTVIEW_FindItemW(infoPtr, (INT)wParam, (LPLVFINDINFOW)lParam);
11540
11541 case LVM_FINDITEMA:
11542 return LISTVIEW_FindItemA(infoPtr, (INT)wParam, (LPLVFINDINFOA)lParam);
11543
11544 case LVM_GETBKCOLOR:
11545 return infoPtr->clrBk;
11546
11547 /* case LVM_GETBKIMAGE: */
11548
11550 return infoPtr->uCallbackMask;
11551
11552 case LVM_GETCOLUMNA:
11553 case LVM_GETCOLUMNW:
11554 return LISTVIEW_GetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam,
11555 uMsg == LVM_GETCOLUMNW);
11556
11559
11560 case LVM_GETCOLUMNWIDTH:
11561 return LISTVIEW_GetColumnWidth(infoPtr, (INT)wParam);
11562
11564 return LISTVIEW_GetCountPerPage(infoPtr);
11565
11566 case LVM_GETEDITCONTROL:
11567 return (LRESULT)infoPtr->hwndEdit;
11568
11570 return infoPtr->dwLvExStyle;
11571
11572 /* case LVM_GETGROUPINFO: */
11573
11574 /* case LVM_GETGROUPMETRICS: */
11575
11576 case LVM_GETHEADER:
11577 return (LRESULT)infoPtr->hwndHeader;
11578
11579 case LVM_GETHOTCURSOR:
11580 return (LRESULT)infoPtr->hHotCursor;
11581
11582 case LVM_GETHOTITEM:
11583 return infoPtr->nHotItem;
11584
11585 case LVM_GETHOVERTIME:
11586 return infoPtr->dwHoverTime;
11587
11588 case LVM_GETIMAGELIST:
11589 return (LRESULT)LISTVIEW_GetImageList(infoPtr, (INT)wParam);
11590
11591 /* case LVM_GETINSERTMARK: */
11592
11593 /* case LVM_GETINSERTMARKCOLOR: */
11594
11595 /* case LVM_GETINSERTMARKRECT: */
11596
11599 FIXME("LVM_GETISEARCHSTRING: unimplemented\n");
11600 return FALSE;
11601
11602 case LVM_GETITEMA:
11603 case LVM_GETITEMW:
11604 return LISTVIEW_GetItemExtT(infoPtr, (LPLVITEMW)lParam, uMsg == LVM_GETITEMW);
11605
11606 case LVM_GETITEMCOUNT:
11607 return infoPtr->nItemCount;
11608
11610 return LISTVIEW_GetItemPosition(infoPtr, (INT)wParam, (LPPOINT)lParam);
11611
11612 case LVM_GETITEMRECT:
11613 return LISTVIEW_GetItemRect(infoPtr, (INT)wParam, (LPRECT)lParam);
11614
11615 case LVM_GETITEMSPACING:
11616 return LISTVIEW_GetItemSpacing(infoPtr, (BOOL)wParam);
11617
11618 case LVM_GETITEMSTATE:
11619 return LISTVIEW_GetItemState(infoPtr, (INT)wParam, (UINT)lParam);
11620
11621 case LVM_GETITEMTEXTA:
11622 case LVM_GETITEMTEXTW:
11623 return LISTVIEW_GetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam,
11624 uMsg == LVM_GETITEMTEXTW);
11625
11626 case LVM_GETNEXTITEM:
11627 return LISTVIEW_GetNextItem(infoPtr, (INT)wParam, LOWORD(lParam));
11628
11630 FIXME("LVM_GETNUMBEROFWORKAREAS: unimplemented\n");
11631 return 1;
11632
11633 case LVM_GETORIGIN:
11634 if (!lParam) return FALSE;
11635 if (infoPtr->uView == LV_VIEW_DETAILS ||
11636 infoPtr->uView == LV_VIEW_LIST) return FALSE;
11638 return TRUE;
11639
11640 /* case LVM_GETOUTLINECOLOR: */
11641
11642 /* case LVM_GETSELECTEDCOLUMN: */
11643
11645 return LISTVIEW_GetSelectedCount(infoPtr);
11646
11648 return infoPtr->nSelectionMark;
11649
11652 return LISTVIEW_GetStringWidthT(infoPtr, (LPCWSTR)lParam,
11653 uMsg == LVM_GETSTRINGWIDTHW);
11654
11655 case LVM_GETSUBITEMRECT:
11656 return LISTVIEW_GetSubItemRect(infoPtr, (UINT)wParam, (LPRECT)lParam);
11657
11658 case LVM_GETTEXTBKCOLOR:
11659 return infoPtr->clrTextBk;
11660
11661 case LVM_GETTEXTCOLOR:
11662 return infoPtr->clrText;
11663
11664 /* case LVM_GETTILEINFO: */
11665
11666 /* case LVM_GETTILEVIEWINFO: */
11667
11668 case LVM_GETTOOLTIPS:
11669 if( !infoPtr->hwndToolTip )
11671 return (LRESULT)infoPtr->hwndToolTip;
11672
11673 case LVM_GETTOPINDEX:
11674 return LISTVIEW_GetTopIndex(infoPtr);
11675
11677 return (infoPtr->notifyFormat == NFR_UNICODE);
11678
11679 case LVM_GETVIEW:
11680 return infoPtr->uView;
11681
11682 case LVM_GETVIEWRECT:
11683 return LISTVIEW_GetViewRect(infoPtr, (LPRECT)lParam);
11684
11685 case LVM_GETWORKAREAS:
11686 FIXME("LVM_GETWORKAREAS: unimplemented\n");
11687 return FALSE;
11688
11689 /* case LVM_HASGROUP: */
11690
11691 case LVM_HITTEST:
11692 return LISTVIEW_HitTest(infoPtr, (LPLVHITTESTINFO)lParam, FALSE, TRUE);
11693
11694 case LVM_INSERTCOLUMNA:
11695 case LVM_INSERTCOLUMNW:
11697 uMsg == LVM_INSERTCOLUMNW);
11698
11699 /* case LVM_INSERTGROUP: */
11700
11701 /* case LVM_INSERTGROUPSORTED: */
11702
11703 case LVM_INSERTITEMA:
11704 case LVM_INSERTITEMW:
11705 return LISTVIEW_InsertItemT(infoPtr, (LPLVITEMW)lParam, uMsg == LVM_INSERTITEMW);
11706
11707 /* case LVM_INSERTMARKHITTEST: */
11708
11709 /* case LVM_ISGROUPVIEWENABLED: */
11710
11711 case LVM_ISITEMVISIBLE:
11712 return LISTVIEW_IsItemVisible(infoPtr, (INT)wParam);
11713
11714 case LVM_MAPIDTOINDEX:
11715 return LISTVIEW_MapIdToIndex(infoPtr, (UINT)wParam);
11716
11717 case LVM_MAPINDEXTOID:
11718 return LISTVIEW_MapIndexToId(infoPtr, (INT)wParam);
11719
11720 /* case LVM_MOVEGROUP: */
11721
11722 /* case LVM_MOVEITEMTOGROUP: */
11723
11724 case LVM_REDRAWITEMS:
11725 return LISTVIEW_RedrawItems(infoPtr, (INT)wParam, (INT)lParam);
11726
11727 /* case LVM_REMOVEALLGROUPS: */
11728
11729 /* case LVM_REMOVEGROUP: */
11730
11731 case LVM_SCROLL:
11732 return LISTVIEW_Scroll(infoPtr, (INT)wParam, (INT)lParam);
11733
11734 case LVM_SETBKCOLOR:
11735 return LISTVIEW_SetBkColor(infoPtr, (COLORREF)lParam);
11736
11737 /* case LVM_SETBKIMAGE: */
11738
11740 infoPtr->uCallbackMask = (UINT)wParam;
11741 return TRUE;
11742
11743 case LVM_SETCOLUMNA:
11744 case LVM_SETCOLUMNW:
11745 return LISTVIEW_SetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam,
11746 uMsg == LVM_SETCOLUMNW);
11747
11750
11751 case LVM_SETCOLUMNWIDTH:
11752 return LISTVIEW_SetColumnWidth(infoPtr, (INT)wParam, (short)LOWORD(lParam));
11753
11756
11757 /* case LVM_SETGROUPINFO: */
11758
11759 /* case LVM_SETGROUPMETRICS: */
11760
11761 case LVM_SETHOTCURSOR:
11762 return (LRESULT)LISTVIEW_SetHotCursor(infoPtr, (HCURSOR)lParam);
11763
11764 case LVM_SETHOTITEM:
11765 return LISTVIEW_SetHotItem(infoPtr, (INT)wParam);
11766
11767 case LVM_SETHOVERTIME:
11768 return LISTVIEW_SetHoverTime(infoPtr, (DWORD)lParam);
11769
11770 case LVM_SETICONSPACING:
11771 if(lParam == -1)
11772 return LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
11774
11775 case LVM_SETIMAGELIST:
11777
11778 /* case LVM_SETINFOTIP: */
11779
11780 /* case LVM_SETINSERTMARK: */
11781
11782 /* case LVM_SETINSERTMARKCOLOR: */
11783
11784 case LVM_SETITEMA:
11785 case LVM_SETITEMW:
11786 {
11787 if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
11788 return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, (uMsg == LVM_SETITEMW));
11789 }
11790
11791 case LVM_SETITEMCOUNT:
11792 return LISTVIEW_SetItemCount(infoPtr, (INT)wParam, (DWORD)lParam);
11793
11795 {
11796 POINT pt;
11797 pt.x = (short)LOWORD(lParam);
11798 pt.y = (short)HIWORD(lParam);
11799 return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, &pt);
11800 }
11801
11803 return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, (POINT*)lParam);
11804
11805 case LVM_SETITEMSTATE:
11806 return LISTVIEW_SetItemState(infoPtr, (INT)wParam, (LPLVITEMW)lParam);
11807
11808 case LVM_SETITEMTEXTA:
11809 case LVM_SETITEMTEXTW:
11810 return LISTVIEW_SetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam,
11811 uMsg == LVM_SETITEMTEXTW);
11812
11813 /* case LVM_SETOUTLINECOLOR: */
11814
11815 /* case LVM_SETSELECTEDCOLUMN: */
11816
11818 return LISTVIEW_SetSelectionMark(infoPtr, (INT)lParam);
11819
11820 case LVM_SETTEXTBKCOLOR:
11821 return LISTVIEW_SetTextBkColor(infoPtr, (COLORREF)lParam);
11822
11823 case LVM_SETTEXTCOLOR:
11824 return LISTVIEW_SetTextColor(infoPtr, (COLORREF)lParam);
11825
11826 /* case LVM_SETTILEINFO: */
11827
11828 /* case LVM_SETTILEVIEWINFO: */
11829
11830 /* case LVM_SETTILEWIDTH: */
11831
11832 case LVM_SETTOOLTIPS:
11833 return (LRESULT)LISTVIEW_SetToolTips(infoPtr, (HWND)lParam);
11834
11836 return LISTVIEW_SetUnicodeFormat(infoPtr, wParam);
11837
11838 case LVM_SETVIEW:
11839 return LISTVIEW_SetView(infoPtr, wParam);
11840
11841 /* case LVM_SETWORKAREAS: */
11842
11843 /* case LVM_SORTGROUPS: */
11844
11845 case LVM_SORTITEMS:
11846 case LVM_SORTITEMSEX:
11847 return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, wParam,
11848 uMsg == LVM_SORTITEMSEX);
11849 case LVM_SUBITEMHITTEST:
11850 return LISTVIEW_HitTest(infoPtr, (LPLVHITTESTINFO)lParam, TRUE, FALSE);
11851
11852 case LVM_UPDATE:
11853 return LISTVIEW_Update(infoPtr, (INT)wParam);
11854
11855 case CCM_GETVERSION:
11856 return LISTVIEW_GetVersion(infoPtr);
11857
11858 case CCM_SETVERSION:
11859 return LISTVIEW_SetVersion(infoPtr, wParam);
11860
11861 case WM_CHAR:
11862 return LISTVIEW_ProcessLetterKeys( infoPtr, wParam, lParam );
11863
11864 case WM_COMMAND:
11865 return LISTVIEW_Command(infoPtr, wParam, lParam);
11866
11867 case WM_NCCREATE:
11869
11870 case WM_CREATE:
11872
11873 case WM_DESTROY:
11874 return LISTVIEW_Destroy(infoPtr);
11875
11876 case WM_ENABLE:
11877 return LISTVIEW_Enable(infoPtr);
11878
11879 case WM_ERASEBKGND:
11880 return LISTVIEW_EraseBkgnd(infoPtr, (HDC)wParam);
11881
11882 case WM_GETDLGCODE:
11884
11885 case WM_GETFONT:
11886 return (LRESULT)infoPtr->hFont;
11887
11888 case WM_HSCROLL:
11889 return LISTVIEW_HScroll(infoPtr, (INT)LOWORD(wParam), 0);
11890
11891 case WM_KEYDOWN:
11892 return LISTVIEW_KeyDown(infoPtr, (INT)wParam, (LONG)lParam);
11893
11894 case WM_KILLFOCUS:
11895 return LISTVIEW_KillFocus(infoPtr);
11896
11897 case WM_LBUTTONDBLCLK:
11899
11900 case WM_LBUTTONDOWN:
11902
11903 case WM_LBUTTONUP:
11905
11906 case WM_MOUSEMOVE:
11908
11909 case WM_MOUSEHOVER:
11911
11912 case WM_NCDESTROY:
11913 return LISTVIEW_NCDestroy(infoPtr);
11914
11915 case WM_NCPAINT:
11916 return LISTVIEW_NCPaint(infoPtr, (HRGN)wParam);
11917
11918 case WM_NOTIFY:
11919 return LISTVIEW_Notify(infoPtr, (LPNMHDR)lParam);
11920
11921 case WM_NOTIFYFORMAT:
11922 return LISTVIEW_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);
11923
11924 case WM_PRINTCLIENT:
11925 return LISTVIEW_PrintClient(infoPtr, (HDC)wParam, (DWORD)lParam);
11926
11927 case WM_PAINT:
11928 return LISTVIEW_WMPaint(infoPtr, (HDC)wParam);
11929
11930 case WM_RBUTTONDBLCLK:
11932
11933 case WM_RBUTTONDOWN:
11935
11936 case WM_SETCURSOR:
11937 return LISTVIEW_SetCursor(infoPtr, wParam, lParam);
11938
11939 case WM_SETFOCUS:
11940 return LISTVIEW_SetFocus(infoPtr, (HWND)wParam);
11941
11942 case WM_SETFONT:
11943 return LISTVIEW_SetFont(infoPtr, (HFONT)wParam, (WORD)lParam);
11944
11945 case WM_SETREDRAW:
11946 return LISTVIEW_SetRedraw(infoPtr, (BOOL)wParam);
11947
11948 case WM_SHOWWINDOW:
11949 return LISTVIEW_ShowWindow(infoPtr, wParam, lParam);
11950
11951 case WM_STYLECHANGED:
11953
11954 case WM_STYLECHANGING:
11956
11957 case WM_SYSCOLORCHANGE:
11959#ifdef __REACTOS__
11960 if (infoPtr->bDefaultBkColor)
11961 {
11963 infoPtr->bDefaultBkColor = TRUE;
11964 LISTVIEW_InvalidateList(infoPtr);
11965 }
11966#endif
11967 return 0;
11968
11969/* case WM_TIMER: */
11970 case WM_THEMECHANGED:
11971 return LISTVIEW_ThemeChanged(infoPtr);
11972
11973 case WM_VSCROLL:
11974 return LISTVIEW_VScroll(infoPtr, (INT)LOWORD(wParam), 0);
11975
11976 case WM_MOUSEWHEEL:
11977 if (wParam & (MK_SHIFT | MK_CONTROL))
11978 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
11979 return LISTVIEW_MouseWheel(infoPtr, (short int)HIWORD(wParam));
11980
11982 if (!(((WINDOWPOS *)lParam)->flags & SWP_NOSIZE))
11983 {
11984 SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE |
11986
11987 if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
11988 {
11989 if (notify_measureitem(infoPtr)) LISTVIEW_InvalidateList(infoPtr);
11990 }
11991 LISTVIEW_Size(infoPtr, ((WINDOWPOS *)lParam)->cx, ((WINDOWPOS *)lParam)->cy);
11992 }
11993 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
11994
11995/* case WM_WININICHANGE: */
11996
11997 default:
11998 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
11999 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
12000
12001 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
12002 }
12003
12004}
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
HWND COMCTL32_CreateToolTip(HWND) DECLSPEC_HIDDEN
Definition: commctrl.c:1544
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1586
static LRESULT LISTVIEW_Notify(LISTVIEW_INFO *infoPtr, NMHDR *lpnmhdr)
Definition: listview.c:10611
static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10492
static LRESULT LISTVIEW_PrintClient(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD options)
Definition: listview.c:10921
static DWORD LISTVIEW_MapIndexToId(const LISTVIEW_INFO *infoPtr, INT iItem)
Definition: listview.c:2706
static BOOL LISTVIEW_Enable(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:9796
static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:5912
static DWORD LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD mask, DWORD ex_style)
Definition: listview.c:8688
static LRESULT LISTVIEW_SetFocus(LISTVIEW_INFO *infoPtr, HWND hwndLoseFocus)
Definition: listview.c:11086
static BOOL LISTVIEW_GetSubItemRect(const LISTVIEW_INFO *infoPtr, INT item, LPRECT lprc)
Definition: listview.c:7294
static BOOL LISTVIEW_SetCursor(const LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: listview.c:11055
static INT LISTVIEW_MapIdToIndex(const LISTVIEW_INFO *infoPtr, UINT iID)
Definition: listview.c:2673
static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: listview.c:9717
static BOOL LISTVIEW_NCPaint(const LISTVIEW_INFO *infoPtr, HRGN region)
Definition: listview.c:10783
static BOOL LISTVIEW_GetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCount, LPINT lpiArray)
Definition: listview.c:6651
static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, LPARAM keyData)
Definition: listview.c:1875
static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, LPARAM lParamSort, BOOL IsEx)
Definition: listview.c:9460
static INT LISTVIEW_GetItemTextT(const LISTVIEW_INFO *infoPtr, INT nItem, LPLVITEMW lpLVItem, BOOL isW)
Definition: listview.c:7428
static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
Definition: listview.c:6669
static LRESULT LISTVIEW_SetRedraw(LISTVIEW_INFO *infoPtr, BOOL redraw)
Definition: listview.c:11160
static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFlags)
Definition: listview.c:8977
static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LPPOINT lppt)
Definition: listview.c:5553
static LRESULT LISTVIEW_ThemeChanged(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:9526
static LRESULT LISTVIEW_Size(LISTVIEW_INFO *infoPtr, int Width, int Height)
Definition: listview.c:11194
static DWORD LISTVIEW_SetHoverTime(LISTVIEW_INFO *infoPtr, DWORD dwHoverTime)
Definition: listview.c:8832
static BOOL LISTVIEW_SetTextBkColor(LISTVIEW_INFO *infoPtr, COLORREF color)
Definition: listview.c:9264
static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
Definition: listview.c:10069
static HIMAGELIST LISTVIEW_GetImageList(const LISTVIEW_INFO *infoPtr, INT nImageList)
Definition: listview.c:6741
static LRESULT LISTVIEW_ShowWindow(LISTVIEW_INFO *infoPtr, WPARAM bShown, LPARAM iStatus)
Definition: listview.c:11436
static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: listview.c:11300
static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nItemCount, WORD wWidth, WORD wHeight)
Definition: listview.c:5412
static BOOL LISTVIEW_IsItemVisible(const LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:8099
static BOOL LISTVIEW_Update(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:9546
static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW)
Definition: listview.c:7921
static LRESULT LISTVIEW_NotifyFormat(LISTVIEW_INFO *infoPtr, HWND hwndFrom, INT nCommand)
Definition: listview.c:10837
static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
Definition: listview.c:10562
static BOOL LISTVIEW_GetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn, LPLVCOLUMNW lpColumn, BOOL isW)
Definition: listview.c:6601
static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
Definition: listview.c:5755
static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
Definition: listview.c:9338
static HCURSOR LISTVIEW_SetHotCursor(LISTVIEW_INFO *infoPtr, HCURSOR hCursor)
Definition: listview.c:8789
static LRESULT LISTVIEW_GetVersion(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:11460
static LRESULT LISTVIEW_WMPaint(LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:10899
static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10981
static LRESULT LISTVIEW_Destroy(LISTVIEW_INFO *infoPtr)
Definition: listview.c:9773
static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10368
static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)
Definition: listview.c:4133
static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, INT x, INT y)
Definition: listview.c:3907
static BOOL LISTVIEW_SetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
Definition: listview.c:8433
static LRESULT LISTVIEW_KillFocus(LISTVIEW_INFO *infoPtr)
Definition: listview.c:10230
static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast)
Definition: listview.c:8138
static BOOL LISTVIEW_SetColumnOrderArray(LISTVIEW_INFO *infoPtr, INT iCount, const INT *lpiArray)
Definition: listview.c:8488
static INT LISTVIEW_SetSelectionMark(LISTVIEW_INFO *infoPtr, INT nIndex)
Definition: listview.c:9240
static BOOL LISTVIEW_SetUnicodeFormat(LISTVIEW_INFO *infoPtr, BOOL unicode)
Definition: listview.c:9320
static INT LISTVIEW_SetHotItem(LISTVIEW_INFO *infoPtr, INT iIndex)
Definition: listview.c:8811
static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, const POINT *pt)
Definition: listview.c:9075
static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lKeyData)
Definition: listview.c:10125
static BOOL LISTVIEW_SetItemTextT(LISTVIEW_INFO *infoPtr, INT nItem, const LVITEMW *lpLVItem, BOOL isW)
Definition: listview.c:9211
static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
Definition: listview.c:8315
static LONG LISTVIEW_GetItemSpacing(const LISTVIEW_INFO *infoPtr, BOOL bSmall)
Definition: listview.c:7369
static LRESULT LISTVIEW_SetVersion(LISTVIEW_INFO *infoPtr, DWORD iVersion)
Definition: listview.c:11477
static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedraw)
Definition: listview.c:11120
static INT LISTVIEW_StyleChanging(WPARAM wStyleType, STYLESTRUCT *lpss)
Definition: listview.c:11406
static HWND LISTVIEW_SetToolTips(LISTVIEW_INFO *infoPtr, HWND hwndNewToolTip)
Definition: listview.c:9303
static LRESULT LISTVIEW_Command(LISTVIEW_INFO *, WPARAM, LPARAM)
Definition: listview.c:12058
static BOOL LISTVIEW_SetTextColor(LISTVIEW_INFO *infoPtr, COLORREF color)
Definition: listview.c:9284
static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOA *lpFindInfo)
Definition: listview.c:6571
static INT LISTVIEW_GetCountPerPage(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:6713
static LRESULT LISTVIEW_RButtonDblClk(const LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10951
static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10281
static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
Definition: listview.c:9627
#define WM_APP
Definition: eventvwr.h:73
#define LVM_GETCALLBACKMASK
Definition: commctrl.h:2416
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2413
#define LVM_CREATEDRAGIMAGE
Definition: commctrl.h:2652
#define LVM_GETITEMA
Definition: commctrl.h:2389
#define LVM_ARRANGE
Definition: commctrl.h:2532
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2687
#define LVM_SETHOVERTIME
Definition: commctrl.h:2792
#define LVM_SETCOLUMNW
Definition: commctrl.h:2625
#define LVM_SETTEXTCOLOR
Definition: commctrl.h:2658
#define LVM_INSERTCOLUMNA
Definition: commctrl.h:2631
#define LVM_GETITEMCOUNT
Definition: commctrl.h:2306
#define LVM_GETITEMSTATE
Definition: commctrl.h:2675
#define LVM_GETCOLUMNORDERARRAY
Definition: commctrl.h:2768
#define LVM_GETHEADER
Definition: commctrl.h:2650
#define LVM_GETTOPINDEX
Definition: commctrl.h:2664
#define LVM_GETITEMSPACING
Definition: commctrl.h:2711
#define LVM_SETCOLUMNA
Definition: commctrl.h:2624
#define LVM_SETCOLUMNWIDTH
Definition: commctrl.h:2646
#define LVM_SETBKCOLOR
Definition: commctrl.h:2293
#define LVM_GETITEMPOSITION
Definition: commctrl.h:2483
#define LVM_SETITEMSTATE
Definition: commctrl.h:2672
#define CCM_GETVERSION
Definition: commctrl.h:115
#define LVM_EDITLABELW
Definition: commctrl.h:2536
#define LVM_GETHOTITEM
Definition: commctrl.h:2772
#define LVM_DELETECOLUMN
Definition: commctrl.h:2638
#define LVM_SETITEMPOSITION
Definition: commctrl.h:2480
#define LVM_FINDITEMW
Definition: commctrl.h:2466
#define LVM_SETCALLBACKMASK
Definition: commctrl.h:2419
#define LVM_SETUNICODEFORMAT
Definition: commctrl.h:2287
#define LVM_GETEDITCONTROL
Definition: commctrl.h:2542
#define LVM_EDITLABELA
Definition: commctrl.h:2535
#define LVM_GETNUMBEROFWORKAREAS
Definition: commctrl.h:2786
#define LVM_UPDATE
Definition: commctrl.h:2670
#define LVM_REDRAWITEMS
Definition: commctrl.h:2524
#define LVM_GETCOLUMNA
Definition: commctrl.h:2617
#define LVM_APPROXIMATEVIEWRECT
Definition: commctrl.h:2778
#define LVM_GETHOVERTIME
Definition: commctrl.h:2794
#define LVM_GETSTRINGWIDTHA
Definition: commctrl.h:2486
#define LVM_SETIMAGELIST
Definition: commctrl.h:2303
#define LVM_SETITEMW
Definition: commctrl.h:2397
#define LVM_SETTOOLTIPS
Definition: commctrl.h:2796
#define LVM_GETVIEWRECT
Definition: commctrl.h:2654
#define LVM_GETNEXTITEM
Definition: commctrl.h:2433
#define LVM_MAPIDTOINDEX
Definition: commctrl.h:3016
#define LVM_MAPINDEXTOID
Definition: commctrl.h:3014
#define LVM_GETSUBITEMRECT
Definition: commctrl.h:2762
#define LVM_ENSUREVISIBLE
Definition: commctrl.h:2518
#define LVM_GETTOOLTIPS
Definition: commctrl.h:2798
#define LVM_GETWORKAREAS
Definition: commctrl.h:2784
#define LVM_GETVIEW
Definition: commctrl.h:2848
#define LVM_SETSELECTIONMARK
Definition: commctrl.h:2790
#define LVM_SETITEMTEXTA
Definition: commctrl.h:2686
#define LVM_CANCELEDITLABEL
Definition: commctrl.h:3012
#define LVM_GETCOLUMNW
Definition: commctrl.h:2618
#define LVM_SETITEMCOUNT
Definition: commctrl.h:2696
#define LVM_SCROLL
Definition: commctrl.h:2521
#define LVM_GETIMAGELIST
Definition: commctrl.h:2295
#define LVM_ISITEMVISIBLE
Definition: commctrl.h:3018
#define LVM_INSERTITEMA
Definition: commctrl.h:2403
#define LVM_GETCOUNTPERPAGE
Definition: commctrl.h:2666
#define LVM_SETHOTCURSOR
Definition: commctrl.h:2774
#define LVM_SUBITEMHITTEST
Definition: commctrl.h:2764
#define LVM_GETITEMTEXTW
Definition: commctrl.h:2680
#define LVM_GETITEMRECT
Definition: commctrl.h:2477
#define LVM_GETITEMTEXTA
Definition: commctrl.h:2679
#define LVM_GETBKCOLOR
Definition: commctrl.h:2291
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2632
#define LVM_GETISEARCHSTRINGA
Definition: commctrl.h:2714
#define LVM_DELETEITEM
Definition: commctrl.h:2410
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2727
#define LVM_SETITEMA
Definition: commctrl.h:2396
#define CCM_SETVERSION
Definition: commctrl.h:114
#define LVM_SETVIEW
Definition: commctrl.h:2846
#define LVM_GETSELECTIONMARK
Definition: commctrl.h:2788
#define LVM_GETORIGIN
Definition: commctrl.h:2668
#define LVM_SETICONSPACING
Definition: commctrl.h:2721
#define WM_MOUSEHOVER
Definition: commctrl.h:4974
#define LVM_SETHOTITEM
Definition: commctrl.h:2770
#define LVM_GETSELECTEDCOUNT
Definition: commctrl.h:2708
#define LVM_GETUNICODEFORMAT
Definition: commctrl.h:2289
#define LVM_GETTEXTCOLOR
Definition: commctrl.h:2656
#define LVM_SETITEMPOSITION32
Definition: commctrl.h:2705
#define LVM_SETTEXTBKCOLOR
Definition: commctrl.h:2662
#define LVM_SORTITEMSEX
Definition: commctrl.h:2800
#define LVM_SETCOLUMNORDERARRAY
Definition: commctrl.h:2766
#define LVM_INSERTITEMW
Definition: commctrl.h:2404
#define LVM_GETITEMW
Definition: commctrl.h:2390
#define LVM_SORTITEMS
Definition: commctrl.h:2702
#define LVM_FINDITEMA
Definition: commctrl.h:2465
#define LVM_GETCOLUMNWIDTH
Definition: commctrl.h:2641
int(CALLBACK * PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM)
Definition: commctrl.h:2700
#define LVM_HITTEST
Definition: commctrl.h:2515
#define LVM_GETTEXTBKCOLOR
Definition: commctrl.h:2660
#define LVM_GETISEARCHSTRINGW
Definition: commctrl.h:2715
#define LVM_GETSTRINGWIDTHW
Definition: commctrl.h:2487
#define LVM_GETHOTCURSOR
Definition: commctrl.h:2776
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2724
#define WM_NOTIFY
Definition: richedit.h:61
#define WM_MOUSEWHEEL
Definition: treelist.c:96
LONG_PTR LRESULT
Definition: windef.h:209
int * LPINT
Definition: windef.h:178
#define WM_PAINT
Definition: winuser.h:1620
#define WM_ENABLE
Definition: winuser.h:1615
#define WM_HSCROLL
Definition: winuser.h:1743
#define SWP_FRAMECHANGED
Definition: winuser.h:1240
#define WM_VSCROLL
Definition: winuser.h:1744
#define WM_CREATE
Definition: winuser.h:1608
#define DLGC_WANTCHARS
Definition: winuser.h:2618
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1778
#define WM_SETFOCUS
Definition: winuser.h:1613
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1626
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define WM_CHAR
Definition: winuser.h:1717
#define WM_NCDESTROY
Definition: winuser.h:1684
#define WM_USER
Definition: winuser.h:1895
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662
#define WM_SETREDRAW
Definition: winuser.h:1616

Referenced by LISTVIEW_Register().

◆ LISTVIEW_WMPaint()

static LRESULT LISTVIEW_WMPaint ( LISTVIEW_INFO infoPtr,
HDC  hdc 
)
inlinestatic

Definition at line 10899 of file listview.c.

10900{
10901 TRACE("(hdc=%p)\n", hdc);
10902
10903 if (!is_redrawing(infoPtr))
10904 return DefWindowProcW (infoPtr->hwndSelf, WM_PAINT, (WPARAM)hdc, 0);
10905
10906 return LISTVIEW_Paint(infoPtr, hdc);
10907}

Referenced by LISTVIEW_WindowProc().

◆ lstrncmpiW()

static int lstrncmpiW ( LPCWSTR  s1,
LPCWSTR  s2,
int  n 
)
inlinestatic

Definition at line 546 of file listview.c.

547{
548 n = min(min(n, lstrlenW(s1)), lstrlenW(s2));
550}
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2671
struct S1 s1
struct S2 s2
#define LOCALE_USER_DEFAULT
#define NORM_IGNORECASE
Definition: winnls.h:176
#define CSTR_EQUAL
Definition: winnls.h:456

Referenced by LISTVIEW_ProcessLetterKeys().

◆ map_style_view()

static void map_style_view ( LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1609 of file listview.c.

1610{
1611 switch (infoPtr->dwStyle & LVS_TYPEMASK)
1612 {
1613 case LVS_ICON:
1614 infoPtr->uView = LV_VIEW_ICON;
1615 break;
1616 case LVS_REPORT:
1617 infoPtr->uView = LV_VIEW_DETAILS;
1618 break;
1619 case LVS_SMALLICON:
1620 infoPtr->uView = LV_VIEW_SMALLICON;
1621 break;
1622 case LVS_LIST:
1623 infoPtr->uView = LV_VIEW_LIST;
1624 }
1625}
#define LVS_LIST
Definition: commctrl.h:2264

Referenced by LISTVIEW_Create(), LISTVIEW_NCCreate(), and LISTVIEW_StyleChanged().

◆ MapIdSearchCompare()

static INT CALLBACK MapIdSearchCompare ( LPVOID  p1,
LPVOID  p2,
LPARAM  lParam 
)
static

Definition at line 2652 of file listview.c.

2653{
2654 ITEM_ID *id1 = (ITEM_ID*)p1;
2655 ITEM_ID *id2 = (ITEM_ID*)p2;
2656
2657 if (id1->id == id2->id) return 0;
2658
2659 return (id1->id < id2->id) ? -1 : 1;
2660}

Referenced by LISTVIEW_MapIdToIndex().

◆ notify()

static BOOL notify ( const LISTVIEW_INFO infoPtr,
INT  code 
)
inlinestatic

Definition at line 848 of file listview.c.

849{
850 NMHDR nmh;
851 HWND hwnd = infoPtr->hwndSelf;
852 notify_hdr(infoPtr, code, &nmh);
853 return IsWindow(hwnd);
854}
Definition: inflate.c:139

◆ notify_click()

static BOOL notify_click ( const LISTVIEW_INFO infoPtr,
INT  code,
const LVHITTESTINFO lvht 
)
static

Definition at line 895 of file listview.c.

896{
897 NMITEMACTIVATE nmia;
899 HWND hwnd = infoPtr->hwndSelf;
900 LRESULT ret;
901
902 TRACE("code=%d, lvht=%s\n", code, debuglvhittestinfo(lvht));
903 ZeroMemory(&nmia, sizeof(nmia));
904 nmia.iItem = lvht->iItem;
905 nmia.iSubItem = lvht->iSubItem;
906 nmia.ptAction = lvht->pt;
907 item.mask = LVIF_PARAM;
908 item.iItem = lvht->iItem;
909 item.iSubItem = 0;
910 if (LISTVIEW_GetItemT(infoPtr, &item, TRUE)) nmia.lParam = item.lParam;
911 ret = notify_hdr(infoPtr, code, (NMHDR*)&nmia);
912 return IsWindow(hwnd) && (code == NM_RCLICK ? !ret : TRUE);
913}
static const char * debuglvhittestinfo(const LVHITTESTINFO *lpht)
Definition: listview.c:715

Referenced by LISTVIEW_LButtonDblClk(), LISTVIEW_LButtonDown(), LISTVIEW_LButtonUp(), LISTVIEW_RButtonDblClk(), and LISTVIEW_RButtonDown().

◆ notify_customdraw()

static DWORD notify_customdraw ( const LISTVIEW_INFO infoPtr,
DWORD  dwDrawStage,
NMLVCUSTOMDRAW lpnmlvcd 
)
inlinestatic

Definition at line 1052 of file listview.c.

1053{
1054 BOOL isForItem = (lpnmlvcd->nmcd.dwItemSpec != 0);
1055 DWORD result;
1056
1057 lpnmlvcd->nmcd.dwDrawStage = dwDrawStage;
1058 if (isForItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_ITEM;
1059 if (lpnmlvcd->iSubItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_SUBITEM;
1060 if (isForItem) lpnmlvcd->nmcd.dwItemSpec--;
1061 result = notify_hdr(infoPtr, NM_CUSTOMDRAW, &lpnmlvcd->nmcd.hdr);
1062 if (isForItem) lpnmlvcd->nmcd.dwItemSpec++;
1063 return result;
1064}
GLuint64EXT * result
Definition: glext.h:11304
#define CDDS_ITEM
Definition: commctrl.h:284
#define NM_CUSTOMDRAW
Definition: commctrl.h:137

Referenced by LISTVIEW_DrawItem(), LISTVIEW_Refresh(), LISTVIEW_RefreshOwnerDraw(), and notify_postpaint().

◆ notify_deleteitem()

static BOOL notify_deleteitem ( const LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 915 of file listview.c.

916{
917 NMLISTVIEW nmlv;
919 HWND hwnd = infoPtr->hwndSelf;
920
921 ZeroMemory(&nmlv, sizeof (NMLISTVIEW));
922 nmlv.iItem = nItem;
923 item.mask = LVIF_PARAM;
924 item.iItem = nItem;
925 item.iSubItem = 0;
926 if (LISTVIEW_GetItemT(infoPtr, &item, TRUE)) nmlv.lParam = item.lParam;
927 notify_listview(infoPtr, LVN_DELETEITEM, &nmlv);
928 return IsWindow(hwnd);
929}
#define LVN_DELETEITEM
Definition: commctrl.h:3133

Referenced by LISTVIEW_DeleteAllItems(), and LISTVIEW_DeleteItem().

◆ notify_dispinfoT()

static BOOL notify_dispinfoT ( const LISTVIEW_INFO infoPtr,
UINT  code,
LPNMLVDISPINFOW  pdi,
BOOL  isW 
)
static

Definition at line 939 of file listview.c.

940{
941 INT length = 0, ret_length;
942 LPWSTR buffer = NULL, ret_text;
943 BOOL return_ansi = FALSE;
944 BOOL return_unicode = FALSE;
945 BOOL ret;
946
947 if ((pdi->item.mask & LVIF_TEXT) && is_text(pdi->item.pszText))
948 {
949 return_unicode = ( isW && infoPtr->notifyFormat == NFR_ANSI);
950 return_ansi = (!isW && infoPtr->notifyFormat == NFR_UNICODE);
951 }
952
953 ret_length = pdi->item.cchTextMax;
954 ret_text = pdi->item.pszText;
955
956 if (return_unicode || return_ansi)
957 {
958 if (code != LVN_GETDISPINFOW)
959 {
960 length = return_ansi ?
961 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1, NULL, 0):
962 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
963 }
964 else
965 {
966 length = pdi->item.cchTextMax;
967 *pdi->item.pszText = 0; /* make sure we don't process garbage */
968 }
969
970 buffer = Alloc( (return_ansi ? sizeof(WCHAR) : sizeof(CHAR)) * length);
971 if (!buffer) return FALSE;
972
973 if (return_ansi)
974 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1,
975 buffer, length);
976 else
977 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) buffer,
978 length, NULL, NULL);
979
980 pdi->item.pszText = buffer;
981 pdi->item.cchTextMax = length;
982 }
983
984 if (infoPtr->notifyFormat == NFR_ANSI)
986
987 TRACE(" pdi->item=%s\n", debuglvitem_t(&pdi->item, infoPtr->notifyFormat != NFR_ANSI));
988 ret = notify_hdr(infoPtr, code, &pdi->hdr);
989 TRACE(" resulting code=%d\n", pdi->hdr.code);
990
991 if (return_ansi || return_unicode)
992 {
993 if (return_ansi && (pdi->hdr.code == LVN_GETDISPINFOA))
994 {
995 strcpy((char*)ret_text, (char*)pdi->item.pszText);
996 }
997 else if (return_unicode && (pdi->hdr.code == LVN_GETDISPINFOW))
998 {
999 lstrcpyW(ret_text, pdi->item.pszText);
1000 }
1001 else if (return_ansi) /* note : pointer can be changed by app ! */
1002 {
1003 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) ret_text,
1004 ret_length, NULL, NULL);
1005 }
1006 else
1007 MultiByteToWideChar(CP_ACP, 0, (LPSTR) pdi->item.pszText, -1,
1008 ret_text, ret_length);
1009
1010 pdi->item.pszText = ret_text; /* restores our buffer */
1011 pdi->item.cchTextMax = ret_length;
1012
1013 Free(buffer);
1014 return ret;
1015 }
1016
1017 /* if dispinfo holder changed notification code then convert */
1018 if (!isW && (pdi->hdr.code == LVN_GETDISPINFOW) && (pdi->item.mask & LVIF_TEXT))
1019 {
1020 length = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
1021
1022 buffer = Alloc(length * sizeof(CHAR));
1023 if (!buffer) return FALSE;
1024
1025 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) buffer,
1026 ret_length, NULL, NULL);
1027
1028 strcpy((LPSTR)pdi->item.pszText, (LPSTR)buffer);
1029 Free(buffer);
1030 }
1031
1032 return ret;
1033}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static int get_ansi_notification(UINT unicodeNotificationCode)
Definition: listview.c:743
#define CP_ACP
Definition: compat.h:109
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
_In_ LPWSTR _In_ ULONG _In_ ULONG _In_ ULONG _Out_ DEVINFO * pdi
Definition: winddi.h:3554
char * LPSTR
Definition: xmlstorage.h:182

Referenced by LISTVIEW_EditLabelT(), LISTVIEW_EndEditLabelT(), and LISTVIEW_GetItemT().

◆ notify_forward_header()

static LRESULT notify_forward_header ( const LISTVIEW_INFO infoPtr,
NMHEADERW lpnmhW 
)
static

Definition at line 781 of file listview.c.

782{
784 LRESULT ret;
785 NMHEADERA *lpnmh = (NMHEADERA*) lpnmhW;
786
787 /* on unicode format exit earlier */
788 if (infoPtr->notifyFormat == NFR_UNICODE)
789 return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->hdr.idFrom,
790 (LPARAM)lpnmh);
791
792 /* header always supplies unicode notifications,
793 all we have to do is to convert strings to ANSI */
794 if (lpnmh->pitem)
795 {
796 /* convert item text */
797 if (lpnmh->pitem->mask & HDI_TEXT)
798 {
799 text = (LPCWSTR)lpnmh->pitem->pszText;
800 lpnmh->pitem->pszText = NULL;
801 Str_SetPtrWtoA(&lpnmh->pitem->pszText, text);
802 }
803 /* convert filter text */
804 if ((lpnmh->pitem->mask & HDI_FILTER) && (lpnmh->pitem->type == HDFT_ISSTRING) &&
805 lpnmh->pitem->pvFilter)
806 {
807 filter = (LPCWSTR)((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText;
808 ((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText = NULL;
809 Str_SetPtrWtoA(&((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText, filter);
810 }
811 }
812 lpnmh->hdr.code = get_ansi_notification(lpnmh->hdr.code);
813
814 ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->hdr.idFrom,
815 (LPARAM)lpnmh);
816
817 /* cleanup */
818 if(text)
819 {
820 Free(lpnmh->pitem->pszText);
821 lpnmh->pitem->pszText = (LPSTR)text;
822 }
823 if(filter)
824 {
825 Free(((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText);
826 ((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText = (LPSTR)filter;
827 }
828
829 return ret;
830}
BOOL Str_SetPtrWtoA(LPSTR *lppDest, LPCWSTR lpSrc) DECLSPEC_HIDDEN
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HDFT_ISSTRING
Definition: commctrl.h:642
#define HDI_FILTER
Definition: commctrl.h:711
UINT mask
Definition: commctrl.h:667
LPSTR pszText
Definition: commctrl.h:669
UINT type
Definition: commctrl.h:676
void * pvFilter
Definition: commctrl.h:677
UINT_PTR idFrom
Definition: winuser.h:3158
NMHDR hdr
Definition: commctrl.h:881
HDITEMA * pitem
Definition: commctrl.h:884

Referenced by LISTVIEW_Notify().

◆ notify_hdr()

static LRESULT notify_hdr ( const LISTVIEW_INFO infoPtr,
INT  code,
LPNMHDR  pnmh 
)
static

◆ notify_itemactivate()

static void notify_itemactivate ( const LISTVIEW_INFO infoPtr,
const LVHITTESTINFO htInfo 
)
inlinestatic

Definition at line 856 of file listview.c.

857{
858 NMITEMACTIVATE nmia;
860
861 nmia.uNewState = 0;
862 nmia.uOldState = 0;
863 nmia.uChanged = 0;
864 nmia.uKeyFlags = 0;
865
867 item.iItem = htInfo->iItem;
868 item.iSubItem = 0;
869 item.stateMask = (UINT)-1;
870 if (LISTVIEW_GetItemT(infoPtr, &item, TRUE)) {
871 nmia.lParam = item.lParam;
872 nmia.uOldState = item.state;
873 nmia.uNewState = item.state | LVIS_ACTIVATING;
874 nmia.uChanged = LVIF_STATE;
875 }
876
877 nmia.iItem = htInfo->iItem;
878 nmia.iSubItem = htInfo->iSubItem;
879 nmia.ptAction = htInfo->pt;
880
881 if (GetKeyState(VK_SHIFT) & 0x8000) nmia.uKeyFlags |= LVKF_SHIFT;
882 if (GetKeyState(VK_CONTROL) & 0x8000) nmia.uKeyFlags |= LVKF_CONTROL;
883 if (GetKeyState(VK_MENU) & 0x8000) nmia.uKeyFlags |= LVKF_ALT;
884
885 notify_hdr(infoPtr, LVN_ITEMACTIVATE, (LPNMHDR)&nmia);
886}
#define LVIS_ACTIVATING
Definition: commctrl.h:2323
#define LVKF_CONTROL
Definition: commctrl.h:3056
#define LVKF_SHIFT
Definition: commctrl.h:3057
#define LVKF_ALT
Definition: commctrl.h:3055
#define VK_MENU
Definition: winuser.h:2204

Referenced by LISTVIEW_LButtonDblClk(), and LISTVIEW_LButtonDown().

◆ notify_listview()

static LRESULT notify_listview ( const LISTVIEW_INFO infoPtr,
INT  code,
LPNMLISTVIEW  plvnm 
)
inlinestatic

Definition at line 888 of file listview.c.

889{
890 TRACE("(code=%d, plvnm=%s)\n", code, debugnmlistview(plvnm));
891 return notify_hdr(infoPtr, code, (LPNMHDR)plvnm);
892}
static const char * debugnmlistview(const NMLISTVIEW *plvnm)
Definition: listview.c:617

Referenced by LISTVIEW_DeleteAllItems(), LISTVIEW_InsertItemT(), LISTVIEW_MouseMove(), LISTVIEW_Notify(), LISTVIEW_RButtonDown(), LISTVIEW_SetItemState(), notify_deleteitem(), and set_main_item().

◆ notify_measureitem()

static BOOL notify_measureitem ( LISTVIEW_INFO infoPtr)
static

Definition at line 1113 of file listview.c.

1114{
1116 mis.CtlType = ODT_LISTVIEW;
1117 mis.CtlID = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
1118 mis.itemID = -1;
1119 mis.itemWidth = 0;
1120 mis.itemData = 0;
1121 mis.itemHeight= infoPtr->nItemHeight;
1122 SendMessageW(infoPtr->hwndNotify, WM_MEASUREITEM, mis.CtlID, (LPARAM)&mis);
1123 if (infoPtr->nItemHeight != max(mis.itemHeight, 1))
1124 {
1125 infoPtr->nMeasureItemHeight = infoPtr->nItemHeight = max(mis.itemHeight, 1);
1126 return TRUE;
1127 }
1128 return FALSE;
1129}
ULONG_PTR itemData
Definition: winuser.h:3646
#define WM_MEASUREITEM
Definition: winuser.h:1646

Referenced by LISTVIEW_Create(), and LISTVIEW_WindowProc().

◆ notify_postpaint()

static DWORD notify_postpaint ( const LISTVIEW_INFO infoPtr,
NMLVCUSTOMDRAW lpnmlvcd 
)
inlinestatic

Definition at line 1107 of file listview.c.

1108{
1109 return notify_customdraw(infoPtr, CDDS_POSTPAINT, lpnmlvcd);
1110}
#define CDDS_POSTPAINT
Definition: commctrl.h:281

Referenced by LISTVIEW_Refresh(), and LISTVIEW_RefreshOwnerDraw().

◆ prepaint_setup()

static void prepaint_setup ( const LISTVIEW_INFO infoPtr,
HDC  hdc,
NMLVCUSTOMDRAW lpnmlvcd,
BOOL  SubItem 
)
static

Definition at line 1066 of file listview.c.

1067{
1068 COLORREF backcolor, textcolor;
1069
1070 /* apparently, for selected items, we have to override the returned values */
1071 if (!SubItem || (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
1072 {
1073 if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
1074 {
1075 if (infoPtr->bFocus)
1076 {
1079 }
1080 else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
1081 {
1083 lpnmlvcd->clrText = comctl32_color.clrBtnText;
1084 }
1085 }
1086 }
1087
1088 backcolor = lpnmlvcd->clrTextBk;
1089 textcolor = lpnmlvcd->clrText;
1090
1091 if (backcolor == CLR_DEFAULT)
1092 backcolor = comctl32_color.clrWindow;
1093 if (textcolor == CLR_DEFAULT)
1094 textcolor = comctl32_color.clrWindowText;
1095
1096 /* Set the text attributes */
1097 if (backcolor != CLR_NONE)
1098 {
1100 SetBkColor(hdc, backcolor);
1101 }
1102 else
1104 SetTextColor(hdc, textcolor);
1105}
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2267
COLORREF clrHighlightText
Definition: comctl32.h:170
COLORREF clrBtnText
Definition: comctl32.h:167
COLORREF clrWindowText
Definition: comctl32.h:177
COLORREF clrHighlight
Definition: comctl32.h:169
#define TRANSPARENT
Definition: wingdi.h:950
#define OPAQUE
Definition: wingdi.h:949

Referenced by LISTVIEW_DrawItem(), and LISTVIEW_RefreshOwnerDraw().

◆ ranges_add()

static BOOL ranges_add ( RANGES  ranges,
RANGE  range 
)
static

Definition at line 3338 of file listview.c.

3339{
3340 RANGE srchrgn;
3341 INT index;
3342
3343 TRACE("(%s)\n", debugrange(&range));
3344 ranges_check(ranges, "before add");
3345
3346 /* try find overlapping regions first */
3347 srchrgn.lower = range.lower - 1;
3348 srchrgn.upper = range.upper + 1;
3349 index = DPA_Search(ranges->hdpa, &srchrgn, 0, ranges_cmp, 0, DPAS_SORTED);
3350
3351 if (index == -1)
3352 {
3353 RANGE *newrgn;
3354
3355 TRACE("Adding new range\n");
3356
3357 /* create the brand new range to insert */
3358 newrgn = Alloc(sizeof(RANGE));
3359 if(!newrgn) goto fail;
3360 *newrgn = range;
3361
3362 /* figure out where to insert it */
3363 index = DPA_Search(ranges->hdpa, newrgn, 0, ranges_cmp, 0, DPAS_SORTED | DPAS_INSERTAFTER);
3364 TRACE("index=%d\n", index);
3365 if (index == -1) index = 0;
3366
3367 /* and get it over with */
3368 if (DPA_InsertPtr(ranges->hdpa, index, newrgn) == -1)
3369 {
3370 Free(newrgn);
3371 goto fail;
3372 }
3373 }
3374 else
3375 {
3376 RANGE *chkrgn, *mrgrgn;
3377 INT fromindex, mergeindex;
3378
3379 chkrgn = DPA_GetPtr(ranges->hdpa, index);
3380 TRACE("Merge with %s @%d\n", debugrange(chkrgn), index);
3381
3382 chkrgn->lower = min(range.lower, chkrgn->lower);
3383 chkrgn->upper = max(range.upper, chkrgn->upper);
3384
3385 TRACE("New range %s @%d\n", debugrange(chkrgn), index);
3386
3387 /* merge now common ranges */
3388 fromindex = 0;
3389 srchrgn.lower = chkrgn->lower - 1;
3390 srchrgn.upper = chkrgn->upper + 1;
3391
3392 do
3393 {
3394 mergeindex = DPA_Search(ranges->hdpa, &srchrgn, fromindex, ranges_cmp, 0, 0);
3395 if (mergeindex == -1) break;
3396 if (mergeindex == index)
3397 {
3398 fromindex = index + 1;
3399 continue;
3400 }
3401
3402 TRACE("Merge with index %i\n", mergeindex);
3403
3404 mrgrgn = DPA_GetPtr(ranges->hdpa, mergeindex);
3405 chkrgn->lower = min(chkrgn->lower, mrgrgn->lower);
3406 chkrgn->upper = max(chkrgn->upper, mrgrgn->upper);
3407 Free(mrgrgn);
3408 DPA_DeletePtr(ranges->hdpa, mergeindex);
3409 if (mergeindex < index) index --;
3410 } while(1);
3411 }
3412
3413 ranges_check(ranges, "after add");
3414 return TRUE;
3415
3416fail:
3417 ranges_check(ranges, "failed add");
3418 return FALSE;
3419}
#define ranges_check(ranges, desc)
Definition: listview.c:3199
static INT CALLBACK ranges_cmp(LPVOID range1, LPVOID range2, LPARAM flags)
Definition: listview.c:3183
#define DPAS_INSERTAFTER
Definition: commctrl.h:4864
HDPA hdpa
Definition: listview.c:192

Referenced by iterator_frameditems_absolute(), iterator_visibleitems(), LISTVIEW_SetGroupSelection(), and ranges_additem().

◆ ranges_additem()

static BOOL ranges_additem ( RANGES  ranges,
INT  nItem 
)
inlinestatic

◆ ranges_assert()

static void ranges_assert ( RANGES  ranges,
LPCSTR  desc,
const char file,
int  line 
)
static

Definition at line 3201 of file listview.c.

3202{
3203 INT i;
3204 RANGE *prev, *curr;
3205
3206 TRACE("*** Checking %s:%d:%s ***\n", file, line, desc);
3207 assert (ranges);
3208 assert (DPA_GetPtrCount(ranges->hdpa) >= 0);
3209 ranges_dump(ranges);
3210 if (DPA_GetPtrCount(ranges->hdpa) > 0)
3211 {
3212 prev = DPA_GetPtr(ranges->hdpa, 0);
3213 assert (prev->lower >= 0 && prev->lower < prev->upper);
3214 for (i = 1; i < DPA_GetPtrCount(ranges->hdpa); i++)
3215 {
3216 curr = DPA_GetPtr(ranges->hdpa, i);
3217 assert (prev->upper <= curr->lower);
3218 assert (curr->lower < curr->upper);
3219 prev = curr;
3220 }
3221 }
3222 TRACE("--- Done checking---\n");
3223}
static void ranges_dump(RANGES ranges)
Definition: listview.c:3289
static const WCHAR desc[]
Definition: protectdata.c:36
Definition: fci.c:127
Definition: parser.c:49

◆ ranges_clear()

static void ranges_clear ( RANGES  ranges)
static

Definition at line 3235 of file listview.c.

3236{
3237 INT i;
3238
3239 for(i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++)
3240 Free(DPA_GetPtr(ranges->hdpa, i));
3241 DPA_DeleteAllPtrs(ranges->hdpa);
3242}
BOOL WINAPI DPA_DeleteAllPtrs(HDPA hdpa)
Definition: dpa.c:730

Referenced by LISTVIEW_DeleteAllItems(), LISTVIEW_SortItems(), and ranges_destroy().

◆ ranges_clone()

static RANGES ranges_clone ( RANGES  ranges)
static

Definition at line 3253 of file listview.c.

3254{
3255 RANGES clone;
3256 INT i;
3257
3258 if (!(clone = ranges_create(DPA_GetPtrCount(ranges->hdpa)))) goto fail;
3259
3260 for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++)
3261 {
3262 RANGE *newrng = Alloc(sizeof(RANGE));
3263 if (!newrng) goto fail;
3264 *newrng = *((RANGE*)DPA_GetPtr(ranges->hdpa, i));
3265 if (!DPA_SetPtr(clone->hdpa, i, newrng))
3266 {
3267 Free(newrng);
3268 goto fail;
3269 }
3270 }
3271 return clone;
3272
3273fail:
3274 TRACE ("clone failed\n");
3275 ranges_destroy(clone);
3276 return NULL;
3277}

Referenced by LISTVIEW_DeselectAllSkipItems().

◆ ranges_cmp()

static INT CALLBACK ranges_cmp ( LPVOID  range1,
LPVOID  range2,
LPARAM  flags 
)
static

Definition at line 3183 of file listview.c.

3184{
3185 INT cmp;
3186
3187 if (((RANGE*)range1)->upper <= ((RANGE*)range2)->lower)
3188 cmp = -1;
3189 else if (((RANGE*)range2)->upper <= ((RANGE*)range1)->lower)
3190 cmp = 1;
3191 else
3192 cmp = 0;
3193
3194 TRACE("range1=%s, range2=%s, cmp=%d\n", debugrange(range1), debugrange(range2), cmp);
3195
3196 return cmp;
3197}
#define cmp(status, error)
Definition: error.c:114

Referenced by ranges_add(), ranges_contain(), ranges_del(), and ranges_shift().

◆ ranges_contain()

static BOOL ranges_contain ( RANGES  ranges,
INT  nItem 
)
inlinestatic

Definition at line 3297 of file listview.c.

3298{
3299 RANGE srchrng = { nItem, nItem + 1 };
3300
3301 TRACE("(nItem=%d)\n", nItem);
3302 ranges_check(ranges, "before contain");
3303 return DPA_Search(ranges->hdpa, &srchrng, 0, ranges_cmp, 0, DPAS_SORTED) != -1;
3304}

Referenced by LISTVIEW_GetItemT().

◆ ranges_create()

static RANGES ranges_create ( int  count)
static

Definition at line 3225 of file listview.c.

3226{
3227 RANGES ranges = Alloc(sizeof(struct tagRANGES));
3228 if (!ranges) return NULL;
3229 ranges->hdpa = DPA_Create(count);
3230 if (ranges->hdpa) return ranges;
3231 Free(ranges);
3232 return NULL;
3233}

Referenced by iterator_frameditems_absolute(), iterator_visibleitems(), LISTVIEW_DeselectAllSkipItem(), LISTVIEW_NCCreate(), LISTVIEW_RefreshReport(), LISTVIEW_RefreshReportGrid(), LISTVIEW_SetGroupSelection(), and ranges_clone().

◆ ranges_del()

static BOOL ranges_del ( RANGES  ranges,
RANGE  range 
)
static

Definition at line 3421 of file listview.c.

3422{
3423 RANGE *chkrgn;
3424 INT index;
3425
3426 TRACE("(%s)\n", debugrange(&range));
3427 ranges_check(ranges, "before del");
3428
3429 /* we don't use DPAS_SORTED here, since we need *
3430 * to find the first overlapping range */
3431 index = DPA_Search(ranges->hdpa, &range, 0, ranges_cmp, 0, 0);
3432 while(index != -1)
3433 {
3434 chkrgn = DPA_GetPtr(ranges->hdpa, index);
3435
3436 TRACE("Matches range %s @%d\n", debugrange(chkrgn), index);
3437
3438 /* case 1: Same range */
3439 if ( (chkrgn->upper == range.upper) &&
3440 (chkrgn->lower == range.lower) )
3441 {
3442 DPA_DeletePtr(ranges->hdpa, index);
3443 Free(chkrgn);
3444 break;
3445 }
3446 /* case 2: engulf */
3447 else if ( (chkrgn->upper <= range.upper) &&
3448 (chkrgn->lower >= range.lower) )
3449 {
3450 DPA_DeletePtr(ranges->hdpa, index);
3451 Free(chkrgn);
3452 }
3453 /* case 3: overlap upper */
3454 else if ( (chkrgn->upper <= range.upper) &&
3455 (chkrgn->lower < range.lower) )
3456 {
3457 chkrgn->upper = range.lower;
3458 }
3459 /* case 4: overlap lower */
3460 else if ( (chkrgn->upper > range.upper) &&
3461 (chkrgn->lower >= range.lower) )
3462 {
3463 chkrgn->lower = range.upper;
3464 break;
3465 }
3466 /* case 5: fully internal */
3467 else
3468 {
3469 RANGE *newrgn;
3470
3471 if (!(newrgn = Alloc(sizeof(RANGE)))) goto fail;
3472 newrgn->lower = chkrgn->lower;
3473 newrgn->upper = range.lower;
3474 chkrgn->lower = range.upper;
3475 if (DPA_InsertPtr(ranges->hdpa, index, newrgn) == -1)
3476 {
3477 Free(newrgn);
3478 goto fail;
3479 }
3480 break;
3481 }
3482
3483 index = DPA_Search(ranges->hdpa, &range, index, ranges_cmp, 0, 0);
3484 }
3485
3486 ranges_check(ranges, "after del");
3487 return TRUE;
3488
3489fail:
3490 ranges_check(ranges, "failed del");
3491 return FALSE;
3492}

Referenced by LISTVIEW_SetItemCount(), ranges_delitem(), and ranges_diff().

◆ ranges_delitem()

static BOOL ranges_delitem ( RANGES  ranges,
INT  nItem 
)
inlinestatic

Definition at line 1146 of file listview.c.

1147{
1148 RANGE range = { nItem, nItem + 1 };
1149
1150 return ranges_del(ranges, range);
1151}

Referenced by iterator_remove_common_items(), iterator_visibleitems(), and set_main_item().

◆ ranges_destroy()

static void ranges_destroy ( RANGES  ranges)
static

Definition at line 3245 of file listview.c.

3246{
3247 if (!ranges) return;
3248 ranges_clear(ranges);
3249 DPA_Destroy(ranges->hdpa);
3250 Free(ranges);
3251}

Referenced by iterator_destroy(), iterator_visibleitems(), LISTVIEW_DeselectAllSkipItem(), LISTVIEW_NCCreate(), LISTVIEW_NCDestroy(), LISTVIEW_RefreshReportGrid(), LISTVIEW_SetGroupSelection(), and ranges_clone().

◆ ranges_diff()

static RANGES ranges_diff ( RANGES  ranges,
RANGES  sub 
)
static

Definition at line 3279 of file listview.c.

3280{
3281 INT i;
3282
3283 for (i = 0; i < DPA_GetPtrCount(sub->hdpa); i++)
3284 ranges_del(ranges, *((RANGE *)DPA_GetPtr(sub->hdpa, i)));
3285
3286 return ranges;
3287}

Referenced by LISTVIEW_DeselectAllSkipItems().

◆ ranges_dump()

static void ranges_dump ( RANGES  ranges)
static

Definition at line 3289 of file listview.c.

3290{
3291 INT i;
3292
3293 for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++)
3294 TRACE(" %s\n", debugrange(DPA_GetPtr(ranges->hdpa, i)));
3295}

Referenced by ranges_assert().

◆ ranges_itemcount()

static INT ranges_itemcount ( RANGES  ranges)
static

Definition at line 3306 of file listview.c.

3307{
3308 INT i, count = 0;
3309
3310 for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++)
3311 {
3312 RANGE *sel = DPA_GetPtr(ranges->hdpa, i);
3313 count += sel->upper - sel->lower;
3314 }
3315
3316 return count;
3317}

Referenced by LISTVIEW_GetSelectedCount().

◆ ranges_shift()

static BOOL ranges_shift ( RANGES  ranges,
INT  nItem,
INT  delta,
INT  nUpper 
)
static

Definition at line 3319 of file listview.c.

3320{
3321 RANGE srchrng = { nItem, nItem + 1 }, *chkrng;
3322 INT index;
3323
3324 index = DPA_Search(ranges->hdpa, &srchrng, 0, ranges_cmp, 0, DPAS_SORTED | DPAS_INSERTAFTER);
3325 if (index == -1) return TRUE;
3326
3327 for (; index < DPA_GetPtrCount(ranges->hdpa); index++)
3328 {
3329 chkrng = DPA_GetPtr(ranges->hdpa, index);
3330 if (chkrng->lower >= nItem)
3331 chkrng->lower = max(min(chkrng->lower + delta, nUpper - 1), 0);
3332 if (chkrng->upper > nItem)
3333 chkrng->upper = max(min(chkrng->upper + delta, nUpper), 0);
3334 }
3335 return TRUE;
3336}

Referenced by LISTVIEW_ShiftIndices().

◆ scroll_list()

static void scroll_list ( LISTVIEW_INFO infoPtr,
INT  dx,
INT  dy 
)
static

Definition at line 9849 of file listview.c.

9850{
9851 /* now we can scroll the list */
9852 ScrollWindowEx(infoPtr->hwndSelf, dx, dy, &infoPtr->rcList,
9853 &infoPtr->rcList, 0, 0, SW_ERASE | SW_INVALIDATE);
9854 /* if we have focus, adjust rect */
9855 OffsetRect(&infoPtr->rcFocus, dx, dy);
9856 UpdateWindow(infoPtr->hwndSelf);
9857}

Referenced by LISTVIEW_HScroll(), and LISTVIEW_VScroll().

◆ set_icon_size()

static void set_icon_size ( SIZE size,
HIMAGELIST  himl,
BOOL  is_small 
)
inlinestatic

Definition at line 8891 of file listview.c.

8892{
8893 INT cx, cy;
8894
8895 if (himl && ImageList_GetIconSize(himl, &cx, &cy))
8896 {
8897 size->cx = cx;
8898 size->cy = cy;
8899 }
8900 else
8901 {
8902 size->cx = GetSystemMetrics(is_small ? SM_CXSMICON : SM_CXICON);
8903 size->cy = GetSystemMetrics(is_small ? SM_CYSMICON : SM_CYICON);
8904 }
8905}

Referenced by LISTVIEW_Create(), LISTVIEW_SetImageList(), LISTVIEW_SetView(), and LISTVIEW_StyleChanged().

◆ set_main_item()

static BOOL set_main_item ( LISTVIEW_INFO infoPtr,
const LVITEMW lpLVItem,
BOOL  isNew,
BOOL  isW,
BOOL bChanged 
)
static

Definition at line 4303 of file listview.c.

4304{
4305 ITEM_INFO *lpItem;
4306 NMLISTVIEW nmlv;
4307 UINT uChanged = 0;
4308 LVITEMW item;
4309 /* stateMask is ignored for LVM_INSERTITEM */
4310 UINT stateMask = isNew ? ~0 : lpLVItem->stateMask;
4311
4312 TRACE("()\n");
4313
4314 assert(lpLVItem->iItem >= 0 && lpLVItem->iItem < infoPtr->nItemCount);
4315
4316 if (lpLVItem->mask == 0) return TRUE;
4317
4318 if (infoPtr->dwStyle & LVS_OWNERDATA)
4319 {
4320 /* a virtual listview only stores selection and focus */
4321 if (lpLVItem->mask & ~LVIF_STATE)
4322 return FALSE;
4323 lpItem = NULL;
4324 }
4325 else
4326 {
4327 HDPA hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem);
4328 lpItem = DPA_GetPtr(hdpaSubItems, 0);
4329 assert (lpItem);
4330 }
4331
4332 /* we need to get the lParam and state of the item */
4333 item.iItem = lpLVItem->iItem;
4334 item.iSubItem = lpLVItem->iSubItem;
4335 item.mask = LVIF_STATE | LVIF_PARAM;
4336 item.stateMask = (infoPtr->dwStyle & LVS_OWNERDATA) ? LVIS_FOCUSED | LVIS_SELECTED : ~0;
4337
4338 item.state = 0;
4339 item.lParam = 0;
4340 if (!isNew && !LISTVIEW_GetItemW(infoPtr, &item)) return FALSE;
4341
4342 TRACE("oldState=%x, newState=%x\n", item.state, lpLVItem->state);
4343 /* determine what fields will change */
4344 if ((lpLVItem->mask & LVIF_STATE) && ((item.state ^ lpLVItem->state) & stateMask & ~infoPtr->uCallbackMask))
4345 uChanged |= LVIF_STATE;
4346
4347 if ((lpLVItem->mask & LVIF_IMAGE) && (lpItem->hdr.iImage != lpLVItem->iImage))
4348 uChanged |= LVIF_IMAGE;
4349
4350 if ((lpLVItem->mask & LVIF_PARAM) && (lpItem->lParam != lpLVItem->lParam))
4351 uChanged |= LVIF_PARAM;
4352
4353 if ((lpLVItem->mask & LVIF_INDENT) && (lpItem->iIndent != lpLVItem->iIndent))
4354 uChanged |= LVIF_INDENT;
4355
4356 if ((lpLVItem->mask & LVIF_TEXT) && textcmpWT(lpItem->hdr.pszText, lpLVItem->pszText, isW))
4357 uChanged |= LVIF_TEXT;
4358
4359 TRACE("change mask=0x%x\n", uChanged);
4360
4361 memset(&nmlv, 0, sizeof(NMLISTVIEW));
4362 nmlv.iItem = lpLVItem->iItem;
4363 if (lpLVItem->mask & LVIF_STATE)
4364 {
4365 nmlv.uNewState = (item.state & ~stateMask) | (lpLVItem->state & stateMask);
4366 nmlv.uOldState = item.state;
4367 }
4368 nmlv.uChanged = uChanged ? uChanged : lpLVItem->mask;
4369 nmlv.lParam = item.lParam;
4370
4371 /* Send LVN_ITEMCHANGING notification, if the item is not being inserted
4372 and we are _NOT_ virtual (LVS_OWNERDATA), and change notifications
4373 are enabled. Even nothing really changed we still need to send this,
4374 in this case uChanged mask is just set to passed item mask. */
4375 if (lpItem && !isNew && (infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE))
4376 {
4377 HWND hwndSelf = infoPtr->hwndSelf;
4378
4379 if (notify_listview(infoPtr, LVN_ITEMCHANGING, &nmlv))
4380 return FALSE;
4381 if (!IsWindow(hwndSelf))
4382 return FALSE;
4383 }
4384
4385 /* When item is inserted we need to shift existing focus index if new item has lower index. */
4386 if (isNew && (stateMask & ~infoPtr->uCallbackMask & LVIS_FOCUSED) &&
4387 /* this means we won't hit a focus change path later */
4388 ((uChanged & LVIF_STATE) == 0 || (!(lpLVItem->state & LVIS_FOCUSED) && (infoPtr->nFocusedItem != lpLVItem->iItem))))
4389 {
4390 if (infoPtr->nFocusedItem != -1 && (lpLVItem->iItem <= infoPtr->nFocusedItem))
4391 infoPtr->nFocusedItem++;
4392 }
4393
4394 if (!uChanged) return TRUE;
4395 *bChanged = TRUE;
4396
4397 /* copy information */
4398 if (lpLVItem->mask & LVIF_TEXT)
4399 textsetptrT(&lpItem->hdr.pszText, lpLVItem->pszText, isW);
4400
4401 if (lpLVItem->mask & LVIF_IMAGE)
4402 lpItem->hdr.iImage = lpLVItem->iImage;
4403
4404 if (lpLVItem->mask & LVIF_PARAM)
4405 lpItem->lParam = lpLVItem->lParam;
4406
4407 if (lpLVItem->mask & LVIF_INDENT)
4408 lpItem->iIndent = lpLVItem->iIndent;
4409
4410 if (uChanged & LVIF_STATE)
4411 {
4412 if (lpItem && (stateMask & ~infoPtr->uCallbackMask))
4413 {
4414 lpItem->state &= ~stateMask;
4415 lpItem->state |= (lpLVItem->state & stateMask);
4416 }
4417 if (lpLVItem->state & stateMask & ~infoPtr->uCallbackMask & LVIS_SELECTED)
4418 {
4419 if (infoPtr->dwStyle & LVS_SINGLESEL) LISTVIEW_DeselectAllSkipItem(infoPtr, lpLVItem->iItem);
4420 ranges_additem(infoPtr->selectionRanges, lpLVItem->iItem);
4421 }
4422 else if (stateMask & LVIS_SELECTED)
4423 {
4424 ranges_delitem(infoPtr->selectionRanges, lpLVItem->iItem);
4425 }
4426 /* If we are asked to change focus, and we manage it, do it.
4427 It's important to have all new item data stored at this point,
4428 because changing existing focus could result in a redrawing operation,
4429 which in turn could ask for disp data, application should see all data
4430 for inserted item when processing LVN_GETDISPINFO.
4431
4432 The way this works application will see nested item change notifications -
4433 changed item notifications interrupted by ones from item losing focus. */
4434 if (stateMask & ~infoPtr->uCallbackMask & LVIS_FOCUSED)
4435 {
4436 if (lpLVItem->state & LVIS_FOCUSED)
4437 {
4438 /* update selection mark */
4439 if (infoPtr->nFocusedItem == -1 && infoPtr->nSelectionMark == -1)
4440 infoPtr->nSelectionMark = lpLVItem->iItem;
4441
4442 if (infoPtr->nFocusedItem != -1)
4443 {
4444 /* remove current focus */
4445 item.mask = LVIF_STATE;
4446 item.state = 0;
4447 item.stateMask = LVIS_FOCUSED;
4448
4449 /* recurse with redrawing an item */
4450 LISTVIEW_SetItemState(infoPtr, infoPtr->nFocusedItem, &item);
4451 }
4452
4453 infoPtr->nFocusedItem = lpLVItem->iItem;
4454 LISTVIEW_EnsureVisible(infoPtr, lpLVItem->iItem, infoPtr->uView == LV_VIEW_LIST);
4455 }
4456 else if (infoPtr->nFocusedItem == lpLVItem->iItem)
4457 {
4458 infoPtr->nFocusedItem = -1;
4459 }
4460 }
4461 }
4462
4463 /* if we're inserting the item, we're done */
4464 if (isNew) return TRUE;
4465
4466 /* send LVN_ITEMCHANGED notification */
4467 if (lpLVItem->mask & LVIF_PARAM) nmlv.lParam = lpLVItem->lParam;
4468 if (infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE)
4469 notify_listview(infoPtr, LVN_ITEMCHANGED, &nmlv);
4470
4471 return TRUE;
4472}
#define LVN_ITEMCHANGING
Definition: commctrl.h:3130

Referenced by LISTVIEW_InsertItemT(), and LISTVIEW_SetItemT().

◆ set_sub_item()

static BOOL set_sub_item ( const LISTVIEW_INFO infoPtr,
const LVITEMW lpLVItem,
BOOL  isW,
BOOL bChanged 
)
static

Definition at line 4488 of file listview.c.

4489{
4490 HDPA hdpaSubItems;
4491 SUBITEM_INFO *lpSubItem;
4492
4493 /* we do not support subitems for virtual listviews */
4494 if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
4495
4496 /* set subitem only if column is present */
4497 if (lpLVItem->iSubItem >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
4498
4499 /* First do some sanity checks */
4500 /* The LVIF_STATE flag is valid for subitems, but does not appear to be
4501 particularly useful. We currently do not actually do anything with
4502 the flag on subitems.
4503 */
4504 if (lpLVItem->mask & ~(LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_DI_SETITEM)) return FALSE;
4505 if (!(lpLVItem->mask & (LVIF_TEXT | LVIF_IMAGE | LVIF_STATE))) return TRUE;
4506
4507 /* get the subitem structure, and create it if not there */
4508 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, lpLVItem->iItem);
4509 assert (hdpaSubItems);
4510
4511 lpSubItem = LISTVIEW_GetSubItemPtr(hdpaSubItems, lpLVItem->iSubItem);
4512 if (!lpSubItem)
4513 {
4514 SUBITEM_INFO *tmpSubItem;
4515 INT i;
4516
4517 lpSubItem = Alloc(sizeof(SUBITEM_INFO));
4518 if (!lpSubItem) return FALSE;
4519 /* we could binary search here, if need be...*/
4520 for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++)
4521 {
4522 tmpSubItem = DPA_GetPtr(hdpaSubItems, i);
4523 if (tmpSubItem->iSubItem > lpLVItem->iSubItem) break;
4524 }
4525 if (DPA_InsertPtr(hdpaSubItems, i, lpSubItem) == -1)
4526 {
4527 Free(lpSubItem);
4528 return FALSE;
4529 }
4530 lpSubItem->iSubItem = lpLVItem->iSubItem;
4531 lpSubItem->hdr.iImage = I_IMAGECALLBACK;
4532 *bChanged = TRUE;
4533 }
4534
4535 if ((lpLVItem->mask & LVIF_IMAGE) && (lpSubItem->hdr.iImage != lpLVItem->iImage))
4536 {
4537 lpSubItem->hdr.iImage = lpLVItem->iImage;
4538 *bChanged = TRUE;
4539 }
4540
4541 if ((lpLVItem->mask & LVIF_TEXT) && textcmpWT(lpSubItem->hdr.pszText, lpLVItem->pszText, isW))
4542 {
4543 textsetptrT(&lpSubItem->hdr.pszText, lpLVItem->pszText, isW);
4544 *bChanged = TRUE;
4545 }
4546
4547 return TRUE;
4548}

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetItemT().

◆ shift_item()

static INT shift_item ( const LISTVIEW_INFO infoPtr,
INT  nShiftItem,
INT  nItem,
INT  direction 
)
static

Definition at line 3600 of file listview.c.

3601{
3602 if (nShiftItem < nItem) return nShiftItem;
3603
3604 if (nShiftItem > nItem) return nShiftItem + direction;
3605
3606 if (direction > 0) return nShiftItem + direction;
3607
3608 return min(nShiftItem, infoPtr->nItemCount - 1);
3609}

Referenced by LISTVIEW_ShiftFocus(), and LISTVIEW_ShiftIndices().

◆ textcmpWT()

static int textcmpWT ( LPCWSTR  aw,
LPCWSTR  bt,
BOOL  isW 
)
inlinestatic

Definition at line 529 of file listview.c.

530{
531 if (!aw) return bt ? -1 : 0;
532 if (!bt) return 1;
533 if (aw == LPSTR_TEXTCALLBACKW)
534 return bt == LPSTR_TEXTCALLBACKW ? 1 : -1;
535 if (bt != LPSTR_TEXTCALLBACKW)
536 {
537 LPWSTR bw = textdupTtoW(bt, isW);
538 int r = bw ? lstrcmpW(aw, bw) : 1;
539 textfreeT(bw, isW);
540 return r;
541 }
542
543 return 1;
544}
static int bw
Definition: maze.c:120

Referenced by LISTVIEW_InsertItemT(), set_main_item(), and set_sub_item().

◆ textcpynT()

static void textcpynT ( LPWSTR  dest,
BOOL  isDestW,
LPCWSTR  src,
BOOL  isSrcW,
INT  max 
)
inlinestatic

Definition at line 474 of file listview.c.

475{
476 if (isDestW)
477 if (isSrcW) lstrcpynW(dest, src, max);
478 else MultiByteToWideChar(CP_ACP, 0, (LPCSTR)src, -1, dest, max);
479 else
480 if (isSrcW) WideCharToMultiByte(CP_ACP, 0, src, -1, (LPSTR)dest, max, NULL, NULL);
481 else lstrcpynA((LPSTR)dest, (LPCSTR)src, max);
482}
#define lstrcpynA
Definition: compat.h:751
#define lstrcpynW
Definition: compat.h:738
GLenum src
Definition: glext.h:6340
static char * dest
Definition: rtl.c:135

Referenced by LISTVIEW_GetItemExtT(), and LISTVIEW_GetItemT().

◆ textdupTtoW()

static LPWSTR textdupTtoW ( LPCWSTR  text,
BOOL  isW 
)
inlinestatic

Definition at line 484 of file listview.c.

485{
486 LPWSTR wstr = (LPWSTR)text;
487
488 if (!isW && is_text(text))
489 {
491 wstr = Alloc(len * sizeof(WCHAR));
492 if (wstr) MultiByteToWideChar(CP_ACP, 0, (LPCSTR)text, -1, wstr, len);
493 }
494 TRACE(" wstr=%s\n", text == LPSTR_TEXTCALLBACKW ? "(callback)" : debugstr_w(wstr));
495 return wstr;
496}

Referenced by LISTVIEW_EndEditLabelT(), LISTVIEW_FindItemA(), LISTVIEW_InsertItemT(), LISTVIEW_SetItemT(), textcmpWT(), and textsetptrT().

◆ textfreeT()

static void textfreeT ( LPWSTR  wstr,
BOOL  isW 
)
inlinestatic

Definition at line 498 of file listview.c.

499{
500 if (!isW && is_text(wstr)) Free (wstr);
501}

Referenced by LISTVIEW_EndEditLabelT(), LISTVIEW_FindItemA(), LISTVIEW_InsertItemT(), LISTVIEW_SetItemT(), textcmpWT(), and textsetptrT().

◆ textlenT()

static int textlenT ( LPCWSTR  text,
BOOL  isW 
)
inlinestatic

Definition at line 468 of file listview.c.

469{
470 return !is_text(text) ? 0 :
472}

Referenced by column_fill_hditem(), debugtext_tn(), LISTVIEW_EndEditLabelT(), and LISTVIEW_GetItemTextT().

◆ textsetptrT()

static BOOL textsetptrT ( LPWSTR dest,
LPCWSTR  src,
BOOL  isW 
)
static

Definition at line 507 of file listview.c.

508{
509 BOOL bResult = TRUE;
510
512 {
513 if (is_text(*dest)) Free(*dest);
515 }
516 else
517 {
518 LPWSTR pszText = textdupTtoW(src, isW);
519 if (*dest == LPSTR_TEXTCALLBACKW) *dest = NULL;
520 bResult = Str_SetPtrW(dest, pszText);
521 textfreeT(pszText, isW);
522 }
523 return bResult;
524}
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:236

Referenced by LISTVIEW_GetItemT(), set_main_item(), and set_sub_item().

◆ toggle_checkbox_state()

static void toggle_checkbox_state ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 1594 of file listview.c.

1595{
1597 if(state == 1 || state == 2)
1598 {
1599 LVITEMW lvitem;
1600 state ^= 3;
1603 LISTVIEW_SetItemState(infoPtr, nItem, &lvitem);
1604 }
1605}
static int state
Definition: maze.c:121

Referenced by LISTVIEW_KeyDown(), and LISTVIEW_LButtonDown().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( listview  )

Variable Documentation

◆ themeClass

const WCHAR themeClass[] = {'L','i','s','t','V','i','e','w',0}
static

Definition at line 427 of file listview.c.

Referenced by LISTVIEW_Create(), and LISTVIEW_ThemeChanged().