ReactOS 0.4.16-dev-1049-g378a335
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 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 3189 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 3938 of file listview.c.

◆ SCROLL_LEFT

#define SCROLL_LEFT   0x1

Definition at line 3935 of file listview.c.

◆ SCROLL_RIGHT

#define SCROLL_RIGHT   0x2

Definition at line 3936 of file listview.c.

◆ SCROLL_UP

#define SCROLL_UP   0x4

Definition at line 3937 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 1575 of file listview.c.

1577{
1578 if (isW) return CallWindowProcW(proc, hwnd, uMsg, wParam, lParam);
1579 else return CallWindowProcA(proc, hwnd, uMsg, wParam, lParam);
1580}
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 8231 of file listview.c.

8233{
8234 if (lpColumn->mask & LVCF_FMT)
8235 {
8236 /* format member is valid */
8237 lphdi->mask |= HDI_FORMAT;
8238
8239 /* set text alignment (leftmost column must be left-aligned) */
8240 if (nColumn == 0 || (lpColumn->fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_LEFT)
8241 lphdi->fmt |= HDF_LEFT;
8242 else if ((lpColumn->fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_RIGHT)
8243 lphdi->fmt |= HDF_RIGHT;
8244 else if ((lpColumn->fmt & LVCFMT_JUSTIFYMASK) == LVCFMT_CENTER)
8245 lphdi->fmt |= HDF_CENTER;
8246
8247 if (lpColumn->fmt & LVCFMT_BITMAP_ON_RIGHT)
8248 lphdi->fmt |= HDF_BITMAP_ON_RIGHT;
8249
8250 if (lpColumn->fmt & LVCFMT_COL_HAS_IMAGES)
8251 {
8252 lphdi->fmt |= HDF_IMAGE;
8253 lphdi->iImage = I_IMAGECALLBACK;
8254 }
8255
8256 if (lpColumn->fmt & LVCFMT_FIXED_WIDTH)
8257 lphdi->fmt |= HDF_FIXEDWIDTH;
8258 }
8259
8260 if (lpColumn->mask & LVCF_WIDTH)
8261 {
8262 lphdi->mask |= HDI_WIDTH;
8263 if(lpColumn->cx == LVSCW_AUTOSIZE_USEHEADER)
8264 {
8265 /* make it fill the remainder of the controls width */
8266 RECT rcHeader;
8267 INT item_index;
8268
8269 for(item_index = 0; item_index < (nColumn - 1); item_index++)
8270 {
8271 LISTVIEW_GetHeaderRect(infoPtr, item_index, &rcHeader);
8272 lphdi->cxy += rcHeader.right - rcHeader.left;
8273 }
8274
8275 /* retrieve the layout of the header */
8276 GetClientRect(infoPtr->hwndSelf, &rcHeader);
8277 TRACE("start cxy=%d rcHeader=%s\n", lphdi->cxy, wine_dbgstr_rect(&rcHeader));
8278
8279 lphdi->cxy = (rcHeader.right - rcHeader.left) - lphdi->cxy;
8280 }
8281 else
8282 lphdi->cxy = lpColumn->cx;
8283 }
8284
8285 if (lpColumn->mask & LVCF_TEXT)
8286 {
8287 lphdi->mask |= HDI_TEXT | HDI_FORMAT;
8288 lphdi->fmt |= HDF_STRING;
8289 lphdi->pszText = lpColumn->pszText;
8290 lphdi->cchTextMax = textlenT(lpColumn->pszText, isW);
8291 }
8292
8293 if (lpColumn->mask & LVCF_IMAGE)
8294 {
8295 lphdi->mask |= HDI_IMAGE;
8296 lphdi->iImage = lpColumn->iImage;
8297 }
8298
8299 if (lpColumn->mask & LVCF_ORDER)
8300 {
8301 lphdi->mask |= HDI_ORDER;
8302 lphdi->iOrder = lpColumn->iOrder;
8303 }
8304}
static void LISTVIEW_GetHeaderRect(const LISTVIEW_INFO *infoPtr, INT nSubItem, LPRECT lprc)
Definition: listview.c:1695
static int textlenT(LPCWSTR text, BOOL isW)
Definition: listview.c:468
#define LVCF_ORDER
Definition: commctrl.h:2596
#define I_IMAGECALLBACK
Definition: commctrl.h:2390
#define HDF_LEFT
Definition: commctrl.h:713
#define LVCFMT_COL_HAS_IMAGES
Definition: commctrl.h:2609
#define HDI_TEXT
Definition: commctrl.h:704
#define LVCFMT_CENTER
Definition: commctrl.h:2605
#define HDF_CENTER
Definition: commctrl.h:715
#define LVCF_IMAGE
Definition: commctrl.h:2595
#define HDF_RIGHT
Definition: commctrl.h:714
#define LVCF_WIDTH
Definition: commctrl.h:2592
#define HDF_IMAGE
Definition: commctrl.h:723
#define LVCFMT_BITMAP_ON_RIGHT
Definition: commctrl.h:2608
#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:2606
#define HDI_FORMAT
Definition: commctrl.h:705
#define LVCF_FMT
Definition: commctrl.h:2591
#define LVCFMT_LEFT
Definition: commctrl.h:2603
#define LVCFMT_RIGHT
Definition: commctrl.h:2604
#define HDI_IMAGE
Definition: commctrl.h:708
#define LVSCW_AUTOSIZE_USEHEADER
Definition: commctrl.h:2650
#define LVCF_TEXT
Definition: commctrl.h:2593
#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:2572
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 6205 of file listview.c.

6206{
6209 HWND hedit;
6210
6211 TRACE("(%p, text=%s, isW=%d)\n", infoPtr, debugtext_t(text, isW), isW);
6212
6213 /* window will be resized and positioned after LVN_BEGINLABELEDIT */
6214 if (isW)
6215 hedit = CreateWindowW(WC_EDITW, text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
6216 else
6217 hedit = CreateWindowA(WC_EDITA, (LPCSTR)text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
6218
6219 if (!hedit) return 0;
6220
6221 infoPtr->EditWndProc = (WNDPROC)
6224
6225 SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE);
6227
6228 return hedit;
6229}
Arabic default style
Definition: afstyles.h:94
#define FALSE
Definition: types.h:117
static LPCSTR debugtext_t(LPCWSTR text, BOOL isW)
Definition: listview.c:548
static LRESULT CALLBACK EditLblWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6171
#define DISP_TEXT_SIZE
Definition: listview.c:349
static LRESULT CALLBACK EditLblWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6188
const WCHAR * text
Definition: package.c:1794
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:4692
#define WC_EDITA
Definition: commctrl.h:4691
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:5365
#define GetWindowLongPtrW
Definition: winuser.h:4840
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4326
#define GWLP_HINSTANCE
Definition: winuser.h:867
#define EM_SETLIMITTEXT
Definition: winuser.h:2022
#define WM_SETFONT
Definition: winuser.h:1661
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4327
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2917
#define SetWindowLongPtrW
Definition: winuser.h:5366
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 1029 of file listview.c.

1031{
1032 ZeroMemory(lpnmlvcd, sizeof(NMLVCUSTOMDRAW));
1033 lpnmlvcd->nmcd.hdc = hdc;
1034 lpnmlvcd->nmcd.rc = *rcBounds;
1035 lpnmlvcd->clrTextBk = infoPtr->clrTextBk;
1036 lpnmlvcd->clrText = infoPtr->clrText;
1037 if (!lplvItem) return;
1038 lpnmlvcd->nmcd.dwItemSpec = lplvItem->iItem + 1;
1039 lpnmlvcd->iSubItem = lplvItem->iSubItem;
1040 if (lplvItem->state & LVIS_SELECTED) lpnmlvcd->nmcd.uItemState |= CDIS_SELECTED;
1041 if (lplvItem->state & LVIS_FOCUSED) lpnmlvcd->nmcd.uItemState |= CDIS_FOCUS;
1042 if (lplvItem->iItem == infoPtr->nHotItem) lpnmlvcd->nmcd.uItemState |= CDIS_HOT;
1043 lpnmlvcd->nmcd.lItemlParam = lplvItem->lParam;
1044}
HDC hdc
Definition: main.c:9
#define CDIS_SELECTED
Definition: commctrl.h:291
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define CDIS_FOCUS
Definition: commctrl.h:295
#define CDIS_HOT
Definition: commctrl.h:297
#define LVIS_FOCUSED
Definition: commctrl.h:2323
COLORREF clrTextBk
Definition: listview.c:301
COLORREF clrText
Definition: listview.c:300
int iSubItem
Definition: commctrl.h:2367
UINT state
Definition: commctrl.h:2368
LPARAM lParam
Definition: commctrl.h:2373
DWORD_PTR dwItemSpec
Definition: commctrl.h:307
COLORREF clrTextBk
Definition: commctrl.h:3069
NMCUSTOMDRAW nmcd
Definition: commctrl.h:3067
COLORREF clrText
Definition: commctrl.h:3068
#define ZeroMemory
Definition: winbase.h:1743

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

◆ debug_getbuf()

static char * debug_getbuf ( void  )
static

Definition at line 561 of file listview.c.

562{
563 static int index = 0;
565 return buffers[index++ % DEBUG_BUFFERS];
566}
#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 662 of file listview.c.

663{
664 char* buf = debug_getbuf(), *text = buf;
666
667 if (lpColumn == NULL) return "(null)";
668 len = snprintf(buf, size, "{");
669 if (len == -1) goto end;
670 buf += len; size -= len;
671 if (lpColumn->mask & LVCF_SUBITEM)
672 len = snprintf(buf, size, "iSubItem=%d, ", lpColumn->iSubItem);
673 else len = 0;
674 if (len == -1) goto end;
675 buf += len; size -= len;
676 if (lpColumn->mask & LVCF_FMT)
677 len = snprintf(buf, size, "fmt=%x, ", lpColumn->fmt);
678 else len = 0;
679 if (len == -1) goto end;
680 buf += len; size -= len;
681 if (lpColumn->mask & LVCF_WIDTH)
682 len = snprintf(buf, size, "cx=%d, ", lpColumn->cx);
683 else len = 0;
684 if (len == -1) goto end;
685 buf += len; size -= len;
686 if (lpColumn->mask & LVCF_TEXT)
687 len = snprintf(buf, size, "pszText=%s, cchTextMax=%d, ", debugtext_tn(lpColumn->pszText, isW, 80), lpColumn->cchTextMax);
688 else len = 0;
689 if (len == -1) goto end;
690 buf += len; size -= len;
691 if (lpColumn->mask & LVCF_IMAGE)
692 len = snprintf(buf, size, "iImage=%d, ", lpColumn->iImage);
693 else len = 0;
694 if (len == -1) goto end;
695 buf += len; size -= len;
696 if (lpColumn->mask & LVCF_ORDER)
697 len = snprintf(buf, size, "iOrder=%d, ", lpColumn->iOrder);
698 else len = 0;
699 if (len == -1) goto end;
700 buf += len;
701 goto undo;
702end:
703 buf = text + strlen(text);
704undo:
705 if (buf - text > 2) { buf[-2] = '}'; buf[-1] = 0; }
706 return text;
707}
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:554
static char * debug_getbuf(void)
Definition: listview.c:561
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:2594
int cchTextMax
Definition: commctrl.h:2573
#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 709 of file listview.c.

710{
711 if (!lpht) return "(null)";
712
713 return wine_dbg_sprintf("{pt=%s, flags=0x%x, iItem=%d, iSubItem=%d}",
714 wine_dbgstr_point(&lpht->pt), lpht->flags, lpht->iItem, lpht->iSubItem);
715}
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 620 of file listview.c.

621{
622 char* buf = debug_getbuf(), *text = buf;
624
625 if (lpLVItem == NULL) return "(null)";
626 len = snprintf(buf, size, "{iItem=%d, iSubItem=%d, ", lpLVItem->iItem, lpLVItem->iSubItem);
627 if (len == -1) goto end;
628 buf += len; size -= len;
629 if (lpLVItem->mask & LVIF_STATE)
630 len = snprintf(buf, size, "state=%x, stateMask=%x, ", lpLVItem->state, lpLVItem->stateMask);
631 else len = 0;
632 if (len == -1) goto end;
633 buf += len; size -= len;
634 if (lpLVItem->mask & LVIF_TEXT)
635 len = snprintf(buf, size, "pszText=%s, cchTextMax=%d, ", debugtext_tn(lpLVItem->pszText, isW, 80), lpLVItem->cchTextMax);
636 else len = 0;
637 if (len == -1) goto end;
638 buf += len; size -= len;
639 if (lpLVItem->mask & LVIF_IMAGE)
640 len = snprintf(buf, size, "iImage=%d, ", lpLVItem->iImage);
641 else len = 0;
642 if (len == -1) goto end;
643 buf += len; size -= len;
644 if (lpLVItem->mask & LVIF_PARAM)
645 len = snprintf(buf, size, "lParam=%lx, ", lpLVItem->lParam);
646 else len = 0;
647 if (len == -1) goto end;
648 buf += len; size -= len;
649 if (lpLVItem->mask & LVIF_INDENT)
650 len = snprintf(buf, size, "iIndent=%d, ", lpLVItem->iIndent);
651 else len = 0;
652 if (len == -1) goto end;
653 buf += len;
654 goto undo;
655end:
656 buf = text + strlen(text);
657undo:
658 if (buf - text > 2) { buf[-2] = '}'; buf[-1] = 0; }
659 return text;
660}
#define LVIF_STATE
Definition: commctrl.h:2317
#define LVIF_INDENT
Definition: commctrl.h:2318
#define LVIF_PARAM
Definition: commctrl.h:2316
#define LVIF_TEXT
Definition: commctrl.h:2314
#define LVIF_IMAGE
Definition: commctrl.h:2315
LPWSTR pszText
Definition: commctrl.h:2370
int cchTextMax
Definition: commctrl.h:2371
UINT mask
Definition: commctrl.h:2365
UINT stateMask
Definition: commctrl.h:2369
int iImage
Definition: commctrl.h:2372
int iIndent
Definition: commctrl.h:2374

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 611 of file listview.c.

612{
613 if (!plvnm) return "(null)";
614 return wine_dbg_sprintf("iItem=%d, iSubItem=%d, uNewState=0x%x,"
615 " uOldState=0x%x, uChanged=0x%x, ptAction=%s, lParam=%ld",
616 plvnm->iItem, plvnm->iSubItem, plvnm->uNewState, plvnm->uOldState,
617 plvnm->uChanged, wine_dbgstr_point(&plvnm->ptAction), plvnm->lParam);
618}
POINT ptAction
Definition: commctrl.h:3044
UINT uNewState
Definition: commctrl.h:3041
LPARAM lParam
Definition: commctrl.h:3045
UINT uOldState
Definition: commctrl.h:3042

Referenced by notify_listview().

◆ debugrange()

static const char * debugrange ( const RANGE lprng)
inlinestatic

Definition at line 568 of file listview.c.

569{
570 if (!lprng) return "(null)";
571 return wine_dbg_sprintf("[%d, %d]", lprng->lower, lprng->upper);
572}

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

◆ debugscrollcode()

static LPCSTR debugscrollcode ( int  nScrollCode)
inlinestatic

Definition at line 718 of file listview.c.

719{
720 switch(nScrollCode)
721 {
722 case SB_LINELEFT: return "SB_LINELEFT";
723 case SB_LINERIGHT: return "SB_LINERIGHT";
724 case SB_PAGELEFT: return "SB_PAGELEFT";
725 case SB_PAGERIGHT: return "SB_PAGERIGHT";
726 case SB_THUMBPOSITION: return "SB_THUMBPOSITION";
727 case SB_THUMBTRACK: return "SB_THUMBTRACK";
728 case SB_ENDSCROLL: return "SB_ENDSCROLL";
729 case SB_INTERNAL: return "SB_INTERNAL";
730 default: return "unknown";
731 }
732}
#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 574 of file listview.c.

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

Referenced by LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateVScroll().

◆ debugtext_t()

static LPCSTR debugtext_t ( LPCWSTR  text,
BOOL  isW 
)
inlinestatic

Definition at line 548 of file listview.c.

549{
550 if (text == LPSTR_TEXTCALLBACKW) return "(callback)";
551 return isW ? debugstr_w(text) : debugstr_a((LPCSTR)text);
552}
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2385

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

◆ debugtext_tn()

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

Definition at line 554 of file listview.c.

555{
556 if (text == LPSTR_TEXTCALLBACKW) return "(callback)";
557 n = min(textlenT(text, isW), n);
558 return isW ? debugstr_wn(text, n) : debugstr_an((LPCSTR)text, n);
559}
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 6188 of file listview.c.

6189{
6190 return EditLblWndProcT(hwnd, uMsg, wParam, lParam, FALSE);
6191}
static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
Definition: listview.c:6117

Referenced by CreateEditLabelT().

◆ EditLblWndProcT()

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

Definition at line 6117 of file listview.c.

6118{
6120 BOOL save = TRUE;
6121
6122 TRACE("(hwnd=%p, uMsg=%x, wParam=%lx, lParam=%lx, isW=%d)\n",
6123 hwnd, uMsg, wParam, lParam, isW);
6124
6125 switch (uMsg)
6126 {
6127 case WM_GETDLGCODE:
6129
6130 case WM_DESTROY:
6131 {
6132 WNDPROC editProc = infoPtr->EditWndProc;
6133 infoPtr->EditWndProc = 0;
6135 return CallWindowProcT(editProc, hwnd, uMsg, wParam, lParam, isW);
6136 }
6137
6138 case WM_KEYDOWN:
6139 if (VK_ESCAPE == (INT)wParam)
6140 {
6141 save = FALSE;
6142 break;
6143 }
6144 else if (VK_RETURN == (INT)wParam)
6145 break;
6146
6147 default:
6148 return CallWindowProcT(infoPtr->EditWndProc, hwnd, uMsg, wParam, lParam, isW);
6149 }
6150
6151 /* kill the edit */
6152 if (infoPtr->hwndEdit)
6153 LISTVIEW_EndEditLabelT(infoPtr, save, isW);
6154
6155 SendMessageW(hwnd, WM_CLOSE, 0, 0);
6156 return 0;
6157}
#define TRUE
Definition: types.h:120
static LRESULT CallWindowProcT(WNDPROC proc, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
Definition: listview.c:1575
static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *, BOOL, BOOL)
Definition: listview.c:5998
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_CLOSE
Definition: winuser.h:1632
#define DLGC_WANTALLKEYS
Definition: winuser.h:2623
#define VK_RETURN
Definition: winuser.h:2212
#define DLGC_WANTARROWS
Definition: winuser.h:2621
HWND WINAPI GetParent(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1620
#define WM_KEYDOWN
Definition: winuser.h:1726
#define VK_ESCAPE
Definition: winuser.h:2225
#define WM_GETDLGCODE
Definition: winuser.h:1700

Referenced by EditLblWndProcA(), and EditLblWndProcW().

◆ EditLblWndProcW()

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

Definition at line 6171 of file listview.c.

6172{
6173 return EditLblWndProcT(hwnd, uMsg, wParam, lParam, TRUE);
6174}

Referenced by CreateEditLabelT().

◆ get_ansi_notification()

static int get_ansi_notification ( UINT  unicodeNotificationCode)
static

Definition at line 737 of file listview.c.

738{
739 switch (unicodeNotificationCode)
740 {
745 case LVN_GETDISPINFOA:
747 case LVN_SETDISPINFOA:
749 case LVN_ODFINDITEMA:
750 case LVN_ODFINDITEMW: return LVN_ODFINDITEMA;
751 case LVN_GETINFOTIPA:
752 case LVN_GETINFOTIPW: return LVN_GETINFOTIPA;
753 /* header forwards */
754 case HDN_TRACKA:
755 case HDN_TRACKW: return HDN_TRACKA;
756 case HDN_ENDTRACKA:
757 case HDN_ENDTRACKW: return HDN_ENDTRACKA;
758 case HDN_BEGINDRAG: return HDN_BEGINDRAG;
759 case HDN_ENDDRAG: return HDN_ENDDRAG;
762 case HDN_ITEMCHANGEDA:
764 case HDN_ITEMCLICKA:
765 case HDN_ITEMCLICKW: return HDN_ITEMCLICKA;
768 default: break;
769 }
770 FIXME("unknown notification %x\n", unicodeNotificationCode);
771 return unicodeNotificationCode;
772}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define LVN_GETDISPINFOA
Definition: commctrl.h:3158
#define LVN_ODFINDITEMW
Definition: commctrl.h:3150
#define HDN_ITEMCHANGEDW
Definition: commctrl.h:840
#define LVN_GETINFOTIPA
Definition: commctrl.h:3227
#define LVN_SETDISPINFOW
Definition: commctrl.h:3161
#define LVN_GETINFOTIPW
Definition: commctrl.h:3228
#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:3140
#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:3143
#define LVN_SETDISPINFOA
Definition: commctrl.h:3160
#define LVN_BEGINLABELEDITW
Definition: commctrl.h:3141
#define HDN_ITEMCHANGINGW
Definition: commctrl.h:838
#define LVN_ENDLABELEDITA
Definition: commctrl.h:3142
#define HDN_DIVIDERDBLCLICKW
Definition: commctrl.h:846
#define LVN_ODFINDITEMA
Definition: commctrl.h:3149
#define LVN_GETDISPINFOW
Definition: commctrl.h:3159
#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 1622 of file listview.c.

1623{
1625
1626 if (count > 0)
1627 {
1628 ITEM_ID *lpID = DPA_GetPtr(infoPtr->hdpaItemIds, count - 1);
1629 return lpID->id + 1;
1630 }
1631 return 0;
1632}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define DPA_GetPtrCount(hdpa)
Definition: commctrl.h:4960
#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 4283 of file listview.c.

4284{
4285 if ( (lpLVItem->mask & LVIF_TEXT) &&
4286 (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) &&
4287 (lStyle & (LVS_SORTASCENDING | LVS_SORTDESCENDING)) ) return FALSE;
4288
4289 return TRUE;
4290}
#define LVS_SORTASCENDING
Definition: commctrl.h:2273
#define LVS_SORTDESCENDING
Definition: commctrl.h:2274

Referenced by LISTVIEW_InsertItemT(), and LISTVIEW_SetItemT().

◆ is_autoarrange()

static BOOL is_autoarrange ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1582 of file listview.c.

1583{
1584 return (infoPtr->dwStyle & LVS_AUTOARRANGE) &&
1585 (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON);
1586}
#define LV_VIEW_SMALLICON
Definition: commctrl.h:2847
#define LV_VIEW_ICON
Definition: commctrl.h:2845
#define LVS_AUTOARRANGE
Definition: commctrl.h:2277

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 1303 of file listview.c.

1304{
1305 ranges_destroy(i->ranges);
1306}
static void ranges_destroy(RANGES ranges)
Definition: listview.c:3235
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 1311 of file listview.c.

1312{
1313 ZeroMemory(i, sizeof(*i));
1314 i->nItem = i->nSpecial = i->range.lower = i->range.upper = -1;
1315}

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 1440 of file listview.c.

1441{
1442 RECT frame = *lprc;
1443 POINT Origin;
1444
1445 TRACE("(lprc=%s)\n", wine_dbgstr_rect(lprc));
1446
1447 LISTVIEW_GetOrigin(infoPtr, &Origin);
1448 OffsetRect(&frame, -Origin.x, -Origin.y);
1449
1450 return iterator_frameditems_absolute(i, infoPtr, &frame);
1451}
static void LISTVIEW_GetOrigin(const LISTVIEW_INFO *, LPPOINT)
Definition: listview.c:7671
static BOOL iterator_frameditems_absolute(ITERATOR *i, const LISTVIEW_INFO *infoPtr, const RECT *frame)
Definition: listview.c:1341
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4477
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 1341 of file listview.c.

1342{
1343 RECT rcItem, rcTemp;
1344 RANGES ranges;
1345
1346 TRACE("(frame=%s)\n", wine_dbgstr_rect(frame));
1347
1348 /* in case we fail, we want to return an empty iterator */
1350
1351 if (infoPtr->nItemCount == 0)
1352 return TRUE;
1353
1354 if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)
1355 {
1356 INT nItem;
1357
1358 if (infoPtr->uView == LV_VIEW_ICON && infoPtr->nFocusedItem != -1)
1359 {
1360 LISTVIEW_GetItemBox(infoPtr, infoPtr->nFocusedItem, &rcItem);
1361 if (IntersectRect(&rcTemp, &rcItem, frame))
1362 i->nSpecial = infoPtr->nFocusedItem;
1363 }
1364 if (!(ranges = ranges_create(50))) return FALSE;
1365 iterator_rangesitems(i, ranges);
1366 /* to do better here, we need to have PosX, and PosY sorted */
1367 TRACE("building icon ranges:\n");
1368 for (nItem = 0; nItem < infoPtr->nItemCount; nItem++)
1369 {
1370 rcItem.left = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
1371 rcItem.top = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
1372 rcItem.right = rcItem.left + infoPtr->nItemWidth;
1373 rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
1374 if (IntersectRect(&rcTemp, &rcItem, frame))
1375 ranges_additem(i->ranges, nItem);
1376 }
1377 return TRUE;
1378 }
1379 else if (infoPtr->uView == LV_VIEW_DETAILS)
1380 {
1381 RANGE range;
1382
1383 if (frame->left >= infoPtr->nItemWidth) return TRUE;
1384 if (frame->top >= infoPtr->nItemHeight * infoPtr->nItemCount) return TRUE;
1385
1386 range.lower = max(frame->top / infoPtr->nItemHeight, 0);
1387 range.upper = min((frame->bottom - 1) / infoPtr->nItemHeight, infoPtr->nItemCount - 1) + 1;
1388 if (range.upper <= range.lower) return TRUE;
1390 TRACE(" report=%s\n", debugrange(&i->range));
1391 }
1392 else
1393 {
1394 INT nPerCol = max((infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight, 1);
1395 INT nFirstRow = max(frame->top / infoPtr->nItemHeight, 0);
1396 INT nLastRow = min((frame->bottom - 1) / infoPtr->nItemHeight, nPerCol - 1);
1397 INT nFirstCol;
1398 INT nLastCol;
1399 INT lower;
1400 RANGE item_range;
1401 INT nCol;
1402
1403 if (infoPtr->nItemWidth)
1404 {
1405 nFirstCol = max(frame->left / infoPtr->nItemWidth, 0);
1406 nLastCol = min((frame->right - 1) / infoPtr->nItemWidth, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
1407 }
1408 else
1409 {
1410 nFirstCol = max(frame->left, 0);
1411 nLastCol = min(frame->right - 1, (infoPtr->nItemCount + nPerCol - 1) / nPerCol);
1412 }
1413
1414 lower = nFirstCol * nPerCol + nFirstRow;
1415
1416 TRACE("nPerCol=%d, nFirstRow=%d, nLastRow=%d, nFirstCol=%d, nLastCol=%d, lower=%d\n",
1417 nPerCol, nFirstRow, nLastRow, nFirstCol, nLastCol, lower);
1418
1419 if (nLastCol < nFirstCol || nLastRow < nFirstRow) return TRUE;
1420
1421 if (!(ranges = ranges_create(nLastCol - nFirstCol + 1))) return FALSE;
1422 iterator_rangesitems(i, ranges);
1423 TRACE("building list ranges:\n");
1424 for (nCol = nFirstCol; nCol <= nLastCol; nCol++)
1425 {
1426 item_range.lower = nCol * nPerCol + nFirstRow;
1427 if(item_range.lower >= infoPtr->nItemCount) break;
1428 item_range.upper = min(nCol * nPerCol + nLastRow + 1, infoPtr->nItemCount);
1429 TRACE(" list=%s\n", debugrange(&item_range));
1430 ranges_add(i->ranges, item_range);
1431 }
1432 }
1433
1434 return TRUE;
1435}
static void iterator_rangeitems(ITERATOR *i, RANGE range)
Definition: listview.c:1320
static RANGES ranges_create(int count)
Definition: listview.c:3215
static BOOL ranges_add(RANGES ranges, RANGE range)
Definition: listview.c:3339
static BOOL ranges_additem(RANGES ranges, INT nItem)
Definition: listview.c:1133
static void iterator_empty(ITERATOR *i)
Definition: listview.c:1311
static void iterator_rangesitems(ITERATOR *i, RANGES ranges)
Definition: listview.c:1331
static const char * debugrange(const RANGE *lprng)
Definition: listview.c:568
static void LISTVIEW_GetItemBox(const LISTVIEW_INFO *, INT, LPRECT)
Definition: listview.c:2606
GLenum GLint * range
Definition: glext.h:7539
#define LV_VIEW_DETAILS
Definition: commctrl.h:2846
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 1208 of file listview.c.

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

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 1248 of file listview.c.

1249{
1250 BOOL start = FALSE;
1251
1252 if (i->nItem == -1)
1253 {
1254 start = TRUE;
1255 if (i->ranges) i->index = DPA_GetPtrCount(i->ranges->hdpa);
1256 goto pickarange;
1257 }
1258 if (i->nItem == i->nSpecial)
1259 {
1260 i->nItem = -1;
1261 return FALSE;
1262 }
1263
1264testitem:
1265 i->nItem--;
1266 if (i->nItem == i->nSpecial) i->nItem--;
1267 if (i->nItem >= i->range.lower) return TRUE;
1268
1269pickarange:
1270 if (i->ranges)
1271 {
1272 if (i->index > 0)
1273 i->range = *(RANGE*)DPA_GetPtr(i->ranges->hdpa, --i->index);
1274 else goto end;
1275 }
1276 else if (!start && i->nItem < i->range.lower) goto end;
1277
1278 i->nItem = i->range.upper;
1279 if (i->nItem > 0) goto testitem;
1280end:
1281 return (i->nItem = i->nSpecial) != -1;
1282}
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 1284 of file listview.c.

1285{
1286 RANGE range;
1287
1288 if (!i->ranges) return i->range;
1289
1290 if (DPA_GetPtrCount(i->ranges->hdpa) > 0)
1291 {
1292 range.lower = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, 0)).lower;
1293 range.upper = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, DPA_GetPtrCount(i->ranges->hdpa) - 1)).upper;
1294 }
1295 else range.lower = range.upper = 0;
1296
1297 return range;
1298}

Referenced by LISTVIEW_Refresh().

◆ iterator_rangeitems()

static void iterator_rangeitems ( ITERATOR i,
RANGE  range 
)
inlinestatic

Definition at line 1320 of file listview.c.

1321{
1323 i->range = range;
1324}

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 1511 of file listview.c.

1512{
1513 if(!iter1->ranges || !iter2->ranges) {
1514 int lower, upper;
1515
1516 if(iter1->ranges || iter2->ranges ||
1517 (iter1->range.lower<iter2->range.lower && iter1->range.upper>iter2->range.upper) ||
1518 (iter1->range.lower>iter2->range.lower && iter1->range.upper<iter2->range.upper)) {
1519 ERR("result is not a one range iterator\n");
1520 return FALSE;
1521 }
1522
1523 if(iter1->range.lower==-1 || iter2->range.lower==-1)
1524 return TRUE;
1525
1526 lower = iter1->range.lower;
1527 upper = iter1->range.upper;
1528
1529 if(lower < iter2->range.lower)
1530 iter1->range.upper = iter2->range.lower;
1531 else if(upper > iter2->range.upper)
1532 iter1->range.lower = iter2->range.upper;
1533 else
1534 iter1->range.lower = iter1->range.upper = -1;
1535
1536 if(iter2->range.lower < lower)
1537 iter2->range.upper = lower;
1538 else if(iter2->range.upper > upper)
1539 iter2->range.lower = upper;
1540 else
1541 iter2->range.lower = iter2->range.upper = -1;
1542
1543 return TRUE;
1544 }
1545
1546 iterator_next(iter1);
1547 iterator_next(iter2);
1548
1549 while(1) {
1550 if(iter1->nItem==-1 || iter2->nItem==-1)
1551 break;
1552
1553 if(iter1->nItem == iter2->nItem) {
1554 int delete = iter1->nItem;
1555
1556 iterator_prev(iter1);
1557 iterator_prev(iter2);
1558 ranges_delitem(iter1->ranges, delete);
1559 ranges_delitem(iter2->ranges, delete);
1560 iterator_next(iter1);
1561 iterator_next(iter2);
1562 } else if(iter1->nItem > iter2->nItem)
1563 iterator_next(iter2);
1564 else
1565 iterator_next(iter1);
1566 }
1567
1568 iter1->nItem = iter1->range.lower = iter1->range.upper = -1;
1569 iter2->nItem = iter2->range.lower = iter2->range.upper = -1;
1570 return TRUE;
1571}
#define ERR(fmt,...)
Definition: precomp.h:57
static BOOL iterator_next(ITERATOR *i)
Definition: listview.c:1208
static BOOL ranges_delitem(RANGES ranges, INT nItem)
Definition: listview.c:1140
static BOOL iterator_prev(ITERATOR *i)
Definition: listview.c:1248
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 1456 of file listview.c.

1457{
1458 POINT Origin, Position;
1459 RECT rcItem, rcClip;
1460 INT rgntype;
1461
1462 rgntype = GetClipBox(hdc, &rcClip);
1463 if (rgntype == NULLREGION)
1464 {
1466 return TRUE;
1467 }
1468 if (!iterator_frameditems(i, infoPtr, &rcClip)) return FALSE;
1469 if (rgntype == SIMPLEREGION) return TRUE;
1470
1471 /* first deal with the special item */
1472 if (i->nSpecial != -1)
1473 {
1474 LISTVIEW_GetItemBox(infoPtr, i->nSpecial, &rcItem);
1475 if (!RectVisible(hdc, &rcItem)) i->nSpecial = -1;
1476 }
1477
1478 /* if we can't deal with the region, we'll just go with the simple range */
1479 LISTVIEW_GetOrigin(infoPtr, &Origin);
1480 TRACE("building visible range:\n");
1481 if (!i->ranges && i->range.lower < i->range.upper)
1482 {
1483 if (!(i->ranges = ranges_create(50))) return TRUE;
1484 if (!ranges_add(i->ranges, i->range))
1485 {
1486 ranges_destroy(i->ranges);
1487 i->ranges = 0;
1488 return TRUE;
1489 }
1490 }
1491
1492 /* now delete the invisible items from the list */
1493 while(iterator_next(i))
1494 {
1495 LISTVIEW_GetItemOrigin(infoPtr, i->nItem, &Position);
1496 rcItem.left = (infoPtr->uView == LV_VIEW_DETAILS) ? Origin.x : Position.x + Origin.x;
1497 rcItem.top = Position.y + Origin.y;
1498 rcItem.right = rcItem.left + infoPtr->nItemWidth;
1499 rcItem.bottom = rcItem.top + infoPtr->nItemHeight;
1500 if (!RectVisible(hdc, &rcItem))
1501 ranges_delitem(i->ranges, i->nItem);
1502 }
1503 /* the iterator should restart on the next iterator_next */
1504 TRACE("done\n");
1505
1506 return TRUE;
1507}
static BOOL iterator_frameditems(ITERATOR *i, const LISTVIEW_INFO *infoPtr, const RECT *lprc)
Definition: listview.c:1440
static void LISTVIEW_GetItemOrigin(const LISTVIEW_INFO *, INT, LPPOINT)
Definition: listview.c:2297
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 3664 of file listview.c.

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

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

2863{
2864#ifdef __REACTOS__
2865 void (*next_pos)(LISTVIEW_INFO *, LPPOINT, INT);
2866#else
2867 void (*next_pos)(LISTVIEW_INFO *, LPPOINT);
2868#endif
2869 POINT pos;
2870 INT i;
2871
2872 if (infoPtr->uView != LV_VIEW_ICON && infoPtr->uView != LV_VIEW_SMALLICON) return FALSE;
2873
2874 TRACE("nAlignCode=%d\n", nAlignCode);
2875
2876 if (nAlignCode == LVA_DEFAULT)
2877 {
2878 if (infoPtr->dwStyle & LVS_ALIGNLEFT) nAlignCode = LVA_ALIGNLEFT;
2879 else nAlignCode = LVA_ALIGNTOP;
2880 }
2881
2882 switch (nAlignCode)
2883 {
2884 case LVA_ALIGNLEFT: next_pos = LISTVIEW_NextIconPosLeft; break;
2885 case LVA_ALIGNTOP: next_pos = LISTVIEW_NextIconPosTop; break;
2886#ifdef __REACTOS__
2887 case LVA_SNAPTOGRID: next_pos = LISTVIEW_NextIconPosSnap; break;
2888#else
2889 case LVA_SNAPTOGRID: next_pos = LISTVIEW_NextIconPosTop; break; /* FIXME */
2890#endif
2891 default: return FALSE;
2892 }
2893
2894 infoPtr->currIconPos.x = infoPtr->currIconPos.y = 0;
2895 for (i = 0; i < infoPtr->nItemCount; i++)
2896 {
2897#ifdef __REACTOS__
2898 next_pos(infoPtr, &pos, i);
2899#else
2900 next_pos(infoPtr, &pos);
2901#endif
2902 LISTVIEW_MoveIconTo(infoPtr, i, &pos, FALSE);
2903 }
2904
2905 return TRUE;
2906}
static void LISTVIEW_NextIconPosLeft(LISTVIEW_INFO *infoPtr, LPPOINT lpPos)
Definition: listview.c:2759
static BOOL LISTVIEW_MoveIconTo(const LISTVIEW_INFO *infoPtr, INT nItem, const POINT *lppt, BOOL isNew)
Definition: listview.c:2827
static void LISTVIEW_NextIconPosTop(LISTVIEW_INFO *infoPtr, LPPOINT lpPos)
Definition: listview.c:2728
#define INT
Definition: polytest.cpp:20
#define LVA_DEFAULT
Definition: commctrl.h:2532
#define LVA_ALIGNLEFT
Definition: commctrl.h:2533
#define LVA_ALIGNTOP
Definition: commctrl.h:2534
#define LVA_SNAPTOGRID
Definition: commctrl.h:2535
#define LVS_ALIGNLEFT
Definition: commctrl.h:2285
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 3087 of file listview.c.

3088{
3089 INT nItemHeight;
3090
3091 TRACE("uView=%d\n", infoPtr->uView);
3092
3093 if (infoPtr->uView == LV_VIEW_ICON)
3094 nItemHeight = infoPtr->iconSpacing.cy;
3095 else
3096 {
3097 nItemHeight = infoPtr->ntmHeight;
3098 if (infoPtr->himlState)
3099 nItemHeight = max(nItemHeight, infoPtr->iconStateSize.cy);
3100 if (infoPtr->himlSmall)
3101 nItemHeight = max(nItemHeight, infoPtr->iconSize.cy);
3102 nItemHeight += HEIGHT_PADDING;
3103 if (infoPtr->nMeasureItemHeight > 0)
3104 nItemHeight = infoPtr->nMeasureItemHeight;
3105 }
3106
3107 return max(nItemHeight, 1);
3108}
#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 3027 of file listview.c.

3028{
3029 INT nItemWidth = 0;
3030
3031 TRACE("uView=%d\n", infoPtr->uView);
3032
3033 if (infoPtr->uView == LV_VIEW_ICON)
3034 nItemWidth = infoPtr->iconSpacing.cx;
3035 else if (infoPtr->uView == LV_VIEW_DETAILS)
3036 {
3037 if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
3038 {
3039 RECT rcHeader;
3040 INT index;
3041
3043 DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
3044
3045 LISTVIEW_GetHeaderRect(infoPtr, index, &rcHeader);
3046 nItemWidth = rcHeader.right;
3047 }
3048 }
3049 else /* LV_VIEW_SMALLICON, or LV_VIEW_LIST */
3050 {
3051 WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
3052 LVITEMW lvItem;
3053 INT i;
3054
3055 lvItem.mask = LVIF_TEXT;
3056 lvItem.iSubItem = 0;
3057
3058 for (i = 0; i < infoPtr->nItemCount; i++)
3059 {
3060 lvItem.iItem = i;
3061 lvItem.pszText = szDispText;
3062 lvItem.cchTextMax = DISP_TEXT_SIZE;
3063 if (LISTVIEW_GetItemW(infoPtr, &lvItem))
3064 nItemWidth = max(LISTVIEW_GetStringWidthT(infoPtr, lvItem.pszText, TRUE),
3065 nItemWidth);
3066 }
3067
3068 if (infoPtr->himlSmall) nItemWidth += infoPtr->iconSize.cx;
3069 if (infoPtr->himlState) nItemWidth += infoPtr->iconStateSize.cx;
3070
3071 nItemWidth = max(DEFAULT_COLUMN_WIDTH, nItemWidth + WIDTH_PADDING);
3072 }
3073
3074 return nItemWidth;
3075}
#define index(s, c)
Definition: various.h:29
static BOOL LISTVIEW_GetItemW(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem)
Definition: listview.c:1707
#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:7712
#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 9423 of file listview.c.

9424{
9425 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
9426 ITEM_INFO* lv_first = DPA_GetPtr( first, 0 );
9427 ITEM_INFO* lv_second = DPA_GetPtr( second, 0 );
9428
9429 /* Forward the call to the client defined callback */
9430 return (infoPtr->pfnCompare)( lv_first->lParam , lv_second->lParam, infoPtr->lParamSort );
9431}
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 9447 of file listview.c.

9448{
9449 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
9450 INT first_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, first );
9451 INT second_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, second );
9452
9453 /* Forward the call to the client defined callback */
9454 return (infoPtr->pfnCompare)( first_idx, second_idx, infoPtr->lParamSort );
9455}
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 5536 of file listview.c.

