Moves up accessibility events to all Carbon controls and improves the implementation of the accessibility event handler. Adds customized accessibility descriptions to two basic controls in the Initial Setup Dialog

git-svn-id: trunk@34697 -
This commit is contained in:
sekelsenmat 2012-01-10 20:42:11 +00:00
parent 355493350f
commit e1d0c8ab65
5 changed files with 77 additions and 61 deletions

View File

@ -18,12 +18,13 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideRight.Control = Splitter1
AnchorSideBottom.Control = BtnPanel
Left = 6
Height = 282
Height = 289
Top = 54
Width = 159
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
DefaultItemHeight = 18
Images = ImageList1
ReadOnly = True
ScrollBars = ssNone
@ -39,7 +40,7 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideBottom.Control = PropertiesTreeView
AnchorSideBottom.Side = asrBottom
Left = 165
Height = 282
Height = 289
Top = 54
Width = 5
Align = alNone
@ -47,21 +48,21 @@ object InitialSetupDialog: TInitialSetupDialog
end
object BtnPanel: TPanel
Left = 10
Height = 29
Top = 346
Height = 22
Top = 353
Width = 600
Align = alBottom
AutoSize = True
BorderSpacing.Around = 10
BevelOuter = bvNone
ClientHeight = 29
ClientHeight = 22
ClientWidth = 600
TabOrder = 2
object StartIDEBitBtn: TBitBtn
Left = 495
Height = 29
Left = 489
Height = 22
Top = 0
Width = 105
Width = 111
Align = alRight
AutoSize = True
Caption = 'StartIDEBitBtn'
@ -79,7 +80,7 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideBottom.Control = Splitter1
AnchorSideBottom.Side = asrBottom
Left = 170
Height = 282
Height = 289
Top = 54
Width = 444
ActivePage = FPCSourcesTabSheet
@ -162,13 +163,13 @@ object InitialSetupDialog: TInitialSetupDialog
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ClientHeight = 255
ClientWidth = 442
ClientHeight = 250
ClientWidth = 438
object CompilerLabel: TLabel
Left = 6
Height = 14
Height = 17
Top = 6
Width = 424
Width = 426
Align = alTop
Caption = 'CompilerLabel'
ParentColor = False
@ -182,8 +183,8 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideRight.Side = asrBottom
Left = 6
Height = 21
Top = 26
Width = 424
Top = 29
Width = 426
Anchors = [akTop, akLeft, akRight]
ItemHeight = 0
OnChange = CompilerComboBoxChange
@ -195,9 +196,9 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideTop.Control = CompilerComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 23
Top = 53
Width = 134
Height = 20
Top = 56
Width = 168
AutoSize = True
Caption = 'CompilerBrowseButton'
OnClick = CompilerBrowseButtonClick
@ -212,9 +213,9 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideBottom.Control = CompilerTabSheet
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 174
Height = 162
Top = 82
Width = 424
Width = 426
Anchors = [akTop, akLeft, akRight, akBottom]
Lines.Strings = (
'CompilerMemo'
@ -231,13 +232,13 @@ object InitialSetupDialog: TInitialSetupDialog
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 6
ClientHeight = 255
ClientWidth = 442
ClientHeight = 250
ClientWidth = 438
object FPCSrcDirLabel: TLabel
Left = 6
Height = 18
Height = 17
Top = 6
Width = 430
Width = 426
Align = alTop
Caption = 'FPCSrcDirLabel'
ParentColor = False
@ -245,9 +246,9 @@ object InitialSetupDialog: TInitialSetupDialog
end
object FPCSrcDirComboBox: TComboBox
Left = 6
Height = 29
Top = 30
Width = 430
Height = 21
Top = 29
Width = 426
Align = alTop
ItemHeight = 0
OnChange = FPCSrcDirComboBoxChange
@ -259,9 +260,9 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideTop.Control = FPCSrcDirComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 29
Top = 65
Width = 167
Height = 20
Top = 56
Width = 171
AutoSize = True
Caption = 'FPCSrcDirBrowseButton'
OnClick = FPCSrcDirBrowseButtonClick
@ -271,9 +272,9 @@ object InitialSetupDialog: TInitialSetupDialog
AnchorSideTop.Control = FPCSrcDirBrowseButton
AnchorSideTop.Side = asrBottom
Left = 6
Height = 149
Top = 100
Width = 430
Height = 162
Top = 82
Width = 426
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
Lines.Strings = (

View File

@ -894,6 +894,9 @@ begin
FPCSrcDirLabel.Caption:=Format(
lisTheSourcesOfTheFreePascalPackagesAreRequiredForBro, [SetDirSeparators('rtl'
+'/linux/system.pp')]);
PropertiesTreeView.AccessibleDescription := lisInitialSetupDialogTreeViewAccessibleDescription;
PropertiesPageControl.AccessibleDescription := lisInitialSetupDialogPageControlAccessibleDescription;
end;
procedure TInitialSetupDialog.CompilerComboBoxChange(Sender: TObject);

View File

@ -5406,6 +5406,8 @@ resourcestring
lisDebuggerFeedbackLess = 'Less';
lisDebuggerFeedbackMore = 'More';
lisDebuggerFeedbackOk = 'OK';
lisInitialSetupDialogTreeViewAccessibleDescription = 'List to select the visible properties page';
lisInitialSetupDialogPageControlAccessibleDescription = 'Tab control to select the visible properties page';
// breakpointgroups
dbgBreakGroupDlgCaptionEnable = 'Select Groups';

View File

@ -710,7 +710,6 @@ end;
procedure TCarbonCustomControl.RegisterEvents;
var
TmpSpec: EventTypeSpec;
AccessibilitySpec: array [0..2] of EventTypeSpec;
begin
inherited RegisterEvents;
@ -721,25 +720,6 @@ begin
RegisterEventHandler(@CarbonScrollable_ScrollTo),
1, @TmpSpec, Pointer(Self), nil);
end;
// Accessibility
AccessibilitySpec[0].eventClass := kEventClassAccessibility;
AccessibilitySpec[0].eventKind := kEventAccessibleGetChildAtPoint;
AccessibilitySpec[1].eventClass := kEventClassAccessibility;
AccessibilitySpec[1].eventKind := kEventAccessibleGetFocusedChild;
// kEventAccessibleGetAllAttributeNames
// kEventAccessibleGetAllParameterizedAttributeNames
AccessibilitySpec[2].eventClass := kEventClassAccessibility;
AccessibilitySpec[2].eventKind := kEventAccessibleGetNamedAttribute;
// kEventAccessibleSetNamedAttribute
// kEventAccessibleIsNamedAttributeSettable
// kEventAccessibleGetAllActionNames
// kEventAccessiblePerformNamedAction
// kEventAccessibleGetNamedActionDescription
InstallControlEventHandler(Content,
RegisterEventHandler(@CarbonControl_Accessibility),
3, @AccessibilitySpec[0], Pointer(Self), nil);
end;
{------------------------------------------------------------------------------

View File

@ -196,9 +196,12 @@ begin
DebugLn('CarbonControl_Accessibility kEventAccessibleGetAllAttributeNames After GetEventParameter');
{$ENDIF}
// AXFocused interrests all classes
lOutputStr := CFSTR('AXFocused');
CFArrayAppendValue(lInputMutableArray, lOutputStr);
// AXFocused interrests all focusable classes
if (lLazControl is TWinControl) then
begin
lOutputStr := CFSTR('AXFocused');
CFArrayAppendValue(lInputMutableArray, lOutputStr);
end;
end; // kEventAccessibleGetAllAttributeNames
kEventAccessibleGetNamedAttribute:
begin
@ -215,12 +218,18 @@ begin
if lInputPasStr = 'AXRole' then
begin
if (lLazControl is TWinControl) and (not (lLazControl is TCustomForm))
and (not (lLazControl is TCustomControl)) then Exit;
case lLazAXRole of
// kAXApplicationRole
// There is nothing in the LCL for this role, it comes automatically in the application hierarchy
// kAXBrowserRole
larTreeView: lAXRole := CFSTR('AXBrowser'); // alternatively
larTreeView: lAXRole := CFSTR('AXBrowser');
// kAXButtonRole
larButton, larButtonDropDown: lAXRole := CFSTR('AXButton');
// kAXCheckBoxRole
larCheckBox: lAXRole := CFSTR('AXCheckBox');
// kAXColumnRole
// kAXDrawerRole
// kAXGrowAreaRole
@ -235,7 +244,7 @@ begin
// kAXTabGroupRole
// kAXTableRole
// kAXWindowRole
larWindow: lAXRole := CFSTR('AXWindow'); // alternatively
larWindow: lAXRole := CFSTR('AXWindow'); // Maybe AXDrawer since this is the client area of the window not the window itself?
// kAXUnknownRole
else
lAXRole := CFSTR('AXUnknown');
@ -247,6 +256,7 @@ begin
end
else if lInputPasStr = 'AXRoleDescription' then
begin
if lLazControl.AccessibleDescription = '' then Exit;
CreateCFString(lLazControl.AccessibleDescription, lOutputStr);
SetEventParameter(AEvent, kEventParamAccessibleAttributeValue, typeCFStringRef,
SizeOf(CFStringRef), @lOutputStr);
@ -254,9 +264,8 @@ begin
end
else if lInputPasStr = 'AXFocused' then
begin
if not (lLazControl is TWinControl) then Exit;
if TWinControl(lLazControl).Focused then lOutputBool := kCFBooleanTrue
if not (lLazControl is TWinControl) then lOutputBool := kCFBooleanFalse
else if TWinControl(lLazControl).Focused then lOutputBool := kCFBooleanTrue
else lOutputBool := kCFBooleanFalse;
SetEventParameter(AEvent, kEventParamAccessibleAttributeValue, typeCFBooleanRef,
@ -374,6 +383,7 @@ procedure TCarbonControl.RegisterEvents;
var
TmpSpec: EventTypeSpec;
Events: TCarbonControlEvents;
AccessibilitySpec: array [0..3] of EventTypeSpec;
begin
Events := GetValidEvents;
@ -443,6 +453,26 @@ begin
1, @TmpSpec, Pointer(Self), nil);
end;
// Accessibility
AccessibilitySpec[0].eventClass := kEventClassAccessibility;
AccessibilitySpec[0].eventKind := kEventAccessibleGetChildAtPoint;
AccessibilitySpec[1].eventClass := kEventClassAccessibility;
AccessibilitySpec[1].eventKind := kEventAccessibleGetFocusedChild;
AccessibilitySpec[2].eventClass := kEventClassAccessibility;
AccessibilitySpec[2].eventKind := kEventAccessibleGetAllAttributeNames;
// kEventAccessibleGetAllParameterizedAttributeNames
AccessibilitySpec[3].eventClass := kEventClassAccessibility;
AccessibilitySpec[3].eventKind := kEventAccessibleGetNamedAttribute;
// kEventAccessibleSetNamedAttribute
// kEventAccessibleIsNamedAttributeSettable
// kEventAccessibleGetAllActionNames
// kEventAccessiblePerformNamedAction
// kEventAccessibleGetNamedActionDescription
InstallControlEventHandler(Content,
RegisterEventHandler(@CarbonControl_Accessibility),
4, @AccessibilitySpec[0], Pointer(Self), nil);
{$IFDEF VerboseControlEvent}
DebugLn('TCarbonControl.RegisterEvents ', ClassName, ' ',
LCLObject.Name, ': ', LCLObject.ClassName);