Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

juce_KeyboardFocusTraverser.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 7 End-User License
  8. Agreement and JUCE Privacy Policy.
  9. End User License Agreement: www.juce.com/juce-7-licence
  10. Privacy Policy: www.juce.com/juce-privacy-policy
  11. Or: You may also use this code under the terms of the GPL v3 (see
  12. www.gnu.org/licenses).
  13. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  14. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  15. DISCLAIMED.
  16. ==============================================================================
  17. */
  18. namespace juce
  19. {
  20. //==============================================================================
  21. /**
  22. Controls the order in which keyboard focus moves between components.
  23. The default behaviour of this class uses a FocusTraverser object internally to
  24. determine the default/next/previous component until it finds one which wants
  25. keyboard focus, as set by the Component::setWantsKeyboardFocus() method.
  26. If you need keyboard focus traversal in a more customised way, you can create
  27. a subclass of ComponentTraverser that uses your own algorithm, and use
  28. Component::createKeyboardFocusTraverser() to create it.
  29. @see FocusTraverser, ComponentTraverser, Component::createKeyboardFocusTraverser
  30. @tags{GUI}
  31. */
  32. class JUCE_API KeyboardFocusTraverser : public ComponentTraverser
  33. {
  34. public:
  35. /** Destructor. */
  36. ~KeyboardFocusTraverser() override = default;
  37. /** Returns the component that should receive keyboard focus by default within the
  38. given parent component.
  39. The default implementation will return the foremost focusable component (as
  40. determined by FocusTraverser) that also wants keyboard focus, or nullptr if
  41. there is no suitable component.
  42. */
  43. Component* getDefaultComponent (Component* parentComponent) override;
  44. /** Returns the component that should be given keyboard focus after the specified
  45. one when moving "forwards".
  46. The default implementation will return the next focusable component (as
  47. determined by FocusTraverser) that also wants keyboard focus, or nullptr if
  48. there is no suitable component.
  49. */
  50. Component* getNextComponent (Component* current) override;
  51. /** Returns the component that should be given keyboard focus after the specified
  52. one when moving "backwards".
  53. The default implementation will return the previous focusable component (as
  54. determined by FocusTraverser) that also wants keyboard focus, or nullptr if
  55. there is no suitable component.
  56. */
  57. Component* getPreviousComponent (Component* current) override;
  58. /** Returns all of the components that can receive keyboard focus within the given
  59. parent component in traversal order.
  60. The default implementation will return all focusable child components (as
  61. determined by FocusTraverser) that also wants keyboard focus.
  62. */
  63. std::vector<Component*> getAllComponents (Component* parentComponent) override;
  64. };
  65. } // namespace juce