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.

87 lines
3.3KB

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