5537{
5538 if (infoPtr->hwndEdit)
5539 {
5540 /* handle value will be lost after LISTVIEW_EndEditLabelT */
5541 HWND edit = infoPtr->hwndEdit;
5542
5544 SendMessageW(edit, WM_CLOSE, 0, 0);
5545 }
5546
5547 return TRUE;
5548}
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 12101 of file listview.c.

12102{
12103
12104 TRACE("(%p %x %x %lx)\n", infoPtr, HIWORD(wParam), LOWORD(wParam), lParam);
12105
12106 if (!infoPtr->hwndEdit) return 0;
12107
12108 switch (HIWORD(wParam))
12109 {
12110 case EN_UPDATE:
12111 {
12112 /*
12113 * Adjust the edit window size
12114 */
12115 WCHAR buffer[1024];
12116 HDC hdc = GetDC(infoPtr->hwndEdit);
12117 HFONT hFont, hOldFont = 0;
12118 RECT rect;
12119 SIZE sz;
12120
12121 if (!infoPtr->hwndEdit || !hdc) return 0;
12123 GetWindowRect(infoPtr->hwndEdit, &rect);
12124
12125 /* Select font to get the right dimension of the string */
12126 hFont = (HFONT)SendMessageW(infoPtr->hwndEdit, WM_GETFONT, 0, 0);
12127 if (hFont)
12128 {
12129 hOldFont = SelectObject(hdc, hFont);
12130 }
12131
12133 {
12134 TEXTMETRICW textMetric;
12135
12136 /* Add Extra spacing for the next character */
12137 GetTextMetricsW(hdc, &textMetric);
12138 sz.cx += (textMetric.tmMaxCharWidth * 2);
12139
12140 SetWindowPos(infoPtr->hwndEdit, NULL, 0, 0, sz.cx,
12141 rect.bottom - rect.top, SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOZORDER);
12142 }
12143 if (hFont)
12144 SelectObject(hdc, hOldFont);
12145
12146 ReleaseDC(infoPtr->hwndEdit, hdc);
12147
12148 break;
12149 }
12150 case EN_KILLFOCUS:
12151 {
12153 LISTVIEW_CancelEditLabel(infoPtr);
12154 break;
12155 }
12156
12157 default:
12158 return SendMessageW (infoPtr->hwndNotify, WM_COMMAND, wParam, lParam);
12159 }
12160
12161 return 0;
12162}
HFONT hFont
Definition: main.c:53
#define ARRAY_SIZE(A)
Definition: main.h:20
static LRESULT LISTVIEW_CancelEditLabel(LISTVIEW_INFO *infoPtr)
Definition: listview.c:5536
#define lstrlenW
Definition: compat.h:750
GLuint buffer
Definition: glext.h:5915
static HDC
Definition: imagelist.c:88
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:1394
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
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:2036
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:2039
#define SWP_DRAWFRAME
Definition: winuser.h:1250
#define SWP_NOMOVE
Definition: winuser.h:1255
#define WM_COMMAND
Definition: winuser.h:1751
#define WM_GETFONT
Definition: winuser.h:1662
HDC WINAPI GetDC(_In_opt_ HWND)
#define SWP_NOZORDER
Definition: winuser.h:1258

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Create()

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

Definition at line 9728 of file listview.c.

9729{
9731
9732 TRACE("(lpcs=%p, style=0x%08x)\n", lpcs, lpcs->style);
9733
9734 infoPtr->dwStyle = lpcs->style;
9735 map_style_view(infoPtr);
9736
9737 infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT,
9738 (WPARAM)infoPtr->hwndSelf, NF_QUERY);
9739 /* on error defaulting to ANSI notifications */
9740 if (infoPtr->notifyFormat == 0) infoPtr->notifyFormat = NFR_ANSI;
9741 TRACE("notify format=%d\n", infoPtr->notifyFormat);
9742
9743 if ((infoPtr->uView == LV_VIEW_DETAILS) && (lpcs->style & WS_VISIBLE))
9744 {
9745 if (LISTVIEW_CreateHeader(infoPtr) < 0) return -1;
9746 }
9747 else
9748 infoPtr->hwndHeader = 0;
9749
9750 /* init item size to avoid division by 0 */
9751 LISTVIEW_UpdateItemSize (infoPtr);
9752 LISTVIEW_UpdateSize (infoPtr);
9753
9754 if (infoPtr->uView == LV_VIEW_DETAILS)
9755 {
9756 if (!(LVS_NOCOLUMNHEADER & lpcs->style) && (WS_VISIBLE & lpcs->style))
9757 {
9759 }
9760 LISTVIEW_UpdateScroll(infoPtr);
9761 /* send WM_MEASUREITEM notification */
9762 if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED) notify_measureitem(infoPtr);
9763 }
9764
9766
9767 /* initialize the icon sizes */
9768 set_icon_size(&infoPtr->iconSize, infoPtr->himlNormal, infoPtr->uView != LV_VIEW_ICON);
9769 set_icon_size(&infoPtr->iconStateSize, infoPtr->himlState, TRUE);
9770 return 0;
9771}
static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr)
Definition: listview.c:2166
static void map_style_view(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1603
static BOOL notify_measureitem(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1107
static const WCHAR themeClass[]
Definition: listview.c:427
static void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL is_small)
Definition: listview.c:8902
static void LISTVIEW_UpdateItemSize(LISTVIEW_INFO *infoPtr)
Definition: listview.c:3120
static INT LISTVIEW_CreateHeader(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1660
static void LISTVIEW_UpdateSize(LISTVIEW_INFO *)
Definition: listview.c:11244
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:850
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2289
#define LVS_OWNERDRAWFIXED
Definition: commctrl.h:2288
HIMAGELIST himlNormal
Definition: listview.c:272
SHORT notifyFormat
Definition: listview.c:229
#define SW_SHOWNORMAL
Definition: winuser.h:781
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define NFR_ANSI
Definition: winuser.h:2469
#define NF_QUERY
Definition: winuser.h:2471

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateCheckBoxIL()

static HIMAGELIST LISTVIEW_CreateCheckBoxIL ( const LISTVIEW_INFO infoPtr)
static

Definition at line 8646 of file listview.c.

8647{
8648 HDC hdc_wnd, hdc;
8649 HBITMAP hbm_im, hbm_mask, hbm_orig;
8650 RECT rc;
8651 HBRUSH hbr_white = GetStockObject(WHITE_BRUSH);
8652 HBRUSH hbr_black = GetStockObject(BLACK_BRUSH);
8654
8656 ILC_COLOR | ILC_MASK, 2, 2);
8657 hdc_wnd = GetDC(infoPtr->hwndSelf);
8658 hdc = CreateCompatibleDC(hdc_wnd);
8661 ReleaseDC(infoPtr->hwndSelf, hdc_wnd);
8662
8664 hbm_orig = SelectObject(hdc, hbm_mask);
8665 FillRect(hdc, &rc, hbr_white);
8666 InflateRect(&rc, -2, -2);
8667 FillRect(hdc, &rc, hbr_black);
8668
8669 SelectObject(hdc, hbm_im);
8671 SelectObject(hdc, hbm_orig);
8672 ImageList_Add(himl, hbm_im, hbm_mask);
8673
8674 SelectObject(hdc, hbm_im);
8676 SelectObject(hdc, hbm_orig);
8677 ImageList_Add(himl, hbm_im, hbm_mask);
8678
8679 DeleteObject(hbm_mask);
8680 DeleteObject(hbm_im);
8681 DeleteDC(hdc);
8682
8683 return himl;
8684}
HIMAGELIST himl
INT WINAPI ImageList_Add(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask)
Definition: imagelist.c:458
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:814
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:1024
#define DFCS_MONO
Definition: winuser.h:511
#define SM_CXSMICON
Definition: winuser.h:1023
#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 5562 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateHeader()

static INT LISTVIEW_CreateHeader ( LISTVIEW_INFO infoPtr)
static

Definition at line 1660 of file listview.c.

1661{
1664
1665 if (infoPtr->hwndHeader) return 0;
1666
1667 TRACE("Creating header for list %p\n", infoPtr->hwndSelf);
1668
1669 /* setup creation flags */
1670 dFlags |= (LVS_NOSORTHEADER & infoPtr->dwStyle) ? 0 : HDS_BUTTONS;
1671 dFlags |= (LVS_NOCOLUMNHEADER & infoPtr->dwStyle) ? HDS_HIDDEN : 0;
1672
1674
1675 /* create header */
1676 infoPtr->hwndHeader = CreateWindowW(WC_HEADERW, NULL, dFlags,
1677 0, 0, 0, 0, infoPtr->hwndSelf, NULL, hInst, NULL);
1678 if (!infoPtr->hwndHeader) return -1;
1679
1680 /* set header unicode format */
1682
1683 /* set header font */
1684 SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, TRUE);
1685
1686 /* set header image list */
1687 if (infoPtr->himlSmall)
1688 SendMessageW(infoPtr->hwndHeader, HDM_SETIMAGELIST, 0, (LPARAM)infoPtr->himlSmall);
1689
1690 LISTVIEW_UpdateSize(infoPtr);
1691
1692 return 0;
1693}
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:2290
#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 9614 of file listview.c.

