Merge "Implement Placeholder additional property" into devel/master
[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) 2017 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
30 namespace Toolkit
31 {
32
33 namespace DevelKeyboardFocusManager
34 {
35 /**
36  * @brief Interface used to provide custom keyboard focus algorithm for retrieving the next focusable actor.
37  *
38  * The application / toolkit can implement the interface and override the keyboard focus behaviour.
39  * Upon providing an implementation of this interface, the PreFocusChangeSignal is no longer emitted.
40  * If focus is changing within a layout container, then the layout container is queried first to provide
41  * the next focusable actor. If this does not provide a valid actor, then the Keyboard FocusManager will
42  * check focusable properties to determine next focusable actor. If focusable properties are not set,
43  * then the Keyboard FocusManager calls the GetNextFocusableActor() method of this interface.
44  */
45 class CustomAlgorithmInterface
46 {
47 public:
48
49   /**
50    * @brief Virtual destructor.
51    */
52   virtual ~CustomAlgorithmInterface() {};
53
54   /**
55    * @brief Called by the KeyboardFocusManager to get the next focusable actor.
56    *
57    * @param[in] current The current focused actor
58    * @param[in] proposed The proposed focused actor
59    * @param[in] direction The direction of focus movement
60    * @return A handle to the next focusable actor
61    */
62   virtual Actor GetNextFocusableActor(Actor current, Actor proposed, Control::KeyboardFocus::Direction direction) = 0;
63 };
64
65 /**
66  * @brief Provide the implementation of custom Focus algorithm interface
67  *
68  * @param[in] keyboardFocusManager The instance of KeyboardFocusManager
69  * @param[in] interface The user's implementation of CustomAlgorithmInterface
70  * @see DevelKeyboardFocusManager::CustomAlgorithmInterface
71  */
72 DALI_IMPORT_API void SetCustomAlgorithm(KeyboardFocusManager keyboardFocusManager, CustomAlgorithmInterface& interface);
73
74 } // namespace DevelKeyboardFocusManager
75
76 } // namespace Toolkit
77
78 } // namespace Dali
79
80 #endif // DALI_TOOLKIT_KEYBOARD_FOCUS_MANAGER_DEVEL_H