From 78b457b59d673621886ac20633045a9d7a967fdc Mon Sep 17 00:00:00 2001 From: dmitry Date: Thu, 9 Jan 2020 19:37:10 +0000 Subject: [PATCH] win32: implementation of sortindicator git-svn-id: branches/listviewsortindicator@62517 - --- lcl/interfaces/win32/win32wscomctrls.pp | 1 + .../win32/win32wscustomlistview.inc | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/lcl/interfaces/win32/win32wscomctrls.pp b/lcl/interfaces/win32/win32wscomctrls.pp index 9741a9034d..358ac77d58 100644 --- a/lcl/interfaces/win32/win32wscomctrls.pp +++ b/lcl/interfaces/win32/win32wscomctrls.pp @@ -137,6 +137,7 @@ type class procedure ColumnSetMinWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AMinWidth: integer); override; class procedure ColumnSetWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AWidth: Integer); override; class procedure ColumnSetVisible(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AVisible: Boolean); override; + class procedure ColumnSetSortIndicator(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AAndicator: TSortIndicator); override; // items class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); override; diff --git a/lcl/interfaces/win32/win32wscustomlistview.inc b/lcl/interfaces/win32/win32wscustomlistview.inc index 4f086da451..06c8d5f3a2 100644 --- a/lcl/interfaces/win32/win32wscustomlistview.inc +++ b/lcl/interfaces/win32/win32wscustomlistview.inc @@ -484,6 +484,28 @@ begin else ListView_SetColumnWidth(ALV.Handle, AIndex, 0); end; +class procedure TWin32WSCustomListView.ColumnSetSortIndicator( + const ALV: TCustomListView; const AIndex: Integer; + const AColumn: TListColumn; const AAndicator: TSortIndicator); +var + Hdr: HWND; + Itm: THDITEM; +begin + if not WSCheckHandleAllocated(ALV, 'ColumnSetSortIndicator') + then Exit; + + Hdr := ListView_GetHeader(ALV.Handle); + FillChar(itm, sizeof(itm),0); + itm.mask := HDI_FORMAT; + Header_GetItem(Hdr, AIndex, Itm); + case AAndicator of + siNone: itm.fmt := itm.fmt and (not (HDF_SORTDOWN or HDF_SORTUP)); + siAscending: itm.fmt := (itm.fmt or HDF_SORTUP) and (not HDF_SORTDOWN); + siDescending: itm.fmt := (itm.fmt or HDF_SORTDOWN) and (not HDF_SORTUP); + end; + Header_SetItem(Hdr, AIndex, Itm); +end; + //////////////////////////////////////////////////////////////////////////////// // Item code ////////////////////////////////////////////////////////////////////////////////