mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 12:39:18 +02:00
Carbon: Fixes AXFocusable support and starts AXChildren support
git-svn-id: trunk@34703 -
This commit is contained in:
parent
d4dc90bb8e
commit
729c0297aa
@ -163,11 +163,16 @@ var
|
|||||||
lAXRole, lInputStr, lOutputStr: CFStringRef;
|
lAXRole, lInputStr, lOutputStr: CFStringRef;
|
||||||
lInputPasStr: string;
|
lInputPasStr: string;
|
||||||
lInputMutableArray: CFMutableArrayRef;
|
lInputMutableArray: CFMutableArrayRef;
|
||||||
lOutputBool: CFBooleanRef;
|
lOutputBool: Boolean;
|
||||||
lLazControl: TControl;
|
lLazControl: TControl;
|
||||||
lLazAXRole: TLazAccessibilityRole;
|
lLazAXRole: TLazAccessibilityRole;
|
||||||
Command: HICommandExtended;
|
Command: HICommandExtended;
|
||||||
EventKind: UInt32;
|
EventKind: UInt32;
|
||||||
|
// array
|
||||||
|
lArray: CFMutableArrayRef;
|
||||||
|
lElement: AXUIElementRef;
|
||||||
|
lCount: Integer;
|
||||||
|
i: Integer;
|
||||||
const SName = 'CarbonControl_Accessibility';
|
const SName = 'CarbonControl_Accessibility';
|
||||||
begin
|
begin
|
||||||
{$IF defined(VerboseControlEvent) or defined(VerboseAccessibilityEvent)}
|
{$IF defined(VerboseControlEvent) or defined(VerboseAccessibilityEvent)}
|
||||||
@ -202,6 +207,12 @@ begin
|
|||||||
lOutputStr := CFSTR('AXFocused');
|
lOutputStr := CFSTR('AXFocused');
|
||||||
CFArrayAppendValue(lInputMutableArray, lOutputStr);
|
CFArrayAppendValue(lInputMutableArray, lOutputStr);
|
||||||
end;
|
end;
|
||||||
|
lCount := lLazControl.GetChildAccessibleObjectsCount;
|
||||||
|
if lCount > 0 then
|
||||||
|
begin
|
||||||
|
lOutputStr := CFSTR('AXChildren');
|
||||||
|
CFArrayAppendValue(lInputMutableArray, lOutputStr);
|
||||||
|
end;
|
||||||
end; // kEventAccessibleGetAllAttributeNames
|
end; // kEventAccessibleGetAllAttributeNames
|
||||||
kEventAccessibleGetNamedAttribute:
|
kEventAccessibleGetNamedAttribute:
|
||||||
begin
|
begin
|
||||||
@ -262,14 +273,38 @@ begin
|
|||||||
SizeOf(CFStringRef), @lOutputStr);
|
SizeOf(CFStringRef), @lOutputStr);
|
||||||
FreeCFString(lOutputStr);
|
FreeCFString(lOutputStr);
|
||||||
end
|
end
|
||||||
|
//if (CFStringCompare(lInputStr, kAXFocusedAttribute, 0) = kCFCompareEqualTo) then
|
||||||
else if lInputPasStr = 'AXFocused' then
|
else if lInputPasStr = 'AXFocused' then
|
||||||
begin
|
begin
|
||||||
if not (lLazControl is TWinControl) then lOutputBool := kCFBooleanFalse
|
if not (lLazControl is TWinControl) then lOutputBool := False
|
||||||
else if TWinControl(lLazControl).Focused then lOutputBool := kCFBooleanTrue
|
else if TWinControl(lLazControl).Focused then lOutputBool := True
|
||||||
else lOutputBool := kCFBooleanFalse;
|
else lOutputBool := False;
|
||||||
|
|
||||||
SetEventParameter(AEvent, kEventParamAccessibleAttributeValue, typeCFBooleanRef,
|
{$IF defined(VerboseControlEvent) or defined(VerboseAccessibilityEvent)}
|
||||||
SizeOf(CFBooleanRef), @lOutputBool);
|
DebugLn('CarbonControl_Accessibility AXFocused');
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
SetEventParameter(AEvent, kEventParamAccessibleAttributeValue, typeBoolean,
|
||||||
|
SizeOf(Boolean), @lOutputBool);
|
||||||
|
|
||||||
|
Result := noErr;
|
||||||
|
end
|
||||||
|
else if (CFStringCompare(lInputStr, CFSTR('AXChildren'), 0) = kCFCompareEqualTo) then // kAXChildrenAttribute
|
||||||
|
begin
|
||||||
|
// Create and return an array of AXUIElements describing the children of this view.
|
||||||
|
lCount := lLazControl.GetChildAccessibleObjectsCount;
|
||||||
|
lArray := CFArrayCreateMutable( kCFAllocatorDefault, lCount, @kCFTypeArrayCallBacks);
|
||||||
|
for i := 0 to lCount - 1 do
|
||||||
|
begin
|
||||||
|
lElement := MacOSAll.AXUIElementCreateSystemWide();
|
||||||
|
CFArrayAppendValue(lArray, lElement);
|
||||||
|
CFRelease(lElement);
|
||||||
|
end;
|
||||||
|
|
||||||
|
SetEventParameter(AEvent, kEventParamAccessibleAttributeValue, typeCFTypeRef,
|
||||||
|
SizeOf(lArray), @lArray);
|
||||||
|
CFRelease(lArray);
|
||||||
|
Result := noErr;
|
||||||
end;
|
end;
|
||||||
end; // kEventAccessibleGetNamedAttribute
|
end; // kEventAccessibleGetNamedAttribute
|
||||||
end; // case EventKind of
|
end; // case EventKind of
|
||||||
|
Loading…
Reference in New Issue
Block a user