mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Accessibility: Added VoiceOver (macOS) and Narrator (Windows) accessibility screen reader support to juce_gui_basics
This commit is contained in:
parent
1df59f7469
commit
ec990202b1
133 changed files with 10158 additions and 1297 deletions
|
|
@ -616,4 +616,10 @@ void FileBrowserComponent::timerCallback()
|
|||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
std::unique_ptr<AccessibilityHandler> FileBrowserComponent::createAccessibilityHandler()
|
||||
{
|
||||
return std::make_unique<AccessibilityHandler> (*this, AccessibilityRole::group);
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -252,6 +252,8 @@ public:
|
|||
FilePreviewComponent* getPreviewComponent() const noexcept;
|
||||
/** @internal */
|
||||
DirectoryContentsDisplayComponent* getDisplayComponent() const noexcept;
|
||||
/** @internal */
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||
|
||||
protected:
|
||||
/** Returns a list of names and paths for the default places the user might want to look.
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ FileListComponent::FileListComponent (DirectoryContentsList& listToShow)
|
|||
DirectoryContentsDisplayComponent (listToShow),
|
||||
lastDirectory (listToShow.getDirectory())
|
||||
{
|
||||
setTitle ("Files");
|
||||
setModel (this);
|
||||
directoryContentsList.addChangeListener (this);
|
||||
}
|
||||
|
|
@ -68,7 +69,7 @@ void FileListComponent::setSelectedFile (const File& f)
|
|||
{
|
||||
for (int i = directoryContentsList.getNumFiles(); --i >= 0;)
|
||||
{
|
||||
if (directoryContentsList.getFile(i) == f)
|
||||
if (directoryContentsList.getFile (i) == f)
|
||||
{
|
||||
fileWaitingToBeSelected = File();
|
||||
|
||||
|
|
@ -189,6 +190,11 @@ public:
|
|||
repaint();
|
||||
}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
FileListComponent& owner;
|
||||
|
|
@ -231,6 +237,11 @@ int FileListComponent::getNumRows()
|
|||
return directoryContentsList.getNumFiles();
|
||||
}
|
||||
|
||||
String FileListComponent::getNameForRow (int rowNumber)
|
||||
{
|
||||
return directoryContentsList.getFile (rowNumber).getFileName();
|
||||
}
|
||||
|
||||
void FileListComponent::paintListBoxItem (int, Graphics&, int, int, bool)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ private:
|
|||
|
||||
void changeListenerCallback (ChangeBroadcaster*) override;
|
||||
int getNumRows() override;
|
||||
String getNameForRow (int rowNumber) override;
|
||||
void paintListBoxItem (int, Graphics&, int, int, bool) override;
|
||||
Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component*) override;
|
||||
void selectedRowsChanged (int row) override;
|
||||
|
|
|
|||
|
|
@ -190,6 +190,11 @@ public:
|
|||
indexInContentsList, owner);
|
||||
}
|
||||
|
||||
String getAccessibilityName() override
|
||||
{
|
||||
return file.getFileName();
|
||||
}
|
||||
|
||||
void itemClicked (const MouseEvent& e) override
|
||||
{
|
||||
owner.sendMouseClickMessage (file, e);
|
||||
|
|
|
|||
|
|
@ -70,11 +70,11 @@ void FilenameComponent::resized()
|
|||
getLookAndFeel().layoutFilenameComponent (*this, &filenameBox, browseButton.get());
|
||||
}
|
||||
|
||||
KeyboardFocusTraverser* FilenameComponent::createFocusTraverser()
|
||||
std::unique_ptr<ComponentTraverser> FilenameComponent::createKeyboardFocusTraverser()
|
||||
{
|
||||
// This prevents the sub-components from grabbing focus if the
|
||||
// FilenameComponent has been set to refuse focus.
|
||||
return getWantsKeyboardFocus() ? Component::createFocusTraverser() : nullptr;
|
||||
return getWantsKeyboardFocus() ? Component::createKeyboardFocusTraverser() : nullptr;
|
||||
}
|
||||
|
||||
void FilenameComponent::setBrowseButtonText (const String& newBrowseButtonText)
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ public:
|
|||
/** @internal */
|
||||
void fileDragExit (const StringArray&) override;
|
||||
/** @internal */
|
||||
KeyboardFocusTraverser* createFocusTraverser() override;
|
||||
std::unique_ptr<ComponentTraverser> createKeyboardFocusTraverser() override;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -117,4 +117,10 @@ void ImagePreviewComponent::paint (Graphics& g)
|
|||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
std::unique_ptr<AccessibilityHandler> ImagePreviewComponent::createAccessibilityHandler()
|
||||
{
|
||||
return std::make_unique<AccessibilityHandler> (*this, AccessibilityRole::image);
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
|
|
@ -53,6 +53,8 @@ public:
|
|||
void paint (Graphics&) override;
|
||||
/** @internal */
|
||||
void timerCallback() override;
|
||||
/** @internal */
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||
|
||||
private:
|
||||
File fileToLoad;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue