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.

90 lines
3.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_KEYBOARDFOCUSTRAVERSER_H_INCLUDED
  18. #define JUCE_KEYBOARDFOCUSTRAVERSER_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. Controls the order in which focus moves between components.
  22. The default algorithm used by this class to work out the order of traversal
  23. is as follows:
  24. - if two components both have an explicit focus order specified, then the
  25. one with the lowest number comes first (see the Component::setExplicitFocusOrder()
  26. method).
  27. - any component with an explicit focus order greater than 0 comes before ones
  28. that don't have an order specified.
  29. - any unspecified components are traversed in a left-to-right, then top-to-bottom
  30. order.
  31. If you need traversal in a more customised way, you can create a subclass
  32. of KeyboardFocusTraverser that uses your own algorithm, and use
  33. Component::createFocusTraverser() to create it.
  34. @see Component::setExplicitFocusOrder, Component::createFocusTraverser
  35. */
  36. class JUCE_API KeyboardFocusTraverser
  37. {
  38. public:
  39. KeyboardFocusTraverser();
  40. /** Destructor. */
  41. virtual ~KeyboardFocusTraverser();
  42. /** Returns the component that should be given focus after the specified one
  43. when moving "forwards".
  44. The default implementation will return the next component which is to the
  45. right of or below this one.
  46. This may return nullptr if there's no suitable candidate.
  47. */
  48. virtual Component* getNextComponent (Component* current);
  49. /** Returns the component that should be given focus after the specified one
  50. when moving "backwards".
  51. The default implementation will return the next component which is to the
  52. left of or above this one.
  53. This may return nullptr if there's no suitable candidate.
  54. */
  55. virtual Component* getPreviousComponent (Component* current);
  56. /** Returns the component that should receive focus be default within the given
  57. parent component.
  58. The default implementation will just return the foremost child component that
  59. wants focus.
  60. This may return nullptr if there's no suitable candidate.
  61. */
  62. virtual Component* getDefaultComponent (Component* parentComponent);
  63. };
  64. #endif // JUCE_KEYBOARDFOCUSTRAVERSER_H_INCLUDED