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.

94 lines
3.6KB

  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 focus moves between components.
  23. The algorithm used by this class to work out the order of traversal is as
  24. follows:
  25. - Only visible and enabled components are considered focusable.
  26. - If two components both have an explicit focus order specified then the
  27. one with the lowest number comes first (see the
  28. Component::setExplicitFocusOrder() method).
  29. - Any component with an explicit focus order greater than 0 comes before ones
  30. that don't have an order specified.
  31. - Components with their 'always on top' flag set come before those without.
  32. - Any unspecified components are traversed in a left-to-right, then
  33. top-to-bottom order.
  34. If you need focus traversal in a more customised way you can create a
  35. ComponentTraverser subclass that uses your own algorithm and return it
  36. from Component::createFocusTraverser().
  37. @see ComponentTraverser, Component::createFocusTraverser
  38. @tags{GUI}
  39. */
  40. class JUCE_API FocusTraverser : public ComponentTraverser
  41. {
  42. public:
  43. /** Destructor. */
  44. ~FocusTraverser() override = default;
  45. /** Returns the component that should receive focus by default within the given
  46. parent component.
  47. The default implementation will just return the foremost visible and enabled
  48. child component, and will return nullptr if there is no suitable component.
  49. */
  50. Component* getDefaultComponent (Component* parentComponent) override;
  51. /** Returns the component that should be given focus after the specified one when
  52. moving "forwards".
  53. The default implementation will return the next visible and enabled component
  54. which is to the right of or below this one, and will return nullptr if there
  55. is no suitable component.
  56. */
  57. Component* getNextComponent (Component* current) override;
  58. /** Returns the component that should be given focus after the specified one when
  59. moving "backwards".
  60. The default implementation will return the previous visible and enabled component
  61. which is to the left of or above this one, and will return nullptr if there
  62. is no suitable component.
  63. */
  64. Component* getPreviousComponent (Component* current) override;
  65. /** Returns all of the components that can receive focus within the given parent
  66. component in traversal order.
  67. The default implementation will return all visible and enabled child components.
  68. */
  69. std::vector<Component*> getAllComponents (Component* parentComponent) override;
  70. };
  71. } // namespace juce