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

Go to the source code of this file.

Classes

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

Macros

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

Typedefs

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

Enumerations

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

Functions

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

Variables

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

Macro Definition Documentation

◆ CAPTION_BORDER

#define CAPTION_BORDER   2

Definition at line 400 of file listview.c.

◆ DEBUG_BUFFER_SIZE

#define DEBUG_BUFFER_SIZE   256

Definition at line 343 of file listview.c.

◆ DEBUG_BUFFERS

#define DEBUG_BUFFERS   20

Definition at line 341 of file listview.c.

◆ DEFAULT_COLUMN_WIDTH

#define DEFAULT_COLUMN_WIDTH   128

Definition at line 387 of file listview.c.

◆ DEFAULT_LABEL_WIDTH

#define DEFAULT_LABEL_WIDTH   40

Definition at line 382 of file listview.c.

◆ DISP_TEXT_SIZE

#define DISP_TEXT_SIZE   260

Definition at line 349 of file listview.c.

◆ HEIGHT_PADDING

#define HEIGHT_PADDING   1

Definition at line 355 of file listview.c.

◆ ICON_BOTTOM_PADDING

#define ICON_BOTTOM_PADDING   4

Definition at line 375 of file listview.c.

◆ ICON_LR_HALF

#define ICON_LR_HALF   (ICON_LR_PADDING/2)

Definition at line 379 of file listview.c.

◆ ICON_LR_PADDING

#define ICON_LR_PADDING   16

Definition at line 378 of file listview.c.

◆ ICON_TOP_PADDING

Definition at line 374 of file listview.c.

◆ ICON_TOP_PADDING_HITABLE

#define ICON_TOP_PADDING_HITABLE   2

Definition at line 373 of file listview.c.

◆ ICON_TOP_PADDING_NOTHITABLE

#define ICON_TOP_PADDING_NOTHITABLE   2

Definition at line 372 of file listview.c.

◆ IMAGE_PADDING

#define IMAGE_PADDING   2

Definition at line 393 of file listview.c.

◆ KEY_DELAY

#define KEY_DELAY   450

Definition at line 411 of file listview.c.

◆ LABEL_HOR_PADDING

#define LABEL_HOR_PADDING   5

Definition at line 376 of file listview.c.

◆ LABEL_VERT_PADDING

#define LABEL_VERT_PADDING   7

Definition at line 377 of file listview.c.

◆ LISTVIEW_DUMP

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

Definition at line 414 of file listview.c.

◆ LISTVIEW_SCROLL_ICON_LINE_SIZE

#define LISTVIEW_SCROLL_ICON_LINE_SIZE   37

Definition at line 390 of file listview.c.

◆ LV_FL_DT_FLAGS

Definition at line 404 of file listview.c.

◆ LV_ML_DT_FLAGS

Definition at line 403 of file listview.c.

◆ LV_SL_DT_FLAGS

Definition at line 405 of file listview.c.

◆ MAX_EMPTYTEXT_SELECT_WIDTH

#define MAX_EMPTYTEXT_SELECT_WIDTH   80

Definition at line 384 of file listview.c.

◆ ranges_check

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

Definition at line 3199 of file listview.c.

◆ REPORT_MARGINX

#define REPORT_MARGINX   2

Definition at line 358 of file listview.c.

◆ SB_INTERNAL

#define SB_INTERNAL   -1

Definition at line 346 of file listview.c.

◆ SCROLL_DOWN

#define SCROLL_DOWN   0x8

Definition at line 3944 of file listview.c.

◆ SCROLL_LEFT

#define SCROLL_LEFT   0x1

Definition at line 3941 of file listview.c.

◆ SCROLL_RIGHT

#define SCROLL_RIGHT   0x2

Definition at line 3942 of file listview.c.

◆ SCROLL_UP

#define SCROLL_UP   0x4

Definition at line 3943 of file listview.c.

◆ STATEIMAGEINDEX

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

Definition at line 408 of file listview.c.

◆ TRAILING_HEADER_PADDING

#define TRAILING_HEADER_PADDING   11

Definition at line 397 of file listview.c.

◆ TRAILING_LABEL_PADDING

#define TRAILING_LABEL_PADDING   12

Definition at line 396 of file listview.c.

◆ WIDTH_PADDING

#define WIDTH_PADDING   12

Definition at line 352 of file listview.c.

Typedef Documentation

◆ COLUMN_INFO

◆ DELAYED_ITEM_EDIT

◆ ITEM_ID

Definition at line 167 of file listview.c.

◆ ITEM_INFO

◆ ITEMHDR

◆ ITERATOR

◆ LISTVIEW_INFO

