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

Go to the source code of this file.

Classes

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

Macros

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

Typedefs

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

Enumerations

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

Functions

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

Variables

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

Macro Definition Documentation

◆ CAPTION_BORDER

#define CAPTION_BORDER   2

Definition at line 400 of file listview.c.

◆ DEBUG_BUFFER_SIZE

#define DEBUG_BUFFER_SIZE   256

Definition at line 343 of file listview.c.

◆ DEBUG_BUFFERS

#define DEBUG_BUFFERS   20

Definition at line 341 of file listview.c.

◆ DEFAULT_COLUMN_WIDTH

#define DEFAULT_COLUMN_WIDTH   128

Definition at line 387 of file listview.c.

◆ DEFAULT_LABEL_WIDTH

#define DEFAULT_LABEL_WIDTH   40

Definition at line 382 of file listview.c.

◆ DISP_TEXT_SIZE

#define DISP_TEXT_SIZE   260

Definition at line 349 of file listview.c.

◆ HEIGHT_PADDING

#define HEIGHT_PADDING   1

Definition at line 355 of file listview.c.

◆ ICON_BOTTOM_PADDING

#define ICON_BOTTOM_PADDING   4

Definition at line 375 of file listview.c.

◆ ICON_LR_HALF

#define ICON_LR_HALF   (ICON_LR_PADDING/2)

Definition at line 379 of file listview.c.

◆ ICON_LR_PADDING

#define ICON_LR_PADDING   16

Definition at line 378 of file listview.c.

◆ ICON_TOP_PADDING

Definition at line 374 of file listview.c.

◆ ICON_TOP_PADDING_HITABLE

#define ICON_TOP_PADDING_HITABLE   2

Definition at line 373 of file listview.c.

◆ ICON_TOP_PADDING_NOTHITABLE

#define ICON_TOP_PADDING_NOTHITABLE   2

Definition at line 372 of file listview.c.

◆ IMAGE_PADDING

#define IMAGE_PADDING   2

Definition at line 393 of file listview.c.

◆ KEY_DELAY

#define KEY_DELAY   450

Definition at line 411 of file listview.c.

◆ LABEL_HOR_PADDING

#define LABEL_HOR_PADDING   5

Definition at line 376 of file listview.c.

◆ LABEL_VERT_PADDING

#define LABEL_VERT_PADDING   7

Definition at line 377 of file listview.c.

◆ LISTVIEW_DUMP

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

Definition at line 414 of file listview.c.

◆ LISTVIEW_SCROLL_ICON_LINE_SIZE

#define LISTVIEW_SCROLL_ICON_LINE_SIZE   37

Definition at line 390 of file listview.c.

◆ LV_FL_DT_FLAGS

Definition at line 404 of file listview.c.

◆ LV_ML_DT_FLAGS

Definition at line 403 of file listview.c.

◆ LV_SL_DT_FLAGS

Definition at line 405 of file listview.c.

◆ MAX_EMPTYTEXT_SELECT_WIDTH

#define MAX_EMPTYTEXT_SELECT_WIDTH   80

Definition at line 384 of file listview.c.

◆ ranges_check

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

Definition at line 3199 of file listview.c.

◆ REPORT_MARGINX

#define REPORT_MARGINX   2

Definition at line 358 of file listview.c.

◆ SB_INTERNAL

#define SB_INTERNAL   -1

Definition at line 346 of file listview.c.

◆ SCROLL_DOWN

#define SCROLL_DOWN   0x8

Definition at line 3933 of file listview.c.

◆ SCROLL_LEFT

#define SCROLL_LEFT   0x1

Definition at line 3930 of file listview.c.

◆ SCROLL_RIGHT

#define SCROLL_RIGHT   0x2

Definition at line 3931 of file listview.c.

◆ SCROLL_UP

#define SCROLL_UP   0x4

Definition at line 3932 of file listview.c.

◆ STATEIMAGEINDEX

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

Definition at line 408 of file listview.c.

◆ TRAILING_HEADER_PADDING

#define TRAILING_HEADER_PADDING   11

Definition at line 397 of file listview.c.

◆ TRAILING_LABEL_PADDING

#define TRAILING_LABEL_PADDING   12

Definition at line 396 of file listview.c.

◆ WIDTH_PADDING

#define WIDTH_PADDING   12

