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.

84 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - 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 this technical preview, this file is not subject to commercial licensing.
  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 default algorithm used by this class to work out the order of traversal
  19. is as follows:
  20. - if two components both have an explicit focus order specified, then the
  21. one with the lowest number comes first (see the Component::setExplicitFocusOrder()
  22. method).
  23. - any component with an explicit focus order greater than 0 comes before ones
  24. that don't have an order specified.
  25. - any unspecified components are traversed in a left-to-right, then top-to-bottom
  26. order.
  27. If you need traversal in a more customised way, you can create a subclass
  28. of KeyboardFocusTraverser that uses your own algorithm, and use
  29. Component::createFocusTraverser() to create it.
  30. @see Component::setExplicitFocusOrder, Component::createFocusTraverser
  31. @tags{GUI}
  32. */
  33. class JUCE_API KeyboardFocusTraverser
  34. {
  35. public:
  36. KeyboardFocusTraverser();
  37. /** Destructor. */
  38. virtual ~KeyboardFocusTraverser();
  39. /** Returns the component that should be given focus after the specified one
  40. when moving "forwards".
  41. The default implementation will return the next component which is to the
  42. right of or below this one.
  43. This may return nullptr if there's no suitable candidate.
  44. */
  45. virtual Component* getNextComponent (Component* current);
  46. /** Returns the component that should be given focus after the specified one
  47. when moving "backwards".
  48. The default implementation will return the next component which is to the
  49. left of or above this one.
  50. This may return nullptr if there's no suitable candidate.
  51. */
  52. virtual Component* getPreviousComponent (Component* current);
  53. /** Returns the component that should receive focus be default within the given
  54. parent component.
  55. The default implementation will just return the foremost child component that
  56. wants focus.
  57. This may return nullptr if there's no suitable candidate.
  58. */
  59. virtual Component* getDefaultComponent (Component* parentComponent);
  60. };
  61. } // namespace juce