◆ LPITEMHDR

◆ RANGE

◆ RANGES

typedef struct tagRANGES * RANGES

◆ SUBITEM_INFO

Enumeration Type Documentation

◆ notification_mask

Enumerator
NOTIFY_MASK_ITEM_CHANGE 
NOTIFY_MASK_END_LABEL_EDIT 
NOTIFY_MASK_UNMASK_ALL 

Definition at line 210 of file listview.c.

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

Function Documentation

◆ CallWindowProcT()

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

Definition at line 1581 of file listview.c.

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

Referenced by EditLblWndProcT().

◆ column_fill_hditem()

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

Definition at line 8236 of file listview.c.

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

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetColumnT().

◆ CreateEditLabelT()

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

Definition at line 6207 of file listview.c.

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

Referenced by LISTVIEW_EditLabelT().

◆ customdraw_fill()

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

Definition at line 1035 of file listview.c.

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

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

◆ debug_getbuf()

static char * debug_getbuf ( void  )
static

Definition at line 567 of file listview.c.

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

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

◆ debuglvcolumn_t()

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

Definition at line 668 of file listview.c.

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

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetColumnT().

◆ debuglvhittestinfo()

static const char * debuglvhittestinfo ( const LVHITTESTINFO lpht)
static

Definition at line 715 of file listview.c.

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

Referenced by notify_click().

◆ debuglvitem_t()

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

Definition at line 626 of file listview.c.

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

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

◆ debugnmlistview()

static const char * debugnmlistview ( const NMLISTVIEW plvnm)
static

Definition at line 617 of file listview.c.

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

Referenced by notify_listview().

◆ debugrange()

static const char * debugrange ( const RANGE lprng)
inlinestatic

Definition at line 574 of file listview.c.

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

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

◆ debugscrollcode()

static LPCSTR debugscrollcode ( int  nScrollCode)
inlinestatic

Definition at line 724 of file listview.c.

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

Referenced by LISTVIEW_HScroll(), and LISTVIEW_VScroll().

◆ debugscrollinfo()

static const char * debugscrollinfo ( const SCROLLINFO pScrollInfo)
static

Definition at line 580 of file listview.c.

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

Referenced by LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateVScroll().

◆ debugtext_t()

static LPCSTR debugtext_t ( LPCWSTR  text,
BOOL  isW 
)
inlinestatic

Definition at line 554 of file listview.c.

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

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

◆ debugtext_tn()

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

Definition at line 560 of file listview.c.

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

Referenced by debuglvcolumn_t(), and debuglvitem_t().

◆ EditLblWndProcA()

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

Definition at line 6190 of file listview.c.

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

Referenced by CreateEditLabelT().

◆ EditLblWndProcT()

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

Definition at line 6119 of file listview.c.

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

Referenced by EditLblWndProcA(), and EditLblWndProcW().

◆ EditLblWndProcW()

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

Definition at line 6173 of file listview.c.

6174{
6175 return EditLblWndProcT(hwnd, uMsg, wParam, lParam, TRUE);
6176}

Referenced by CreateEditLabelT().

◆ get_ansi_notification()

static int get_ansi_notification ( UINT  unicodeNotificationCode)
static

Definition at line 743 of file listview.c.

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

Referenced by notify_dispinfoT(), and notify_forward_header().

◆ get_next_itemid()

static DWORD get_next_itemid ( const LISTVIEW_INFO infoPtr)
static

Definition at line 1628 of file listview.c.

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

Referenced by LISTVIEW_InsertItemT().

◆ is_assignable_item()

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

Definition at line 4289 of file listview.c.

4290{
4291 if ( (lpLVItem->mask & LVIF_TEXT) &&
4292 (lpLVItem->pszText == LPSTR_TEXTCALLBACKW) &&
4293 (lStyle & (LVS_SORTASCENDING | LVS_SORTDESCENDING)) ) return FALSE;
4294
4295 return TRUE;
4296}
#define LVS_SORTASCENDING
Definition: commctrl.h:2268
#define LVS_SORTDESCENDING
Definition: commctrl.h:2269

Referenced by LISTVIEW_InsertItemT(), and LISTVIEW_SetItemT().

◆ is_autoarrange()

static BOOL is_autoarrange ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1588 of file listview.c.

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

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

◆ is_redrawing()

◆ is_text()

◆ iterator_destroy()

static void iterator_destroy ( const ITERATOR i)
inlinestatic

Definition at line 1309 of file listview.c.

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

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

◆ iterator_empty()

static void iterator_empty ( ITERATOR i)
inlinestatic

Definition at line 1317 of file listview.c.

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

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

◆ iterator_frameditems()

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

