Gtk3: implemented TGtk3ListBox.GetScrollWidth(), TGtk3WSCustomListBox.GetScrollWidth()

This commit is contained in:
zeljan1 2025-01-09 22:38:34 +01:00
parent b0a562be0d
commit 966b895003
2 changed files with 9 additions and 1 deletions

View File

@ -555,6 +555,7 @@ type
function GetItemRect(const AIndex: integer): TRect;
function GetIndexAtXY(const X, Y: integer): integer;
function GetItemSelected(const AIndex: Integer): Boolean;
function GetScrollWidth: integer;
procedure SelectItem(const AIndex: Integer; ASelected: Boolean);
procedure SetTopIndex(const AIndex: Integer);
property ItemIndex: Integer read GetItemIndex write SetItemIndex;
@ -5642,7 +5643,6 @@ begin
AModel := PGtkTreeView(getContainerWidget)^.model;
if AModel = nil then
exit;
if AModel^.iter_nth_child(@Iter, nil, AIndex) then
begin
ACol := gtk_tree_view_get_column(PGtkTreeView(getContainerWidget), 0)^;
@ -5694,6 +5694,11 @@ begin
Result := ASelection^.iter_is_selected(@Item);
end;
function TGtk3ListBox.GetScrollWidth: integer;
begin
Result := Round(getHorizontalScrollbar^.get_adjustment^.get_upper);
end;
procedure TGtk3ListBox.SelectItem(const AIndex: Integer; ASelected: Boolean);
var
ASelection: PGtkTreeSelection;

View File

@ -434,6 +434,9 @@ class function TGtk3WSCustomListBox.GetScrollWidth(
const ACustomListBox: TCustomListBox): Integer;
begin
Result := 0;
if not WSCheckHandleAllocated(ACustomListBox, 'GetScrollWidth') then
Exit;
Result := TGtk3ListBox(ACustomListBox.Handle).GetScrollWidth;
end;
class function TGtk3WSCustomListBox.GetSelCount(const ACustomListBox: TCustomListBox): integer;