Upgrades the Accessibility structure to support roles, name, description and more easily extensible notifications

git-svn-id: trunk@34678 -
This commit is contained in:
sekelsenmat 2012-01-09 13:25:26 +00:00
parent 13f554a1f4
commit 5b98ba7981
11 changed files with 76 additions and 18 deletions

View File

@ -1700,6 +1700,9 @@ type
TWinControl = class(TControl)
private
FAccessibleDescription: TCaption;
FAccessibleName: TCaption;
FAccessibleRole: TLazAccessibilityRole;
FAlignOrder: TFPList; // list of TControl. Last moved (SetBounds) comes first. Used by AlignControls.
FBorderWidth: TBorderWidth;
FBoundsLockCount: integer;
@ -1749,6 +1752,9 @@ type
function GetIsResizing: boolean;
function GetTabOrder: TTabOrder;
function GetVisibleDockClientCount: Integer;
procedure SetAccessibleDescription(AValue: TCaption);
procedure SetAccessibleName(AValue: TCaption);
procedure SetAccessibleRole(AValue: TLazAccessibilityRole);
procedure SetChildSizing(const AValue: TControlChildSizing);
procedure SetDockSite(const NewDockSite: Boolean);
procedure SetHandle(NewHandle: HWND);
@ -1932,6 +1938,9 @@ type
property OnGetDockCaption: TGetDockCaptionEvent read FOnGetDockCaption write FOnGetDockCaption;
public
// properties which are supported by all descendents
property AccessibleDescription: TCaption read FAccessibleDescription write SetAccessibleDescription;
property AccessibleName: TCaption read FAccessibleName write SetAccessibleName;
property AccessibleRole: TLazAccessibilityRole read FAccessibleRole write SetAccessibleRole;
property BorderWidth: TBorderWidth read FBorderWidth write SetBorderWidth default 0;
property BoundsLockCount: integer read FBoundsLockCount;
property Brush: TBrush read GetBrush;

View File

@ -524,12 +524,12 @@ begin
// But Forms is not in the uses clause
end;
procedure TWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
procedure TWidgetSet.LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer);
begin
end;
procedure TWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
procedure TWidgetSet.LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole);
begin
end;

View File

@ -356,14 +356,14 @@ begin
Result := WidgetSet.IsMobilePlatform();
end;
procedure LazAccessibility_SendTextChangedNotification(const ANewText: string);
procedure LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer);
begin
WidgetSet.LazAccessibility_SendTextChangedNotification(ANewText);
WidgetSet.LazAccessibility_SendNotification(ANotification, ATextParam, AIntParam1, AIntParam2);
end;
procedure LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
procedure LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole);
begin
WidgetSet.LazAccessibility_SendSelectionChangedNotification(ASelStart, ASelEnd);
WidgetSet.LazAccessibility_SetFields(AHandle, ADescription, AName, ARole);
end;
procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod);

View File

@ -94,8 +94,8 @@ function InvalidateFrame(aHandle : HWND; ARect : pRect; bErase : Boolean; Border
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
function IsMobilePlatform: Boolean; {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazAccessibility_SendTextChangedNotification(const ANewText: string); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazDeviceAPIs_SendMessage(AMsg: TLazDeviceMessage); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}
procedure LazDeviceAPIs_StartReadingAccelerometerData(); {$IFDEF IF_BASE_MEMBER}virtual;{$ENDIF}

View File

@ -7754,6 +7754,24 @@ begin
if TControl(FDockClients[I]).Visible then inc(Result);
end;
procedure TWinControl.SetAccessibleDescription(AValue: TCaption);
begin
if FAccessibleDescription=AValue then Exit;
FAccessibleDescription:=AValue;
end;
procedure TWinControl.SetAccessibleName(AValue: TCaption);
begin
if FAccessibleName=AValue then Exit;
FAccessibleName:=AValue;
end;
procedure TWinControl.SetAccessibleRole(AValue: TLazAccessibilityRole);
begin
if FAccessibleRole=AValue then Exit;
FAccessibleRole:=AValue;
end;
{------------------------------------------------------------------------------
procedure TWinControl.SetChildSizing(const AValue: TControlChildSizing);
------------------------------------------------------------------------------}

View File

@ -168,12 +168,12 @@ begin
Result := True;
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
procedure TCDWidgetSet.LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
procedure TCDWidgetSet.LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole);
begin
end;

View File

@ -118,12 +118,12 @@ begin
Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
procedure TCDWidgetSet.LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
procedure TCDWidgetSet.LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole);
begin
end;

View File

@ -119,12 +119,12 @@ begin
Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
procedure TCDWidgetSet.LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
procedure TCDWidgetSet.LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole);
begin
end;

View File

@ -119,12 +119,12 @@ begin
Result := Application.ApplicationType in [atPDA, atKeyPadDevice, atTV, atMobileEmulator];
end;
procedure TCDWidgetSet.LazAccessibility_SendTextChangedNotification(const ANewText: string);
procedure TCDWidgetSet.LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer);
begin
end;
procedure TCDWidgetSet.LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer);
procedure TCDWidgetSet.LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole);
begin
end;

View File

@ -57,8 +57,8 @@ procedure HideVirtualKeyboard();
function IsDesignerDC(WindowHandle: HWND; DC: HDC): Boolean; override;*)
function IsMobilePlatform: Boolean; override;
procedure LazAccessibility_SendTextChangedNotification(const ANewText: string); override;
procedure LazAccessibility_SendSelectionChangedNotification(const ASelStart, ASelEnd: Integer); override;
procedure LazAccessibility_SendNotification(ANotification: TLazAccessibilityNotification; const ATextParam: string; const AIntParam1, AIntParam2: Integer); override;
procedure LazAccessibility_SetFields(AHandle: HWND; const ADescription, AName: string; ARole: TLazAccessibilityRole); override;
procedure LazDeviceAPIs_RequestPositionInfo(AMethod: TLazPositionMethod); override;
procedure LazDeviceAPIs_SendMessage(AMsg: TLazDeviceMessage); override;
procedure LazDeviceAPIs_StartReadingAccelerometerData(); override;

View File

@ -125,6 +125,37 @@ type
destructor Destroy; override;
end;
{ LazAccessibility }
TLazAccessibilityNotification = (
lanTextChanged, // The text or current line of text of the object has changed
lanCursorOrSelectionChanged // The cursor or the text selection changed
);
TLazAccessibilityRole = (
larAlertMessage, // An object that is used to alert the user.
larAnimation, // An object that displays an animation.
larButton, // A button.
larButtonDropDown, // A button that drops down a list of items or drops down something else
larCell, // A cell in a table.
larChart, // An object that displays a graphical representation of data.
larCheckBox, // An object that can be checked or unchecked, or sometimes in an intermediary state
larClock, // A clock displaying time.
larComboBox, // A list of choices that the user can select from.
larEditableText, // Editable text
larIgnore, // Something to be ignored. For example a blank space between other objects.
larImage, // A graphic or picture or an icon.
larGrip, // A grip that the user can drag to change the size of widgets.
larHotkeyField, // A hotkey field that allows the user to enter a key sequence.
larHotLink, // A link to something else.
larLabel, // A text label as usually placed near other widgets.
larList, // A list of items, from which the user can select one or more items.
larListItem, // An item in a list of items.
larTree, // A list of items in a tree structure.
larTreeItem, // An item in a tree structure.
larWindow // A top level window.
);
{$ifndef WINDOWS}
THandle = type PtrUInt; // define our own, because the SysUtils.THandle = System.THandle is a longint
HANDLE = THandle;