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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - 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 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-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 default algorithm used by this class to work out the order of traversal
  24. is as follows:
  25. - if two components both have an explicit focus order specified, then the
  26. one with the lowest number comes first (see the Component::setExplicitFocusOrder()
  27. method).
  28. - any component with an explicit focus order greater than 0 comes before ones
  29. that don't have an order specified.
  30. - any unspecified components are traversed in a left-to-right, then top-to-bottom
  31. order.
  32. If you need traversal in a more customised way, you can create a subclass
  33. of KeyboardFocusTraverser that uses your own algorithm, and use
  34. Component::createFocusTraverser() to create it.
  35. @see Component::setExplicitFocusOrder, Component::createFocusTraverser
  36. @tags{GUI}
  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