9615{
9616 DELAYED_ITEM_EDIT *editItem = (DELAYED_ITEM_EDIT *)idEvent;
9618
9619 KillTimer(hwnd, idEvent);
9620 editItem->fEnabled = FALSE;
9621 /* check if the item is still selected */
9622 if (infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, editItem->iItem, LVIS_SELECTED))
9623 LISTVIEW_EditLabelT(infoPtr, editItem->iItem, TRUE);
9624}
static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT)
Definition: listview.c:7405
static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
Definition: listview.c:6244
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 5627 of file listview.c.

5628{
5629 HDPA hdpaSubItems = NULL;
5631 ITEMHDR *hdrItem;
5632 ITEM_INFO *lpItem;
5633 ITEM_ID *lpID;
5634 INT i, j;
5635
5636 TRACE("()\n");
5637
5638 /* we do it directly, to avoid notifications */
5639 ranges_clear(infoPtr->selectionRanges);
5640 infoPtr->nSelectionMark = -1;
5641 infoPtr->nFocusedItem = -1;
5642 SetRectEmpty(&infoPtr->rcFocus);
5643 /* But we are supposed to leave nHotItem as is! */
5644
5645 /* send LVN_DELETEALLITEMS notification */
5646 if (!(infoPtr->dwStyle & LVS_OWNERDATA) || !destroy)
5647 {
5648 NMLISTVIEW nmlv;
5649
5650 memset(&nmlv, 0, sizeof(NMLISTVIEW));
5651 nmlv.iItem = -1;
5652 suppress = notify_listview(infoPtr, LVN_DELETEALLITEMS, &nmlv);
5653 }
5654
5655 for (i = infoPtr->nItemCount - 1; i >= 0; i--)
5656 {
5657 if (!(infoPtr->dwStyle & LVS_OWNERDATA))
5658 {
5659 /* send LVN_DELETEITEM notification, if not suppressed
5660 and if it is not a virtual listview */
5661 if (!suppress) notify_deleteitem(infoPtr, i);
5662 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i);
5663 lpItem = DPA_GetPtr(hdpaSubItems, 0);
5664 /* free id struct */
5665 j = DPA_GetPtrIndex(infoPtr->hdpaItemIds, lpItem->id);
5666 lpID = DPA_GetPtr(infoPtr->hdpaItemIds, j);
5667 DPA_DeletePtr(infoPtr->hdpaItemIds, j);
5668 Free(lpID);
5669 /* both item and subitem start with ITEMHDR header */
5670 for (j = 0; j < DPA_GetPtrCount(hdpaSubItems); j++)
5671 {
5672 hdrItem = DPA_GetPtr(hdpaSubItems, j);
5673 if (is_text(hdrItem->pszText)) Free(hdrItem->pszText);
5674 Free(hdrItem);
5675 }
5676 DPA_Destroy(hdpaSubItems);
5677 DPA_DeletePtr(infoPtr->hdpaItems, i);
5678 }
5679 DPA_DeletePtr(infoPtr->hdpaPosX, i);
5680 DPA_DeletePtr(infoPtr->hdpaPosY, i);
5681 infoPtr->nItemCount --;
5682 }
5683
5684 if (!destroy)
5685 {
5686 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
5687 LISTVIEW_UpdateScroll(infoPtr);
5688 }
5689 LISTVIEW_InvalidateList(infoPtr);
5690
5691 return TRUE;
5692}
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:3225
static LRESULT notify_listview(const LISTVIEW_INFO *infoPtr, INT code, LPNMLISTVIEW plvnm)
Definition: listview.c:882
static BOOL LISTVIEW_Arrange(LISTVIEW_INFO *infoPtr, INT nAlignCode)
Definition: listview.c:2862
static BOOL notify_deleteitem(const LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:909
static void LISTVIEW_InvalidateList(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1776
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:3139
#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 5764 of file listview.c.

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

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

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

Referenced by LISTVIEW_LButtonDown(), and LISTVIEW_RButtonDown().

◆ LISTVIEW_DeselectAllSkipItem()

static BOOL LISTVIEW_DeselectAllSkipItem ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
inlinestatic

Definition at line 3529 of file listview.c.

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

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 3507 of file listview.c.

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

Referenced by LISTVIEW_DeselectAllSkipItem(), and LISTVIEW_SetGroupSelection().

◆ LISTVIEW_Destroy()

static LRESULT LISTVIEW_Destroy ( LISTVIEW_INFO infoPtr)
static

Definition at line 9784 of file listview.c.

9785{
9786 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
9787 CloseThemeData(theme);
9788
9789 /* delete all items */
9790 LISTVIEW_DeleteAllItems(infoPtr, TRUE);
9791
9792 return 0;
9793}
static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy)
Definition: listview.c:5627
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:866
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:965
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 1713 of file listview.c.

1714{
1715#ifdef __REACTOS__
1716 BOOL Ret = FALSE;
1717
1718 if (infoPtr->rcFocus.left < infoPtr->rcFocus.right)
1719 {
1720 DWORD dwOldBkColor, dwOldTextColor;
1721
1722 dwOldBkColor = SetBkColor(hdc, RGB(255, 255, 255));
1723 dwOldTextColor = SetBkColor(hdc, RGB(0, 0, 0));
1724 Ret = DrawFocusRect(hdc, &infoPtr->rcFocus);
1725 SetBkColor(hdc, dwOldBkColor);
1726 SetBkColor(hdc, dwOldTextColor);
1727 }
1728 return Ret;
1729#else
1730 return (infoPtr->rcFocus.left < infoPtr->rcFocus.right) ?
1731 DrawFocusRect(hdc, &infoPtr->rcFocus) : FALSE;
1732#endif
1733}
#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 4851 of file listview.c.

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

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

9586{
9587 HDC hdc;
9588
9589 if (infoPtr->xTrackLine == -1)
9590 return FALSE;
9591
9592 if (!(hdc = GetDC(infoPtr->hwndSelf)))
9593 return FALSE;
9594 PatBlt( hdc, infoPtr->xTrackLine, infoPtr->rcList.top,
9595 1, infoPtr->rcList.bottom - infoPtr->rcList.top, DSTINVERT );
9596 ReleaseDC(infoPtr->hwndSelf, hdc);
9597 return TRUE;
9598}
#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 6244 of file listview.c.

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

9808{
9809 if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED)
9810 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
9811 return TRUE;
9812}
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 5998 of file listview.c.

5999{
6000 HWND hwndSelf = infoPtr->hwndSelf;
6001 WCHAR szDispText[DISP_TEXT_SIZE] = { 0 };
6002 NMLVDISPINFOW dispInfo;
6003 INT editedItem = infoPtr->nEditLabelItem;
6004 BOOL same;
6005 WCHAR *pszText = NULL;
6006 BOOL res;
6007
6008 if (storeText)
6009 {
6011
6012 if (len++)
6013 {
6014 if (!(pszText = Alloc(len * (isW ? sizeof(WCHAR) : sizeof(CHAR)))))
6015 return FALSE;
6016
6017 if (isW)
6018 GetWindowTextW(infoPtr->hwndEdit, pszText, len);
6019 else
6020 GetWindowTextA(infoPtr->hwndEdit, (CHAR*)pszText, len);
6021 }
6022 }
6023
6024 TRACE("(pszText=%s, isW=%d)\n", debugtext_t(pszText, isW), isW);
6025
6026 ZeroMemory(&dispInfo, sizeof(dispInfo));
6027 dispInfo.item.mask = LVIF_PARAM | LVIF_STATE | LVIF_TEXT;
6028 dispInfo.item.iItem = editedItem;
6029 dispInfo.item.iSubItem = 0;
6030 dispInfo.item.stateMask = ~0;
6031 dispInfo.item.pszText = szDispText;
6032 dispInfo.item.cchTextMax = DISP_TEXT_SIZE;
6033 if (!LISTVIEW_GetItemT(infoPtr, &dispInfo.item, isW))
6034 {
6035 res = FALSE;
6036 goto cleanup;
6037 }
6038
6039 if (isW)
6040 same = (lstrcmpW(dispInfo.item.pszText, pszText) == 0);
6041 else
6042 {
6043 LPWSTR tmp = textdupTtoW(pszText, FALSE);
6044 same = (lstrcmpW(dispInfo.item.pszText, tmp) == 0);
6045 textfreeT(tmp, FALSE);
6046 }
6047
6048 /* add the text from the edit in */
6049 dispInfo.item.mask |= LVIF_TEXT;
6050 dispInfo.item.pszText = same ? NULL : pszText;
6051 dispInfo.item.cchTextMax = textlenT(dispInfo.item.pszText, isW);
6052
6053 infoPtr->notify_mask &= ~NOTIFY_MASK_END_LABEL_EDIT;
6054
6055 /* Do we need to update the Item Text */
6056 res = notify_dispinfoT(infoPtr, LVN_ENDLABELEDITW, &dispInfo, isW);
6057
6059
6060 infoPtr->nEditLabelItem = -1;
6061 infoPtr->hwndEdit = 0;
6062
6063 if (!res) goto cleanup;
6064
6065 if (!IsWindow(hwndSelf))
6066 {
6067 res = FALSE;
6068 goto cleanup;
6069 }
6070 if (!pszText) return TRUE;
6071 if (same)
6072 {
6073 res = TRUE;
6074 goto cleanup;
6075 }
6076
6077 if (!(infoPtr->dwStyle & LVS_OWNERDATA))
6078 {
6079 HDPA hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, editedItem);
6080 ITEM_INFO* lpItem = DPA_GetPtr(hdpaSubItems, 0);
6081 if (lpItem && lpItem->hdr.pszText == LPSTR_TEXTCALLBACKW)
6082 {
6083 LISTVIEW_InvalidateItem(infoPtr, editedItem);
6084 res = TRUE;
6085 goto cleanup;
6086 }
6087 }
6088
6089 ZeroMemory(&dispInfo, sizeof(dispInfo));
6090 dispInfo.item.mask = LVIF_TEXT;
6091 dispInfo.item.iItem = editedItem;
6092 dispInfo.item.iSubItem = 0;
6093 dispInfo.item.pszText = pszText;
6094 dispInfo.item.cchTextMax = textlenT(pszText, isW);
6095 res = LISTVIEW_SetItemT(infoPtr, &dispInfo.item, isW);
6096
6097cleanup:
6098 Free(pszText);
6099
6100 return res;
6101}
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:4568
static void cleanup(void)
Definition: main.c:1335
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
GLuint res
Definition: glext.h:9613
ITEMHDR hdr
Definition: listview.c:171
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1312
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 6348 of file listview.c.

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

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 9826 of file listview.c.

9827{
9828 RECT rc;
9829
9830 TRACE("(hdc=%p)\n", hdc);
9831
9832 if (!GetClipBox(hdc, &rc)) return FALSE;
9833
9834 if (infoPtr->clrBk == CLR_NONE)
9835 {
9836 if (infoPtr->dwLvExStyle & LVS_EX_TRANSPARENTBKGND)
9837 return SendMessageW(infoPtr->hwndNotify, WM_PRINTCLIENT,
9839 else
9840 return SendMessageW(infoPtr->hwndNotify, WM_ERASEBKGND, (WPARAM)hdc, 0);
9841 }
9842
9843 /* for double buffered controls we need to do this during refresh */
9844 if (infoPtr->dwLvExStyle & LVS_EX_DOUBLEBUFFER) return FALSE;
9845
9846 return LISTVIEW_FillBkgnd(infoPtr, hdc, &rc);
9847}
static BOOL LISTVIEW_FillBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *lprcBox)
Definition: listview.c:4677
#define LVS_EX_DOUBLEBUFFER
Definition: commctrl.h:2750
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define WM_ERASEBKGND
Definition: winuser.h:1636
#define PRF_ERASEBKGND
Definition: winuser.h:2537

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 4677 of file listview.c.

4678{
4679 if (!infoPtr->hBkBrush) return FALSE;
4680
4681 TRACE("(hdc=%p, lprcBox=%s, hBkBrush=%p)\n", hdc, wine_dbgstr_rect(lprcBox), infoPtr->hBkBrush);
4682
4683 return FillRect(hdc, lprcBox, infoPtr->hBkBrush);
4684}

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 6580 of file listview.c.

6582{
6583 LVFINDINFOW fiw;
6584 INT res;
6585 LPWSTR strW = NULL;
6586
6587 memcpy(&fiw, lpFindInfo, sizeof(fiw));
6588 if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL | LVFI_SUBSTRING))
6589 fiw.psz = strW = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE);
6590 res = LISTVIEW_FindItemW(infoPtr, nStart, &fiw);
6592 return res;
6593}
static INT LISTVIEW_FindItemW(const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOW *lpFindInfo)
Definition: listview.c:6435
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR strW[12]
Definition: clipboard.c:2029
#define LVFI_STRING
Definition: commctrl.h:2442
#define LVFI_SUBSTRING
Definition: commctrl.h:2443
#define LVFI_PARTIAL
Definition: commctrl.h:2444
LPCWSTR psz
Definition: commctrl.h:2462
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 6435 of file listview.c.

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

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 2921 of file listview.c.

2922{
2923 INT i, x, y;
2924
2925 SetRectEmpty(lprcView);
2926
2927 switch (infoPtr->uView)
2928 {
2929 case LV_VIEW_ICON:
2930 case LV_VIEW_SMALLICON:
2931 for (i = 0; i < infoPtr->nItemCount; i++)
2932 {
2933 x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, i);
2934 y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, i);
2935 lprcView->right = max(lprcView->right, x);
2936 lprcView->bottom = max(lprcView->bottom, y);
2937 }
2938 if (infoPtr->nItemCount > 0)
2939 {
2940 lprcView->right += infoPtr->nItemWidth;
2941 lprcView->bottom += infoPtr->nItemHeight;
2942 }
2943 break;
2944
2945 case LV_VIEW_LIST:
2946 y = LISTVIEW_GetCountPerColumn(infoPtr);
2947 x = infoPtr->nItemCount / y;
2948 if (infoPtr->nItemCount % y) x++;
2949 lprcView->right = x * infoPtr->nItemWidth;
2950 lprcView->bottom = y * infoPtr->nItemHeight;
2951 break;
2952 }
2953}
static INT LISTVIEW_GetCountPerColumn(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1820
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 1636 of file listview.c.

1637{
1638 static COLUMN_INFO mainItem;
1639
1640 if (nSubItem == 0 && DPA_GetPtrCount(infoPtr->hdpaColumns) == 0) return &mainItem;
1641 assert (nSubItem >= 0 && nSubItem < DPA_GetPtrCount(infoPtr->hdpaColumns));
1642
1643 /* update cached column rectangles */
1644 if (infoPtr->colRectsDirty)
1645 {
1647 LISTVIEW_INFO *Ptr = (LISTVIEW_INFO*)infoPtr;
1648 INT i;
1649
1650 for (i = 0; i < DPA_GetPtrCount(infoPtr->hdpaColumns); i++) {
1651 info = DPA_GetPtr(infoPtr->hdpaColumns, i);
1652 SendMessageW(infoPtr->hwndHeader, HDM_GETITEMRECT, i, (LPARAM)&info->rcHeader);
1653 }
1654 Ptr->colRectsDirty = FALSE;
1655 }
1656
1657 return DPA_GetPtr(infoPtr->hdpaColumns, nSubItem);
1658}
#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 6660 of file listview.c.

6661{
6662 if (!infoPtr->hwndHeader) return FALSE;
6663 return SendMessageW(infoPtr->hwndHeader, HDM_GETORDERARRAY, iCount, (LPARAM)lpiArray);
6664}
#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 6610 of file listview.c.

6611{
6612 COLUMN_INFO *lpColumnInfo;
6613 HDITEMW hdi;
6614
6615 if (!lpColumn || nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE;
6616 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nColumn);
6617
6618 /* initialize memory */
6619 ZeroMemory(&hdi, sizeof(hdi));
6620
6621 if (lpColumn->mask & LVCF_TEXT)
6622 {
6623 hdi.mask |= HDI_TEXT;
6624 hdi.pszText = lpColumn->pszText;
6625 hdi.cchTextMax = lpColumn->cchTextMax;
6626 }
6627
6628 if (lpColumn->mask & LVCF_IMAGE)
6629 hdi.mask |= HDI_IMAGE;
6630
6631 if (lpColumn->mask & LVCF_ORDER)
6632 hdi.mask |= HDI_ORDER;
6633
6634 if (lpColumn->mask & LVCF_SUBITEM)
6635 hdi.mask |= HDI_LPARAM;
6636
6637 if (!SendMessageW(infoPtr->hwndHeader, isW ? HDM_GETITEMW : HDM_GETITEMA, nColumn, (LPARAM)&hdi)) return FALSE;
6638
6639 if (lpColumn->mask & LVCF_FMT)
6640 lpColumn->fmt = lpColumnInfo->fmt;
6641
6642 if (lpColumn->mask & LVCF_WIDTH)
6643 lpColumn->cx = lpColumnInfo->rcHeader.right - lpColumnInfo->rcHeader.left;
6644
6645 if (lpColumn->mask & LVCF_IMAGE)
6646 lpColumn->iImage = hdi.iImage;
6647
6648 if (lpColumn->mask & LVCF_ORDER)
6649 lpColumn->iOrder = hdi.iOrder;
6650
6651 if (lpColumn->mask & LVCF_SUBITEM)
6652 lpColumn->iSubItem = hdi.lParam;
6653
6654 if (lpColumn->mask & LVCF_MINWIDTH)
6655 lpColumn->cxMin = lpColumnInfo->cxMin;
6656
6657 return TRUE;
6658}
#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 6678 of file listview.c.

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

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 6722 of file listview.c.

6723{
6724 switch (infoPtr->uView)
6725 {
6726 case LV_VIEW_ICON:
6727 case LV_VIEW_SMALLICON:
6728 return infoPtr->nItemCount;
6729 case LV_VIEW_DETAILS:
6730 return LISTVIEW_GetCountPerColumn(infoPtr);
6731 case LV_VIEW_LIST:
6732 return LISTVIEW_GetCountPerRow(infoPtr) * LISTVIEW_GetCountPerColumn(infoPtr);
6733 }
6734 assert(FALSE);
6735 return 0;
6736}
static INT LISTVIEW_GetCountPerRow(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1802

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetCountPerRow()

static INT LISTVIEW_GetCountPerRow ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1802 of file listview.c.

1803{
1804 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
1805
1806 return max(nListWidth/(infoPtr->nItemWidth ? infoPtr->nItemWidth : 1), 1);
1807}

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 6750 of file listview.c.

6751{
6752 switch (nImageList)
6753 {
6754 case LVSIL_NORMAL: return infoPtr->himlNormal;
6755 case LVSIL_SMALL: return infoPtr->himlSmall;
6756 case LVSIL_STATE: return infoPtr->himlState;
6757 case LVSIL_GROUPHEADER:
6758 FIXME("LVSIL_GROUPHEADER not supported\n");
6759 break;
6760 default:
6761 WARN("got unknown imagelist index - %d\n", nImageList);
6762 }
6763 return NULL;
6764}
#define LVSIL_SMALL
Definition: commctrl.h:2304
#define LVSIL_GROUPHEADER
Definition: commctrl.h:2306
#define LVSIL_STATE
Definition: commctrl.h:2305
#define LVSIL_NORMAL
Definition: commctrl.h:2303

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemAtPt()

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

Definition at line 3870 of file listview.c.

3871{
3872 LVHITTESTINFO lvHitTestInfo;
3873
3874 ZeroMemory(&lvHitTestInfo, sizeof(lvHitTestInfo));
3875 lvHitTestInfo.pt.x = pt.x;
3876 lvHitTestInfo.pt.y = pt.y;
3877
3878 LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
3879
3880 lpLVItem->mask = LVIF_PARAM;
3881 lpLVItem->iItem = lvHitTestInfo.iItem;
3882 lpLVItem->iSubItem = 0;
3883
3884 return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE);
3885}
static INT LISTVIEW_HitTest(const LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL)
Definition: listview.c:7752
#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 2606 of file listview.c.

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

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 7076 of file listview.c.

7077{
7078 LPWSTR pszText;
7079 BOOL bResult;
7080
7081 if (!lpLVItem || lpLVItem->iItem < 0 || lpLVItem->iItem >= infoPtr->nItemCount)
7082 return FALSE;
7083
7084 pszText = lpLVItem->pszText;
7085 bResult = LISTVIEW_GetItemT(infoPtr, lpLVItem, isW);
7086 if (bResult && (lpLVItem->mask & LVIF_TEXT) && lpLVItem->pszText != pszText)
7087 {
7088 if (lpLVItem->pszText != LPSTR_TEXTCALLBACKW)
7089 textcpynT(pszText, isW, lpLVItem->pszText, isW, lpLVItem->cchTextMax);
7090 else
7091 pszText = LPSTR_TEXTCALLBACKW;
7092 }
7093 lpLVItem->pszText = pszText;
7094
7095 return bResult;
7096}
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 2364 of file listview.c.

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

2298{
2299 assert(nItem >= 0 && nItem < infoPtr->nItemCount);
2300
2301 if ((infoPtr->uView == LV_VIEW_SMALLICON) || (infoPtr->uView == LV_VIEW_ICON))
2302 {
2303 lpptPosition->x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
2304 lpptPosition->y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
2305 }
2306 else if (infoPtr->uView == LV_VIEW_LIST)
2307 {
2308 INT nCountPerColumn = LISTVIEW_GetCountPerColumn(infoPtr);
2309 lpptPosition->x = nItem / nCountPerColumn * infoPtr->nItemWidth;
2310 lpptPosition->y = nItem % nCountPerColumn * infoPtr->nItemHeight;
2311 }
2312 else /* LV_VIEW_DETAILS */
2313 {
2314 lpptPosition->x = REPORT_MARGINX;
2315 /* item is always at zero indexed column */
2316 if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
2317 lpptPosition->x += LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left;
2318 lpptPosition->y = nItem * infoPtr->nItemHeight;
2319 }
2320}

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 7114 of file listview.c.

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

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 7199 of file listview.c.

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

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 7375 of file listview.c.

7376{
7377 LONG lResult;
7378
7379 if (!bSmall)
7380 {
7381 lResult = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
7382 }
7383 else
7384 {
7385 if (infoPtr->uView == LV_VIEW_ICON)
7387 else
7388 lResult = MAKELONG(infoPtr->nItemWidth, infoPtr->nItemHeight);
7389 }
7390 return lResult;
7391}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemState()

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

Definition at line 7405 of file listview.c.

7406{
7407 LVITEMW lvItem;
7408
7409 if (nItem < 0 || nItem >= infoPtr->nItemCount) return 0;
7410
7411 lvItem.iItem = nItem;
7412 lvItem.iSubItem = 0;
7413 lvItem.mask = LVIF_STATE;
7414 lvItem.stateMask = uMask;
7415 if (!LISTVIEW_GetItemW(infoPtr, &lvItem)) return 0;
7416
7417 return lvItem.state & uMask;
7418}

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 6795 of file listview.c.

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

7435{
7436 if (!lpLVItem || nItem < 0 || nItem >= infoPtr->nItemCount) return 0;
7437
7438 lpLVItem->mask = LVIF_TEXT;
7439 lpLVItem->iItem = nItem;
7440 if (!LISTVIEW_GetItemExtT(infoPtr, lpLVItem, isW)) return 0;
7441
7442 return textlenT(lpLVItem->pszText, isW);
7443}
static BOOL LISTVIEW_GetItemExtT(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL isW)
Definition: listview.c:7076

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetItemW()

◆ LISTVIEW_GetNextItem()

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

Definition at line 7458 of file listview.c.

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

Referenced by LISTVIEW_KeyDown(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetOrigin()

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

Definition at line 7671 of file listview.c.

7672{
7673 INT nHorzPos = 0, nVertPos = 0;
7674 SCROLLINFO scrollInfo;
7675
7676 scrollInfo.cbSize = sizeof(SCROLLINFO);
7677 scrollInfo.fMask = SIF_POS;
7678
7679 if (GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &scrollInfo))
7680 nHorzPos = scrollInfo.nPos;
7681 if (GetScrollInfo(infoPtr->hwndSelf, SB_VERT, &scrollInfo))
7682 nVertPos = scrollInfo.nPos;
7683
7684 TRACE("nHorzPos=%d, nVertPos=%d\n", nHorzPos, nVertPos);
7685
7686 lpptOrigin->x = infoPtr->rcList.left;
7687 lpptOrigin->y = infoPtr->rcList.top;
7688 if (infoPtr->uView == LV_VIEW_LIST)
7689 nHorzPos *= infoPtr->nItemWidth;
7690 else if (infoPtr->uView == LV_VIEW_DETAILS)
7691 nVertPos *= infoPtr->nItemHeight;
7692
7693 lpptOrigin->x -= nHorzPos;
7694 lpptOrigin->y -= nVertPos;
7695
7696 TRACE(" origin=%s\n", wine_dbgstr_point(lpptOrigin));
7697}
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 3555 of file listview.c.

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

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 7712 of file listview.c.

7713{
7714 SIZE stringSize;
7715
7716 stringSize.cx = 0;
7717 if (is_text(lpszText))
7718 {
7719 HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
7720 HDC hdc = GetDC(infoPtr->hwndSelf);
7721 HFONT hOldFont = SelectObject(hdc, hFont);
7722
7723 if (isW)
7724 GetTextExtentPointW(hdc, lpszText, lstrlenW(lpszText), &stringSize);
7725 else
7726 GetTextExtentPointA(hdc, (LPCSTR)lpszText, lstrlenA((LPCSTR)lpszText), &stringSize);
7727 SelectObject(hdc, hOldFont);
7728 ReleaseDC(infoPtr->hwndSelf, hdc);
7729 }
7730 return stringSize.cx;
7731}
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 3000 of file listview.c.

3001{
3002 SUBITEM_INFO *lpSubItem;
3003 INT i;
3004
3005 /* we should binary search here if need be */
3006 for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++)
3007 {
3008 lpSubItem = DPA_GetPtr(hdpaSubItems, i);
3009 if (lpSubItem->iSubItem == nSubItem)
3010 return lpSubItem;
3011 }
3012
3013 return NULL;
3014}

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 7300 of file listview.c.

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

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

