1 #ifndef __DALI_TOOLKIT_INTERNAL_KEYINPUT_FOCUS_MANAGER_H__
2 #define __DALI_TOOLKIT_INTERNAL_KEYINPUT_FOCUS_MANAGER_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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
11 // http://floralicense.org/license/
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.
25 #include <dali/dali.h>
26 #include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>
27 #include <dali-toolkit/public-api/controls/control.h>
38 class KeyInputFocusManager;
41 * @copydoc Toolkit::KeyInputFocusManager
43 class KeyInputFocusManager : public Dali::BaseObject
47 typedef std::deque< unsigned int > ActorQueue;
48 typedef std::deque< unsigned int >::iterator ActorQueueIterator;
49 typedef std::deque< unsigned int >::const_iterator ActorQueueConstIterator;
52 * Construct a new KeyInputFocusManager.
54 KeyInputFocusManager();
57 * @copydoc Toolkit::SetFocus
59 void SetFocus(Toolkit::Control control);
62 * @copydoc Toolkit::GetCurrentFocusControl
64 Toolkit::Control GetCurrentFocusControl() const;
67 * @copydoc Toolkit::RemoveFocus
69 void RemoveFocus(Toolkit::Control control);
72 * @copydoc Toolkit::IsKeyboardListener
74 bool IsKeyboardListener(Toolkit::Control control) const;
79 * @copydoc Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignal()
81 Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignalV2& KeyInputFocusChangedSignal();
84 * @copydoc Toolkit::KeyInputFocusManager::UnhandledKeyEventSignal()
86 Toolkit::KeyInputFocusManager::UnhandledKeyEventSignalV2& UnhandledKeyEventSignal();
89 * Connects a callback function with the object's signals.
90 * @param[in] object The object providing the signal.
91 * @param[in] tracker Used to disconnect the signal.
92 * @param[in] signalName The signal to connect to.
93 * @param[in] functor A newly allocated FunctorDelegate.
94 * @return True if the signal was connected.
95 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
97 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
104 virtual ~KeyInputFocusManager();
109 * Callback for the key event when no actor in the stage has gained the key input focus
110 * @param[in] event The KeyEvent event.
112 void OnKeyEvent(const KeyEvent& event);
115 * Signal handler called when a focused Actor is removed from Stage.
116 * @param[in] actor The actor removed from stage.
118 void OnFocusActorStageDisconnection( Dali::Actor actor );
123 KeyInputFocusManager(const KeyInputFocusManager&);
125 KeyInputFocusManager& operator=(const KeyInputFocusManager& rhs);
129 // The key input focus change signal
130 Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignalV2 mKeyInputFocusChangedSignalV2;
132 // The un-handled key event signal
133 Toolkit::KeyInputFocusManager::UnhandledKeyEventSignalV2 mUnhandledKeyEventSignalV2;
135 // Keyboard events are sent to the current focus actor, which will be the actor on the top of the focus actors stack.
136 ActorQueue mFocusActorsQueue;
138 SlotDelegate< KeyInputFocusManager > mSlotDelegate;
141 } // namespace Internal
143 inline Internal::KeyInputFocusManager& GetImpl(Dali::Toolkit::KeyInputFocusManager& obj)
145 DALI_ASSERT_ALWAYS(obj);
147 Dali::BaseObject& handle = obj.GetBaseObject();
149 return static_cast<Internal::KeyInputFocusManager&>(handle);
152 inline const Internal::KeyInputFocusManager& GetImpl(const Dali::Toolkit::KeyInputFocusManager& obj)
154 DALI_ASSERT_ALWAYS(obj);
156 const Dali::BaseObject& handle = obj.GetBaseObject();
158 return static_cast<const Internal::KeyInputFocusManager&>(handle);
161 } // namespace Toolkit
165 #endif // __DALI_TOOLKIT_INTERNAL_KEYINPUT_FOCUS_MANAGER_H__