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.

81 lines
3.1KB

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