Referenced by LISTVIEW_KeyDown(), and LISTVIEW_WindowProc().

◆ LISTVIEW_GetVersion()

static LRESULT LISTVIEW_GetVersion ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 11474 of file listview.c.

11475{
11476 return infoPtr->iVersion;
11477}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_GetViewRect()

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

Definition at line 2967 of file listview.c.

2968{
2969 POINT ptOrigin;
2970
2971 TRACE("(lprcView=%p)\n", lprcView);
2972
2973 if (!lprcView) return FALSE;
2974
2975 LISTVIEW_GetAreaRect(infoPtr, lprcView);
2976
2977 if (infoPtr->uView != LV_VIEW_DETAILS)
2978 {
2979 LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
2980 OffsetRect(lprcView, ptOrigin.x, ptOrigin.y);
2981 }
2982
2983 TRACE("lprcView=%s\n", wine_dbgstr_rect(lprcView));
2984
2985 return TRUE;
2986}

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 7752 of file listview.c.

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

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

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 8321 of file listview.c.

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

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

1782{
1783 RECT rcCol;
1784
1785 if(!is_redrawing(infoPtr)) return;
1786 LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol);
1787 rcCol.top = infoPtr->rcList.top;
1788 rcCol.bottom = infoPtr->rcList.bottom;
1789 LISTVIEW_InvalidateRect(infoPtr, &rcCol);
1790}
static BOOL is_redrawing(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:1737
static void LISTVIEW_InvalidateRect(const LISTVIEW_INFO *infoPtr, const RECT *rect)
Definition: listview.c:1742

Referenced by LISTVIEW_SetColumnT().

◆ LISTVIEW_InvalidateItem()

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

Definition at line 1749 of file listview.c.

1750{
1751 RECT rcBox;
1752
1753 if (!is_redrawing(infoPtr) || nItem < 0 || nItem >= infoPtr->nItemCount)
1754 return;
1755
1756 LISTVIEW_GetItemBox(infoPtr, nItem, &rcBox);
1757 LISTVIEW_InvalidateRect(infoPtr, &rcBox);
1758}

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()

◆ LISTVIEW_InvalidateSelectedItems()

static void LISTVIEW_InvalidateSelectedItems ( const LISTVIEW_INFO infoPtr)
static

Definition at line 2266 of file listview.c.

2267{
2268 ITERATOR i;
2269
2270 iterator_frameditems(&i, infoPtr, &infoPtr->rcList);
2271 while(iterator_next(&i))
2272 {
2273 if (LISTVIEW_GetItemState(infoPtr, i.nItem, LVIS_SELECTED))
2274 LISTVIEW_InvalidateItem(infoPtr, i.nItem);
2275 }
2277}

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 1760 of file listview.c.

1761{
1762 POINT Origin, Position;
1763 RECT rcBox;
1764
1765 if(!is_redrawing(infoPtr)) return;
1766 assert (infoPtr->uView == LV_VIEW_DETAILS);
1767 LISTVIEW_GetOrigin(infoPtr, &Origin);
1768 LISTVIEW_GetItemOrigin(infoPtr, nItem, &Position);
1769 LISTVIEW_GetHeaderRect(infoPtr, nSubItem, &rcBox);
1770 rcBox.top = 0;
1771 rcBox.bottom = infoPtr->nItemHeight;
1772 OffsetRect(&rcBox, Origin.x, Origin.y + Position.y);
1773 LISTVIEW_InvalidateRect(infoPtr, &rcBox);
1774}

Referenced by LISTVIEW_SetItemT().

◆ LISTVIEW_IsHeaderEnabled()

static BOOL LISTVIEW_IsHeaderEnabled ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1700 of file listview.c.

1701{
1702 return (infoPtr->uView == LV_VIEW_DETAILS ||
1703 infoPtr->dwLvExStyle & LVS_EX_HEADERINALLVIEWS) &&
1704 !(infoPtr->dwStyle & LVS_NOCOLUMNHEADER);
1705}

Referenced by LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateSize().

◆ LISTVIEW_IsHotTracking()

static BOOL LISTVIEW_IsHotTracking ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 3887 of file listview.c.

3888{
3889 return ((infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) ||
3890 (infoPtr->dwLvExStyle & LVS_EX_ONECLICKACTIVATE) ||
3892}
#define LVS_EX_ONECLICKACTIVATE
Definition: commctrl.h:2740
#define LVS_EX_TWOCLICKACTIVATE
Definition: commctrl.h:2741
#define LVS_EX_TRACKSELECT
Definition: commctrl.h:2737

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 8105 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_KeyDown()

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

Definition at line 10136 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_KeySelection()

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

Definition at line 3831 of file listview.c.

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

10242{
10243 TRACE("()\n");
10244
10245 /* drop any left over scroll amount */
10246 infoPtr->cWheelRemainder = 0;
10247
10248 /* if we did not have the focus, there's nothing more to do */
10249 if (!infoPtr->bFocus) return 0;
10250
10251 /* send NM_KILLFOCUS notification */
10252 if (!notify(infoPtr, NM_KILLFOCUS)) return 0;
10253
10254 /* if we have a focus rectangle, get rid of it */
10255 LISTVIEW_ShowFocusRect(infoPtr, FALSE);
10256
10257 /* if have a marquee selection, stop it */
10258 if (infoPtr->bMarqueeSelect)
10259 {
10260 /* Remove the marquee rectangle and release our mouse capture */
10261 LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeRect);
10263
10264 SetRectEmpty(&infoPtr->marqueeRect);
10265
10266 infoPtr->bMarqueeSelect = FALSE;
10267 infoPtr->bScrolling = FALSE;
10268 KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
10269 }
10270
10271 /* set window focus flag */
10272 infoPtr->bFocus = FALSE;
10273
10274 /* invalidate the selected items before resetting focus flag */
10276
10277 return 0;
10278}
static void LISTVIEW_InvalidateSelectedItems(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:2266
static void LISTVIEW_ShowFocusRect(const LISTVIEW_INFO *infoPtr, BOOL fShow)
Definition: listview.c:2204
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 10292 of file listview.c.

10293{
10294 LVHITTESTINFO htInfo;
10295
10296 TRACE("(key=%hu, X=%u, Y=%u)\n", wKey, x, y);
10297
10298 /* Cancel the item edition if any */
10299 if (infoPtr->itemEdit.fEnabled)
10300 {
10301 KillTimer(infoPtr->hwndSelf, (UINT_PTR)&infoPtr->itemEdit);
10302 infoPtr->itemEdit.fEnabled = FALSE;
10303 }
10304
10305 /* send NM_RELEASEDCAPTURE notification */
10306 if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0;
10307
10308 htInfo.pt.x = x;
10309 htInfo.pt.y = y;
10310
10311 /* send NM_DBLCLK notification */
10312 LISTVIEW_HitTest(infoPtr, &htInfo, TRUE, FALSE);
10313 if (!notify_click(infoPtr, NM_DBLCLK, &htInfo)) return 0;
10314
10315 /* To send the LVN_ITEMACTIVATE, it must be on an Item */
10316 if(htInfo.iItem != -1) notify_itemactivate(infoPtr,&htInfo);
10317
10318 return 0;
10319}
static BOOL notify_click(const LISTVIEW_INFO *infoPtr, INT code, const LVHITTESTINFO *lvht)
Definition: listview.c:889
static void notify_itemactivate(const LISTVIEW_INFO *infoPtr, const LVHITTESTINFO *htInfo)
Definition: listview.c:850
#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 10379 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_LButtonUp()

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

Definition at line 10503 of file listview.c.

10504{
10505 LVHITTESTINFO lvHitTestInfo;
10506
10507 TRACE("(key=%hu, X=%u, Y=%u)\n", wKey, x, y);
10508
10509 if (!infoPtr->bLButtonDown) return 0;
10510
10511 lvHitTestInfo.pt.x = x;
10512 lvHitTestInfo.pt.y = y;
10513
10514 /* send NM_CLICK notification */
10515 LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
10516 if (!notify_click(infoPtr, NM_CLICK, &lvHitTestInfo)) return 0;
10517
10518 /* set left button flag */
10519 infoPtr->bLButtonDown = FALSE;
10520
10521 /* set a single selection, reset others */
10522 if(lvHitTestInfo.iItem == infoPtr->nLButtonDownItem && lvHitTestInfo.iItem != -1)
10523 LISTVIEW_SetSelection(infoPtr, infoPtr->nLButtonDownItem);
10524 infoPtr->nLButtonDownItem = -1;
10525
10526 if (infoPtr->bDragging || infoPtr->bMarqueeSelect)
10527 {
10528 /* Remove the marquee rectangle and release our mouse capture */
10529 if (infoPtr->bMarqueeSelect)
10530 {
10531 LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeDrawRect);
10533 }
10534
10535 SetRectEmpty(&infoPtr->marqueeRect);
10536 SetRectEmpty(&infoPtr->marqueeDrawRect);
10537
10538 infoPtr->bDragging = FALSE;
10539 infoPtr->bMarqueeSelect = FALSE;
10540 infoPtr->bScrolling = FALSE;
10541
10542 KillTimer(infoPtr->hwndSelf, (UINT_PTR) infoPtr);
10543 return 0;
10544 }
10545
10546 /* if we clicked on a selected item, edit the label */
10547 if(lvHitTestInfo.iItem == infoPtr->nEditLabelItem && (lvHitTestInfo.flags & LVHT_ONITEMLABEL))
10548 {
10549 /* we want to make sure the user doesn't want to do a double click. So we will
10550 * delay the edit. WM_LBUTTONDBLCLICK will cancel the timer
10551 */
10552 infoPtr->itemEdit.fEnabled = TRUE;
10553 infoPtr->itemEdit.iItem = lvHitTestInfo.iItem;
10554 SetTimer(infoPtr->hwndSelf,
10555 (UINT_PTR)&infoPtr->itemEdit,
10558 }
10559
10560 return 0;
10561}
static VOID CALLBACK LISTVIEW_DelayedEditItem(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
Definition: listview.c:9614
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 2663 of file listview.c.

2664{
2665 ITEM_ID ID;
2666 INT index;
2667
2668 TRACE("iID=%d\n", iID);
2669
2670 if (infoPtr->dwStyle & LVS_OWNERDATA) return -1;
2671 if (infoPtr->nItemCount == 0) return -1;
2672
2673 ID.id = iID;
2675
2676 if (index != -1)
2677 {
2678 ITEM_ID *lpID = DPA_GetPtr(infoPtr->hdpaItemIds, index);
2679 return DPA_GetPtrIndex(infoPtr->hdpaItems, lpID->item);
2680 }
2681
2682 return -1;
2683}
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:2642
#define DPAS_SORTED
Definition: commctrl.h:4867
#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 2696 of file listview.c.

2697{
2698 ITEM_INFO *lpItem;
2699 HDPA hdpaSubItems;
2700
2701 TRACE("iItem=%d\n", iItem);
2702
2703 if (infoPtr->dwStyle & LVS_OWNERDATA) return -1;
2704 if (iItem < 0 || iItem >= infoPtr->nItemCount) return -1;
2705
2706 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, iItem);
2707 lpItem = DPA_GetPtr(hdpaSubItems, 0);
2708
2709 return lpItem->id->id;
2710}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MarqueeHighlight()

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

Definition at line 3954 of file listview.c.

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

3913{
3914 NMHDR hdr;
3915
3916 if (notify_hdr(infoPtr, NM_HOVER, &hdr)) return 0;
3917
3918 if (LISTVIEW_IsHotTracking(infoPtr))
3919 {
3920 LVITEMW item;
3921 POINT pt;
3922
3923 pt.x = x;
3924 pt.y = y;
3925
3926 if (LISTVIEW_GetItemAtPt(infoPtr, &item, pt))
3927 LISTVIEW_SetSelection(infoPtr, item.iItem);
3928
3929 SetFocus(infoPtr->hwndSelf);
3930 }
3931
3932 return 0;
3933}
static BOOL LISTVIEW_GetItemAtPt(const LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, POINT pt)
Definition: listview.c:3870
static BOOL LISTVIEW_IsHotTracking(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:3887
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 4138 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_MouseWheel()

static LRESULT LISTVIEW_MouseWheel ( LISTVIEW_INFO infoPtr,
INT  wheelDelta 
)
static

Definition at line 10080 of file listview.c.

10081{
10082 INT pulScrollLines = 3;
10083
10084 TRACE("(wheelDelta=%d)\n", wheelDelta);
10085
10086 switch(infoPtr->uView)
10087 {
10088 case LV_VIEW_ICON:
10089 case LV_VIEW_SMALLICON:
10090 /*
10091 * listview should be scrolled by a multiple of 37 dependently on its dimension or its visible item number
10092 * should be fixed in the future.
10093 */
10094 LISTVIEW_VScroll(infoPtr, SB_INTERNAL, (wheelDelta > 0) ?
10096 break;
10097
10098 case LV_VIEW_DETAILS:
10099 SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0);
10100
10101 /* if scrolling changes direction, ignore left overs */
10102 if ((wheelDelta < 0 && infoPtr->cWheelRemainder < 0) ||
10103 (wheelDelta > 0 && infoPtr->cWheelRemainder > 0))
10104 infoPtr->cWheelRemainder += wheelDelta;
10105 else
10106 infoPtr->cWheelRemainder = wheelDelta;
10107 if (infoPtr->cWheelRemainder && pulScrollLines)
10108 {
10109 int cLineScroll;
10110 pulScrollLines = min((UINT)LISTVIEW_GetCountPerColumn(infoPtr), pulScrollLines);
10111 cLineScroll = pulScrollLines * infoPtr->cWheelRemainder / WHEEL_DELTA;
10112 infoPtr->cWheelRemainder -= WHEEL_DELTA * cLineScroll / pulScrollLines;
10113 LISTVIEW_VScroll(infoPtr, SB_INTERNAL, -cLineScroll);
10114 }
10115 break;
10116
10117 case LV_VIEW_LIST:
10118 LISTVIEW_HScroll(infoPtr, (wheelDelta > 0) ? SB_LINELEFT : SB_LINERIGHT, 0);
10119 break;
10120 }
10121 return 0;
10122}
#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 2827 of file listview.c.

2828{
2829 POINT old;
2830
2831 if (!isNew)
2832 {
2833 old.x = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosX, nItem);
2834 old.y = (LONG_PTR)DPA_GetPtr(infoPtr->hdpaPosY, nItem);
2835
2836 if (lppt->x == old.x && lppt->y == old.y) return TRUE;
2837 LISTVIEW_InvalidateItem(infoPtr, nItem);
2838 }
2839
2840 /* Allocating a POINTER for every item is too resource intensive,
2841 * so we'll keep the (x,y) in different arrays */
2842 if (!DPA_SetPtr(infoPtr->hdpaPosX, nItem, (void *)(LONG_PTR)lppt->x)) return FALSE;
2843 if (!DPA_SetPtr(infoPtr->hdpaPosY, nItem, (void *)(LONG_PTR)lppt->y)) return FALSE;
2844
2845 LISTVIEW_InvalidateItem(infoPtr, nItem);
2846
2847 return TRUE;
2848}
__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 9638 of file listview.c.

9639{
9640 LISTVIEW_INFO *infoPtr;
9641 LOGFONTW logFont;
9642
9643 TRACE("(lpcs=%p)\n", lpcs);
9644
9645 /* initialize info pointer */
9646 infoPtr = Alloc(sizeof(LISTVIEW_INFO));
9647 if (!infoPtr) return FALSE;
9648
9649 SetWindowLongPtrW(hwnd, 0, (DWORD_PTR)infoPtr);
9650
9651 infoPtr->hwndSelf = hwnd;
9652 infoPtr->dwStyle = lpcs->style; /* Note: may be changed in WM_CREATE */
9653 map_style_view(infoPtr);
9654 /* determine the type of structures to use */
9655 infoPtr->hwndNotify = lpcs->hwndParent;
9656 /* infoPtr->notifyFormat will be filled in WM_CREATE */
9657
9658 /* initialize color information */
9659 infoPtr->clrBk = CLR_NONE;
9660 infoPtr->clrText = CLR_DEFAULT;
9661 infoPtr->clrTextBk = CLR_DEFAULT;
9663#ifdef __REACTOS__
9664 infoPtr->bDefaultBkColor = TRUE;
9665#endif
9666
9667 /* set default values */
9668 infoPtr->nFocusedItem = -1;
9669 infoPtr->nSelectionMark = -1;
9670 infoPtr->nHotItem = -1;
9671 infoPtr->redraw = TRUE;
9672 infoPtr->bNoItemMetrics = TRUE;
9674 infoPtr->autoSpacing = TRUE;
9677 infoPtr->nEditLabelItem = -1;
9678 infoPtr->nLButtonDownItem = -1;
9679 infoPtr->dwHoverTime = HOVER_DEFAULT; /* default system hover time */
9680 infoPtr->cWheelRemainder = 0;
9681 infoPtr->nMeasureItemHeight = 0;
9682 infoPtr->xTrackLine = -1; /* no track line */
9683 infoPtr->itemEdit.fEnabled = FALSE;
9684 infoPtr->iVersion = COMCTL32_VERSION;
9685 infoPtr->colRectsDirty = FALSE;
9686
9687 /* get default font (icon title) */
9689 infoPtr->hDefaultFont = CreateFontIndirectW(&logFont);
9690 infoPtr->hFont = infoPtr->hDefaultFont;
9691 LISTVIEW_SaveTextMetrics(infoPtr);
9692
9693 /* allocate memory for the data structure */
9694 if (!(infoPtr->selectionRanges = ranges_create(10))) goto fail;
9695 if (!(infoPtr->hdpaItems = DPA_Create(10))) goto fail;
9696 if (!(infoPtr->hdpaItemIds = DPA_Create(10))) goto fail;
9697 if (!(infoPtr->hdpaPosX = DPA_Create(10))) goto fail;
9698 if (!(infoPtr->hdpaPosY = DPA_Create(10))) goto fail;
9699 if (!(infoPtr->hdpaColumns = DPA_Create(10))) goto fail;
9700
9701 return DefWindowProcW(hwnd, WM_NCCREATE, wParam, (LPARAM)lpcs);
9702
9703fail:
9704 DestroyWindow(infoPtr->hwndHeader);
9706 DPA_Destroy(infoPtr->hdpaItems);
9707 DPA_Destroy(infoPtr->hdpaItemIds);
9708 DPA_Destroy(infoPtr->hdpaPosX);
9709 DPA_Destroy(infoPtr->hdpaPosY);
9710 DPA_Destroy(infoPtr->hdpaColumns);
9711 Free(infoPtr);
9712 return FALSE;
9713}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
static void LISTVIEW_SaveTextMetrics(LISTVIEW_INFO *infoPtr)
Definition: listview.c:3136
static BOOL LISTVIEW_SetBkColor(LISTVIEW_INFO *infoPtr, COLORREF color)
Definition: listview.c:8206
#define COMCTL32_VERSION
Definition: resource.h:72
#define HOVER_DEFAULT
Definition: commctrl.h:4991
COLORREF clrWindow
Definition: comctl32.h:182
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:1013
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1391
#define WM_NCCREATE
Definition: winuser.h:1694
#define SM_CYICON
Definition: winuser.h:984
#define SM_CXICON
Definition: winuser.h:983
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SM_CXICONSPACING
Definition: winuser.h:1012

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_NCDestroy()

static LRESULT LISTVIEW_NCDestroy ( LISTVIEW_INFO infoPtr)
static

Definition at line 10573 of file listview.c.

10574{
10575 INT i;
10576
10577 TRACE("()\n");
10578
10579 /* destroy data structure */
10580 DPA_Destroy(infoPtr->hdpaItems);
10581 DPA_Destroy(infoPtr->hdpaItemIds);
10582 DPA_Destroy(infoPtr->hdpaPosX);
10583 DPA_Destroy(infoPtr->hdpaPosY);
10584 /* columns */
10585 for (i = 0; i < DPA_GetPtrCount(infoPtr->hdpaColumns); i++)
10586 Free(DPA_GetPtr(infoPtr->hdpaColumns, i));
10587 DPA_Destroy(infoPtr->hdpaColumns);
10589#ifdef __REACTOS__
10590 infoPtr->selectionRanges = NULL; /* See note in ranges_clone */
10591#endif
10592
10593 /* destroy image lists */
10594 if (!(infoPtr->dwStyle & LVS_SHAREIMAGELISTS))
10595 {
10596 ImageList_Destroy(infoPtr->himlNormal);
10597 ImageList_Destroy(infoPtr->himlSmall);
10598 ImageList_Destroy(infoPtr->himlState);
10599 }
10600
10601 /* destroy font, bkgnd brush */
10602 infoPtr->hFont = 0;
10603 if (infoPtr->hDefaultFont) DeleteObject(infoPtr->hDefaultFont);
10604 if (infoPtr->clrBk != CLR_NONE) DeleteObject(infoPtr->hBkBrush);
10605
10606 SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
10607
10608 /* free listview info pointer*/
10609 Free(infoPtr);
10610
10611 return 0;
10612}
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:941
#define LVS_SHAREIMAGELISTS
Definition: commctrl.h:2275

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_NCPaint()

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

Definition at line 10797 of file listview.c.

10798{
10799 HTHEME theme = GetWindowTheme (infoPtr->hwndSelf);
10800 HDC dc;
10801 RECT r;
10802 HRGN cliprgn;
10803 int cxEdge = GetSystemMetrics (SM_CXEDGE),
10804 cyEdge = GetSystemMetrics (SM_CYEDGE);
10805
10806 if (!theme)
10807 return DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)region, 0);
10808
10809 GetWindowRect(infoPtr->hwndSelf, &r);
10810
10811 cliprgn = CreateRectRgn (r.left + cxEdge, r.top + cyEdge,
10812 r.right - cxEdge, r.bottom - cyEdge);
10813 if (region != (HRGN)1)
10814 CombineRgn (cliprgn, cliprgn, region, RGN_AND);
10815 OffsetRect(&r, -r.left, -r.top);
10816
10817#ifdef __REACTOS__ /* r73789 */
10818 dc = GetWindowDC(infoPtr->hwndSelf);
10819 /* Exclude client part */
10820 ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge,
10821 r.right - cxEdge, r.bottom -cyEdge);
10822#else
10823 dc = GetDCEx(infoPtr->hwndSelf, region, DCX_WINDOW|DCX_INTERSECTRGN);
10824 OffsetRect(&r, -r.left, -r.top);
10825#endif
10826
10827 if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0))
10829 DrawThemeBackground (theme, dc, 0, 0, &r, 0);
10830 ReleaseDC(infoPtr->hwndSelf, dc);
10831
10832 /* Call default proc to get the scrollbars etc. painted */
10833 DefWindowProcW (infoPtr->hwndSelf, WM_NCPAINT, (WPARAM)cliprgn, 0);
10834 DeleteObject(cliprgn);
10835
10836 return FALSE;
10837}
HDC dc
Definition: cylfrac.c:34
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:1927
HRESULT WINAPI DrawThemeParentBackground(HWND hwnd, HDC hdc, RECT *prc)
Definition: draw.c:72
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
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:1020
#define DCX_WINDOW
Definition: winuser.h:2124
#define SM_CXEDGE
Definition: winuser.h:1019
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define DCX_INTERSECTRGN
Definition: winuser.h:2133
#define WM_NCPAINT
Definition: winuser.h:1698

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_NextIconPosLeft()

