win32: implementation of sortindicator

git-svn-id: branches/listviewsortindicator@62517 -
This commit is contained in:
dmitry 2020-01-09 19:37:10 +00:00
parent 5c82bc971e
commit 78b457b59d
2 changed files with 23 additions and 0 deletions

View File

@ -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;

View File

@ -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
////////////////////////////////////////////////////////////////////////////////