192c296dcd620f4cafe96dc868c9ffca02ac1f4d
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / focus-manager / keyboard-focus-manager-devel.h
1 #ifndef DALI_TOOLKIT_KEYBOARD_FOCUS_MANAGER_DEVEL_H
2 #define DALI_TOOLKIT_KEYBOARD_FOCUS_MANAGER_DEVEL_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
26
27 namespace Dali
28 {
29 namespace Toolkit
30 {
31 namespace DevelKeyboardFocusManager
32 {
33 /**
34  * @brief Interface used to provide custom keyboard focus algorithm for retrieving the next focusable actor.
35  *
36  * The application / toolkit can implement the interface and override the keyboard focus behaviour.
37  * Upon providing an implementation of this interface, the PreFocusChangeSignal is no longer emitted.
38  * If focus is changing within a layout container, then the layout container is queried first to provide
39  * the next focusable actor. If this does not provide a valid actor, then the Keyboard FocusManager will
40  * check focusable properties to determine next focusable actor. If focusable properties are not set,
41  * then the Keyboard FocusManager calls the GetNextFocusableActor() method of this interface.
42  */
43 class CustomAlgorithmInterface
44 {
45 public:
46   /**
47    * @brief Virtual destructor.
48    */
49   virtual ~CustomAlgorithmInterface(){};
50
51   /**
52    * @brief Called by the KeyboardFocusManager to get the next focusable actor.
53    *
54    * @param[in] current The current focused actor
55    * @param[in] proposed The proposed focused actor
56    * @param[in] direction The direction of focus movement
57    * @return A handle to the next focusable actor
58    */
59   virtual Actor GetNextFocusableActor(Actor current, Actor proposed, Control::KeyboardFocus::Direction direction) = 0;
60 };
61
62 /**
63  * @brief Provide the implementation of custom Focus algorithm interface
64  *
65  * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
66  * @param[in] interface The user's implementation of CustomAlgorithmInterface
67  * @see DevelKeyboardFocusManager::CustomAlgorithmInterface
68  */
69 DALI_TOOLKIT_API void SetCustomAlgorithm(KeyboardFocusManager keyboardFocusManager, CustomAlgorithmInterface& interface);
70
71 /**
72  * @brief Decide using focus indicator or not
73  *
74  * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
75  * @param[in] enable Whether using focus indicator or not
76  */
77 DALI_TOOLKIT_API void EnableFocusIndicator(KeyboardFocusManager keyboardFocusManager, bool enable);
78
79 /**
80  * @brief Check focus indicator is enabled or not
81  *
82  * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
83  * @return True when focus indicator is enabled
84  */
85 DALI_TOOLKIT_API bool IsFocusIndicatorEnabled(KeyboardFocusManager keyboardFocusManager);
86
87 /**
88  * @brief Decide using default focus algorithm or not
89  *
90  * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
91  * @param[in] enable Whether using default focus algorithm or not
92  */
93 DALI_TOOLKIT_API void EnableDefaultAlgorithm(KeyboardFocusManager keyboardFocusManager, bool enable);
94
95 /**
96  * @brief Check default focus algorithm is enabled or not
97  *
98  * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
99  * @return True when default focus algorithm is enabled
100  */
101 DALI_TOOLKIT_API bool IsDefaultAlgorithmEnabled(KeyboardFocusManager keyboardFocusManager);
102
103 } // namespace DevelKeyboardFocusManager
104
105 } // namespace Toolkit
106
107 } // namespace Dali
108
109 #endif // DALI_TOOLKIT_KEYBOARD_FOCUS_MANAGER_DEVEL_H