static void LISTVIEW_NextIconPosLeft ( LISTVIEW_INFO infoPtr,
LPPOINT  lpPos 
)
static

Definition at line 2759 of file listview.c.

2761{
2762 INT nListHeight = infoPtr->rcList.bottom - infoPtr->rcList.top;
2763
2764 *lpPos = infoPtr->currIconPos;
2765
2766 infoPtr->currIconPos.y += infoPtr->nItemHeight;
2767 if (infoPtr->currIconPos.y + infoPtr->nItemHeight <= nListHeight) return;
2768
2769 infoPtr->currIconPos.x += infoPtr->nItemWidth;
2770 infoPtr->currIconPos.y = 0;
2771}

Referenced by LISTVIEW_Arrange(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_NextIconPosTop()

static void LISTVIEW_NextIconPosTop ( LISTVIEW_INFO infoPtr,
LPPOINT  lpPos 
)
static

Definition at line 2728 of file listview.c.

2730{
2731 INT nListWidth = infoPtr->rcList.right - infoPtr->rcList.left;
2732
2733 *lpPos = infoPtr->currIconPos;
2734
2735 infoPtr->currIconPos.x += infoPtr->nItemWidth;
2736 if (infoPtr->currIconPos.x + infoPtr->nItemWidth <= nListWidth) return;
2737
2738 infoPtr->currIconPos.x = 0;
2739 infoPtr->currIconPos.y += infoPtr->nItemHeight;
2740}

Referenced by LISTVIEW_Arrange(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_Notify()

static LRESULT LISTVIEW_Notify ( LISTVIEW_INFO infoPtr,
NMHDR lpnmhdr 
)
static

Definition at line 10625 of file listview.c.

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

10852{
10853 TRACE("(hwndFrom=%p, nCommand=%d)\n", hwndFrom, nCommand);
10854
10855 if (nCommand == NF_REQUERY)
10856 infoPtr->notifyFormat = SendMessageW(infoPtr->hwndNotify, WM_NOTIFYFORMAT, (WPARAM)infoPtr->hwndSelf, NF_QUERY);
10857
10858 return infoPtr->notifyFormat;
10859}
#define NF_REQUERY
Definition: winuser.h:2472

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Paint()

static LRESULT LISTVIEW_Paint ( LISTVIEW_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 10872 of file listview.c.

10873{
10874 TRACE("(hdc=%p)\n", hdc);
10875
10876 if (infoPtr->bNoItemMetrics && infoPtr->nItemCount)
10877 {
10878 infoPtr->bNoItemMetrics = FALSE;
10879 LISTVIEW_UpdateItemSize(infoPtr);
10880 if (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON)
10881 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
10882 LISTVIEW_UpdateScroll(infoPtr);
10883 }
10884
10885 if (infoPtr->hwndHeader) UpdateWindow(infoPtr->hwndHeader);
10886
10887 if (hdc)
10888 LISTVIEW_Refresh(infoPtr, hdc, NULL);
10889 else
10890 {
10891 PAINTSTRUCT ps;
10892
10893 hdc = BeginPaint(infoPtr->hwndSelf, &ps);
10894 if (!hdc) return 1;
10895 LISTVIEW_Refresh(infoPtr, hdc, ps.fErase ? &ps.rcPaint : NULL);
10896 EndPaint(infoPtr->hwndSelf, &ps);
10897 }
10898
10899 return 0;
10900}
static void LISTVIEW_Refresh(LISTVIEW_INFO *infoPtr, HDC hdc, const RECT *prcErase)
Definition: listview.c:5270
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 10935 of file listview.c.

10936{
10937 if ((options & PRF_CHECKVISIBLE) && !IsWindowVisible(infoPtr->hwndSelf))
10938 return 0;
10939
10941 FIXME("(hdc=%p options=0x%08x) partial stub\n", hdc, options);
10942
10943 if (options & PRF_ERASEBKGND)
10944 LISTVIEW_EraseBkgnd(infoPtr, hdc);
10945
10946 if (options & PRF_CLIENT)
10947 LISTVIEW_Paint(infoPtr, hdc);
10948
10949 return 0;
10950}
static BOOL LISTVIEW_EraseBkgnd(const LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:9826
static LRESULT LISTVIEW_Paint(LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:10872
#define PRF_CLIENT
Definition: winuser.h:2536
#define PRF_CHECKVISIBLE
Definition: winuser.h:2534
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 1869 of file listview.c.

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

10966{
10967 LVHITTESTINFO lvHitTestInfo;
10968
10969 TRACE("(key=%hu,X=%u,Y=%u)\n", wKey, x, y);
10970
10971 /* send NM_RELEASEDCAPTURE notification */
10972 if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0;
10973
10974 /* send NM_RDBLCLK notification */
10975 lvHitTestInfo.pt.x = x;
10976 lvHitTestInfo.pt.y = y;
10977 LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
10978 notify_click(infoPtr, NM_RDBLCLK, &lvHitTestInfo);
10979
10980 return 0;
10981}
#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 10995 of file listview.c.

10996{
10998 INT item;
10999
11000 TRACE("(key=%hu, x=%d, y=%d)\n", wKey, x, y);
11001
11002 /* send NM_RELEASEDCAPTURE notification */
11003 if (!notify(infoPtr, NM_RELEASEDCAPTURE)) return 0;
11004
11005 /* determine the index of the selected item */
11006 ht.pt.x = x;
11007 ht.pt.y = y;
11008 item = LISTVIEW_HitTest(infoPtr, &ht, TRUE, TRUE);
11009
11010 /* make sure the listview control window has the focus */
11011 if (!infoPtr->bFocus) SetFocus(infoPtr->hwndSelf);
11012
11013 if ((item >= 0) && (item < infoPtr->nItemCount))
11014 {
11015 LISTVIEW_SetItemFocus(infoPtr, item);
11016 if (!((wKey & MK_SHIFT) || (wKey & MK_CONTROL)) &&
11018 LISTVIEW_SetSelection(infoPtr, item);
11019 }
11020 else
11021 LISTVIEW_DeselectAll(infoPtr);
11022
11023 if (LISTVIEW_TrackMouse(infoPtr, ht.pt))
11024 {
11025 if (ht.iItem != -1)
11026 {
11027 NMLISTVIEW nmlv;
11028
11029 memset(&nmlv, 0, sizeof(nmlv));
11030 nmlv.iItem = ht.iItem;
11031 nmlv.ptAction = ht.pt;
11032
11033 notify_listview(infoPtr, LVN_BEGINRDRAG, &nmlv);
11034 }
11035 }
11036 else
11037 {
11038 SetFocus(infoPtr->hwndSelf);
11039
11040 ht.pt.x = x;
11041 ht.pt.y = y;
11042 LISTVIEW_HitTest(infoPtr, &ht, TRUE, FALSE);
11043
11044 if (notify_click(infoPtr, NM_RCLICK, &ht))
11045 {
11046 /* Send a WM_CONTEXTMENU message in response to the WM_RBUTTONUP */
11048 (WPARAM)infoPtr->hwndSelf, (LPARAM)GetMessagePos());
11049 }
11050 }
11051
11052 return 0;
11053}
static LRESULT LISTVIEW_TrackMouse(const LISTVIEW_INFO *infoPtr, POINT pt)
Definition: listview.c:10321
#define LVN_BEGINRDRAG
Definition: commctrl.h:3146
#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 8144 of file listview.c.

8145{
8146 INT i;
8147
8148 for (i = max(nFirst, 0); i <= min(nLast, infoPtr->nItemCount - 1); i++)
8149 LISTVIEW_InvalidateItem(infoPtr, i);
8150
8151 return TRUE;
8152}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Refresh()

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

Definition at line 5270 of file listview.c.

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

5240{
5241 POINT Origin, Position;
5242
5243 /* Get scroll info once before loop */
5244 LISTVIEW_GetOrigin(infoPtr, &Origin);
5245
5246 while(iterator_prev(i))
5247 {
5248 SelectObject(hdc, infoPtr->hFont);
5249 LISTVIEW_GetItemOrigin(infoPtr, i->nItem, &Position);
5250 Position.x += Origin.x;
5251 Position.y += Origin.y;
5252
5253 LISTVIEW_DrawItem(infoPtr, hdc, i->nItem, NULL, Position, cdmode);
5254 }
5255}

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_RefreshOwnerDraw()

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

Definition at line 4978 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_RefreshReport()

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

Definition at line 5052 of file listview.c.

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

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

12060{
12061 WNDCLASSW wndClass;
12062
12063 ZeroMemory(&wndClass, sizeof(WNDCLASSW));
12064 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
12066 wndClass.cbClsExtra = 0;
12067 wndClass.cbWndExtra = sizeof(LISTVIEW_INFO *);
12068 wndClass.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
12069 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
12070 wndClass.lpszClassName = WC_LISTVIEWW;
12071 RegisterClassW(&wndClass);
12072}
static LRESULT WINAPI LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:11511
#define WC_LISTVIEWW
Definition: commctrl.h:2262
LPCWSTR lpszClassName
Definition: winuser.h:3196
HBRUSH hbrBackground
Definition: winuser.h:3194
int cbClsExtra
Definition: winuser.h:3189
UINT style
Definition: winuser.h:3187
WNDPROC lpfnWndProc
Definition: winuser.h:3188
int cbWndExtra
Definition: winuser.h:3190
HCURSOR hCursor
Definition: winuser.h:3193
#define COLOR_WINDOW
Definition: winuser.h:929
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:695
#define CS_DBLCLKS
Definition: winuser.h:659
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2442
#define CS_GLOBALCLASS
Definition: winuser.h:660

Referenced by DllMain().

◆ LISTVIEW_SaveTextMetrics()

static void LISTVIEW_SaveTextMetrics ( LISTVIEW_INFO infoPtr)
static

Definition at line 3136 of file listview.c.

3137{
3138 HDC hdc = GetDC(infoPtr->hwndSelf);
3139 HFONT hFont = infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont;
3140 HFONT hOldFont = SelectObject(hdc, hFont);
3142 SIZE sz;
3143
3144 if (GetTextMetricsW(hdc, &tm))
3145 {
3146 infoPtr->ntmHeight = tm.tmHeight;
3147 infoPtr->ntmMaxCharWidth = tm.tmMaxCharWidth;
3148 }
3149
3150 if (GetTextExtentPoint32A(hdc, "...", 3, &sz))
3151 infoPtr->nEllipsisWidth = sz.cx;
3152
3153 SelectObject(hdc, hOldFont);
3154 ReleaseDC(infoPtr->hwndSelf, hdc);
3155
3156 TRACE("tmHeight=%d\n", infoPtr->ntmHeight);
3157}
BOOL WINAPI GetTextExtentPoint32A(_In_ HDC hdc, _In_reads_(c) LPCSTR lpString, _In_ int c, _Out_ LPSIZE psizl)

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

◆ LISTVIEW_Scroll()

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

Definition at line 8174 of file listview.c.

8175{
8176 switch(infoPtr->uView) {
8177 case LV_VIEW_DETAILS:
8178 dy += (dy < 0 ? -1 : 1) * infoPtr->nItemHeight/2;
8179 dy /= infoPtr->nItemHeight;
8180 break;
8181 case LV_VIEW_LIST:
8182 if (dy != 0) return FALSE;
8183 break;
8184 default: /* icon */
8185 break;
8186 }
8187
8188 if (dx != 0) LISTVIEW_HScroll(infoPtr, SB_INTERNAL, dx);
8189 if (dy != 0) LISTVIEW_VScroll(infoPtr, SB_INTERNAL, dy);
8190
8191 return TRUE;
8192}
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 5706 of file listview.c.

5707{
5708 COLUMN_INFO *lpColumnInfo;
5709 RECT rcOld, rcCol;
5710 POINT ptOrigin;
5711 INT nCol;
5712 HDITEMW hdi;
5713
5714 if (nColumn < 0 || DPA_GetPtrCount(infoPtr->hdpaColumns) < 1) return;
5715 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, min(nColumn, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1));
5716 rcCol = lpColumnInfo->rcHeader;
5717 if (nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns))
5718 rcCol.left = rcCol.right;
5719
5720 /* adjust the other columns */
5721 hdi.mask = HDI_ORDER;
5722 if (SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nColumn, (LPARAM)&hdi))
5723 {
5724 INT nOrder = hdi.iOrder;
5725 for (nCol = 0; nCol < DPA_GetPtrCount(infoPtr->hdpaColumns); nCol++)
5726 {
5727 hdi.mask = HDI_ORDER;
5728 SendMessageW(infoPtr->hwndHeader, HDM_GETITEMW, nCol, (LPARAM)&hdi);
5729 if (hdi.iOrder >= nOrder) {
5730 lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nCol);
5731 lpColumnInfo->rcHeader.left += dx;
5732 lpColumnInfo->rcHeader.right += dx;
5733 }
5734 }
5735 }
5736
5737 /* do not update screen if not in report mode */
5738 if (!is_redrawing(infoPtr) || infoPtr->uView != LV_VIEW_DETAILS) return;
5739
5740 /* Need to reset the item width when inserting a new column */
5741 infoPtr->nItemWidth += dx;
5742
5743 LISTVIEW_UpdateScroll(infoPtr);
5744 LISTVIEW_GetOrigin(infoPtr, &ptOrigin);
5745
5746 /* scroll to cover the deleted column, and invalidate for redraw */
5747 rcOld = infoPtr->rcList;
5748 rcOld.left = ptOrigin.x + rcCol.left + dx;
5749 ScrollWindowEx(infoPtr->hwndSelf, dx, 0, &rcOld, &rcOld, 0, 0, SW_ERASE | SW_INVALIDATE);
5750}
#define SW_INVALIDATE
Definition: winuser.h:2590
#define SW_ERASE
Definition: winuser.h:2591
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 5849 of file listview.c.

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

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

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

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 8494 of file listview.c.

8495{
8496 if (!infoPtr->hwndHeader) return FALSE;
8497 infoPtr->colRectsDirty = TRUE;
8498 return SendMessageW(infoPtr->hwndHeader, HDM_SETORDERARRAY, iCount, (LPARAM)lpiArray);
8499}
#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 8439 of file listview.c.

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

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

11070{
11071 LVHITTESTINFO lvHitTestInfo;
11072
11073 if (!LISTVIEW_IsHotTracking(infoPtr)) goto forward;
11074
11075 if (!infoPtr->hHotCursor) goto forward;
11076
11077 GetCursorPos(&lvHitTestInfo.pt);
11078 if (LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, FALSE, FALSE) < 0) goto forward;
11079
11080 SetCursor(infoPtr->hHotCursor);
11081
11082 return TRUE;
11083
11084forward:
11085
11086 return DefWindowProcW(infoPtr->hwndSelf, WM_SETCURSOR, wParam, lParam);
11087}
HCURSOR hHotCursor
Definition: listview.c:319
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_SETCURSOR
Definition: winuser.h:1647

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetExtendedListViewStyle()

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

Definition at line 8699 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetFocus()

static LRESULT LISTVIEW_SetFocus ( LISTVIEW_INFO infoPtr,
HWND  hwndLoseFocus 
)
static

Definition at line 11100 of file listview.c.

11101{
11102 TRACE("(hwndLoseFocus=%p)\n", hwndLoseFocus);
11103
11104 /* if we have the focus already, there's nothing to do */
11105 if (infoPtr->bFocus) return 0;
11106
11107 /* send NM_SETFOCUS notification */
11108 if (!notify(infoPtr, NM_SETFOCUS)) return 0;
11109
11110 /* set window focus flag */
11111 infoPtr->bFocus = TRUE;
11112
11113 /* put the focus rect back on */
11114 LISTVIEW_ShowFocusRect(infoPtr, TRUE);
11115
11116 /* redraw all visible selected items */
11118
11119 return 0;
11120}
#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 11134 of file listview.c.

11135{
11136 HFONT oldFont = infoPtr->hFont;
11137 INT oldHeight = infoPtr->nItemHeight;
11138
11139 TRACE("(hfont=%p,redraw=%hu)\n", hFont, fRedraw);
11140
11141 infoPtr->hFont = hFont ? hFont : infoPtr->hDefaultFont;
11142 if (infoPtr->hFont == oldFont) return 0;
11143
11144 LISTVIEW_SaveTextMetrics(infoPtr);
11145
11146 infoPtr->nItemHeight = LISTVIEW_CalculateItemHeight(infoPtr);
11147
11148 if (infoPtr->uView == LV_VIEW_DETAILS)
11149 {
11150 SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)hFont, MAKELPARAM(fRedraw, 0));
11151 LISTVIEW_UpdateSize(infoPtr);
11152 LISTVIEW_UpdateScroll(infoPtr);
11153 }
11154 else if (infoPtr->nItemHeight != oldHeight)
11155 LISTVIEW_UpdateScroll(infoPtr);
11156
11157 if (fRedraw) LISTVIEW_InvalidateList(infoPtr);
11158
11159 return 0;
11160}
#define MAKELPARAM(l, h)
Definition: winuser.h:4019

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetGroupSelection()

static void LISTVIEW_SetGroupSelection ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 3716 of file listview.c.

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

8801{
8802 HCURSOR oldCursor = infoPtr->hHotCursor;
8803
8804 infoPtr->hHotCursor = hCursor;
8805
8806 return oldCursor;
8807}
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 8822 of file listview.c.

8823{
8824 INT iOldIndex = infoPtr->nHotItem;
8825
8826 infoPtr->nHotItem = iIndex;
8827
8828 return iOldIndex;
8829}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetHoverTime()

static DWORD LISTVIEW_SetHoverTime ( LISTVIEW_INFO infoPtr,
DWORD  dwHoverTime 
)
static

Definition at line 8843 of file listview.c.

8844{
8845 DWORD oldHoverTime = infoPtr->dwHoverTime;
8846
8847 infoPtr->dwHoverTime = dwHoverTime;
8848
8849 return oldHoverTime;
8850}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetIconSpacing()

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

Definition at line 8864 of file listview.c.

8865{
8866 INT iconWidth = 0, iconHeight = 0;
8867 DWORD oldspacing = MAKELONG(infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy);
8868
8869 TRACE("requested=(%d,%d)\n", cx, cy);
8870
8871 /* set to defaults, if instructed to */
8872 if (cx == -1 && cy == -1)
8873 {
8874 infoPtr->autoSpacing = TRUE;
8875 if (infoPtr->himlNormal)
8876 ImageList_GetIconSize(infoPtr->himlNormal, &iconWidth, &iconHeight);
8879 }
8880 else
8881 infoPtr->autoSpacing = FALSE;
8882
8883 /* if 0 then keep width */
8884 if (cx != 0)
8885 infoPtr->iconSpacing.cx = cx;
8886
8887 /* if 0 then keep height */
8888 if (cy != 0)
8889 infoPtr->iconSpacing.cy = cy;
8890
8891 TRACE("old=(%d,%d), new=(%d,%d), iconSize=(%d,%d), ntmH=%d\n",
8892 LOWORD(oldspacing), HIWORD(oldspacing), infoPtr->iconSpacing.cx, infoPtr->iconSpacing.cy,
8893 infoPtr->iconSize.cx, infoPtr->iconSize.cy,
8894 infoPtr->ntmHeight);
8895
8896 /* these depend on the iconSpacing */
8897 LISTVIEW_UpdateItemSize(infoPtr);
8898
8899 return oldspacing;
8900}
_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 8931 of file listview.c.

8932{
8933 INT oldHeight = infoPtr->nItemHeight;
8934 HIMAGELIST himlOld = 0;
8935
8936 TRACE("(nType=%d, himl=%p)\n", nType, himl);
8937
8938 switch (nType)
8939 {
8940 case LVSIL_NORMAL:
8941 himlOld = infoPtr->himlNormal;
8942 infoPtr->himlNormal = himl;
8943 if (infoPtr->uView == LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, FALSE);
8944 if (infoPtr->autoSpacing)
8945 LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
8946 break;
8947
8948 case LVSIL_SMALL:
8949 himlOld = infoPtr->himlSmall;
8950 infoPtr->himlSmall = himl;
8951 if (infoPtr->uView != LV_VIEW_ICON) set_icon_size(&infoPtr->iconSize, himl, TRUE);
8952 if (infoPtr->hwndHeader)
8954 break;
8955
8956 case LVSIL_STATE:
8957 himlOld = infoPtr->himlState;
8958 infoPtr->himlState = himl;
8959 set_icon_size(&infoPtr->iconStateSize, himl, TRUE);
8961 break;
8962
8963 default:
8964 ERR("Unknown icon type=%d\n", nType);
8965 return NULL;
8966 }
8967
8968 infoPtr->nItemHeight = LISTVIEW_CalculateItemHeight(infoPtr);
8969 if (infoPtr->nItemHeight != oldHeight)
8970 LISTVIEW_UpdateScroll(infoPtr);
8971
8972 return himlOld;
8973}
COLORREF WINAPI ImageList_SetBkColor(HIMAGELIST himl, COLORREF clrBk)
Definition: imagelist.c:2949
static DWORD LISTVIEW_SetIconSpacing(LISTVIEW_INFO *infoPtr, INT cx, INT cy)
Definition: listview.c:8864

Referenced by LISTVIEW_SetExtendedListViewStyle(), and LISTVIEW_WindowProc().

◆ LISTVIEW_SetItemCount()

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

Definition at line 8988 of file listview.c.

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

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

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 9086 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetItemState()

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

Definition at line 9142 of file listview.c.

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

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 4568 of file listview.c.

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

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 9222 of file listview.c.

