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

Go to the source code of this file.

Classes

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

Macros

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

Typedefs

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

Enumerations

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

Functions

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

Variables

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

Macro Definition Documentation

◆ CAPTION_BORDER

#define CAPTION_BORDER   2

Definition at line 400 of file listview.c.

◆ DEBUG_BUFFER_SIZE

#define DEBUG_BUFFER_SIZE   256

Definition at line 343 of file listview.c.

◆ DEBUG_BUFFERS

#define DEBUG_BUFFERS   20

Definition at line 341 of file listview.c.

◆ DEFAULT_COLUMN_WIDTH

#define DEFAULT_COLUMN_WIDTH   128

Definition at line 387 of file listview.c.

◆ DEFAULT_LABEL_WIDTH

#define DEFAULT_LABEL_WIDTH   40

Definition at line 382 of file listview.c.

◆ DISP_TEXT_SIZE

#define DISP_TEXT_SIZE   260

Definition at line 349 of file listview.c.

◆ HEIGHT_PADDING

#define HEIGHT_PADDING   1

Definition at line 355 of file listview.c.

◆ ICON_BOTTOM_PADDING

#define ICON_BOTTOM_PADDING   4

Definition at line 375 of file listview.c.

◆ ICON_LR_HALF

#define ICON_LR_HALF   (ICON_LR_PADDING/2)

Definition at line 379 of file listview.c.

◆ ICON_LR_PADDING

#define ICON_LR_PADDING   16

Definition at line 378 of file listview.c.

◆ ICON_TOP_PADDING

Definition at line 374 of file listview.c.

◆ ICON_TOP_PADDING_HITABLE

#define ICON_TOP_PADDING_HITABLE   2

Definition at line 373 of file listview.c.

◆ ICON_TOP_PADDING_NOTHITABLE

#define ICON_TOP_PADDING_NOTHITABLE   2

Definition at line 372 of file listview.c.

◆ IMAGE_PADDING

#define IMAGE_PADDING   2

Definition at line 393 of file listview.c.

◆ KEY_DELAY

#define KEY_DELAY   450

Definition at line 411 of file listview.c.

◆ LABEL_HOR_PADDING

#define LABEL_HOR_PADDING   5

Definition at line 376 of file listview.c.

◆ LABEL_VERT_PADDING

#define LABEL_VERT_PADDING   7

Definition at line 377 of file listview.c.

◆ LISTVIEW_DUMP

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

Definition at line 414 of file listview.c.

◆ LISTVIEW_SCROLL_ICON_LINE_SIZE

#define LISTVIEW_SCROLL_ICON_LINE_SIZE   37

Definition at line 390 of file listview.c.

◆ LV_FL_DT_FLAGS

Definition at line 404 of file listview.c.

◆ LV_ML_DT_FLAGS

Definition at line 403 of file listview.c.

◆ LV_SL_DT_FLAGS

Definition at line 405 of file listview.c.

◆ MAX_EMPTYTEXT_SELECT_WIDTH

#define MAX_EMPTYTEXT_SELECT_WIDTH   80

Definition at line 384 of file listview.c.

◆ ranges_check

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

Definition at line 3193 of file listview.c.

◆ REPORT_MARGINX

#define REPORT_MARGINX   2

Definition at line 358 of file listview.c.

◆ SB_INTERNAL

#define SB_INTERNAL   -1

Definition at line 346 of file listview.c.

◆ SCROLL_DOWN

#define SCROLL_DOWN   0x8

Definition at line 3938 of file listview.c.

◆ SCROLL_LEFT

#define SCROLL_LEFT   0x1

Definition at line 3935 of file listview.c.

◆ SCROLL_RIGHT

#define SCROLL_RIGHT   0x2

Definition at line 3936 of file listview.c.

◆ SCROLL_UP

#define SCROLL_UP   0x4

Definition at line 3937 of file listview.c.

◆ STATEIMAGEINDEX

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

