Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions Headers/AppKit/NSAccessibilityCustomAction.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* Interface of class NSAccessibilityCustomAction
Copyright (C) 2020 Free Software Foundation, Inc.

By: Gregory John Casamento
Date: Mon 15 Jun 2020 03:18:47 AM EDT

This file is part of the GNUstep Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Expand All @@ -35,7 +35,7 @@ extern "C" {
#endif

DEFINE_BLOCK_TYPE(GSAccessibilityCustomActionHandler, void, BOOL);

APPKIT_EXPORT_CLASS
@interface NSAccessibilityCustomAction : NSObject
{
Expand All @@ -52,9 +52,18 @@ APPKIT_EXPORT_CLASS
target: (id)target
selector: (SEL)selector;

/* Convenience factory returning an autoreleased custom action that invokes a block. */
+ (instancetype) actionWithName: (NSString *)name
handler: (GSAccessibilityCustomActionHandler)handler;

/* Convenience factory returning an autoreleased custom action that sends selector to target. */
+ (instancetype) actionWithName: (NSString *)name
target: (id)target
selector: (SEL)selector;

- (NSString *) name;
- (void) setName: (NSString *)name;

- (GSAccessibilityCustomActionHandler) handler;
- (void) setHandler: (GSAccessibilityCustomActionHandler)handler;

Expand All @@ -63,7 +72,10 @@ APPKIT_EXPORT_CLASS

- (SEL) selector;
- (void) setSelector: (SEL)selector;


/* Perform the custom action. Returns YES on success (block executed or target responded) */
- (BOOL) perform;

@end

#if defined(__cplusplus)
Expand Down
32 changes: 22 additions & 10 deletions Headers/AppKit/NSAccessibilityCustomRotor.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* Interface of class NSAccessibilityCustomRotor
Copyright (C) 2020 Free Software Foundation, Inc.

By: Gregory John Casamento
Date: Mon 15 Jun 2020 03:18:59 AM EDT

This file is part of the GNUstep Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Expand Down Expand Up @@ -46,14 +46,14 @@ extern "C" {
@class NSAccessibilityCustomRotorSearchParameters;
@class NSString;
@class NSAccessibilityElement;

enum
{
NSAccessibilityCustomRotorSearchDirectionPrevious,
NSAccessibilityCustomRotorSearchDirectionNext,
};
typedef NSInteger NSAccessibilityCustomRotorSearchDirection;

enum
{
NSAccessibilityCustomRotorTypeCustom = 0,
Expand All @@ -77,13 +77,19 @@ enum
NSAccessibilityCustomRotorTypeTextField,
NSAccessibilityCustomRotorTypeUnderlinedText,
NSAccessibilityCustomRotorTypeVisitedLink,
};
};
typedef NSInteger NSAccessibilityCustomRotorType;

// Rotor...
APPKIT_EXPORT_CLASS
@interface NSAccessibilityCustomRotor : NSObject

{
NSString *_label;
id<NSAccessibilityCustomRotorItemSearchDelegate> _itemSearchDelegate;
id<NSAccessibilityElementLoading> _itemLoadingDelegate;
NSAccessibilityCustomRotorType _type;
}

- (instancetype) initWithLabel: (NSString *)label
itemSearchDelegate: (id<NSAccessibilityCustomRotorItemSearchDelegate>)delegate;

Expand All @@ -101,20 +107,26 @@ APPKIT_EXPORT_CLASS

- (id<NSAccessibilityElementLoading>) itemLoadingDelegate;
- (void) setItemLoadingDelegate: (id<NSAccessibilityElementLoading>) delegate;

@end

// Results...
APPKIT_EXPORT_CLASS
@interface NSAccessibilityCustomRotorItemResult : NSObject
{
id<NSAccessibilityElement> _targetElement;
id<NSAccessibilityLoadingToken> _itemLoadingToken;
NSString *_customLabel;
NSRange _targetRange;
}

- (instancetype)initWithTargetElement:(id<NSAccessibilityElement>)targetElement;

- (instancetype)initWithItemLoadingToken: (id<NSAccessibilityLoadingToken>)token
customLabel: (NSString *)customLabel;

- (id<NSAccessibilityElement>) targetElement;

- (id<NSAccessibilityLoadingToken>) itemLoadingToken;

- (NSRange) targetRange;
Expand Down
63 changes: 58 additions & 5 deletions Headers/AppKit/NSAccessibilityElement.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* Interface of class NSAccessibilityCustomElement
Copyright (C) 2020 Free Software Foundation, Inc.

By: Gregory John Casamento
Date: Mon 15 Jun 2020 03:19:09 AM EDT

This file is part of the GNUstep Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Expand All @@ -24,18 +24,71 @@

#ifndef _NSAccessibilityElement_h_GNUSTEP_GUI_INCLUDE
#define _NSAccessibilityElement_h_GNUSTEP_GUI_INCLUDE
#import <AppKit/AppKitDefines.h>

#import <Foundation/NSGeometry.h>
#import <Foundation/NSObject.h>

#import <AppKit/AppKitDefines.h>

#if OS_API_VERSION(MAC_OS_X_VERSION_10_13, GS_API_LATEST)

#if defined(__cplusplus)
extern "C" {
#endif

@class NSString;

APPKIT_EXPORT_CLASS
@interface NSAccessibilityElement : NSObject
{
NSString *_accessibilityLabel;
NSString *_accessibilityIdentifier;
NSString *_accessibilityRole;
NSString *_accessibilitySubrole;
NSRect _accessibilityFrame;
id _accessibilityParent; // weak (not retained) similar to Cocoa patterns
BOOL _accessibilityFocused;
}

/**
* Convenience factory for creating a simple accessibility element with the
* specified role, frame, label and parent. Role/label are copied.
*/
+ (instancetype) accessibilityElementWithRole: (NSString *)role
frame: (NSRect)frame
label: (NSString *)label
parent: (id)parent;

/* Designated initializer. */
- (instancetype) initWithRole: (NSString *)role
frame: (NSRect)frame
label: (NSString *)label
parent: (id)parent;

// Basic attribute accessors (mirroring Cocoa style naming) -----------------
- (NSString *) accessibilityLabel;
- (void) setAccessibilityLabel: (NSString *)label;

- (NSString *) accessibilityIdentifier;
- (void) setAccessibilityIdentifier: (NSString *)identifier;

- (NSRect) accessibilityFrame;
- (void) setAccessibilityFrame: (NSRect)frame;

- (id) accessibilityParent;
- (void) setAccessibilityParent: (id)parent;

- (BOOL) isAccessibilityFocused;
- (void) setAccessibilityFocused: (BOOL)focused;

- (NSString *) accessibilityRole;
- (void) setAccessibilityRole: (NSString *)role;

- (NSString *) accessibilitySubrole;
- (void) setAccessibilitySubrole: (NSString *)subrole;

/* A rudimentary role description derived from role/subrole strings. */
- (NSString *) accessibilityRoleDescription;

@end

Expand Down
Loading