9223{
9224 LVITEMW lvItem;
9225
9226 if (!lpLVItem || nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE;
9227 if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
9228
9229 lvItem.iItem = nItem;
9230 lvItem.iSubItem = lpLVItem->iSubItem;
9231 lvItem.mask = LVIF_TEXT;
9232 lvItem.pszText = lpLVItem->pszText;
9233 lvItem.cchTextMax = lpLVItem->cchTextMax;
9234
9235 TRACE("(nItem=%d, lpLVItem=%s, isW=%d)\n", nItem, debuglvitem_t(&lvItem, isW), isW);
9236
9237 return LISTVIEW_SetItemT(infoPtr, &lvItem, isW);
9238}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetRedraw()

static LRESULT LISTVIEW_SetRedraw ( LISTVIEW_INFO infoPtr,
BOOL  redraw 
)
static

Definition at line 11174 of file listview.c.

11175{
11176 TRACE("old=%d, new=%d\n", infoPtr->redraw, redraw);
11177
11178 if (infoPtr->redraw == !!redraw)
11179 return 0;
11180
11181 if (!(infoPtr->redraw = !!redraw))
11182 return 0;
11183
11184 if (is_autoarrange(infoPtr))
11185 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
11186 LISTVIEW_UpdateScroll(infoPtr);
11187
11188 /* despite what the WM_SETREDRAW docs says, apps expect us
11189 * to invalidate the listview here... stupid! */
11190 LISTVIEW_InvalidateList(infoPtr);
11191
11192 return 0;
11193}
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 3803 of file listview.c.

3804{
3805 LVITEMW lvItem;
3806
3807 TRACE("nItem=%d\n", nItem);
3808
3809 LISTVIEW_DeselectAllSkipItem(infoPtr, nItem);
3810
3811 lvItem.state = LVIS_FOCUSED | LVIS_SELECTED;
3813 LISTVIEW_SetItemState(infoPtr, nItem, &lvItem);
3814
3815 infoPtr->nSelectionMark = nItem;
3816}

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 9251 of file listview.c.

9252{
9253 INT nOldIndex = infoPtr->nSelectionMark;
9254
9255 TRACE("(nIndex=%d)\n", nIndex);
9256
9257 if (nIndex >= -1 && nIndex < infoPtr->nItemCount)
9258 infoPtr->nSelectionMark = nIndex;
9259
9260 return nOldIndex;
9261}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetTextBkColor()

static BOOL LISTVIEW_SetTextBkColor ( LISTVIEW_INFO infoPtr,
COLORREF  color 
)
static

Definition at line 9275 of file listview.c.

9276{
9277 TRACE("(color=%x)\n", color);
9278
9279 infoPtr->clrTextBk = color;
9280 return TRUE;
9281}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetTextColor()

static BOOL LISTVIEW_SetTextColor ( LISTVIEW_INFO infoPtr,
COLORREF  color 
)
static

Definition at line 9295 of file listview.c.

9296{
9297 TRACE("(color=%x)\n", color);
9298
9299 infoPtr->clrText = color;
9300 return TRUE;
9301}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetToolTips()

static HWND LISTVIEW_SetToolTips ( LISTVIEW_INFO infoPtr,
HWND  hwndNewToolTip 
)
static

Definition at line 9314 of file listview.c.

9315{
9316 HWND hwndOldToolTip = infoPtr->hwndToolTip;
9317 infoPtr->hwndToolTip = hwndNewToolTip;
9318 return hwndOldToolTip;
9319}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetUnicodeFormat()

static BOOL LISTVIEW_SetUnicodeFormat ( LISTVIEW_INFO infoPtr,
BOOL  unicode 
)
static

Definition at line 9331 of file listview.c.

9332{
9333 SHORT rc = infoPtr->notifyFormat;
9334 infoPtr->notifyFormat = (unicode) ? NFR_UNICODE : NFR_ANSI;
9335 return rc == NFR_UNICODE;
9336}
short SHORT
Definition: pedump.c:59
#define NFR_UNICODE
Definition: winuser.h:2470

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetVersion()

static LRESULT LISTVIEW_SetVersion ( LISTVIEW_INFO infoPtr,
DWORD  iVersion 
)
static

Definition at line 11491 of file listview.c.

11492{
11493 INT iOldVersion = infoPtr->iVersion;
11494
11495 if (iVersion > COMCTL32_VERSION)
11496 return -1;
11497
11498 infoPtr->iVersion = iVersion;
11499
11500 TRACE("new version %d\n", iVersion);
11501
11502 return iOldVersion;
11503}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_SetView()

static INT LISTVIEW_SetView ( LISTVIEW_INFO infoPtr,
DWORD  nView 
)
static

Definition at line 9349 of file listview.c.

9350{
9352
9353 if (infoPtr->uView == nView) return 1;
9354
9355 if ((INT)nView < 0 || nView > LV_VIEW_MAX) return -1;
9356 if (nView == LV_VIEW_TILE)
9357 {
9358 FIXME("View LV_VIEW_TILE unimplemented\n");
9359 return -1;
9360 }
9361
9362 infoPtr->uView = nView;
9363
9364 SendMessageW(infoPtr->hwndEdit, WM_KILLFOCUS, 0, 0);
9365 ShowWindow(infoPtr->hwndHeader, SW_HIDE);
9366
9367 ShowScrollBar(infoPtr->hwndSelf, SB_BOTH, FALSE);
9368 SetRectEmpty(&infoPtr->rcFocus);
9369
9370 himl = (nView == LV_VIEW_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
9371 set_icon_size(&infoPtr->iconSize, himl, nView != LV_VIEW_ICON);
9372
9373 switch (nView)
9374 {
9375 case LV_VIEW_ICON:
9376 case LV_VIEW_SMALLICON:
9377 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
9378 break;
9379 case LV_VIEW_DETAILS:
9380 {
9381 HDLAYOUT hl;
9382 WINDOWPOS wp;
9383
9384 LISTVIEW_CreateHeader( infoPtr );
9385
9386 hl.prc = &infoPtr->rcList;
9387 hl.pwpos = &wp;
9388 SendMessageW(infoPtr->hwndHeader, HDM_LAYOUT, 0, (LPARAM)&hl);
9389 SetWindowPos(infoPtr->hwndHeader, infoPtr->hwndSelf, wp.x, wp.y, wp.cx, wp.cy,
9391 break;
9392 }
9393 case LV_VIEW_LIST:
9394 break;
9395 }
9396
9397 LISTVIEW_UpdateItemSize(infoPtr);
9398 LISTVIEW_UpdateSize(infoPtr);
9399 LISTVIEW_UpdateScroll(infoPtr);
9400 LISTVIEW_InvalidateList(infoPtr);
9401
9402 TRACE("nView=%d\n", nView);
9403
9404 return 1;
9405}
#define HDM_LAYOUT
Definition: commctrl.h:767
#define LV_VIEW_TILE
Definition: commctrl.h:2849
#define LV_VIEW_MAX
Definition: commctrl.h:2850
WINDOWPOS * pwpos
Definition: commctrl.h:764
RECT * prc
Definition: commctrl.h:763
UINT flags
Definition: winuser.h:3605
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
#define SB_BOTH
Definition: winuser.h:555
#define SWP_HIDEWINDOW
Definition: winuser.h:1252
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 3619 of file listview.c.

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

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 3642 of file listview.c.

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

Referenced by LISTVIEW_DeleteItem(), and LISTVIEW_InsertItemT().

◆ LISTVIEW_ShowFocusRect()

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

Definition at line 2204 of file listview.c.

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

Referenced by LISTVIEW_KillFocus(), and LISTVIEW_SetFocus().

◆ LISTVIEW_ShowWindow()

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

Definition at line 11450 of file listview.c.

11451{
11452 /* header delayed creation */
11453 if ((infoPtr->uView == LV_VIEW_DETAILS) && bShown)
11454 {
11455 LISTVIEW_CreateHeader(infoPtr);
11456
11457 if (!(LVS_NOCOLUMNHEADER & infoPtr->dwStyle))
11459 }
11460
11461 return DefWindowProcW(infoPtr->hwndSelf, WM_SHOWWINDOW, bShown, iStatus);
11462}
#define WM_SHOWWINDOW
Definition: winuser.h:1639

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Size()

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

Definition at line 11208 of file listview.c.

11209{
11210 RECT rcOld = infoPtr->rcList;
11211
11212 TRACE("(width=%d, height=%d)\n", Width, Height);
11213
11214 LISTVIEW_UpdateSize(infoPtr);
11215 if (EqualRect(&rcOld, &infoPtr->rcList)) return 0;
11216
11217 /* do not bother with display related stuff if we're not redrawing */
11218 if (!is_redrawing(infoPtr)) return 0;
11219
11220 if (is_autoarrange(infoPtr))
11221 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
11222
11223 LISTVIEW_UpdateScroll(infoPtr);
11224
11225 /* refresh all only for lists whose height changed significantly */
11226 if ((infoPtr->uView == LV_VIEW_LIST) &&
11227 (rcOld.bottom - rcOld.top) / infoPtr->nItemHeight !=
11228 (infoPtr->rcList.bottom - infoPtr->rcList.top) / infoPtr->nItemHeight)
11229 LISTVIEW_InvalidateList(infoPtr);
11230
11231 return 0;
11232}
_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 9471 of file listview.c.

9473{
9474 HDPA hdpaSubItems;
9475 ITEM_INFO *lpItem;
9476 LPVOID selectionMarkItem = NULL;
9477 LPVOID focusedItem = NULL;
9478 int i;
9479
9480 TRACE("(pfnCompare=%p, lParamSort=%lx)\n", pfnCompare, lParamSort);
9481
9482 if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
9483
9484 if (!pfnCompare) return FALSE;
9485 if (!infoPtr->hdpaItems) return FALSE;
9486
9487 /* if there are 0 or 1 items, there is no need to sort */
9488 if (infoPtr->nItemCount < 2) return TRUE;
9489
9490 /* clear selection */
9491 ranges_clear(infoPtr->selectionRanges);
9492
9493 /* save selection mark and focused item */
9494 if (infoPtr->nSelectionMark >= 0)
9495 selectionMarkItem = DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nSelectionMark);
9496 if (infoPtr->nFocusedItem >= 0)
9497 focusedItem = DPA_GetPtr(infoPtr->hdpaItems, infoPtr->nFocusedItem);
9498
9499 infoPtr->pfnCompare = pfnCompare;
9500 infoPtr->lParamSort = lParamSort;
9501 if (IsEx)
9503 else
9505
9506 /* restore selection ranges */
9507 for (i=0; i < infoPtr->nItemCount; i++)
9508 {
9509 hdpaSubItems = DPA_GetPtr(infoPtr->hdpaItems, i);
9510 lpItem = DPA_GetPtr(hdpaSubItems, 0);
9511
9512 if (lpItem->state & LVIS_SELECTED)
9513 ranges_additem(infoPtr->selectionRanges, i);
9514 }
9515 /* restore selection mark and focused item */
9516 infoPtr->nSelectionMark = DPA_GetPtrIndex(infoPtr->hdpaItems, selectionMarkItem);
9517 infoPtr->nFocusedItem = DPA_GetPtrIndex(infoPtr->hdpaItems, focusedItem);
9518
9519 /* I believe nHotItem should be left alone, see LISTVIEW_ShiftIndices */
9520
9521 /* refresh the display */
9522 LISTVIEW_InvalidateList(infoPtr);
9523 return TRUE;
9524}
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:9423
static INT WINAPI LISTVIEW_CallBackCompareEx(LPVOID first, LPVOID second, LPARAM lParam)
Definition: listview.c:9447

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_StyleChanged()

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

Definition at line 11314 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_StyleChanging()

static INT LISTVIEW_StyleChanging ( WPARAM  wStyleType,
STYLESTRUCT lpss 
)
static

Definition at line 11420 of file listview.c.

11422{
11423 TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n",
11424 wStyleType, lpss->styleOld, lpss->styleNew);
11425
11426 /* don't forward LVS_OWNERDATA only if not already set to */
11427 if ((lpss->styleNew ^ lpss->styleOld) & LVS_OWNERDATA)
11428 {
11429 if (lpss->styleOld & LVS_OWNERDATA)
11430 lpss->styleNew |= LVS_OWNERDATA;
11431 else
11432 lpss->styleNew &= ~LVS_OWNERDATA;
11433 }
11434
11435 return 0;
11436}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_ThemeChanged()

static LRESULT LISTVIEW_ThemeChanged ( const LISTVIEW_INFO infoPtr)
static

Definition at line 9537 of file listview.c.

9538{
9539 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
9540 CloseThemeData(theme);
9542 return 0;
9543}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_TrackMouse()

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

Definition at line 10321 of file listview.c.

10322{
10323 MSG msg;
10324 RECT r;
10325
10326 r.top = r.bottom = pt.y;
10327 r.left = r.right = pt.x;
10328
10330
10331 SetCapture(infoPtr->hwndSelf);
10332
10333 while (1)
10334 {
10335 if (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD))
10336 {
10337 if (msg.message == WM_MOUSEMOVE)
10338 {
10339 pt.x = (short)LOWORD(msg.lParam);
10340 pt.y = (short)HIWORD(msg.lParam);
10341 if (PtInRect(&r, pt))
10342 continue;
10343 else
10344 {
10346 return 1;
10347 }
10348 }
10349 else if (msg.message >= WM_LBUTTONDOWN &&
10350 msg.message <= WM_RBUTTONDBLCLK)
10351 {
10352 break;
10353 }
10354
10356 }
10357
10358 if (GetCapture() != infoPtr->hwndSelf)
10359 return 0;
10360 }
10361
10363 return 0;
10364}
#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:1792
#define WM_MOUSEMOVE
Definition: winuser.h:1786
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_LBUTTONDOWN
Definition: winuser.h:1787
#define PM_NOYIELD
Definition: winuser.h:1208
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_REMOVE
Definition: winuser.h:1207
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)

Referenced by LISTVIEW_RButtonDown().

◆ LISTVIEW_Unregister()

void LISTVIEW_Unregister ( void  )

Definition at line 12084 of file listview.c.

12085{
12087}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by DllMain().

◆ LISTVIEW_Update()

static BOOL LISTVIEW_Update ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 9557 of file listview.c.

9558{
9559 TRACE("(nItem=%d)\n", nItem);
9560
9561 if (nItem < 0 || nItem >= infoPtr->nItemCount) return FALSE;
9562
9563 /* rearrange with default alignment style */
9564 if (is_autoarrange(infoPtr))
9565 LISTVIEW_Arrange(infoPtr, LVA_DEFAULT);
9566 else
9567 LISTVIEW_InvalidateItem(infoPtr, nItem);
9568
9569 return TRUE;
9570}

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_UpdateHeaderSize()

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

Definition at line 2009 of file listview.c.