Definition at line 408 of file listview.c.

◆ TRAILING_HEADER_PADDING

#define TRAILING_HEADER_PADDING   11

Definition at line 397 of file listview.c.

◆ TRAILING_LABEL_PADDING

#define TRAILING_LABEL_PADDING   12

Definition at line 396 of file listview.c.

◆ WIDTH_PADDING

#define WIDTH_PADDING   12

Definition at line 352 of file listview.c.

Typedef Documentation

◆ COLUMN_INFO

◆ DELAYED_ITEM_EDIT

◆ ITEM_ID

Definition at line 167 of file listview.c.

◆ ITEM_INFO

◆ ITEMHDR

◆ ITERATOR

◆ LISTVIEW_INFO

◆ LPITEMHDR

◆ RANGE

◆ RANGES

typedef struct tagRANGES * RANGES

◆ SUBITEM_INFO

Enumeration Type Documentation

◆ notification_mask

Enumerator
NOTIFY_MASK_ITEM_CHANGE 
NOTIFY_MASK_END_LABEL_EDIT 
NOTIFY_MASK_UNMASK_ALL 

Definition at line 210 of file listview.c.

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

Function Documentation

◆ CallWindowProcT()

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

Definition at line 1575 of file listview.c.

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

Referenced by EditLblWndProcT().

◆ column_fill_hditem()

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

Definition at line 8227 of file listview.c.

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

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetColumnT().

◆ CreateEditLabelT()

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

Definition at line 6201 of file listview.c.

