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.

juce_KeyboardFocusTraverser.h 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  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 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  23. Controls the order in which focus moves between components.
  24. The default algorithm used by this class to work out the order of traversal
  25. is as follows:
  26. - if two components both have an explicit focus order specified, then the
  27. one with the lowest number comes first (see the Component::setExplicitFocusOrder()
  28. method).
  29. - any component with an explicit focus order greater than 0 comes before ones
  30. that don't have an order specified.
  31. - any unspecified components are traversed in a left-to-right, then top-to-bottom
  32. order.
  33. If you need traversal in a more customised way, you can create a subclass
  34. of KeyboardFocusTraverser that uses your own algorithm, and use
  35. Component::createFocusTraverser() to create it.
  36. @see Component::setExplicitFocusOrder, Component::createFocusTraverser
  37. */
  38. class JUCE_API KeyboardFocusTraverser
  39. {
  40. public:
  41. KeyboardFocusTraverser();
  42. /** Destructor. */
  43. virtual ~KeyboardFocusTraverser();
  44. /** Returns the component that should be given focus after the specified one
  45. when moving "forwards".
  46. The default implementation will return the next component which is to the
  47. right of or below this one.
  48. This may return nullptr if there's no suitable candidate.
  49. */
  50. virtual Component* getNextComponent (Component* current);
  51. /** Returns the component that should be given focus after the specified one
  52. when moving "backwards".
  53. The default implementation will return the next component which is to the
  54. left of or above this one.
  55. This may return nullptr if there's no suitable candidate.
  56. */
  57. virtual Component* getPreviousComponent (Component* current);
  58. /** Returns the component that should receive focus be default within the given
  59. parent component.
  60. The default implementation will just return the foremost child component that
  61. wants focus.
  62. This may return nullptr if there's no suitable candidate.
  63. */
  64. virtual Component* getDefaultComponent (Component* parentComponent);
  65. };
  66. } // namespace juce