2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
27 #define __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__
32 //==============================================================================
34 Controls the order in which focus moves between components.
36 The default algorithm used by this class to work out the order of traversal
38 - if two components both have an explicit focus order specified, then the
39 one with the lowest number comes first (see the Component::setExplicitFocusOrder()
41 - any component with an explicit focus order greater than 0 comes before ones
42 that don't have an order specified.
43 - any unspecified components are traversed in a left-to-right, then top-to-bottom
46 If you need traversal in a more customised way, you can create a subclass
47 of KeyboardFocusTraverser that uses your own algorithm, and use
48 Component::createFocusTraverser() to create it.
50 @see Component::setExplicitFocusOrder, Component::createFocusTraverser
52 class JUCE_API KeyboardFocusTraverser
55 KeyboardFocusTraverser();
58 virtual ~KeyboardFocusTraverser();
60 /** Returns the component that should be given focus after the specified one
61 when moving "forwards".
63 The default implementation will return the next component which is to the
64 right of or below this one.
66 This may return 0 if there's no suitable candidate.
68 virtual Component
* getNextComponent (Component
* current
);
70 /** Returns the component that should be given focus after the specified one
71 when moving "backwards".
73 The default implementation will return the next component which is to the
74 left of or above this one.
76 This may return 0 if there's no suitable candidate.
78 virtual Component
* getPreviousComponent (Component
* current
);
80 /** Returns the component that should receive focus be default within the given
83 The default implementation will just return the foremost child component that
86 This may return 0 if there's no suitable candidate.
88 virtual Component
* getDefaultComponent (Component
* parentComponent
);
92 #endif // __JUCE_KEYBOARDFOCUSTRAVERSER_JUCEHEADER__