The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

93 lines
3.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  19. #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
  20. class Component;
  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 0 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 0 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 0 if there's no suitable candidate.
  63. */
  64. virtual Component* getDefaultComponent (Component* parentComponent);
  65. };
  66. #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__