Definition at line 1446 of file listview.c.

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

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

◆ iterator_frameditems_absolute()

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

Definition at line 1347 of file listview.c.

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

Referenced by iterator_frameditems(), and LISTVIEW_MarqueeHighlight().

◆ iterator_next()

static BOOL iterator_next ( ITERATOR i)
inlinestatic

Definition at line 1214 of file listview.c.

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

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

◆ iterator_prev()

static BOOL iterator_prev ( ITERATOR i)
inlinestatic

Definition at line 1254 of file listview.c.

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

Referenced by iterator_remove_common_items(), and LISTVIEW_RefreshList().

◆ iterator_range()

static RANGE iterator_range ( const ITERATOR i)
static

Definition at line 1290 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ iterator_rangeitems()

static void iterator_rangeitems ( ITERATOR i,
RANGE  range 
)
inlinestatic

Definition at line 1326 of file listview.c.

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

Referenced by iterator_frameditems_absolute().

◆ iterator_rangesitems()

static void iterator_rangesitems ( ITERATOR i,
RANGES  ranges 
)
inlinestatic

◆ iterator_remove_common_items()

static BOOL iterator_remove_common_items ( ITERATOR iter1,
ITERATOR iter2 
)
static

Definition at line 1517 of file listview.c.

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

Referenced by LISTVIEW_MarqueeHighlight().

◆ iterator_visibleitems()

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

Definition at line 1462 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_AddGroupSelection()

static BOOL LISTVIEW_AddGroupSelection ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

DESCRIPTION: Adds a block of selections.

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

RETURN: Whether the window is still valid.

Definition at line 3674 of file listview.c.

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

Referenced by LISTVIEW_LButtonDown().

◆ LISTVIEW_ApproximateViewRect()

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

Definition at line 5423 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Arrange()

static BOOL LISTVIEW_Arrange ( LISTVIEW_INFO infoPtr,
INT  nAlignCode 
)
static

Definition at line 2872 of file listview.c.

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

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

◆ LISTVIEW_CalculateItemHeight()

static INT LISTVIEW_CalculateItemHeight ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3097 of file listview.c.

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

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

◆ LISTVIEW_CalculateItemWidth()

static INT LISTVIEW_CalculateItemWidth ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3037 of file listview.c.

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

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

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Create()

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

