gtk2: sortindicator implementation

git-svn-id: branches/listviewsortindicator@62519 -
This commit is contained in:
dmitry 2020-01-09 20:12:37 +00:00
parent 2e704b21cb
commit b5e9be41f2
3 changed files with 35 additions and 2 deletions

View File

@ -153,6 +153,9 @@ type
class procedure ColumnSetMinWidth(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AMinWidth: integer); override;
class procedure ColumnSetWidth(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AWidth: Integer); override;
class procedure ColumnSetVisible(const ALV: TCustomListView; const AIndex: Integer; const {%H-}AColumn: TListColumn; const AVisible: Boolean); override;
class procedure ColumnSetSortIndicator(const ALV: TCustomListView; const AIndex: Integer;
const AColumn: TListColumn; const ASortIndicator: TSortIndicator);
override;
// items
class procedure ItemDelete(const ALV: TCustomListView; const AIndex: Integer); override;

View File

@ -506,12 +506,12 @@ var
pFixed: PGTKWidget;
begin
AParent := TWinControl(AControl).Parent;
// DebugLn('LM_AddChild: ',dbgsName(AControl),' ',dbgs(AParent<>nil));
DebugLn('LM_AddChild: ',dbgsName(AControl),' ',dbgs(AParent<>nil));
if not Assigned(AParent) then
Assert(true, Format('Trace: [TGtkWSWinControl.AddControl] %s --> Parent is not assigned', [AControl.ClassName]))
else
begin
// DebugLn(Format('Trace: [TGtkWSWinControl.AddControl] %s --> Calling Add Child: %s', [AParent.ClassName, AControl.ClassName]));
DebugLn(Format('Trace: [TGtkWSWinControl.AddControl] %s --> Calling Add Child: %s', [AParent.ClassName, AControl.ClassName]));
ParentWidget := {%H-}PGtkwidget(AParent.Handle);
pFixed := GetFixedWidget(ParentWidget);

View File

@ -1083,6 +1083,36 @@ begin
end;
end;
class procedure TGtk2WSCustomListView.ColumnSetSortIndicator(
const ALV: TCustomListView; const AIndex: Integer;
const AColumn: TListColumn; const ASortIndicator: TSortIndicator);
const
GtkOrder : array [ TSortIndicator] of TGtkSortType = (0, GTK_SORT_ASCENDING, GTK_SORT_DESCENDING);
var
Widgets: PTVWidgets;
GtkColumn: PGtkTreeViewColumn;
begin
if not WSCheckHandleAllocated(ALV, 'ColumnSetCaption')
then Exit;
GetCommonTreeViewWidgets({%H-}PGtkWidget(ALV.Handle), Widgets);
if not GTK_IS_TREE_VIEW(Widgets^.MainView) then
Exit;
GtkColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), AIndex);
if GtkColumn <> nil then
begin
if ASortIndicator = siNone then
gtk_tree_view_column_set_sort_indicator(GtkColumn, false)
else
begin
gtk_tree_view_column_set_sort_indicator(GtkColumn, true);
gtk_tree_view_column_set_sort_order(GtkColumn, GtkOrder[ASortIndicator]);
end;
end;
end;
class procedure TGtk2WSCustomListView.ItemDelete(const ALV: TCustomListView;
const AIndex: Integer);
var