UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GenericAccessibleInterfaces.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "Containers/Array.h"
7#include "Containers/Map.h"
10#include "CoreMinimal.h"
11#include "Delegates/Delegate.h"
12#include "HAL/Platform.h"
13#include "Logging/LogMacros.h"
14#include "Math/Box2D.h"
15#include "Misc/Variant.h"
16#include "Stats/Stats.h"
17#include "Templates/Function.h"
19
22{
26 Auto,
28 Summary,
30 Custom,
33};
34
36
37#if WITH_ACCESSIBILITY
38
39class FGenericWindow;
41
43
46{
47 Unknown,
48 Button,
49 CheckBox,
51 Hyperlink,
52 Image,
53 Layout,
54 ScrollBar,
55 Slider,
56 Text,
58 Window,
59 List,
61};
62
64enum class EAccessibleEvent : uint8
65{
97};
98
101
110{
112public:
114 : UserIndex(InUserIndex)
115 {
116
117 }
118 virtual ~FGenericAccessibleUser() = default;
120 FAccessibleUserIndex GetIndex() const
121 {
122 return UserIndex;
123 }
129 {
131 }
143 {
145 return true;
146 }
149 {
151 }
152protected:
157 virtual void OnRegistered() {}
162 virtual void OnUnregistered() {}
163
164private:
166 FAccessibleUserIndex UserIndex;
169};
170
180{
181public:
182 virtual ~FGenericAccessibleUserRegistry() = default;
201 APPLICATIONCORE_API bool UnregisterUser(const FAccessibleUserIndex UserIndex);
221 {
222 // @TODOAccessibility: Consider allowing remapping of primary user index
223 static const FAccessibleUserIndex PrimaryUserIndex = 0;
224 return PrimaryUserIndex;
225 }
226protected:
229};
230
236{
237public:
239 enum class EWindowDisplayState
240 {
241 Normal,
242 Minimize,
244 };
245
252 virtual TSharedPtr<FGenericWindow> GetNativeWindow() const = 0;
253
271 virtual TSharedPtr<IAccessibleWidget> GetUserFocusedWidget(const FAccessibleUserIndex UserIndex) const = 0;
275 virtual void Close() = 0;
276
283 virtual bool SupportsDisplayState(EWindowDisplayState State) const = 0;
289 virtual EWindowDisplayState GetDisplayState() const = 0;
295 virtual void SetDisplayState(EWindowDisplayState State) = 0;
301 virtual bool IsModal() const = 0;
302};
303
308{
309public:
311 virtual void Activate() = 0;
317 virtual bool IsCheckable() const { return false; }
324 virtual bool GetCheckedState() const { return false; }
325};
326
332{
333public:
339 virtual bool IsReadOnly() const { return true; }
345 virtual bool IsPassword() const { return false; }
352 virtual float GetStepSize() const { return 0.0f; }
358 virtual float GetMaximum() const { return 0.0f; }
364 virtual float GetMinimum() const { return 0.0f; }
371 virtual FString GetValue() const = 0;
377 virtual FVariant GetValueAsVariant() const { return FVariant(); }
378 /*
379 * Set the value stored by the widget. While this function accepts a String, there is no way to know
380 * what the underlying data is stored as. The platform layer must retain some additional information
381 * about what kind of widget this is, and ensure it's being called with valid arguments.
382 *
383 * @param Value The new value to assign to the widget, which may need to be converted before assigning to a variable.
384 */
385 virtual void SetValue(const FString& Value) {}
386};
387
392class IAccessibleText
393{
394public:
400 virtual const FString& GetText() const = 0;
401};
402
408{
409public:
415 virtual TArray<TSharedPtr<IAccessibleWidget>> GetSelectedItems() const { return TArray < TSharedPtr<IAccessibleWidget>>(); }
416
422 virtual bool CanSupportMultiSelection() const { return false; }
423
429 virtual bool IsSelectionRequired() const { return false; }
430};
431
438{
439public:
441 virtual void Select() {}
442
444 virtual void AddToSelection() {}
445
447 virtual void RemoveFromSelection() {}
448
454 virtual bool IsSelected() const { return false; }
455
462 virtual TSharedPtr<IAccessibleWidget> GetOwningTable() const { return nullptr; }
463};
464
466
472class IAccessibleWidget : public TSharedFromThis<IAccessibleWidget>
473{
474public:
476 virtual ~IAccessibleWidget() {}
477
479
486 virtual AccessibleWidgetId GetId() const = 0;
492 virtual bool IsValid() const = 0;
493
500 virtual TSharedPtr<IAccessibleWidget> GetWindow() const = 0;
506 virtual FBox2D GetBounds() const = 0;
513 virtual TSharedPtr<IAccessibleWidget> GetParent() = 0;
523 template<typename PredicateType>
525 {
527 while (Ancestor)
528 {
529 if (Predicate(Ancestor.ToSharedRef()))
530 {
531 return Ancestor;
532 }
533 Ancestor = Ancestor->GetNextSibling();
534 }
535 return nullptr;
536 }
552 template<typename PredicateType>
554 {
555 TSharedPtr<IAccessibleWidget> NextSibling = Source->GetNextSibling();
556 while (NextSibling)
557 {
558 if (Predicate(NextSibling.ToSharedRef()))
559 {
560 return NextSibling;
561 }
562 NextSibling = NextSibling->GetNextSibling();
563 }
564 return nullptr;
565 }
581 template<typename PredicateType>
583 {
585 while(PreviousSibling)
586 {
587 if (Predicate(PreviousSibling.ToSharedRef()))
588 {
589 return PreviousSibling;
590 }
591 PreviousSibling = PreviousSibling->GetPreviousSibling();
592 }
593 return nullptr;
594 }
616 template<typename PredicateType>
618 {
619 TSharedPtr<IAccessibleWidget> NextWidget = Source->GetNextWidgetInHierarchy();
620 while(NextWidget)
621 {
622 if (Predicate(NextWidget.ToSharedRef()))
623 {
624 return NextWidget;
625 }
626 NextWidget = NextWidget->GetNextWidgetInHierarchy();
627 }
628 return nullptr;
629 }
652 template<typename PredicateType>
654 {
655 TSharedPtr<IAccessibleWidget> PreviousWidget = Source->GetPreviousWidgetInHierarchy();
656 while(PreviousWidget)
657 {
658 if (Predicate(PreviousWidget.ToSharedRef()))
659 {
660 return PreviousWidget;
661 }
662 PreviousWidget = PreviousWidget->GetPreviousWidgetInHierarchy();
663 }
664 return nullptr;
665 }
672 virtual TSharedPtr<IAccessibleWidget> GetChildAt(int32 Index) = 0;
678 virtual int32 GetNumberOfChildren() = 0;
688 template<typename PredicateType>
690 {
691 if (Source->GetNumberOfChildren() == 0)
692 {
693 return nullptr;
694 }
696 int32 NumChildren = Source->GetNumberOfChildren();
697 for (int32 ChildIndex = 0; ChildIndex < NumChildren; ++ChildIndex)
698 {
699 Child = Source->GetChildAt(ChildIndex);
700 if (Child && Predicate(Child.ToSharedRef()))
701 {
702 return Child;
703 }
704 }
705 return nullptr;
706 }
713 virtual EAccessibleWidgetType GetWidgetType() const = 0;
714
720 virtual FString GetClassName() const = 0;
726 virtual FString GetWidgetName() const = 0;
732 virtual FString GetHelpText() const = 0;
734 virtual FString ToString() const
735 {
736 TStringBuilder<256> Builder;
737 Builder.Appendf(TEXT("Label: %s. Role: %s."), *GetWidgetName(), *GetClassName());
738 return Builder.ToString();
739 }
740
746 virtual bool IsEnabled() const = 0;
752 virtual bool IsHidden() const = 0;
758 virtual bool SupportsFocus() const = 0;
764 virtual bool SupportsAccessibleFocus() const = 0;
770 virtual bool CanCurrentlyAcceptAccessibleFocus() const = 0;
777 virtual bool HasUserFocus(const FAccessibleUserIndex UserIndex) const = 0;
784 virtual bool SetUserFocus(const FAccessibleUserIndex UserIndex) = 0;
785
791 virtual IAccessibleWindow* AsWindow() { return nullptr; }
797 virtual IAccessibleActivatable* AsActivatable() { return nullptr; }
803 virtual IAccessibleProperty* AsProperty() { return nullptr; }
809 virtual IAccessibleText* AsText() { return nullptr; }
810
816 virtual IAccessibleTable* AsTable() { return nullptr; }
817
823 virtual IAccessibleTableRow* AsTableRow() { return nullptr; }
824};
825
833{
836 , Event(InEvent)
837 , OldValue(InOldValue)
838 , NewValue(InNewValue)
839 , UserIndex(InUserIndex)
840 {}
841
847 FVariant OldValue;
849 FVariant NewValue;
851 FAccessibleUserIndex UserIndex;
852};
853
870{
871public:
877
880 {
882 }
883
890
897 bool IsActive() const { return bIsActive; }
898
904 APPLICATIONCORE_API void SetActive(bool bActive);
905
914
922 virtual AccessibleWidgetId GetAccessibleWindowId(const TSharedRef<FGenericWindow>& InWindow) const { return IAccessibleWidget::InvalidAccessibleWidgetId; }
923
931
938 void RaiseEvent(const FAccessibleEventArgs& Args)
939 {
940 AccessibleEventDelegate.ExecuteIfBound(Args);
941 }
942
948 void SetAccessibleEventDelegate(const FAccessibleEvent& Delegate)
949 {
950 AccessibleEventDelegate = Delegate;
951 }
952
957 {
959 }
960
970
976 virtual void MakeAccessibleAnnouncement(const FString& AnnouncementString) { }
977
982 {
984 }
989 {
991 }
998 {
999 // @TODOAccessibility: Have some means of storing a default manager
1001 }
1002protected:
1004 virtual void OnActivate() {}
1006 virtual void OnDeactivate() {}
1007
1010
1011private:
1013 bool bIsActive;
1021};
1022
1023#endif
@ Normal
Definition AndroidInputInterface.h:116
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define DECLARE_STATS_GROUP(GroupDesc, GroupId, GroupCat)
Definition Stats.h:689
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:48
JsonWriter Close()
#define X(Name, Desc)
Definition FormatStringSan.h:47
EAccessibleBehavior
Definition GenericAccessibleInterfaces.h:22
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition GenericWindow.h:94
Definition Variant.h:114
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition SharedPointer.h:1640
Definition SharedPointer.h:692
TSharedRef< ObjectType, Mode > ToSharedRef() const &
Definition SharedPointer.h:1028
UE_FORCEINLINE_HINT const bool IsValid() const
Definition SharedPointer.h:1085
Definition SharedPointer.h:153
BuilderType & Appendf(const FmtType &Fmt, Types... Args)
Definition StringBuilder.h:419
const CharType * ToString() UE_LIFETIMEBOUND
Definition StringBuilder.h:135
Definition StringBuilder.h:509
Definition SharedPointer.h:1295
IAnalyticsPropertyStore::EStatusCode SetValue(TGetter &&GetterFn, TSetter &&SetterFn, const T &ProposedValue, TCompare &&ConditionFn)
Definition AnalyticsPropertyStore.cpp:34
bool IsEnabled()
Definition IAudioLinkFactory.cpp:13
Type
Definition TaskGraphInterfaces.h:57
@ GameThread
Definition TaskGraphInterfaces.h:61
@ Maximize
Definition GenericApplicationMessageHandler.h:115
T::FDataType GetValue(const UBlackboardComponent &Blackboard, const FName &Name, FBlackboard::FKey &InOutCachedKey, const typename T::FDataType &DefaultValue)
Definition ValueOrBBKey.h:51
FString ToString(uint16 Value)
Definition PathFollowingComponent.cpp:82
float GetStepSize()
Definition HeterogeneousVolumes.cpp:618
U16 Index
Definition radfft.cpp:71