1 #ifndef DALI_TOOLKIT_INTERNAL_FOCUS_FINDER_H
\r
2 #define DALI_TOOLKIT_INTERNAL_FOCUS_FINDER_H
\r
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
21 // EXTERNAL INCLUDES
\r
22 #include <dali/public-api/object/base-object.h>
\r
24 // INTERNAL INCLUDES
\r
25 #include <dali-toolkit/devel-api/focus-manager/focus-finder.h>
\r
29 namespace Integration
\r
33 } // namespace Integration
\r
42 * @copydoc Toolkit::FocusFinder
\r
44 class FocusFinder : public Dali::BaseObject
\r
48 * Construct a new FocusFinder.
\r
53 * @copydoc Toolkit::GetNearestFocusableActor
\r
55 Actor GetNearestFocusableActor(Actor& focusedActor, Toolkit::Control::KeyboardFocus::Direction direction);
\r
61 virtual ~FocusFinder();
\r
65 * Find the next actor to take focus in root's descendants, starting from the actor.
\r
66 * @param[in] actor The root actor.
\r
67 * @param[in] focusedActor The current focused actor.
\r
68 * @param[in] focusedRect The rect of current focused actor.
\r
69 * @param[in] bestCandidateRect The current best candidate.
\r
70 * @param[in] direction The direction.
\r
71 * @return nearest Actor.
\r
73 Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect<float>& focusedRect, Rect<float>& bestCandidateRect, Toolkit::Control::KeyboardFocus::Direction direction);
\r
76 * Is rect1 a better candidate than rect2 for a focus search in a particular
\r
77 * direction from a source rect? This is the core routine that determines
\r
78 * the order of focus searching.
\r
79 * @param direction The direction (up, down, left, right)
\r
80 * @param candidateRect The candidate rectangle
\r
81 * @param bestCandidateRect The current best candidate.
\r
82 * @return Whether the candidate is the new best.
\r
84 bool IsBetterCandidate(Toolkit::Control::KeyboardFocus::Direction direction, Rect<float>& focusedRect, Rect<float>& candidateRect, Rect<float>& bestCandidateRect) const;
\r
88 FocusFinder(const FocusFinder&);
\r
90 FocusFinder& operator=(const FocusFinder& rhs);
\r
93 } // namespace Internal
\r
95 inline Internal::FocusFinder& GetImpl(Dali::Toolkit::FocusFinder& obj)
\r
97 DALI_ASSERT_ALWAYS(obj);
\r
99 Dali::BaseObject& handle = obj.GetBaseObject();
\r
101 return static_cast<Internal::FocusFinder&>(handle);
\r
104 inline const Internal::FocusFinder& GetImpl(const Dali::Toolkit::FocusFinder& obj)
\r
106 DALI_ASSERT_ALWAYS(obj);
\r
108 const Dali::BaseObject& handle = obj.GetBaseObject();
\r
110 return static_cast<const Internal::FocusFinder&>(handle);
\r
113 } // namespace Toolkit
\r
115 } // namespace Dali
\r
117 #endif // DALI_TOOLKIT_INTERNAL_FOCUS_FINDER_H
\r