Gtk3: implemented TGtk3ListView.ShowRow(), partially implemented TGtk3WSComCtrls.ItemShow

This commit is contained in:
zeljan1 2025-02-05 10:25:34 +01:00
parent 26a8fe1765
commit cd67b9603c
2 changed files with 21 additions and 1 deletions

View File

@ -654,7 +654,7 @@ type
const AIsSet: Boolean);
function ItemGetState(const AIndex: Integer; const {%H-}AItem: TListItem; const AState: TListItemState;
out AIsSet: Boolean): Boolean;
procedure ScrollToRow(const ARow: integer);
procedure UpdateImageCellsSize;
property Images: TFPList read FImages write FImages;
@ -7585,6 +7585,18 @@ begin
end;
end;
procedure TGtk3ListView.ScrollToRow(const ARow: integer);
var
ATreePath: PGtkTreePath;
begin
ATreePath := gtk_tree_path_new_from_indices(ARow, [-1]);
if IsTreeView then
gtk_tree_view_scroll_to_cell(PGtkTreeView(getContainerWidget), ATreePath, nil, False, 0.0, 0.0)
else
gtk_icon_view_scroll_to_path(PGtkIconView(getContainerWidget), ATreePath, False, 0.0, 0.0);
gtk_tree_path_free(ATreePath);
end;
procedure TGtk3ListView.UpdateImageCellsSize;
begin
// must get renderer via property

View File

@ -732,6 +732,12 @@ class procedure TGtk3WSCustomListView.ItemShow(const ALV: TCustomListView;
begin
DebugLn('TGtk3WSCustomListView.ItemShow ');
// inherited ItemShow(ALV, AIndex, AItem, PartialOK);
if ALV.HandleAllocated then
begin
//TODO: Hide/Show items
if not PartialOk then
TGtk3ListView(ALV.Handle).ScrollToRow(AIndex);
end;
end;
class function TGtk3WSCustomListView.ItemGetPosition(
@ -767,6 +773,8 @@ class function TGtk3WSCustomListView.GetBoundingRect(const ALV: TCustomListView
begin
DebugLn('TGtk3WSCustomListView.GetBoundingRect ');
Result := Rect(0, 0, 0, 0);
if ALV.HandleAllocated then
Result := TGtk3ListView(ALV.handle).getClientBounds;
end;
class function TGtk3WSCustomListView.GetDropTarget(const ALV: TCustomListView