lcl: adding sortIndicator to the listview

git-svn-id: branches/listviewsortindicator@62516 -
This commit is contained in:
dmitry 2020-01-09 19:36:53 +00:00
parent 2ce8ea42d4
commit 5c82bc971e
3 changed files with 28 additions and 0 deletions

View File

@ -1187,6 +1187,8 @@ type
TWidth = 0..MaxInt;
TSortIndicator = (siNone, siAscending, siDescending);
TListColumn = class(TCollectionItem)
private
FAlignment: TAlignment;
@ -1198,6 +1200,7 @@ type
FWidth: TWidth;
FImageIndex: TImageIndex;
FTag: PtrInt;
FSortIndicator: TSortIndicator;
function GetWidth: TWidth;
procedure WSCreateColumn;
procedure WSDestroyColumn;
@ -1211,6 +1214,7 @@ type
procedure SetCaption(const AValue: TTranslateString);
procedure SetAlignment(const AValue: TAlignment);
procedure SetImageIndex(const AValue: TImageIndex);
procedure SetSortIndicator(AValue: TSortIndicator);
protected
procedure SetIndex(AValue: Integer); override;
function GetDisplayName: string; override;
@ -1230,6 +1234,7 @@ type
property Tag: PtrInt read FTag write FTag default 0;
property Visible: Boolean read FVisible write SetVisible default true;
property Width: TWidth read GetWidth write SetWidth default 50;
property SortIndicator: TSortIndicator read FSortIndicator write SetSortIndicator default siNone;
end;

View File

@ -95,6 +95,8 @@ begin
end;
WSC.ColumnSetImage(LV, Index, Self, FImageIndex);
WSC.ColumnSetVisible(LV, Index, Self, FVisible);
if FSortIndicator<>siNone then
WSC.ColumnSetSortIndicator(LV, Index, Self, FSortIndicator);
end;
procedure TListColumn.WSDestroyColumn;
@ -139,6 +141,19 @@ begin
Result := FWidth;
end;
procedure TListColumn.SetSortIndicator(AValue: TSortIndicator);
var
LV: TCustomListView;
begin
if FSortIndicator = AValue then Exit;
FSortIndicator := AValue;
Changed(False);
if not WSUpdateAllowed then Exit;
LV := TListColumns(Collection).FOwner;
TWSCustomListViewClass(LV.WidgetSetClass).ColumnSetSortIndicator(LV, Index, Self, FSortIndicator);
end;
procedure TListColumn.SetAlignment(const AValue: TAlignment);
var
LV: TCustomListView;

View File

@ -120,6 +120,7 @@ type
class procedure ColumnSetMinWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AMinWidth: integer); virtual;
class procedure ColumnSetWidth(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AWidth: Integer); virtual;
class procedure ColumnSetVisible(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const AVisible: Boolean); virtual;
class procedure ColumnSetSortIndicator(const ALV: TCustomListView; const AIndex: Integer; const AColumn: TListColumn; const ASortIndicator: TSortIndicator); virtual;
// Item
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); virtual;
@ -539,6 +540,13 @@ class procedure TWSCustomListView.ColumnSetVisible(const ALV: TCustomListView;
begin
end;
class procedure TWSCustomListView.ColumnSetSortIndicator(
const ALV: TCustomListView; const AIndex: Integer;
const AColumn: TListColumn; const ASortIndicator: TSortIndicator);
begin
end;
class procedure TWSCustomListView.ItemDelete(const ALV: TCustomListView;
const AIndex: Integer);
begin