Definition at line 352 of file listview.c.

Typedef Documentation

◆ COLUMN_INFO

◆ DELAYED_ITEM_EDIT

◆ ITEM_ID

Definition at line 167 of file listview.c.

◆ ITEM_INFO

◆ ITEMHDR

◆ ITERATOR

◆ LISTVIEW_INFO

◆ LPITEMHDR

◆ RANGE

◆ RANGES

typedef struct tagRANGES * RANGES

◆ SUBITEM_INFO

Enumeration Type Documentation

◆ notification_mask

Enumerator
NOTIFY_MASK_ITEM_CHANGE 
NOTIFY_MASK_END_LABEL_EDIT 
NOTIFY_MASK_UNMASK_ALL 

Definition at line 210 of file listview.c.

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

Function Documentation

◆ CallWindowProcT()

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

Definition at line 1581 of file listview.c.

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

Referenced by EditLblWndProcT().

◆ column_fill_hditem()

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

Definition at line 8225 of file listview.c.

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

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetColumnT().

◆ CreateEditLabelT()

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

Definition at line 6196 of file listview.c.

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

Referenced by LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateVScroll().

◆ debugtext_t()

static LPCSTR debugtext_t ( LPCWSTR  text,
BOOL  isW 
)
inlinestatic

Definition at line 554 of file listview.c.

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

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

◆ debugtext_tn()

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

Definition at line 560 of file listview.c.

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

Referenced by debuglvcolumn_t(), and debuglvitem_t().

◆ EditLblWndProcA()

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

Definition at line 6179 of file listview.c.

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

Referenced by CreateEditLabelT().

◆ EditLblWndProcT()

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

Definition at line 6108 of file listview.c.

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

Referenced by EditLblWndProcA(), and EditLblWndProcW().

◆ EditLblWndProcW()

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

Definition at line 6162 of file listview.c.

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

Referenced by CreateEditLabelT().

◆ get_ansi_notification()

static int get_ansi_notification ( UINT  unicodeNotificationCode)
static

Definition at line 743 of file listview.c.

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

Referenced by notify_dispinfoT(), and notify_forward_header().

◆ get_next_itemid()

static DWORD get_next_itemid ( const LISTVIEW_INFO infoPtr)
static

Definition at line 1628 of file listview.c.

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

Referenced by LISTVIEW_InsertItemT().

◆ is_assignable_item()

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

Definition at line 4278 of file listview.c.

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

Referenced by LISTVIEW_InsertItemT(), and LISTVIEW_SetItemT().

◆ is_autoarrange()

static BOOL is_autoarrange ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1588 of file listview.c.

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

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

◆ is_redrawing()

◆ is_text()

◆ iterator_destroy()

static void iterator_destroy ( const ITERATOR i)
inlinestatic

Definition at line 1309 of file listview.c.

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

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

◆ iterator_empty()

static void iterator_empty ( ITERATOR i)
inlinestatic

Definition at line 1317 of file listview.c.

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

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

◆ iterator_frameditems()

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

Definition at line 1446 of file listview.c.

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

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

◆ iterator_frameditems_absolute()

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

Definition at line 1347 of file listview.c.

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

Referenced by iterator_frameditems(), and LISTVIEW_MarqueeHighlight().

◆ iterator_next()

static BOOL iterator_next ( ITERATOR i)
inlinestatic

Definition at line 1214 of file listview.c.

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

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

◆ iterator_prev()

static BOOL iterator_prev ( ITERATOR i)
inlinestatic

Definition at line 1254 of file listview.c.

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

Referenced by iterator_remove_common_items(), and LISTVIEW_RefreshList().

◆ iterator_range()

static RANGE iterator_range ( const ITERATOR i)
static

Definition at line 1290 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ iterator_rangeitems()

static void iterator_rangeitems ( ITERATOR i,
RANGE  range 
)
inlinestatic

Definition at line 1326 of file listview.c.

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

Referenced by iterator_frameditems_absolute().

◆ iterator_rangesitems()

static void iterator_rangesitems ( ITERATOR i,
RANGES  ranges 
)
inlinestatic

◆ iterator_remove_common_items()

static BOOL iterator_remove_common_items ( ITERATOR iter1,
ITERATOR iter2 
)
static

Definition at line 1517 of file listview.c.

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