2010{
2011 RECT winRect;
2012 POINT point[2];
2013
2014 TRACE("nNewScrollPos=%d\n", nNewScrollPos);
2015
2016 if (!infoPtr->hwndHeader) return;
2017
2018 GetWindowRect(infoPtr->hwndHeader, &winRect);
2019 point[0].x = winRect.left;
2020 point[0].y = winRect.top;
2021 point[1].x = winRect.right;
2022 point[1].y = winRect.bottom;
2023
2025 point[0].x = -nNewScrollPos;
2026 point[1].x += nNewScrollPos;
2027
2028 SetWindowPos(infoPtr->hwndHeader,0,
2029 point[0].x,point[0].y,point[1].x,point[1].y,
2032}
POINTL point
Definition: edittest.c:50
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
#define SWP_NOACTIVATE
Definition: winuser.h:1253
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:1220

Referenced by LISTVIEW_HScroll(), and LISTVIEW_UpdateHScroll().

◆ LISTVIEW_UpdateHScroll()

static INT LISTVIEW_UpdateHScroll ( LISTVIEW_INFO infoPtr)
static

Definition at line 2034 of file listview.c.

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

Referenced by LISTVIEW_UpdateScroll().

◆ LISTVIEW_UpdateItemSize()

static void LISTVIEW_UpdateItemSize ( LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 3120 of file listview.c.

3121{
3122 infoPtr->nItemWidth = LISTVIEW_CalculateItemWidth(infoPtr);
3123 infoPtr->nItemHeight = LISTVIEW_CalculateItemHeight(infoPtr);
3124}
static INT LISTVIEW_CalculateItemWidth(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:3027

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

◆ LISTVIEW_UpdateScroll()

static void LISTVIEW_UpdateScroll ( LISTVIEW_INFO infoPtr)
static

Definition at line 2166 of file listview.c.

2167{
2168 INT dx, dy, pass;
2169
2170 if ((infoPtr->dwStyle & LVS_NOSCROLL) || !is_redrawing(infoPtr)) return;
2171
2172 /* Setting the horizontal scroll can change the listview size
2173 * (and potentially everything else) so we need to recompute
2174 * everything again for the vertical scroll and vice-versa
2175 */
2176 for (dx = 0, dy = 0, pass = 0; pass <= 1; pass++)
2177 {
2178 dx += LISTVIEW_UpdateHScroll(infoPtr);
2179 dy += LISTVIEW_UpdateVScroll(infoPtr);
2180 }
2181
2182 /* Change of the range may have changed the scroll pos. If so move the content */
2183 if (dx != 0 || dy != 0)
2184 {
2185 RECT listRect;
2186 listRect = infoPtr->rcList;
2187 ScrollWindowEx(infoPtr->hwndSelf, dx, dy, &listRect, &listRect, 0, 0,
2189 }
2190}
static INT LISTVIEW_UpdateVScroll(LISTVIEW_INFO *infoPtr)
Definition: listview.c:2104
static INT LISTVIEW_UpdateHScroll(LISTVIEW_INFO *infoPtr)
Definition: listview.c:2034
#define LVS_NOSCROLL
Definition: commctrl.h:2280
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(), LISTVIEW_StyleChanged(), and LISTVIEW_WindowProc().

◆ LISTVIEW_UpdateSize()

static void LISTVIEW_UpdateSize ( LISTVIEW_INFO infoPtr)
static

Definition at line 11244 of file listview.c.

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

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 2104 of file listview.c.

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

Referenced by LISTVIEW_UpdateScroll().

◆ LISTVIEW_VScroll()

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

Definition at line 9890 of file listview.c.

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

11512{
11514
11515 TRACE("(hwnd=%p uMsg=%x wParam=%lx lParam=%lx)\n", hwnd, uMsg, wParam, lParam);
11516
11517 if (!infoPtr && (uMsg != WM_NCCREATE))
11518 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
11519
11520 switch (uMsg)
11521 {
11523 return LISTVIEW_ApproximateViewRect(infoPtr, (INT)wParam,
11525 case LVM_ARRANGE:
11526 return LISTVIEW_Arrange(infoPtr, (INT)wParam);
11527
11529 return LISTVIEW_CancelEditLabel(infoPtr);
11530
11533
11534 case LVM_DELETEALLITEMS:
11535 return LISTVIEW_DeleteAllItems(infoPtr, FALSE);
11536
11537 case LVM_DELETECOLUMN:
11538 return LISTVIEW_DeleteColumn(infoPtr, (INT)wParam);
11539
11540 case LVM_DELETEITEM:
11541 return LISTVIEW_DeleteItem(infoPtr, (INT)wParam);
11542
11543 case LVM_EDITLABELA:
11544 case LVM_EDITLABELW:
11545 return (LRESULT)LISTVIEW_EditLabelT(infoPtr, (INT)wParam,
11546 uMsg == LVM_EDITLABELW);
11547 /* case LVM_ENABLEGROUPVIEW: */
11548
11549 case LVM_ENSUREVISIBLE:
11550 return LISTVIEW_EnsureVisible(infoPtr, (INT)wParam, (BOOL)lParam);
11551
11552 case LVM_FINDITEMW:
11553 return LISTVIEW_FindItemW(infoPtr, (INT)wParam, (LPLVFINDINFOW)lParam);
11554
11555 case LVM_FINDITEMA:
11556 return LISTVIEW_FindItemA(infoPtr, (INT)wParam, (LPLVFINDINFOA)lParam);
11557
11558 case LVM_GETBKCOLOR:
11559 return infoPtr->clrBk;
11560
11561 /* case LVM_GETBKIMAGE: */
11562
11564 return infoPtr->uCallbackMask;
11565
11566 case LVM_GETCOLUMNA:
11567 case LVM_GETCOLUMNW:
11568 return LISTVIEW_GetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam,
11569 uMsg == LVM_GETCOLUMNW);
11570
11573
11574 case LVM_GETCOLUMNWIDTH:
11575 return LISTVIEW_GetColumnWidth(infoPtr, (INT)wParam);
11576
11578 return LISTVIEW_GetCountPerPage(infoPtr);
11579
11580 case LVM_GETEDITCONTROL:
11581 return (LRESULT)infoPtr->hwndEdit;
11582
11584 return infoPtr->dwLvExStyle;
11585
11586 /* case LVM_GETGROUPINFO: */
11587
11588 /* case LVM_GETGROUPMETRICS: */
11589
11590 case LVM_GETHEADER:
11591 return (LRESULT)infoPtr->hwndHeader;
11592
11593 case LVM_GETHOTCURSOR:
11594 return (LRESULT)infoPtr->hHotCursor;
11595
11596 case LVM_GETHOTITEM:
11597 return infoPtr->nHotItem;
11598
11599 case LVM_GETHOVERTIME:
11600 return infoPtr->dwHoverTime;
11601
11602 case LVM_GETIMAGELIST:
11603 return (LRESULT)LISTVIEW_GetImageList(infoPtr, (INT)wParam);
11604
11605 /* case LVM_GETINSERTMARK: */
11606
11607 /* case LVM_GETINSERTMARKCOLOR: */
11608
11609 /* case LVM_GETINSERTMARKRECT: */
11610
11613 FIXME("LVM_GETISEARCHSTRING: unimplemented\n");
11614 return FALSE;
11615
11616 case LVM_GETITEMA:
11617 case LVM_GETITEMW:
11618 return LISTVIEW_GetItemExtT(infoPtr, (LPLVITEMW)lParam, uMsg == LVM_GETITEMW);
11619
11620 case LVM_GETITEMCOUNT:
11621 return infoPtr->nItemCount;
11622
11624 return LISTVIEW_GetItemPosition(infoPtr, (INT)wParam, (LPPOINT)lParam);
11625
11626 case LVM_GETITEMRECT:
11627 return LISTVIEW_GetItemRect(infoPtr, (INT)wParam, (LPRECT)lParam);
11628
11629 case LVM_GETITEMSPACING:
11630 return LISTVIEW_GetItemSpacing(infoPtr, (BOOL)wParam);
11631
11632 case LVM_GETITEMSTATE:
11633 return LISTVIEW_GetItemState(infoPtr, (INT)wParam, (UINT)lParam);
11634
11635 case LVM_GETITEMTEXTA:
11636 case LVM_GETITEMTEXTW:
11637 return LISTVIEW_GetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam,
11638 uMsg == LVM_GETITEMTEXTW);
11639
11640 case LVM_GETNEXTITEM:
11641 return LISTVIEW_GetNextItem(infoPtr, (INT)wParam, LOWORD(lParam));
11642
11644 FIXME("LVM_GETNUMBEROFWORKAREAS: unimplemented\n");
11645 return 1;
11646
11647 case LVM_GETORIGIN:
11648 if (!lParam) return FALSE;
11649 if (infoPtr->uView == LV_VIEW_DETAILS ||
11650 infoPtr->uView == LV_VIEW_LIST) return FALSE;
11652 return TRUE;
11653
11654 /* case LVM_GETOUTLINECOLOR: */
11655
11656 /* case LVM_GETSELECTEDCOLUMN: */
11657
11659 return LISTVIEW_GetSelectedCount(infoPtr);
11660
11662 return infoPtr->nSelectionMark;
11663
11666 return LISTVIEW_GetStringWidthT(infoPtr, (LPCWSTR)lParam,
11667 uMsg == LVM_GETSTRINGWIDTHW);
11668
11669 case LVM_GETSUBITEMRECT:
11670 return LISTVIEW_GetSubItemRect(infoPtr, (UINT)wParam, (LPRECT)lParam);
11671
11672 case LVM_GETTEXTBKCOLOR:
11673 return infoPtr->clrTextBk;
11674
11675 case LVM_GETTEXTCOLOR:
11676 return infoPtr->clrText;
11677
11678 /* case LVM_GETTILEINFO: */
11679
11680 /* case LVM_GETTILEVIEWINFO: */
11681
11682 case LVM_GETTOOLTIPS:
11683 if( !infoPtr->hwndToolTip )
11685 return (LRESULT)infoPtr->hwndToolTip;
11686
11687 case LVM_GETTOPINDEX:
11688 return LISTVIEW_GetTopIndex(infoPtr);
11689
11691 return (infoPtr->notifyFormat == NFR_UNICODE);
11692
11693 case LVM_GETVIEW:
11694 return infoPtr->uView;
11695
11696 case LVM_GETVIEWRECT:
11697 return LISTVIEW_GetViewRect(infoPtr, (LPRECT)lParam);
11698
11699 case LVM_GETWORKAREAS:
11700 FIXME("LVM_GETWORKAREAS: unimplemented\n");
11701 return FALSE;
11702
11703 /* case LVM_HASGROUP: */
11704
11705 case LVM_HITTEST:
11706 return LISTVIEW_HitTest(infoPtr, (LPLVHITTESTINFO)lParam, FALSE, TRUE);
11707
11708 case LVM_INSERTCOLUMNA:
11709 case LVM_INSERTCOLUMNW:
11711 uMsg == LVM_INSERTCOLUMNW);
11712
11713 /* case LVM_INSERTGROUP: */
11714
11715 /* case LVM_INSERTGROUPSORTED: */
11716
11717 case LVM_INSERTITEMA:
11718 case LVM_INSERTITEMW:
11719 return LISTVIEW_InsertItemT(infoPtr, (LPLVITEMW)lParam, uMsg == LVM_INSERTITEMW);
11720
11721 /* case LVM_INSERTMARKHITTEST: */
11722
11723 /* case LVM_ISGROUPVIEWENABLED: */
11724
11725 case LVM_ISITEMVISIBLE:
11726 return LISTVIEW_IsItemVisible(infoPtr, (INT)wParam);
11727
11728 case LVM_MAPIDTOINDEX:
11729 return LISTVIEW_MapIdToIndex(infoPtr, (UINT)wParam);
11730
11731 case LVM_MAPINDEXTOID:
11732 return LISTVIEW_MapIndexToId(infoPtr, (INT)wParam);
11733
11734 /* case LVM_MOVEGROUP: */
11735
11736 /* case LVM_MOVEITEMTOGROUP: */
11737
11738 case LVM_REDRAWITEMS:
11739 return LISTVIEW_RedrawItems(infoPtr, (INT)wParam, (INT)lParam);
11740
11741 /* case LVM_REMOVEALLGROUPS: */
11742
11743 /* case LVM_REMOVEGROUP: */
11744
11745 case LVM_SCROLL:
11746 return LISTVIEW_Scroll(infoPtr, (INT)wParam, (INT)lParam);
11747
11748 case LVM_SETBKCOLOR:
11749 return LISTVIEW_SetBkColor(infoPtr, (COLORREF)lParam);
11750
11751 /* case LVM_SETBKIMAGE: */
11752
11754 infoPtr->uCallbackMask = (UINT)wParam;
11755 return TRUE;
11756
11757 case LVM_SETCOLUMNA:
11758 case LVM_SETCOLUMNW:
11759 return LISTVIEW_SetColumnT(infoPtr, (INT)wParam, (LPLVCOLUMNW)lParam,
11760 uMsg == LVM_SETCOLUMNW);
11761
11764
11765 case LVM_SETCOLUMNWIDTH:
11766 return LISTVIEW_SetColumnWidth(infoPtr, (INT)wParam, (short)LOWORD(lParam));
11767
11770
11771 /* case LVM_SETGROUPINFO: */
11772
11773 /* case LVM_SETGROUPMETRICS: */
11774
11775 case LVM_SETHOTCURSOR:
11776 return (LRESULT)LISTVIEW_SetHotCursor(infoPtr, (HCURSOR)lParam);
11777
11778 case LVM_SETHOTITEM:
11779 return LISTVIEW_SetHotItem(infoPtr, (INT)wParam);
11780
11781 case LVM_SETHOVERTIME:
11782 return LISTVIEW_SetHoverTime(infoPtr, (DWORD)lParam);
11783
11784 case LVM_SETICONSPACING:
11785 if(lParam == -1)
11786 return LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
11788
11789 case LVM_SETIMAGELIST:
11791
11792 /* case LVM_SETINFOTIP: */
11793
11794 /* case LVM_SETINSERTMARK: */
11795
11796 /* case LVM_SETINSERTMARKCOLOR: */
11797
11798 case LVM_SETITEMA:
11799 case LVM_SETITEMW:
11800 {
11801 if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE;
11802 return LISTVIEW_SetItemT(infoPtr, (LPLVITEMW)lParam, (uMsg == LVM_SETITEMW));
11803 }
11804
11805 case LVM_SETITEMCOUNT:
11806 return LISTVIEW_SetItemCount(infoPtr, (INT)wParam, (DWORD)lParam);
11807
11809 {
11810 POINT pt;
11811 pt.x = (short)LOWORD(lParam);
11812 pt.y = (short)HIWORD(lParam);
11813 return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, &pt);
11814 }
11815
11817 return LISTVIEW_SetItemPosition(infoPtr, (INT)wParam, (POINT*)lParam);
11818
11819 case LVM_SETITEMSTATE:
11820 return LISTVIEW_SetItemState(infoPtr, (INT)wParam, (LPLVITEMW)lParam);
11821
11822 case LVM_SETITEMTEXTA:
11823 case LVM_SETITEMTEXTW:
11824 return LISTVIEW_SetItemTextT(infoPtr, (INT)wParam, (LPLVITEMW)lParam,
11825 uMsg == LVM_SETITEMTEXTW);
11826
11827 /* case LVM_SETOUTLINECOLOR: */
11828
11829 /* case LVM_SETSELECTEDCOLUMN: */
11830
11832 return LISTVIEW_SetSelectionMark(infoPtr, (INT)lParam);
11833
11834 case LVM_SETTEXTBKCOLOR:
11835 return LISTVIEW_SetTextBkColor(infoPtr, (COLORREF)lParam);
11836
11837 case LVM_SETTEXTCOLOR:
11838 return LISTVIEW_SetTextColor(infoPtr, (COLORREF)lParam);
11839
11840 /* case LVM_SETTILEINFO: */
11841
11842 /* case LVM_SETTILEVIEWINFO: */
11843
11844 /* case LVM_SETTILEWIDTH: */
11845
11846 case LVM_SETTOOLTIPS:
11847 return (LRESULT)LISTVIEW_SetToolTips(infoPtr, (HWND)lParam);
11848
11850 return LISTVIEW_SetUnicodeFormat(infoPtr, wParam);
11851
11852 case LVM_SETVIEW:
11853 return LISTVIEW_SetView(infoPtr, wParam);
11854
11855 /* case LVM_SETWORKAREAS: */
11856
11857 /* case LVM_SORTGROUPS: */
11858
11859 case LVM_SORTITEMS:
11860 case LVM_SORTITEMSEX:
11861 return LISTVIEW_SortItems(infoPtr, (PFNLVCOMPARE)lParam, wParam,
11862 uMsg == LVM_SORTITEMSEX);
11863 case LVM_SUBITEMHITTEST:
11864 return LISTVIEW_HitTest(infoPtr, (LPLVHITTESTINFO)lParam, TRUE, FALSE);
11865
11866 case LVM_UPDATE:
11867 return LISTVIEW_Update(infoPtr, (INT)wParam);
11868
11869 case CCM_GETVERSION:
11870 return LISTVIEW_GetVersion(infoPtr);
11871
11872 case CCM_SETVERSION:
11873 return LISTVIEW_SetVersion(infoPtr, wParam);
11874
11875 case WM_CHAR:
11876 return LISTVIEW_ProcessLetterKeys( infoPtr, wParam, lParam );
11877
11878 case WM_COMMAND:
11879 return LISTVIEW_Command(infoPtr, wParam, lParam);
11880
11881 case WM_NCCREATE:
11883
11884 case WM_CREATE:
11886
11887 case WM_DESTROY:
11888 return LISTVIEW_Destroy(infoPtr);
11889
11890 case WM_ENABLE:
11891 return LISTVIEW_Enable(infoPtr);
11892
11893 case WM_ERASEBKGND:
11894 return LISTVIEW_EraseBkgnd(infoPtr, (HDC)wParam);
11895
11896 case WM_GETDLGCODE:
11898
11899 case WM_GETFONT:
11900 return (LRESULT)infoPtr->hFont;
11901
11902 case WM_HSCROLL:
11903 return LISTVIEW_HScroll(infoPtr, (INT)LOWORD(wParam), 0);
11904
11905 case WM_KEYDOWN:
11906 return LISTVIEW_KeyDown(infoPtr, (INT)wParam, (LONG)lParam);
11907
11908 case WM_KILLFOCUS:
11909 return LISTVIEW_KillFocus(infoPtr);
11910
11911 case WM_LBUTTONDBLCLK:
11913
11914 case WM_LBUTTONDOWN:
11916
11917 case WM_LBUTTONUP:
11919
11920 case WM_MOUSEMOVE:
11922
11923 case WM_MOUSEHOVER:
11925
11926 case WM_NCDESTROY:
11927 return LISTVIEW_NCDestroy(infoPtr);
11928
11929 case WM_NCPAINT:
11930 return LISTVIEW_NCPaint(infoPtr, (HRGN)wParam);
11931
11932 case WM_NOTIFY:
11933 return LISTVIEW_Notify(infoPtr, (LPNMHDR)lParam);
11934
11935 case WM_NOTIFYFORMAT:
11936 return LISTVIEW_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);
11937
11938 case WM_PRINTCLIENT:
11939 return LISTVIEW_PrintClient(infoPtr, (HDC)wParam, (DWORD)lParam);
11940
11941 case WM_PAINT:
11942 return LISTVIEW_WMPaint(infoPtr, (HDC)wParam);
11943
11944 case WM_RBUTTONDBLCLK:
11946
11947 case WM_RBUTTONDOWN:
11949
11950 case WM_SETCURSOR:
11951 return LISTVIEW_SetCursor(infoPtr, wParam, lParam);
11952
11953 case WM_SETFOCUS:
11954 return LISTVIEW_SetFocus(infoPtr, (HWND)wParam);
11955
11956 case WM_SETFONT:
11957 return LISTVIEW_SetFont(infoPtr, (HFONT)wParam, (WORD)lParam);
11958
11959 case WM_SETREDRAW:
11960 return LISTVIEW_SetRedraw(infoPtr, (BOOL)wParam);
11961
11962 case WM_SHOWWINDOW:
11963 return LISTVIEW_ShowWindow(infoPtr, wParam, lParam);
11964
11965 case WM_STYLECHANGED:
11967
11968 case WM_STYLECHANGING:
11970
11971 case WM_SYSCOLORCHANGE:
11973#ifdef __REACTOS__
11974 if (infoPtr->bDefaultBkColor)
11975 {
11977 infoPtr->bDefaultBkColor = TRUE;
11978 LISTVIEW_InvalidateList(infoPtr);
11979 }
11980#endif
11981 return 0;
11982
11983/* case WM_TIMER: */
11984 case WM_THEMECHANGED:
11985 return LISTVIEW_ThemeChanged(infoPtr);
11986
11987 case WM_VSCROLL:
11988 return LISTVIEW_VScroll(infoPtr, (INT)LOWORD(wParam), 0);
11989
11990 case WM_MOUSEWHEEL:
11991 if (wParam & (MK_SHIFT | MK_CONTROL))
11992 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
11993 return LISTVIEW_MouseWheel(infoPtr, (short int)HIWORD(wParam));
11994
11996 if (!(((WINDOWPOS *)lParam)->flags & SWP_NOSIZE))
11997 {
11998 SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOACTIVATE |
12000
12001 if ((infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (infoPtr->uView == LV_VIEW_DETAILS))
12002 {
12003 if (notify_measureitem(infoPtr)) LISTVIEW_InvalidateList(infoPtr);
12004 }
12005 LISTVIEW_Size(infoPtr, ((WINDOWPOS *)lParam)->cx, ((WINDOWPOS *)lParam)->cy);
12006 }
12007 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
12008
12009#ifdef __REACTOS__
12010 case WM_SETTINGCHANGE: /* Same as WM_WININICHANGE */
12011 if (wParam == SPI_SETICONMETRICS ||
12013 wParam == SPI_SETNONCLIENTMETRICS ||
12014 (!wParam && !lParam))
12015 {
12016 BOOL bDefaultOrNullFont = (infoPtr->hDefaultFont == infoPtr->hFont || !infoPtr->hFont);
12017 LOGFONTW logFont;
12019
12020 if (infoPtr->autoSpacing)
12021 LISTVIEW_SetIconSpacing(infoPtr, -1, -1);
12022
12023 if (infoPtr->hDefaultFont)
12024 DeleteObject(infoPtr->hDefaultFont);
12025 infoPtr->hDefaultFont = CreateFontIndirectW(&logFont);
12026
12027 if (bDefaultOrNullFont)
12028 infoPtr->hFont = infoPtr->hDefaultFont;
12029
12030 LISTVIEW_SaveTextMetrics(infoPtr);
12031 LISTVIEW_UpdateItemSize(infoPtr);
12032 LISTVIEW_UpdateScroll(infoPtr);
12033 LISTVIEW_InvalidateRect(infoPtr, NULL);
12034 }
12035 return 0;
12036#else
12037/* case WM_WININICHANGE: */
12038#endif
12039
12040 default:
12041 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
12042 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
12043
12044 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
12045 }
12046
12047}
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1755
HWND COMCTL32_CreateToolTip(HWND) DECLSPEC_HIDDEN
Definition: commctrl.c:1551
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1593
static LRESULT LISTVIEW_Notify(LISTVIEW_INFO *infoPtr, NMHDR *lpnmhdr)
Definition: listview.c:10625
static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10503
static LRESULT LISTVIEW_PrintClient(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD options)
Definition: listview.c:10935
static DWORD LISTVIEW_MapIndexToId(const LISTVIEW_INFO *infoPtr, INT iItem)
Definition: listview.c:2696
static BOOL LISTVIEW_Enable(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:9807
static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:5921
static DWORD LISTVIEW_SetExtendedListViewStyle(LISTVIEW_INFO *infoPtr, DWORD mask, DWORD ex_style)
Definition: listview.c:8699
static LRESULT LISTVIEW_SetFocus(LISTVIEW_INFO *infoPtr, HWND hwndLoseFocus)
Definition: listview.c:11100
static BOOL LISTVIEW_GetSubItemRect(const LISTVIEW_INFO *infoPtr, INT item, LPRECT lprc)
Definition: listview.c:7300
static BOOL LISTVIEW_SetCursor(const LISTVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: listview.c:11069
static INT LISTVIEW_MapIdToIndex(const LISTVIEW_INFO *infoPtr, UINT iID)
Definition: listview.c:2663
static LRESULT LISTVIEW_Create(HWND hwnd, const CREATESTRUCTW *lpcs)
Definition: listview.c:9728
static BOOL LISTVIEW_NCPaint(const LISTVIEW_INFO *infoPtr, HRGN region)
Definition: listview.c:10797
static BOOL LISTVIEW_GetColumnOrderArray(const LISTVIEW_INFO *infoPtr, INT iCount, LPINT lpiArray)
Definition: listview.c:6660
static INT LISTVIEW_ProcessLetterKeys(LISTVIEW_INFO *infoPtr, WPARAM charCode, LPARAM keyData)
Definition: listview.c:1869
static BOOL LISTVIEW_SortItems(LISTVIEW_INFO *infoPtr, PFNLVCOMPARE pfnCompare, LPARAM lParamSort, BOOL IsEx)
Definition: listview.c:9471
static INT LISTVIEW_GetItemTextT(const LISTVIEW_INFO *infoPtr, INT nItem, LPLVITEMW lpLVItem, BOOL isW)
Definition: listview.c:7434
static INT LISTVIEW_GetColumnWidth(const LISTVIEW_INFO *infoPtr, INT nColumn)
Definition: listview.c:6678
static LRESULT LISTVIEW_SetRedraw(LISTVIEW_INFO *infoPtr, BOOL redraw)
Definition: listview.c:11174
static BOOL LISTVIEW_SetItemCount(LISTVIEW_INFO *infoPtr, INT nItems, DWORD dwFlags)
Definition: listview.c:8988
static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LPPOINT lppt)
Definition: listview.c:5562
static LRESULT LISTVIEW_ThemeChanged(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:9537
static LRESULT LISTVIEW_Size(LISTVIEW_INFO *infoPtr, int Width, int Height)
Definition: listview.c:11208
static DWORD LISTVIEW_SetHoverTime(LISTVIEW_INFO *infoPtr, DWORD dwHoverTime)
Definition: listview.c:8843
static BOOL LISTVIEW_SetTextBkColor(LISTVIEW_INFO *infoPtr, COLORREF color)
Definition: listview.c:9275
static LRESULT LISTVIEW_MouseWheel(LISTVIEW_INFO *infoPtr, INT wheelDelta)
Definition: listview.c:10080
static HIMAGELIST LISTVIEW_GetImageList(const LISTVIEW_INFO *infoPtr, INT nImageList)
Definition: listview.c:6750
static LRESULT LISTVIEW_ShowWindow(LISTVIEW_INFO *infoPtr, WPARAM bShown, LPARAM iStatus)
Definition: listview.c:11450
static INT LISTVIEW_StyleChanged(LISTVIEW_INFO *infoPtr, WPARAM wStyleType, const STYLESTRUCT *lpss)
Definition: listview.c:11314
static DWORD LISTVIEW_ApproximateViewRect(const LISTVIEW_INFO *infoPtr, INT nItemCount, WORD wWidth, WORD wHeight)
Definition: listview.c:5421
static BOOL LISTVIEW_IsItemVisible(const LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:8105
static BOOL LISTVIEW_Update(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:9557
static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL isW)
Definition: listview.c:7927
static LRESULT LISTVIEW_NotifyFormat(LISTVIEW_INFO *infoPtr, HWND hwndFrom, INT nCommand)
Definition: listview.c:10851
static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
Definition: listview.c:10573
static BOOL LISTVIEW_GetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn, LPLVCOLUMNW lpColumn, BOOL isW)
Definition: listview.c:6610
static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn)
Definition: listview.c:5764
static INT LISTVIEW_SetView(LISTVIEW_INFO *infoPtr, DWORD nView)
Definition: listview.c:9349
static HCURSOR LISTVIEW_SetHotCursor(LISTVIEW_INFO *infoPtr, HCURSOR hCursor)
Definition: listview.c:8800
static LRESULT LISTVIEW_GetVersion(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:11474
static LRESULT LISTVIEW_WMPaint(LISTVIEW_INFO *infoPtr, HDC hdc)
Definition: listview.c:10913
static LRESULT LISTVIEW_RButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10995
static LRESULT LISTVIEW_Destroy(LISTVIEW_INFO *infoPtr)
Definition: listview.c:9784
static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10379
static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, INT y)
Definition: listview.c:4138
static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, INT x, INT y)
Definition: listview.c:3912
static BOOL LISTVIEW_SetColumnT(const LISTVIEW_INFO *infoPtr, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
Definition: listview.c:8439
static LRESULT LISTVIEW_KillFocus(LISTVIEW_INFO *infoPtr)
Definition: listview.c:10241
static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast)
Definition: listview.c:8144
static BOOL LISTVIEW_SetColumnOrderArray(LISTVIEW_INFO *infoPtr, INT iCount, const INT *lpiArray)
Definition: listview.c:8494
static INT LISTVIEW_SetSelectionMark(LISTVIEW_INFO *infoPtr, INT nIndex)
Definition: listview.c:9251
static BOOL LISTVIEW_SetUnicodeFormat(LISTVIEW_INFO *infoPtr, BOOL unicode)
Definition: listview.c:9331
static INT LISTVIEW_SetHotItem(LISTVIEW_INFO *infoPtr, INT iIndex)
Definition: listview.c:8822
static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, const POINT *pt)
Definition: listview.c:9086
static LRESULT LISTVIEW_KeyDown(LISTVIEW_INFO *infoPtr, INT nVirtualKey, LONG lKeyData)
Definition: listview.c:10136
static BOOL LISTVIEW_SetItemTextT(LISTVIEW_INFO *infoPtr, INT nItem, const LVITEMW *lpLVItem, BOOL isW)
Definition: listview.c:9222
static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, const LVCOLUMNW *lpColumn, BOOL isW)
Definition: listview.c:8321
static LONG LISTVIEW_GetItemSpacing(const LISTVIEW_INFO *infoPtr, BOOL bSmall)
Definition: listview.c:7375
static LRESULT LISTVIEW_SetVersion(LISTVIEW_INFO *infoPtr, DWORD iVersion)
Definition: listview.c:11491
static LRESULT LISTVIEW_SetFont(LISTVIEW_INFO *infoPtr, HFONT hFont, WORD fRedraw)
Definition: listview.c:11134
static INT LISTVIEW_StyleChanging(WPARAM wStyleType, STYLESTRUCT *lpss)
Definition: listview.c:11420
static HWND LISTVIEW_SetToolTips(LISTVIEW_INFO *infoPtr, HWND hwndNewToolTip)
Definition: listview.c:9314
static LRESULT LISTVIEW_Command(LISTVIEW_INFO *, WPARAM, LPARAM)
Definition: listview.c:12101
static BOOL LISTVIEW_SetTextColor(LISTVIEW_INFO *infoPtr, COLORREF color)
Definition: listview.c:9295
static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOA *lpFindInfo)
Definition: listview.c:6580
static INT LISTVIEW_GetCountPerPage(const LISTVIEW_INFO *infoPtr)
Definition: listview.c:6722
static LRESULT LISTVIEW_RButtonDblClk(const LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10965
static LRESULT LISTVIEW_LButtonDblClk(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT y)
Definition: listview.c:10292
static LRESULT LISTVIEW_NCCreate(HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
Definition: listview.c:9638
#define WM_APP
Definition: eventvwr.h:73
#define LVM_GETCALLBACKMASK
Definition: commctrl.h:2421
#define LVM_DELETEALLITEMS
Definition: commctrl.h:2418
#define LVM_CREATEDRAGIMAGE
Definition: commctrl.h:2657
#define LVM_GETITEMA
Definition: commctrl.h:2394
#define LVM_ARRANGE
Definition: commctrl.h:2537
#define LVM_SETITEMTEXTW
Definition: commctrl.h:2692
#define LVM_SETHOVERTIME
Definition: commctrl.h:2797
#define LVM_SETCOLUMNW
Definition: commctrl.h:2630
#define LVM_SETTEXTCOLOR
Definition: commctrl.h:2663
#define LVM_INSERTCOLUMNA
Definition: commctrl.h:2636
#define LVM_GETITEMCOUNT
Definition: commctrl.h:2311
#define LVM_GETITEMSTATE
Definition: commctrl.h:2680
#define LVM_GETCOLUMNORDERARRAY
Definition: commctrl.h:2773
#define LVM_GETHEADER
Definition: commctrl.h:2655
#define LVM_GETTOPINDEX
Definition: commctrl.h:2669
#define LVM_GETITEMSPACING
Definition: commctrl.h:2716
#define LVM_SETCOLUMNA
Definition: commctrl.h:2629
#define LVM_SETCOLUMNWIDTH
Definition: commctrl.h:2651
#define LVM_SETBKCOLOR
Definition: commctrl.h:2298
#define LVM_GETITEMPOSITION
Definition: commctrl.h:2488
#define LVM_SETITEMSTATE
Definition: commctrl.h:2677
#define CCM_GETVERSION
Definition: commctrl.h:115
#define LVM_EDITLABELW
Definition: commctrl.h:2541
#define LVM_GETHOTITEM
Definition: commctrl.h:2777
#define LVM_DELETECOLUMN
Definition: commctrl.h:2643
#define LVM_SETITEMPOSITION
Definition: commctrl.h:2485
#define LVM_FINDITEMW
Definition: commctrl.h:2471
#define LVM_SETCALLBACKMASK
Definition: commctrl.h:2424
#define LVM_SETUNICODEFORMAT
Definition: commctrl.h:2292
#define LVM_GETEDITCONTROL
Definition: commctrl.h:2547
#define LVM_EDITLABELA
Definition: commctrl.h:2540
#define LVM_GETNUMBEROFWORKAREAS
Definition: commctrl.h:2791
#define LVM_UPDATE
Definition: commctrl.h:2675
#define LVM_REDRAWITEMS
Definition: commctrl.h:2529
#define LVM_GETCOLUMNA
Definition: commctrl.h:2622
#define LVM_APPROXIMATEVIEWRECT
Definition: commctrl.h:2783
#define LVM_GETHOVERTIME
Definition: commctrl.h:2799
#define LVM_GETSTRINGWIDTHA
Definition: commctrl.h:2491
#define LVM_SETIMAGELIST
Definition: commctrl.h:2308
#define LVM_SETITEMW
Definition: commctrl.h:2402
#define LVM_SETTOOLTIPS
Definition: commctrl.h:2801
#define LVM_GETVIEWRECT
Definition: commctrl.h:2659
#define LVM_GETNEXTITEM
Definition: commctrl.h:2438
#define LVM_MAPIDTOINDEX
Definition: commctrl.h:3021
#define LVM_MAPINDEXTOID
Definition: commctrl.h:3019
#define LVM_GETSUBITEMRECT
Definition: commctrl.h:2767
#define LVM_ENSUREVISIBLE
Definition: commctrl.h:2523
#define LVM_GETTOOLTIPS
Definition: commctrl.h:2803
#define LVM_GETWORKAREAS
Definition: commctrl.h:2789
#define LVM_GETVIEW
Definition: commctrl.h:2853
#define LVM_SETSELECTIONMARK
Definition: commctrl.h:2795
#define LVM_SETITEMTEXTA
Definition: commctrl.h:2691
#define LVM_CANCELEDITLABEL
Definition: commctrl.h:3017
#define LVM_GETCOLUMNW
Definition: commctrl.h:2623
#define LVM_SETITEMCOUNT
Definition: commctrl.h:2701
#define LVM_SCROLL
Definition: commctrl.h:2526
#define LVM_GETIMAGELIST
Definition: commctrl.h:2300
#define LVM_ISITEMVISIBLE
Definition: commctrl.h:3023
#define LVM_INSERTITEMA
Definition: commctrl.h:2408
#define LVM_GETCOUNTPERPAGE
Definition: commctrl.h:2671
#define LVM_SETHOTCURSOR
Definition: commctrl.h:2779
#define LVM_SUBITEMHITTEST
Definition: commctrl.h:2769
#define LVM_GETITEMTEXTW
Definition: commctrl.h:2685
#define LVM_GETITEMRECT
Definition: commctrl.h:2482
#define LVM_GETITEMTEXTA
Definition: commctrl.h:2684
#define LVM_GETBKCOLOR
Definition: commctrl.h:2296
#define LVM_INSERTCOLUMNW
Definition: commctrl.h:2637
#define LVM_GETISEARCHSTRINGA
Definition: commctrl.h:2719
#define LVM_DELETEITEM
Definition: commctrl.h:2415
#define LVM_GETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2732
#define LVM_SETITEMA
Definition: commctrl.h:2401
#define CCM_SETVERSION
Definition: commctrl.h:114
#define LVM_SETVIEW
Definition: commctrl.h:2851
#define LVM_GETSELECTIONMARK
Definition: commctrl.h:2793
#define LVM_GETORIGIN
Definition: commctrl.h:2673
#define LVM_SETICONSPACING
Definition: commctrl.h:2726
#define WM_MOUSEHOVER
Definition: commctrl.h:4979
#define LVM_SETHOTITEM
Definition: commctrl.h:2775
#define LVM_GETSELECTEDCOUNT
Definition: commctrl.h:2713
#define LVM_GETUNICODEFORMAT
Definition: commctrl.h:2294
#define LVM_GETTEXTCOLOR
Definition: commctrl.h:2661
#define LVM_SETITEMPOSITION32
Definition: commctrl.h:2710
#define LVM_SETTEXTBKCOLOR
Definition: commctrl.h:2667
#define LVM_SORTITEMSEX
Definition: commctrl.h:2805
#define LVM_SETCOLUMNORDERARRAY
Definition: commctrl.h:2771
#define LVM_INSERTITEMW
Definition: commctrl.h:2409
#define LVM_GETITEMW
Definition: commctrl.h:2395
#define LVM_SORTITEMS
Definition: commctrl.h:2707
#define LVM_FINDITEMA
Definition: commctrl.h:2470
#define LVM_GETCOLUMNWIDTH
Definition: commctrl.h:2646
int(CALLBACK * PFNLVCOMPARE)(LPARAM, LPARAM, LPARAM)
Definition: commctrl.h:2705
#define LVM_HITTEST
Definition: commctrl.h:2520
#define LVM_GETTEXTBKCOLOR
Definition: commctrl.h:2665
#define LVM_GETISEARCHSTRINGW
Definition: commctrl.h:2720
#define LVM_GETSTRINGWIDTHW
Definition: commctrl.h:2492
#define LVM_GETHOTCURSOR
Definition: commctrl.h:2781
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2729
#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:1631
#define WM_ENABLE
Definition: winuser.h:1626
#define WM_HSCROLL
Definition: winuser.h:1754
#define SWP_FRAMECHANGED
Definition: winuser.h:1251
#define WM_VSCROLL
Definition: winuser.h:1755
#define WM_CREATE
Definition: winuser.h:1619
#define DLGC_WANTCHARS
Definition: winuser.h:2629
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1789
#define WM_SETFOCUS
Definition: winuser.h:1624
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1637
#define WM_RBUTTONDOWN
Definition: winuser.h:1790
#define WM_SETTINGCHANGE
Definition: winuser.h:1640
#define SPI_SETICONTITLELOGFONT
Definition: winuser.h:1394
#define WM_LBUTTONUP
Definition: winuser.h:1788
#define WM_CHAR
Definition: winuser.h:1728
#define WM_NCDESTROY
Definition: winuser.h:1695
#define WM_USER
Definition: winuser.h:1906
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1673
#define WM_SETREDRAW
Definition: winuser.h:1627

Referenced by LISTVIEW_Register().

◆ LISTVIEW_WMPaint()

static LRESULT LISTVIEW_WMPaint ( LISTVIEW_INFO infoPtr,
HDC  hdc 
)
inlinestatic

Definition at line 10913 of file listview.c.

10914{
10915 TRACE("(hdc=%p)\n", hdc);
10916
10917 if (!is_redrawing(infoPtr))
10918 return DefWindowProcW (infoPtr->hwndSelf, WM_PAINT, (WPARAM)hdc, 0);
10919
10920 return LISTVIEW_Paint(infoPtr, hdc);
10921}

Referenced by LISTVIEW_WindowProc().

◆ map_style_view()

static void map_style_view ( LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1603 of file listview.c.

1604{
1605 switch (infoPtr->dwStyle & LVS_TYPEMASK)
1606 {
1607 case LVS_ICON:
1608 infoPtr->uView = LV_VIEW_ICON;
1609 break;
1610 case LVS_REPORT:
1611 infoPtr->uView = LV_VIEW_DETAILS;
1612 break;
1613 case LVS_SMALLICON:
1614 infoPtr->uView = LV_VIEW_SMALLICON;
1615 break;
1616 case LVS_LIST:
1617 infoPtr->uView = LV_VIEW_LIST;
1618 }
1619}
#define LVS_LIST
Definition: commctrl.h:2269

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

◆ MapIdSearchCompare()

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

Definition at line 2642 of file listview.c.

2643{
2644 ITEM_ID *id1 = (ITEM_ID*)p1;
2645 ITEM_ID *id2 = (ITEM_ID*)p2;
2646
2647 if (id1->id == id2->id) return 0;
2648
2649 return (id1->id < id2->id) ? -1 : 1;
2650}

Referenced by LISTVIEW_MapIdToIndex().

◆ notify()

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

Definition at line 842 of file listview.c.

843{
844 NMHDR nmh;
845 HWND hwnd = infoPtr->hwndSelf;
846 notify_hdr(infoPtr, code, &nmh);
847 return IsWindow(hwnd);
848}
Definition: inflate.c:139

◆ notify_click()

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

Definition at line 889 of file listview.c.

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

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 1046 of file listview.c.

1047{
1048 BOOL isForItem = (lpnmlvcd->nmcd.dwItemSpec != 0);
1049 DWORD result;
1050
1051 lpnmlvcd->nmcd.dwDrawStage = dwDrawStage;
1052 if (isForItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_ITEM;
1053 if (lpnmlvcd->iSubItem) lpnmlvcd->nmcd.dwDrawStage |= CDDS_SUBITEM;
1054 if (isForItem) lpnmlvcd->nmcd.dwItemSpec--;
1055 result = notify_hdr(infoPtr, NM_CUSTOMDRAW, &lpnmlvcd->nmcd.hdr);
1056 if (isForItem) lpnmlvcd->nmcd.dwItemSpec++;
1057 return result;
1058}
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 909 of file listview.c.

910{
911 NMLISTVIEW nmlv;
913 HWND hwnd = infoPtr->hwndSelf;
914
915 ZeroMemory(&nmlv, sizeof (NMLISTVIEW));
916 nmlv.iItem = nItem;
917 item.mask = LVIF_PARAM;
918 item.iItem = nItem;
919 item.iSubItem = 0;
920 if (LISTVIEW_GetItemT(infoPtr, &item, TRUE)) nmlv.lParam = item.lParam;
921 notify_listview(infoPtr, LVN_DELETEITEM, &nmlv);
922 return IsWindow(hwnd);
923}
#define LVN_DELETEITEM
Definition: commctrl.h:3138

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 933 of file listview.c.

934{
935 INT length = 0, ret_length;
936 LPWSTR buffer = NULL, ret_text;
937 BOOL return_ansi = FALSE;
938 BOOL return_unicode = FALSE;
939 BOOL ret;
940
941 if ((pdi->item.mask & LVIF_TEXT) && is_text(pdi->item.pszText))
942 {
943 return_unicode = ( isW && infoPtr->notifyFormat == NFR_ANSI);
944 return_ansi = (!isW && infoPtr->notifyFormat == NFR_UNICODE);
945 }
946
947 ret_length = pdi->item.cchTextMax;
948 ret_text = pdi->item.pszText;
949
950 if (return_unicode || return_ansi)
951 {
952 if (code != LVN_GETDISPINFOW)
953 {
954 length = return_ansi ?
955 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1, NULL, 0):
956 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
957 }
958 else
959 {
960 length = pdi->item.cchTextMax;
961 *pdi->item.pszText = 0; /* make sure we don't process garbage */
962 }
963
964 buffer = Alloc( (return_ansi ? sizeof(WCHAR) : sizeof(CHAR)) * length);
965 if (!buffer) return FALSE;
966
967 if (return_ansi)
968 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pdi->item.pszText, -1,
969 buffer, length);
970 else
971 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) buffer,
972 length, NULL, NULL);
973
974 pdi->item.pszText = buffer;
975 pdi->item.cchTextMax = length;
976 }
977
978 if (infoPtr->notifyFormat == NFR_ANSI)
980
981 TRACE(" pdi->item=%s\n", debuglvitem_t(&pdi->item, infoPtr->notifyFormat != NFR_ANSI));
982 ret = notify_hdr(infoPtr, code, &pdi->hdr);
983 TRACE(" resulting code=%d\n", pdi->hdr.code);
984
985 if (return_ansi || return_unicode)
986 {
987 if (return_ansi && (pdi->hdr.code == LVN_GETDISPINFOA))
988 {
989 strcpy((char*)ret_text, (char*)pdi->item.pszText);
990 }
991 else if (return_unicode && (pdi->hdr.code == LVN_GETDISPINFOW))
992 {
993 lstrcpyW(ret_text, pdi->item.pszText);
994 }
995 else if (return_ansi) /* note : pointer can be changed by app ! */
996 {
997 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) ret_text,
998 ret_length, NULL, NULL);
999 }
1000 else
1001 MultiByteToWideChar(CP_ACP, 0, (LPSTR) pdi->item.pszText, -1,
1002 ret_text, ret_length);
1003
1004 pdi->item.pszText = ret_text; /* restores our buffer */
1005 pdi->item.cchTextMax = ret_length;
1006
1007 Free(buffer);
1008 return ret;
1009 }
1010
1011 /* if dispinfo holder changed notification code then convert */
1012 if (!isW && (pdi->hdr.code == LVN_GETDISPINFOW) && (pdi->item.mask & LVIF_TEXT))
1013 {
1014 length = WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, NULL, 0, NULL, NULL);
1015
1016 buffer = Alloc(length * sizeof(CHAR));
1017 if (!buffer) return FALSE;
1018
1019 WideCharToMultiByte(CP_ACP, 0, pdi->item.pszText, -1, (LPSTR) buffer,
1020 ret_length, NULL, NULL);
1021
1022 strcpy((LPSTR)pdi->item.pszText, (LPSTR)buffer);
1023 Free(buffer);
1024 }
1025
1026 return ret;
1027}
static int get_ansi_notification(UINT unicodeNotificationCode)
Definition: listview.c:737
#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
strcpy
Definition: string.h:131
_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 775 of file listview.c.