6202{
6205 HWND hedit;
6206
6207 TRACE("(%p, text=%s, isW=%d)\n", infoPtr, debugtext_t(text, isW), isW);
6208
6209 /* window will be resized and positioned after LVN_BEGINLABELEDIT */
6210 if (isW)
6211 hedit = CreateWindowW(WC_EDITW, text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
6212 else
6213 hedit = CreateWindowA(WC_EDITA, (LPCSTR)text, style, 0, 0, 0, 0, infoPtr->hwndSelf, 0, hinst, 0);
6214
6215 if (!hedit) return 0;
6216
6217 infoPtr->EditWndProc = (WNDPROC)
6220
6221 SendMessageW(hedit, WM_SETFONT, (WPARAM)infoPtr->hFont, FALSE);
6223
6224 return hedit;
6225}
Arabic default style
Definition: afstyles.h:94
#define FALSE
Definition: types.h:117
static LPCSTR debugtext_t(LPCWSTR text, BOOL isW)
Definition: listview.c:548
static LRESULT CALLBACK EditLblWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6167
#define DISP_TEXT_SIZE
Definition: listview.c:349
static LRESULT CALLBACK EditLblWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: listview.c:6184
const WCHAR * text
Definition: package.c:1794
unsigned long DWORD
Definition: ntddk_ex.h:95
static HINSTANCE hinst
Definition: edit.c:551
#define WS_BORDER
Definition: pedump.c:625
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CHILDWINDOW
Definition: pedump.c:639
#define ES_LEFT
Definition: pedump.c:664
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WC_EDITW
Definition: commctrl.h:4692
#define WC_EDITA
Definition: commctrl.h:4691
WNDPROC EditWndProc
Definition: listview.c:267
#define GWLP_WNDPROC
Definition: treelist.c:66
HANDLE HINSTANCE
Definition: typedefs.h:77
uint32_t DWORD_PTR
Definition: typedefs.h:65
UINT_PTR WPARAM
Definition: windef.h:207
#define SetWindowLongPtrA
Definition: winuser.h:5357
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4318
#define GWLP_HINSTANCE
Definition: winuser.h:859
#define EM_SETLIMITTEXT
Definition: winuser.h:2014
#define WM_SETFONT
Definition: winuser.h:1653
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4319
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
#define SetWindowLongPtrW
Definition: winuser.h:5358
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by LISTVIEW_EditLabelT().

◆ customdraw_fill()

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

Definition at line 1029 of file listview.c.

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

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

◆ debug_getbuf()

static char * debug_getbuf ( void  )
static

Definition at line 561 of file listview.c.

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

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

◆ debuglvcolumn_t()

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

Definition at line 662 of file listview.c.

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

Referenced by LISTVIEW_InsertColumnT(), and LISTVIEW_SetColumnT().

◆ debuglvhittestinfo()

static const char * debuglvhittestinfo ( const LVHITTESTINFO lpht)
static

Definition at line 709 of file listview.c.

710{
711 if (!lpht) return "(null)";
712
713 return wine_dbg_sprintf("{pt=%s, flags=0x%x, iItem=%d, iSubItem=%d}",
714 wine_dbgstr_point(&lpht->pt), lpht->flags, lpht->iItem, lpht->iSubItem);
715}
static const char * wine_dbgstr_point(const POINT *ppt)
Definition: atltest.h:138
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296

Referenced by notify_click().

◆ debuglvitem_t()

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

Definition at line 620 of file listview.c.

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

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

◆ debugnmlistview()

static const char * debugnmlistview ( const NMLISTVIEW plvnm)
static

Definition at line 611 of file listview.c.

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

Referenced by notify_listview().

◆ debugrange()

static const char * debugrange ( const RANGE lprng)
inlinestatic

Definition at line 568 of file listview.c.

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

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

◆ debugscrollcode()

static LPCSTR debugscrollcode ( int  nScrollCode)
inlinestatic

Definition at line 718 of file listview.c.

719{
720 switch(nScrollCode)
721 {
722 case SB_LINELEFT: return "SB_LINELEFT";
723 case SB_LINERIGHT: return "SB_LINERIGHT";
724 case SB_PAGELEFT: return "SB_PAGELEFT";
725 case SB_PAGERIGHT: return "SB_PAGERIGHT";
726 case SB_THUMBPOSITION: return "SB_THUMBPOSITION";
727 case SB_THUMBTRACK: return "SB_THUMBTRACK";
728 case SB_ENDSCROLL: return "SB_ENDSCROLL";
729 case SB_INTERNAL: return "SB_INTERNAL";
730 default: return "unknown";
731 }
732}
#define SB_INTERNAL
Definition: listview.c:346
#define SB_THUMBTRACK
Definition: winuser.h:573
#define SB_PAGERIGHT
Definition: winuser.h:571
#define SB_LINERIGHT
Definition: winuser.h:567
#define SB_LINELEFT
Definition: winuser.h:566
#define SB_ENDSCROLL
Definition: winuser.h:574
#define SB_PAGELEFT
Definition: winuser.h:570
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by LISTVIEW_HScroll(), and LISTVIEW_VScroll().

◆ debugscrollinfo()

static const char * debugscrollinfo ( const SCROLLINFO pScrollInfo)
static

Definition at line 574 of file listview.c.

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

Referenced by LISTVIEW_UpdateHScroll(), and LISTVIEW_UpdateVScroll().

◆ debugtext_t()

static LPCSTR debugtext_t ( LPCWSTR  text,
BOOL  isW 
)
inlinestatic

Definition at line 548 of file listview.c.

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

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

◆ debugtext_tn()

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

Definition at line 554 of file listview.c.

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

Referenced by debuglvcolumn_t(), and debuglvitem_t().

◆ EditLblWndProcA()

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

Definition at line 6184 of file listview.c.

6185{
6186 return EditLblWndProcT(hwnd, uMsg, wParam, lParam, FALSE);
6187}
static LRESULT EditLblWndProcT(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
Definition: listview.c:6113

Referenced by CreateEditLabelT().

◆ EditLblWndProcT()

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

Definition at line 6113 of file listview.c.

6114{
6116 BOOL save = TRUE;
6117
6118 TRACE("(hwnd=%p, uMsg=%x, wParam=%lx, lParam=%lx, isW=%d)\n",
6119 hwnd, uMsg, wParam, lParam, isW);
6120
6121 switch (uMsg)
6122 {
6123 case WM_GETDLGCODE:
6125
6126 case WM_DESTROY:
6127 {
6128 WNDPROC editProc = infoPtr->EditWndProc;
6129 infoPtr->EditWndProc = 0;
6131 return CallWindowProcT(editProc, hwnd, uMsg, wParam, lParam, isW);
6132 }
6133
6134 case WM_KEYDOWN:
6135 if (VK_ESCAPE == (INT)wParam)
6136 {
6137 save = FALSE;
6138 break;
6139 }
6140 else if (VK_RETURN == (INT)wParam)
6141 break;
6142
6143 default:
6144 return CallWindowProcT(infoPtr->EditWndProc, hwnd, uMsg, wParam, lParam, isW);
6145 }
6146
6147 /* kill the edit */
6148 if (infoPtr->hwndEdit)
6149 LISTVIEW_EndEditLabelT(infoPtr, save, isW);
6150
6151 SendMessageW(hwnd, WM_CLOSE, 0, 0);
6152 return 0;
6153}
#define TRUE
Definition: types.h:120
static LRESULT CallWindowProcT(WNDPROC proc, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL isW)
Definition: listview.c:1575
static BOOL LISTVIEW_EndEditLabelT(LISTVIEW_INFO *, BOOL, BOOL)
Definition: listview.c:5994
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_CLOSE
Definition: winuser.h:1624
#define DLGC_WANTALLKEYS
Definition: winuser.h:2615
#define VK_RETURN
Definition: winuser.h:2204
#define DLGC_WANTARROWS
Definition: winuser.h:2613
HWND WINAPI GetParent(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1612
#define WM_KEYDOWN
Definition: winuser.h:1718
#define VK_ESCAPE
Definition: winuser.h:2217
#define WM_GETDLGCODE
Definition: winuser.h:1692

Referenced by EditLblWndProcA(), and EditLblWndProcW().

◆ EditLblWndProcW()

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

Definition at line 6167 of file listview.c.

6168{
6169 return EditLblWndProcT(hwnd, uMsg, wParam, lParam, TRUE);
6170}

Referenced by CreateEditLabelT().

◆ get_ansi_notification()

static int get_ansi_notification ( UINT  unicodeNotificationCode)
static

Definition at line 737 of file listview.c.

738{
739 switch (unicodeNotificationCode)
740 {
745 case LVN_GETDISPINFOA:
747 case LVN_SETDISPINFOA:
749 case LVN_ODFINDITEMA:
750 case LVN_ODFINDITEMW: return LVN_ODFINDITEMA;
751 case LVN_GETINFOTIPA:
752 case LVN_GETINFOTIPW: return LVN_GETINFOTIPA;
753 /* header forwards */
754 case HDN_TRACKA:
755 case HDN_TRACKW: return HDN_TRACKA;
756 case HDN_ENDTRACKA:
757 case HDN_ENDTRACKW: return HDN_ENDTRACKA;
758 case HDN_BEGINDRAG: return HDN_BEGINDRAG;
759 case HDN_ENDDRAG: return HDN_ENDDRAG;
762 case HDN_ITEMCHANGEDA:
764 case HDN_ITEMCLICKA:
765 case HDN_ITEMCLICKW: return HDN_ITEMCLICKA;
768 default: break;
769 }
770 FIXME("unknown notification %x\n", unicodeNotificationCode);
771 return unicodeNotificationCode;
772}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define LVN_GETDISPINFOA
Definition: commctrl.h:3158
#define LVN_ODFINDITEMW
Definition: commctrl.h:3150
#define HDN_ITEMCHANGEDW
Definition: commctrl.h:840
#define LVN_GETINFOTIPA
Definition: commctrl.h:3227
#define LVN_SETDISPINFOW
Definition: commctrl.h:3161
#define LVN_GETINFOTIPW
Definition: commctrl.h:3228
#define HDN_BEGINDRAG
Definition: commctrl.h:855
#define HDN_ENDTRACKW
Definition: commctrl.h:850
#define HDN_ITEMCHANGINGA
Definition: commctrl.h:837
#define LVN_BEGINLABELEDITA
Definition: commctrl.h:3140
#define HDN_ITEMCLICKA
Definition: commctrl.h:841
#define HDN_ENDTRACKA
Definition: commctrl.h:849
#define HDN_TRACKW
Definition: commctrl.h:852
#define HDN_ENDDRAG
Definition: commctrl.h:856
#define LVN_ENDLABELEDITW
Definition: commctrl.h:3143
#define LVN_SETDISPINFOA
Definition: commctrl.h:3160
#define LVN_BEGINLABELEDITW
Definition: commctrl.h:3141
#define HDN_ITEMCHANGINGW
Definition: commctrl.h:838
#define LVN_ENDLABELEDITA
Definition: commctrl.h:3142
#define HDN_DIVIDERDBLCLICKW
Definition: commctrl.h:846
#define LVN_ODFINDITEMA
Definition: commctrl.h:3149
#define LVN_GETDISPINFOW
Definition: commctrl.h:3159
#define HDN_TRACKA
Definition: commctrl.h:851
#define HDN_ITEMCHANGEDA
Definition: commctrl.h:839
#define HDN_ITEMCLICKW
Definition: commctrl.h:842
#define HDN_DIVIDERDBLCLICKA
Definition: commctrl.h:845

Referenced by notify_dispinfoT(), and notify_forward_header().

◆ get_next_itemid()

static DWORD get_next_itemid ( const LISTVIEW_INFO infoPtr)
static

Definition at line 1622 of file listview.c.

1623{
1625
1626 if (count > 0)
1627 {
1628 ITEM_ID *lpID = DPA_GetPtr(infoPtr->hdpaItemIds, count - 1);
1629 return lpID->id + 1;
1630 }
1631 return 0;
1632}
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define DPA_GetPtrCount(hdpa)
Definition: commctrl.h:4960
#define DPA_GetPtr
Definition: commctrl.h:5
UINT id
Definition: listview.c:180

Referenced by LISTVIEW_InsertItemT().

◆ is_assignable_item()

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

Definition at line 4283 of file listview.c.

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

Referenced by LISTVIEW_InsertItemT(), and LISTVIEW_SetItemT().

◆ is_autoarrange()

static BOOL is_autoarrange ( const LISTVIEW_INFO infoPtr)
inlinestatic

Definition at line 1582 of file listview.c.

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

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

◆ is_redrawing()

◆ is_text()

◆ iterator_destroy()

static void iterator_destroy ( const ITERATOR i)
inlinestatic

Definition at line 1303 of file listview.c.

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

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

◆ iterator_empty()

static void iterator_empty ( ITERATOR i)
inlinestatic

Definition at line 1311 of file listview.c.

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

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

◆ iterator_frameditems()

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

Definition at line 1440 of file listview.c.

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

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

◆ iterator_frameditems_absolute()

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

Definition at line 1341 of file listview.c.

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

Referenced by iterator_frameditems(), and LISTVIEW_MarqueeHighlight().

◆ iterator_next()

static BOOL iterator_next ( ITERATOR i)
inlinestatic

Definition at line 1208 of file listview.c.

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

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

◆ iterator_prev()

static BOOL iterator_prev ( ITERATOR i)
inlinestatic

Definition at line 1248 of file listview.c.

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

Referenced by iterator_remove_common_items(), and LISTVIEW_RefreshList().

◆ iterator_range()

static RANGE iterator_range ( const ITERATOR i)
static

Definition at line 1284 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ iterator_rangeitems()

static void iterator_rangeitems ( ITERATOR i,
RANGE  range 
)
inlinestatic

Definition at line 1320 of file listview.c.

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

Referenced by iterator_frameditems_absolute().

◆ iterator_rangesitems()

static void iterator_rangesitems ( ITERATOR i,
RANGES  ranges 
)
inlinestatic

◆ iterator_remove_common_items()

static BOOL iterator_remove_common_items ( ITERATOR iter1,
ITERATOR iter2 
)
static

Definition at line 1511 of file listview.c.

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

Referenced by LISTVIEW_MarqueeHighlight().

◆ iterator_visibleitems()

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

Definition at line 1456 of file listview.c.

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

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

Referenced by LISTVIEW_LButtonDown().

◆ LISTVIEW_ApproximateViewRect()

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

Definition at line 5417 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Arrange()

static BOOL LISTVIEW_Arrange ( LISTVIEW_INFO infoPtr,
INT  nAlignCode 
)
static

Definition at line 2866 of file listview.c.

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

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

◆ LISTVIEW_CalculateItemHeight()

static INT LISTVIEW_CalculateItemHeight ( const LISTVIEW_INFO infoPtr)
static

Definition at line 3091 of file listview.c.

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

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

9415{
9416 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
9417 ITEM_INFO* lv_first = DPA_GetPtr( first, 0 );
9418 ITEM_INFO* lv_second = DPA_GetPtr( second, 0 );
9419
9420 /* Forward the call to the client defined callback */
9421 return (infoPtr->pfnCompare)( lv_first->lParam , lv_second->lParam, infoPtr->lParamSort );
9422}
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 9438 of file listview.c.

9439{
9440 LISTVIEW_INFO *infoPtr = (LISTVIEW_INFO *)lParam;
9441 INT first_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, first );
9442 INT second_idx = DPA_GetPtrIndex( infoPtr->hdpaItems, second );
9443
9444 /* Forward the call to the client defined callback */
9445 return (infoPtr->pfnCompare)( first_idx, second_idx, infoPtr->lParamSort );
9446}
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 5532 of file listview.c.

5533{
5534 if (infoPtr->hwndEdit)
5535 {
5536 /* handle value will be lost after LISTVIEW_EndEditLabelT */
5537 HWND edit = infoPtr->hwndEdit;
5538
5540 SendMessageW(edit, WM_CLOSE, 0, 0);
5541 }
5542
5543 return TRUE;
5544}
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 12063 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_Create()

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

Definition at line 9719 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateCheckBoxIL()

static HIMAGELIST LISTVIEW_CreateCheckBoxIL ( const LISTVIEW_INFO infoPtr)
static

Definition at line 8637 of file listview.c.

8638{
8639 HDC hdc_wnd, hdc;
8640 HBITMAP hbm_im, hbm_mask, hbm_orig;
8641 RECT rc;
8642 HBRUSH hbr_white = GetStockObject(WHITE_BRUSH);
8643 HBRUSH hbr_black = GetStockObject(BLACK_BRUSH);
8645
8647 ILC_COLOR | ILC_MASK, 2, 2);
8648 hdc_wnd = GetDC(infoPtr->hwndSelf);
8649 hdc = CreateCompatibleDC(hdc_wnd);
8652 ReleaseDC(infoPtr->hwndSelf, hdc_wnd);
8653
8655 hbm_orig = SelectObject(hdc, hbm_mask);
8656 FillRect(hdc, &rc, hbr_white);
8657 InflateRect(&rc, -2, -2);
8658 FillRect(hdc, &rc, hbr_black);
8659
8660 SelectObject(hdc, hbm_im);
8662 SelectObject(hdc, hbm_orig);
8663 ImageList_Add(himl, hbm_im, hbm_mask);
8664
8665 SelectObject(hdc, hbm_im);
8667 SelectObject(hdc, hbm_orig);
8668 ImageList_Add(himl, hbm_im, hbm_mask);
8669
8670 DeleteObject(hbm_mask);
8671 DeleteObject(hbm_im);
8672 DeleteDC(hdc);
8673
8674 return himl;
8675}
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:1016
#define DFCS_MONO
Definition: winuser.h:511
#define SM_CXSMICON
Definition: winuser.h:1015
#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 5558 of file listview.c.

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

Referenced by LISTVIEW_WindowProc().

◆ LISTVIEW_CreateHeader()

static INT LISTVIEW_CreateHeader ( LISTVIEW_INFO infoPtr)
static

Definition at line 1660 of file listview.c.

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

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

◆ LISTVIEW_DelayedEditItem()

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

Definition at line 9605 of file listview.c.

9606{
9607 DELAYED_ITEM_EDIT *editItem = (DELAYED_ITEM_EDIT *)idEvent;
9609
9610 KillTimer(hwnd, idEvent);
9611 editItem->fEnabled = FALSE;
9612 /* check if the item is still selected */
9613 if (infoPtr->bFocus && LISTVIEW_GetItemState(infoPtr, editItem->iItem, LVIS_SELECTED))
9614 LISTVIEW_EditLabelT(infoPtr, editItem->iItem, TRUE);
9615}
static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT)
Definition: listview.c:7401
static HWND LISTVIEW_EditLabelT(LISTVIEW_INFO *infoPtr, INT nItem, BOOL isW)
Definition: listview.c:6240
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 5623 of file listview.c.

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

