Skip to content

Commit

Permalink
Merge commit '111a4d8b467e9fefa69c0e94277db0181931e87e' into alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
salvadorbs committed Jan 2, 2024
2 parents 50d766c + 111a4d8 commit cd150d7
Show file tree
Hide file tree
Showing 14 changed files with 1,070 additions and 833 deletions.
23 changes: 12 additions & 11 deletions Source/VirtualTrees.AccessibilityFactory.pas
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ TVTAccessibilityFactory = class(TObject)
public
constructor Create;
destructor Destroy; override;
function CreateIAccessible(ATree: TBaseVirtualTree): IAccessible;
function CreateIAccessible(ATree: TCustomControl): IAccessible;
class function GetAccessibilityFactory: TVTAccessibilityFactory; static;
procedure RegisterAccessibleProvider(const AProvider: IVTAccessibleProvider);
procedure UnRegisterAccessibleProvider(const AProvider: IVTAccessibleProvider);
end;


implementation

{ TVTAccessibilityFactory }
Expand All @@ -73,11 +73,11 @@ constructor TVTAccessibilityFactory.Create;
FAccessibleProviders.Clear;
end;

function TVTAccessibilityFactory.CreateIAccessible(
ATree: TBaseVirtualTree): IAccessible;
function TVTAccessibilityFactory.CreateIAccessible(ATree: TCustomControl): IAccessible;
var
I: Integer;
TmpIAccessible: IAccessible;
lTree: TBaseVirtualTree;
// returns an IAccessible.
// 1. If the Accessible property of the passed-in tree is nil,
// the first registered element will be returned.
Expand All @@ -89,23 +89,24 @@ function TVTAccessibilityFactory.CreateIAccessible(
// The index for these should all be greater than 0, e g the IAccessible for the tree itself should always be registered first, then any IAccessible items.
begin
Result := nil;
if ATree <> nil then
lTree := (ATree as TBaseVirtualTree);
if lTree <> nil then
begin
if ATree.Accessible = nil then
if lTree.Accessible = nil then
begin
if FAccessibleProviders.Count > 0 then
begin
Result := IVTAccessibleProvider(FAccessibleProviders.Items[0]).CreateIAccessible(ATree);
Result := IVTAccessibleProvider(FAccessibleProviders.Items[0]).CreateIAccessible(lTree);
Exit;
end;
end;
if ATree.AccessibleItem = nil then
if lTree.AccessibleItem = nil then
begin
if FAccessibleProviders.Count > 0 then
begin
for I := FAccessibleProviders.Count - 1 downto 1 do
begin
TmpIAccessible := IVTAccessibleProvider(FAccessibleProviders.Items[I]).CreateIAccessible(ATree);
TmpIAccessible := IVTAccessibleProvider(FAccessibleProviders.Items[I]).CreateIAccessible(lTree);
if TmpIAccessible <> nil then
begin
Result := TmpIAccessible;
Expand All @@ -114,12 +115,12 @@ function TVTAccessibilityFactory.CreateIAccessible(
end;
if TmpIAccessible = nil then
begin
Result := IVTAccessibleProvider(FAccessibleProviders.Items[0]).CreateIAccessible(ATree);
Result := IVTAccessibleProvider(FAccessibleProviders.Items[0]).CreateIAccessible(lTree);
end;
end;
end
else
Result := ATree.AccessibleItem;
Result := lTree.AccessibleItem;
end;
end;

Expand Down
Loading

0 comments on commit cd150d7

Please sign in to comment.