Referenced by LISTVIEW_MarqueeHighlight().

◆ iterator_visibleitems()

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

Definition at line 1462 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_AddGroupSelection()

static BOOL LISTVIEW_AddGroupSelection ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

DESCRIPTION: Adds a block of selections.

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

RETURN: Whether the window is still valid.

Definition at line 3663 of file listview.c.

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

Referenced by LISTVIEW_LButtonDown().

◆ LISTVIEW_ApproximateViewRect()

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

Definition at line 5412 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Arrange()

static BOOL LISTVIEW_Arrange ( LISTVIEW_INFO infoPtr,
INT  nAlignCode 
)
static

Definition at line 2872 of file listview.c.

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

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

◆ LISTVIEW_CalculateItemHeight()

static INT LISTVIEW_CalculateItemHeight ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3097 of file listview.c.

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

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

◆ LISTVIEW_CalculateItemWidth()

static INT LISTVIEW_CalculateItemWidth ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3037 of file listview.c.

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

Referenced by LISTVIEW_UpdateItemSize().

◆ LISTVIEW_CallBackCompare()

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

Definition at line 9412 of file listview.c.

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

Referenced by LISTVIEW_SortItems().

◆ LISTVIEW_CallBackCompareEx()

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

Definition at line 9436 of file listview.c.

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

Referenced by LISTVIEW_SortItems().

◆ LISTVIEW_CancelEditLabel()

static LRESULT LISTVIEW_CancelEditLabel ( LISTVIEW_INFO infoPtr)
static

Definition at line 5527 of file listview.c.

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

Referenced by LISTVIEW_Command(), and LISTVIEW_WindowProc().

◆ LISTVIEW_Command()

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

Definition at line 12058 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Create()

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

Definition at line 9717 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateCheckBoxIL()

static HIMAGELIST LISTVIEW_CreateCheckBoxIL ( const LISTVIEW_INFO infoPtr)
static

Definition at line 8635 of file listview.c.

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

Referenced by LISTVIEW_SetExtendedListViewStyle().

◆ LISTVIEW_CreateDragImage()

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

Definition at line 5553 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateHeader()

static INT LISTVIEW_CreateHeader ( LISTVIEW_INFO infoPtr)
static

Definition at line 1666 of file listview.c.

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

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

◆ LISTVIEW_DelayedEditItem()

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

Definition at line 9603 of file listview.c.

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

Referenced by LISTVIEW_LButtonUp().

◆ LISTVIEW_DeleteAllItems()

static BOOL LISTVIEW_DeleteAllItems ( LISTVIEW_INFO infoPtr,
BOOL  destroy 
)
static

Definition at line 5618 of file listview.c.

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

Referenced by LISTVIEW_Destroy(), and LISTVIEW_WindowProc().

◆ LISTVIEW_DeleteColumn()

static BOOL LISTVIEW_DeleteColumn ( LISTVIEW_INFO infoPtr,
INT  nColumn 
)
static

Definition at line 5755 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_DeleteItem()

static BOOL LISTVIEW_DeleteItem ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
static

Definition at line 5912 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_DeselectAll()

static BOOL LISTVIEW_DeselectAll ( LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 3539 of file listview.c.

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

Referenced by LISTVIEW_LButtonDown(), and LISTVIEW_RButtonDown().

◆ LISTVIEW_DeselectAllSkipItem()

static BOOL LISTVIEW_DeselectAllSkipItem ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
inlinestatic

Definition at line 3528 of file listview.c.

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

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

◆ LISTVIEW_DeselectAllSkipItems()

static BOOL LISTVIEW_DeselectAllSkipItems ( LISTVIEW_INFO infoPtr,
RANGES  toSkip 
)
static

Definition at line 3506 of file listview.c.

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

Referenced by LISTVIEW_DeselectAllSkipItem(), and LISTVIEW_SetGroupSelection().

◆ LISTVIEW_Destroy()

static LRESULT LISTVIEW_Destroy ( LISTVIEW_INFO infoPtr)
static

Definition at line 9773 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_DrawFocusRect()

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

Definition at line 1719 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_DrawItem()

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

Definition at line 4842 of file listview.c.

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

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

◆ LISTVIEW_DrawItemPart()

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

Definition at line 4682 of file listview.c.

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