776{
778 LRESULT ret;
779 NMHEADERA *lpnmh = (NMHEADERA*) lpnmhW;
780
781 /* on unicode format exit earlier */
782 if (infoPtr->notifyFormat == NFR_UNICODE)
783 return SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->hdr.idFrom,
784 (LPARAM)lpnmh);
785
786 /* header always supplies unicode notifications,
787 all we have to do is to convert strings to ANSI */
788 if (lpnmh->pitem)
789 {
790 /* convert item text */
791 if (lpnmh->pitem->mask & HDI_TEXT)
792 {
793 text = (LPCWSTR)lpnmh->pitem->pszText;
794 lpnmh->pitem->pszText = NULL;
795 Str_SetPtrWtoA(&lpnmh->pitem->pszText, text);
796 }
797 /* convert filter text */
798 if ((lpnmh->pitem->mask & HDI_FILTER) && (lpnmh->pitem->type == HDFT_ISSTRING) &&
799 lpnmh->pitem->pvFilter)
800 {
801 filter = (LPCWSTR)((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText;
802 ((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText = NULL;
803 Str_SetPtrWtoA(&((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText, filter);
804 }
805 }
806 lpnmh->hdr.code = get_ansi_notification(lpnmh->hdr.code);
807
808 ret = SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, lpnmh->hdr.idFrom,
809 (LPARAM)lpnmh);
810
811 /* cleanup */
812 if(text)
813 {
814 Free(lpnmh->pitem->pszText);
815 lpnmh->pitem->pszText = (LPSTR)text;
816 }
817 if(filter)
818 {
819 Free(((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText);
820 ((HD_TEXTFILTERA*)lpnmh->pitem->pvFilter)->pszText = (LPSTR)filter;
821 }
822
823 return ret;
824}
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:3169
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 850 of file listview.c.

851{
852 NMITEMACTIVATE nmia;
854
855 nmia.uNewState = 0;
856 nmia.uOldState = 0;
857 nmia.uChanged = 0;
858 nmia.uKeyFlags = 0;
859
861 item.iItem = htInfo->iItem;
862 item.iSubItem = 0;
863 item.stateMask = (UINT)-1;
864 if (LISTVIEW_GetItemT(infoPtr, &item, TRUE)) {
865 nmia.lParam = item.lParam;
866 nmia.uOldState = item.state;
867 nmia.uNewState = item.state | LVIS_ACTIVATING;
868 nmia.uChanged = LVIF_STATE;
869 }
870
871 nmia.iItem = htInfo->iItem;
872 nmia.iSubItem = htInfo->iSubItem;
873 nmia.ptAction = htInfo->pt;
874
875 if (GetKeyState(VK_SHIFT) & 0x8000) nmia.uKeyFlags |= LVKF_SHIFT;
876 if (GetKeyState(VK_CONTROL) & 0x8000) nmia.uKeyFlags |= LVKF_CONTROL;
877 if (GetKeyState(VK_MENU) & 0x8000) nmia.uKeyFlags |= LVKF_ALT;
878
879 notify_hdr(infoPtr, LVN_ITEMACTIVATE, (LPNMHDR)&nmia);
880}
#define LVIS_ACTIVATING
Definition: commctrl.h:2328
#define LVKF_CONTROL
Definition: commctrl.h:3061
#define LVKF_SHIFT
Definition: commctrl.h:3062
#define LVKF_ALT
Definition: commctrl.h:3060
#define VK_MENU
Definition: winuser.h:2215

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 882 of file listview.c.

883{
884 TRACE("(code=%d, plvnm=%s)\n", code, debugnmlistview(plvnm));
885 return notify_hdr(infoPtr, code, (LPNMHDR)plvnm);
886}
static const char * debugnmlistview(const NMLISTVIEW *plvnm)
Definition: listview.c:611

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 1107 of file listview.c.

1108{
1110 mis.CtlType = ODT_LISTVIEW;
1111 mis.CtlID = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID);
1112 mis.itemID = -1;
1113 mis.itemWidth = 0;
1114 mis.itemData = 0;
1115 mis.itemHeight= infoPtr->nItemHeight;
1116 SendMessageW(infoPtr->hwndNotify, WM_MEASUREITEM, mis.CtlID, (LPARAM)&mis);
1117 if (infoPtr->nItemHeight != max(mis.itemHeight, 1))
1118 {
1119 infoPtr->nMeasureItemHeight = infoPtr->nItemHeight = max(mis.itemHeight, 1);
1120 return TRUE;
1121 }
1122 return FALSE;
1123}
ULONG_PTR itemData
Definition: winuser.h:3657
#define WM_MEASUREITEM
Definition: winuser.h:1657

Referenced by LISTVIEW_Create(), and LISTVIEW_WindowProc().

◆ notify_postpaint()

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

Definition at line 1101 of file listview.c.

1102{
1103 return notify_customdraw(infoPtr, CDDS_POSTPAINT, lpnmlvcd);
1104}
#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 1060 of file listview.c.

1061{
1062 COLORREF backcolor, textcolor;
1063
1064 /* apparently, for selected items, we have to override the returned values */
1065 if (!SubItem || (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
1066 {
1067 if (lpnmlvcd->nmcd.uItemState & CDIS_SELECTED)
1068 {
1069 if (infoPtr->bFocus)
1070 {
1073 }
1074 else if (infoPtr->dwStyle & LVS_SHOWSELALWAYS)
1075 {
1077 lpnmlvcd->clrText = comctl32_color.clrBtnText;
1078 }
1079 }
1080 }
1081
1082 backcolor = lpnmlvcd->clrTextBk;
1083 textcolor = lpnmlvcd->clrText;
1084
1085 if (backcolor == CLR_DEFAULT)
1086 backcolor = comctl32_color.clrWindow;
1087 if (textcolor == CLR_DEFAULT)
1088 textcolor = comctl32_color.clrWindowText;
1089
1090 /* Set the text attributes */
1091 if (backcolor != CLR_NONE)
1092 {
1094 SetBkColor(hdc, backcolor);
1095 }
1096 else
1098 SetTextColor(hdc, textcolor);
1099}
#define LVS_SHOWSELALWAYS
Definition: commctrl.h:2272
COLORREF clrHighlightText
Definition: comctl32.h:176
COLORREF clrBtnText
Definition: comctl32.h:173
COLORREF clrWindowText
Definition: comctl32.h:183
COLORREF clrHighlight
Definition: comctl32.h:175
#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 3339 of file listview.c.

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

3192{
3193 INT i;
3194 RANGE *prev, *curr;
3195
3196 TRACE("*** Checking %s:%d:%s ***\n", file, line, desc);
3197 assert (ranges);
3198 assert (DPA_GetPtrCount(ranges->hdpa) >= 0);
3199 ranges_dump(ranges);
3200 if (DPA_GetPtrCount(ranges->hdpa) > 0)
3201 {
3202 prev = DPA_GetPtr(ranges->hdpa, 0);
3203 assert (prev->lower >= 0 && prev->lower < prev->upper);
3204 for (i = 1; i < DPA_GetPtrCount(ranges->hdpa); i++)
3205 {
3206 curr = DPA_GetPtr(ranges->hdpa, i);
3207 assert (prev->upper <= curr->lower);
3208 assert (curr->lower < curr->upper);
3209 prev = curr;
3210 }
3211 }
3212 TRACE("--- Done checking---\n");
3213}
static void ranges_dump(RANGES ranges)
Definition: listview.c:3290
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 3225 of file listview.c.

3226{
3227 INT i;
3228
3229 for(i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++)
3230 Free(DPA_GetPtr(ranges->hdpa, i));
3231 DPA_DeleteAllPtrs(ranges->hdpa);
3232}
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 3243 of file listview.c.

3244{
3245 RANGES clone;
3246 INT i;
3247
3248#ifdef __REACTOS__
3249 if (!ranges || !ranges->hdpa)
3250 {
3251 /*
3252 * If a ExplorerBand tree rename operation is completed by left-clicking in
3253 * DefView, the navigation to the newly named item causes the ListView in DefView
3254 * to call LISTVIEW_DeselectAllSkipItems during ListView destruction.
3255 */
3256 return NULL;
3257 }
3258#endif
3259 if (!(clone = ranges_create(DPA_GetPtrCount(ranges->hdpa)))) goto fail;
3260
3261 for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++)
3262 {
3263 RANGE *newrng = Alloc(sizeof(RANGE));
3264 if (!newrng) goto fail;
3265 *newrng = *((RANGE*)DPA_GetPtr(ranges->hdpa, i));
3266 if (!DPA_SetPtr(clone->hdpa, i, newrng))
3267 {
3268 Free(newrng);
3269 goto fail;
3270 }
3271 }
3272 return clone;
3273
3274fail:
3275 TRACE ("clone failed\n");
3276 ranges_destroy(clone);
3277 return NULL;
3278}

Referenced by LISTVIEW_DeselectAllSkipItems().

◆ ranges_cmp()

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

Definition at line 3173 of file listview.c.

3174{
3175 INT cmp;
3176
3177 if (((RANGE*)range1)->upper <= ((RANGE*)range2)->lower)
3178 cmp = -1;
3179 else if (((RANGE*)range2)->upper <= ((RANGE*)range1)->lower)
3180 cmp = 1;
3181 else
3182 cmp = 0;
3183
3184 TRACE("range1=%s, range2=%s, cmp=%d\n", debugrange(range1), debugrange(range2), cmp);
3185
3186 return cmp;
3187}
#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 3298 of file listview.c.

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

Referenced by LISTVIEW_GetItemT().

◆ ranges_create()

static RANGES ranges_create ( int  count)
static

Definition at line 3215 of file listview.c.

3216{
3217 RANGES ranges = Alloc(sizeof(struct tagRANGES));
3218 if (!ranges) return NULL;
3219 ranges->hdpa = DPA_Create(count);
3220 if (ranges->hdpa) return ranges;
3221 Free(ranges);
3222 return NULL;
3223}

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 3422 of file listview.c.

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

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

◆ ranges_delitem()

static BOOL ranges_delitem ( RANGES  ranges,
INT  nItem 
)
inlinestatic

Definition at line 1140 of file listview.c.

1141{
1142 RANGE range = { nItem, nItem + 1 };
1143
1144 return ranges_del(ranges, range);
1145}

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

◆ ranges_destroy()

static void ranges_destroy ( RANGES  ranges)
static

Definition at line 3235 of file listview.c.

3236{
3237 if (!ranges) return;
3238 ranges_clear(ranges);
3239 DPA_Destroy(ranges->hdpa);
3240 Free(ranges);
3241}

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 3280 of file listview.c.

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

Referenced by LISTVIEW_DeselectAllSkipItems().

◆ ranges_dump()

static void ranges_dump ( RANGES  ranges)
static

Definition at line 3290 of file listview.c.

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

Referenced by ranges_assert().

◆ ranges_itemcount()

static INT ranges_itemcount ( RANGES  ranges)
static

Definition at line 3307 of file listview.c.

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

Referenced by LISTVIEW_GetSelectedCount().

◆ ranges_shift()

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

Definition at line 3320 of file listview.c.

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

Referenced by LISTVIEW_ShiftIndices().

◆ scroll_list()

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

Definition at line 9860 of file listview.c.

9861{
9862 /* now we can scroll the list */
9863 ScrollWindowEx(infoPtr->hwndSelf, dx, dy, &infoPtr->rcList,
9864 &infoPtr->rcList, 0, 0, SW_ERASE | SW_INVALIDATE);
9865 /* if we have focus, adjust rect */
9866 OffsetRect(&infoPtr->rcFocus, dx, dy);
9867 UpdateWindow(infoPtr->hwndSelf);
9868}

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 8902 of file listview.c.

8903{
8904 INT cx, cy;
8905
8906 if (himl && ImageList_GetIconSize(himl, &cx, &cy))
8907 {
8908 size->cx = cx;
8909 size->cy = cy;
8910 }
8911 else
8912 {
8913 size->cx = GetSystemMetrics(is_small ? SM_CXSMICON : SM_CXICON);
8914 size->cy = GetSystemMetrics(is_small ? SM_CYSMICON : SM_CYICON);
8915 }
8916}

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 4308 of file listview.c.

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

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 4493 of file listview.c.

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

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 3601 of file listview.c.

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

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:232

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 1588 of file listview.c.

1589{
1591 if(state == 1 || state == 2)
1592 {
1593 LVITEMW lvitem;
1594 state ^= 3;
1597 LISTVIEW_SetItemState(infoPtr, nItem, &lvitem);
1598 }
1599}
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().