1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-08 04:20:09 +00:00

Added method Component::unfocusAllComponents()

This commit is contained in:
jules 2013-08-21 19:07:21 +01:00
parent 39c44c12ed
commit 9a1171a7ef
2 changed files with 7 additions and 0 deletions

View file

@ -2820,6 +2820,12 @@ Component* JUCE_CALLTYPE Component::getCurrentlyFocusedComponent() noexcept
return currentlyFocusedComponent;
}
void JUCE_CALLTYPE Component::unfocusAllComponents()
{
if (Component* c = getCurrentlyFocusedComponent())
c->giveAwayFocus (true);
}
void Component::giveAwayFocus (const bool sendFocusLossEvent)
{
Component* const componentLosingFocus = currentlyFocusedComponent;

View file

@ -1250,6 +1250,7 @@ public:
*/
static Component* JUCE_CALLTYPE getCurrentlyFocusedComponent() noexcept;
/** If any component has keyboard focus, this will defocus it. */
static void JUCE_CALLTYPE unfocusAllComponents();
//==============================================================================