Referenced by LISTVIEW_Destroy(), and LISTVIEW_WindowProc().

◆ LISTVIEW_DeleteColumn()

static BOOL LISTVIEW_DeleteColumn ( LISTVIEW_INFO infoPtr,
INT  nColumn 
)
static

Definition at line 5760 of file listview.c.

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

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

3545{
3546 return LISTVIEW_DeselectAllSkipItem(infoPtr, -1);
3547}
static BOOL LISTVIEW_DeselectAllSkipItem(LISTVIEW_INFO *infoPtr, INT nItem)
Definition: listview.c:3533

Referenced by LISTVIEW_LButtonDown(), and LISTVIEW_RButtonDown().

◆ LISTVIEW_DeselectAllSkipItem()

static BOOL LISTVIEW_DeselectAllSkipItem ( LISTVIEW_INFO infoPtr,
INT  nItem 
)
inlinestatic

Definition at line 3533 of file listview.c.

3534{
3535 RANGES toSkip;
3536
3537 if (!(toSkip = ranges_create(1))) return FALSE;
3538 if (nItem != -1) ranges_additem(toSkip, nItem);
3539 LISTVIEW_DeselectAllSkipItems(infoPtr, toSkip);
3540 ranges_destroy(toSkip);
3541 return TRUE;
3542}
static BOOL LISTVIEW_DeselectAllSkipItems(LISTVIEW_INFO *infoPtr, RANGES toSkip)
Definition: listview.c:3511

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

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

Referenced by LISTVIEW_DeselectAllSkipItem(), and LISTVIEW_SetGroupSelection().

◆ LISTVIEW_Destroy()

static LRESULT LISTVIEW_Destroy ( LISTVIEW_INFO infoPtr)
static

Definition at line 9775 of file listview.c.

9776{
9777 HTHEME theme = GetWindowTheme(infoPtr->hwndSelf);
9778 CloseThemeData(theme);
9779
9780 /* delete all items */
9781 LISTVIEW_DeleteAllItems(infoPtr, TRUE);
9782
9783 return 0;
9784}
static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr, BOOL destroy)
Definition: listview.c:5623
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 1713 of file listview.c.

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

Referenced by LISTVIEW_Refresh().

◆ LISTVIEW_DrawItem()

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

Definition at line 4847 of file listview.c.

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

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

◆ LISTVIEW_DrawItemPart()

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

Definition at line 4687 of file listview.c.

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