1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

GUI Basics: Refactor juce_gui_basics file structure

- Created a new detail namespace
- Moved shared module implementation details into the detail namespace
- Split dependencies so source files only rely on details in the detail namespace
- Removed all code from the juce_gui_basics.cpp file
This commit is contained in:
Anthony Nicholls 2023-03-03 10:17:48 +00:00
parent 8942f22a9b
commit cff722a4af
129 changed files with 4458 additions and 2318 deletions

View file

@ -78,4 +78,4 @@ enum class AccessibilityEvent
rowSelectionChanged
};
}
} // namespace juce

View file

@ -68,4 +68,4 @@ enum class AccessibilityRole
unspecified
};
}
} // namespace juce

View file

@ -28,30 +28,6 @@ namespace juce
AccessibilityHandler* AccessibilityHandler::currentlyFocusedHandler = nullptr;
enum class InternalAccessibilityEvent
{
elementCreated,
elementDestroyed,
elementMovedOrResized,
focusChanged,
windowOpened,
windowClosed
};
void notifyAccessibilityEventInternal (const AccessibilityHandler&, InternalAccessibilityEvent);
inline String getAccessibleApplicationOrPluginName()
{
#if defined (JucePlugin_Name)
return JucePlugin_Name;
#else
if (auto* app = JUCEApplicationBase::getInstance())
return app->getApplicationName();
return "JUCE Application";
#endif
}
AccessibilityHandler::AccessibilityHandler (Component& comp,
AccessibilityRole accessibilityRole,
AccessibilityActions accessibilityActions,
@ -68,7 +44,7 @@ AccessibilityHandler::AccessibilityHandler (Component& comp,
AccessibilityHandler::~AccessibilityHandler()
{
giveAwayFocus();
notifyAccessibilityEventInternal (*this, InternalAccessibilityEvent::elementDestroyed);
detail::AccessibilityHelpers::notifyAccessibilityEvent (*this, detail::AccessibilityHelpers::Event::elementDestroyed);
}
//==============================================================================
@ -320,13 +296,13 @@ void AccessibilityHandler::grabFocusInternal (bool canTryParent)
void AccessibilityHandler::giveAwayFocusInternal() const
{
currentlyFocusedHandler = nullptr;
notifyAccessibilityEventInternal (*this, InternalAccessibilityEvent::focusChanged);
detail::AccessibilityHelpers::notifyAccessibilityEvent (*this, detail::AccessibilityHelpers::Event::focusChanged);
}
void AccessibilityHandler::takeFocus()
{
currentlyFocusedHandler = this;
notifyAccessibilityEventInternal (*this, InternalAccessibilityEvent::focusChanged);
detail::AccessibilityHelpers::notifyAccessibilityEvent (*this, detail::AccessibilityHelpers::Event::focusChanged);
if ((component.isShowing() || component.isOnDesktop())
&& component.getWantsKeyboardFocus()
@ -336,4 +312,20 @@ void AccessibilityHandler::takeFocus()
}
}
std::unique_ptr<AccessibilityHandler::AccessibilityNativeImpl> AccessibilityHandler::createNativeImpl (AccessibilityHandler& handler)
{
#if JUCE_NATIVE_ACCESSIBILITY_INCLUDED
return std::make_unique<AccessibilityNativeImpl> (handler);
#else
ignoreUnused (handler);
return nullptr;
#endif
}
#if ! JUCE_NATIVE_ACCESSIBILITY_INCLUDED
void AccessibilityHandler::notifyAccessibilityEvent (AccessibilityEvent) const {}
void AccessibilityHandler::postAnnouncement (const String&, AnnouncementPriority) {}
AccessibilityNativeHandle* AccessibilityHandler::getNativeImplementation() const { return nullptr; }
#endif
} // namespace juce