Definition at line 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:2172
static void map_style_view(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1609
static BOOL notify_measureitem(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1113
static const WCHAR themeClass[]
Definition: listview.c:427
static void set_icon_size(SIZE *size, HIMAGELIST himl, BOOL is_small)
Definition: listview.c:8902
static void LISTVIEW_UpdateItemSize(LISTVIEW_INFO *infoPtr)
Definition: listview.c:3130
static INT LISTVIEW_CreateHeader(LISTVIEW_INFO *infoPtr)
Definition: listview.c:1666
static void LISTVIEW_UpdateSize(LISTVIEW_INFO *)
Definition: listview.c:11244
HTHEME WINAPI OpenThemeData(HWND hwnd, LPCWSTR classlist)
Definition: system.c:835
#define LVS_NOCOLUMNHEADER
Definition: commctrl.h:2284
#define LVS_OWNERDRAWFIXED
Definition: commctrl.h:2283
HIMAGELIST himlNormal
Definition: listview.c:272
SHORT notifyFormat
Definition: listview.c:229
#define SW_SHOWNORMAL
Definition: winuser.h:770
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define NFR_ANSI
Definition: winuser.h:2458
#define NF_QUERY
Definition: winuser.h:2460

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateCheckBoxIL()

static HIMAGELIST LISTVIEW_CreateCheckBoxIL ( const LISTVIEW_INFO infoPtr)
static

Definition at line 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:448
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
pKey DeleteObject()
static HBITMAP
Definition: button.c:44
#define ILC_MASK
Definition: commctrl.h:351
#define ILC_COLOR
Definition: commctrl.h:352
HGDIOBJ WINAPI GetStockObject(_In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define BLACK_BRUSH
Definition: wingdi.h:896
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_BUTTONCHECK
Definition: winuser.h:496
#define DFC_BUTTON
Definition: winuser.h:476
#define SM_CYSMICON
Definition: winuser.h:1013
#define DFCS_MONO
Definition: winuser.h:511
#define SM_CXSMICON
Definition: winuser.h:1012
#define DFCS_CHECKED
Definition: winuser.h:504
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by LISTVIEW_SetExtendedListViewStyle().

◆ LISTVIEW_CreateDragImage()

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

Definition at line 5564 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateHeader()

static INT LISTVIEW_CreateHeader ( LISTVIEW_INFO infoPtr)
static

Definition at line 1666 of file listview.c.

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

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

◆ LISTVIEW_DelayedEditItem()

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

Definition at line 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:7410
static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
Definition: listview.c:6246
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 5629 of file listview.c.

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

Referenced by LISTVIEW_Destroy(), and LISTVIEW_WindowProc().

◆ LISTVIEW_DeleteColumn()

static BOOL LISTVIEW_DeleteColumn ( LISTVIEW_INFO infoPtr,
INT  nColumn 
)
static

Definition at line 5766 of file listview.c.

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

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

3551{
3552 return LISTVIEW_DeselectAllSkipItem(infoPtr, -1);
3553}
static BOOL LISTVIEW_DeselectAllSkipItem(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:3539

Referenced by LISTVIEW_LButtonDown(), and LISTVIEW_RButtonDown().

◆ LISTVIEW_DeselectAllSkipItem()

static BOOL LISTVIEW_DeselectAllSkipItem ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
inlinestatic

Definition at line 3539 of file listview.c.

3540{
3541 RANGES toSkip;
3542
3543 if (!(toSkip = ranges_create(1))) return FALSE;
3544 if (nItem != -1) ranges_additem(toSkip, nItem);
3545 LISTVIEW_DeselectAllSkipItems(infoPtr, toSkip);
3546 ranges_destroy(toSkip);
3547 return TRUE;
3548}
static BOOL LISTVIEW_DeselectAllSkipItems(LISTVIEW_INFO *infoPtr, RANGES toSkip)
Definition: listview.c:3517

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

3518{
3519 LVITEMW lvItem;
3520 ITERATOR i;
3521 RANGES clone;
3522
3523 TRACE("()\n");
3524
3525 lvItem.state = 0;
3526 lvItem.stateMask = LVIS_SELECTED;
3527
3528 /* need to clone the DPA because callbacks can change it */
3529 if (!(clone = ranges_clone(infoPtr->selectionRanges))) return FALSE;
3530 iterator_rangesitems(&i, ranges_diff(clone, toSkip));
3531 while(iterator_next(&i))
3532 LISTVIEW_SetItemState(infoPtr, i.nItem, &lvItem);
3533 /* note that the iterator destructor will free the cloned range */
3535
3536 return TRUE;
3537}
static RANGES ranges_diff(RANGES ranges, RANGES sub)
Definition: listview.c:3290
static void iterator_destroy(const ITERATOR *i)
Definition: listview.c:1309
static RANGES ranges_clone(RANGES ranges)
Definition: listview.c:3253

Referenced by LISTVIEW_DeselectAllSkipItem(), and LISTVIEW_SetGroupSelection().

◆ LISTVIEW_Destroy()

static LRESULT LISTVIEW_Destroy ( LISTVIEW_INFO infoPtr)
static

Definition at line 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:5629
HTHEME WINAPI GetWindowTheme(HWND hwnd)
Definition: system.c:851
HRESULT WINAPI CloseThemeData(HTHEME hTheme)
Definition: system.c:950
static HTHEME(WINAPI *pOpenThemeDataEx)(HWND

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_DrawFocusRect()

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

Definition at line 1719 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_DrawItem()

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

Definition at line 4853 of file listview.c.

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

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

◆ LISTVIEW_DrawItemPart()

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

Definition at line 4693 of file listview.c.

4694{
4695 RECT rcSelect, rcLabel, rcBox, rcStateIcon, rcIcon;
4696 const RECT *background;
4698 UINT format;
4699 RECT *focus;
4700
4701 /* now check if we need to update the focus rectangle */
4702 focus = infoPtr->bFocus && (item->state & LVIS_FOCUSED) ? &infoPtr->rcFocus : 0;
4703 if (!focus) item->state &= ~LVIS_FOCUSED;
4704
4705 LISTVIEW_GetItemMetrics(infoPtr, item, &rcBox, &rcSelect, &rcIcon, &rcStateIcon, &rcLabel);
4706 OffsetRect(&rcBox, pos->x, pos->y);
4707 OffsetRect(&rcSelect, pos->x, pos->y);
4708 OffsetRect(&rcIcon, pos->x, pos->y);
4709 OffsetRect(&rcStateIcon, pos->x, pos->y);
4710 OffsetRect(&rcLabel, pos->x, pos->y);
4711 TRACE("%d: box=%s, select=%s, icon=%s. label=%s\n", item->iSubItem,
4712 wine_dbgstr_rect(&rcBox), wine_dbgstr_rect(&rcSelect),
4713 wine_dbgstr_rect(&rcIcon), wine_dbgstr_rect(&rcLabel));
4714
4715 /* FIXME: temporary hack */
4716 rcSelect.left = rcLabel.left;
4717
4718 if (infoPtr->uView == LV_VIEW_DETAILS && item->iSubItem == 0)
4719 {
4720 if (!(infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))
4721 OffsetRect(&rcSelect, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4722 OffsetRect(&rcIcon, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4723 OffsetRect(&rcStateIcon, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4724 OffsetRect(&rcLabel, LISTVIEW_GetColumnInfo(infoPtr, 0)->rcHeader.left, 0);
4725 }
4726
4727 /* in icon mode, the label rect is really what we want to draw the
4728 * background for */
4729 /* in detail mode, we want to paint background for label rect when
4730 * item is not selected or listview has full row select; otherwise paint
4731 * background for text only */
4732 if ( infoPtr->uView == LV_VIEW_ICON ||
4733 (infoPtr->uView == LV_VIEW_DETAILS && (!(item->state & LVIS_SELECTED) ||
4734 (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT))))
4735 background = &rcLabel;
4736 else
4737 background = &rcSelect;
4738
4739 if (nmlvcd->clrTextBk != CLR_NONE)
4740 ExtTextOutW(nmlvcd->nmcd.hdc, background->left, background->top, ETO_OPAQUE, background, NULL, 0, NULL);
4741
4742 if (item->state & LVIS_FOCUSED)
4743 {
4744 if (infoPtr->uView == LV_VIEW_DETAILS)
4745 {
4746 if (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
4747 {
4748 /* we have to update left focus bound too if item isn't in leftmost column
4749 and reduce right box bound */
4750 if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
4751 {
4752 INT leftmost;
4753
4754 if ((leftmost = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX, 0, 0)))
4755 {
4756 INT Originx = pos->x - LISTVIEW_GetColumnInfo(infoPtr, leftmost)->rcHeader.left;
4757 INT rightmost = SendMessageW(infoPtr->hwndHeader, HDM_ORDERTOINDEX,
4758 DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, 0);
4759
4760 rcBox.right = LISTVIEW_GetColumnInfo(infoPtr, rightmost)->rcHeader.right + Originx;
4761 rcSelect.left = LISTVIEW_GetColumnInfo(infoPtr, leftmost)->rcHeader.left + Originx;
4762 }
4763 }
4764 rcSelect.right = rcBox.right;
4765 }
4766 infoPtr->rcFocus = rcSelect;
4767 }
4768 else
4769 infoPtr->rcFocus = rcLabel;
4770 }
4771
4772 /* state icons */
4773 if (infoPtr->himlState && STATEIMAGEINDEX(item->state) && (item->iSubItem == 0))
4774 {
4775 UINT stateimage = STATEIMAGEINDEX(item->state);
4776 if (stateimage)
4777 {
4778 TRACE("stateimage=%d\n", stateimage);
4779 ImageList_Draw(infoPtr->himlState, stateimage-1, nmlvcd->nmcd.hdc, rcStateIcon.left, rcStateIcon.top, ILD_NORMAL);
4780 }
4781 }
4782
4783 /* item icons */
4784 himl = (infoPtr->uView == LV_VIEW_ICON ? infoPtr->himlNormal : infoPtr->himlSmall);
4785 if (himl && item->iImage >= 0 && !IsRectEmpty(&rcIcon))
4786 {
4787 UINT style;
4788
4789 TRACE("iImage=%d\n", item->iImage);
4790
4791 if (item->state & (LVIS_SELECTED | LVIS_CUT) && infoPtr->bFocus)
4793 else
4794 style = ILD_NORMAL;
4795
4796 ImageList_DrawEx(himl, item->iImage, nmlvcd->nmcd.hdc, rcIcon.left, rcIcon.top,
4797 rcIcon.right - rcIcon.left, rcIcon.bottom - rcIcon.top, infoPtr->clrBk,
4798 item->state & LVIS_CUT ? RGB(255, 255, 255) : CLR_DEFAULT,
4799 style | (item->state & LVIS_OVERLAYMASK));
4800 }
4801
4802 /* Don't bother painting item being edited */
4803 if (infoPtr->hwndEdit && item->iItem == infoPtr->nEditLabelItem && item->iSubItem == 0) return;
4804
4805 /* figure out the text drawing flags */
4806 format = (infoPtr->uView == LV_VIEW_ICON ? (focus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS) : LV_SL_DT_FLAGS);
4807 if (infoPtr->uView == LV_VIEW_ICON)
4808 format = (focus ? LV_FL_DT_FLAGS : LV_ML_DT_FLAGS);
4809 else if (item->iSubItem)
4810 {
4811 switch (