mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 12:52:11 +02:00
gtk2: simplify listview autosize code
git-svn-id: trunk@24989 -
This commit is contained in:
parent
8118963651
commit
2eda39d58c
@ -719,10 +719,14 @@ end;
|
||||
|
||||
class procedure TGtk2WSCustomListView.ColumnSetAutoSize(const ALV: TCustomListView;
|
||||
const AIndex: Integer; const AColumn: TListColumn; const AAutoSize: Boolean);
|
||||
const
|
||||
SizingMap: array[Boolean] of TGtkTreeViewColumnSizing = (
|
||||
GTK_TREE_VIEW_COLUMN_FIXED,
|
||||
GTK_TREE_VIEW_COLUMN_AUTOSIZE
|
||||
);
|
||||
var
|
||||
Widgets: PTVWidgets;
|
||||
GtkColumn: PGtkTreeViewColumn;
|
||||
ColSizing: TGtkTreeViewColumnSizing;
|
||||
begin
|
||||
if not WSCheckHandleAllocated(ALV, 'ColumnSetAutoSize')
|
||||
then Exit;
|
||||
@ -735,15 +739,9 @@ begin
|
||||
GtkColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), AIndex);
|
||||
if GtkColumn <> nil then
|
||||
begin
|
||||
if AAutoSize then
|
||||
ColSizing := GTK_TREE_VIEW_COLUMN_AUTOSIZE
|
||||
else
|
||||
ColSizing := GTK_TREE_VIEW_COLUMN_FIXED;
|
||||
|
||||
gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN (GtkColumn), True);
|
||||
gtk_tree_view_column_set_sizing(GtkColumn, ColSizing);
|
||||
gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(GtkColumn), True);
|
||||
gtk_tree_view_column_set_sizing(GtkColumn, SizingMap[AAutoSize]);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
class procedure TGtk2WSCustomListView.ColumnSetCaption(const ALV: TCustomListView;
|
||||
|
Loading…
Reference in New Issue
Block a user