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

View File

@ -95,6 +95,8 @@ begin
end; end;
WSC.ColumnSetImage(LV, Index, Self, FImageIndex); WSC.ColumnSetImage(LV, Index, Self, FImageIndex);
WSC.ColumnSetVisible(LV, Index, Self, FVisible); WSC.ColumnSetVisible(LV, Index, Self, FVisible);
if FSortIndicator<>siNone then
WSC.ColumnSetSortIndicator(LV, Index, Self, FSortIndicator);
end; end;
procedure TListColumn.WSDestroyColumn; procedure TListColumn.WSDestroyColumn;
@ -139,6 +141,19 @@ begin
Result := FWidth; Result := FWidth;
end; 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); procedure TListColumn.SetAlignment(const AValue: TAlignment);
var var
LV: TCustomListView; 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 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 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 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 // Item
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); virtual; class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); virtual;
@ -539,6 +540,13 @@ class procedure TWSCustomListView.ColumnSetVisible(const ALV: TCustomListView;
begin begin
end; 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; class procedure TWSCustomListView.ItemDelete(const ALV: TCustomListView;
const AIndex: Integer); const AIndex: Integer);
begin begin