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 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
26 #include <dali/dali.h>
27 #include <dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h>
28 #include <dali-toolkit/public-api/controls/control.h>
39 class KeyInputFocusManager;
42 * @copydoc Toolkit::KeyInputFocusManager
44 class KeyInputFocusManager : public Dali::BaseObject
48 typedef std::deque< unsigned int > ActorQueue;
49 typedef std::deque< unsigned int >::iterator ActorQueueIterator;
50 typedef std::deque< unsigned int >::const_iterator ActorQueueConstIterator;
53 * Construct a new KeyInputFocusManager.
55 KeyInputFocusManager();
58 * @copydoc Toolkit::SetFocus
60 void SetFocus(Toolkit::Control control);
63 * @copydoc Toolkit::GetCurrentFocusControl
65 Toolkit::Control GetCurrentFocusControl() const;
68 * @copydoc Toolkit::RemoveFocus
70 void RemoveFocus(Toolkit::Control control);
73 * @copydoc Toolkit::IsKeyboardListener
75 bool IsKeyboardListener(Toolkit::Control control) const;
80 * @copydoc Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignal()
82 Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignalV2& KeyInputFocusChangedSignal();
85 * @copydoc Toolkit::KeyInputFocusManager::UnhandledKeyEventSignal()
87 Toolkit::KeyInputFocusManager::UnhandledKeyEventSignalV2& UnhandledKeyEventSignal();
90 * Connects a callback function with the object's signals.
91 * @param[in] object The object providing the signal.
92 * @param[in] tracker Used to disconnect the signal.
93 * @param[in] signalName The signal to connect to.
94 * @param[in] functor A newly allocated FunctorDelegate.
95 * @return True if the signal was connected.
96 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
98 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
105 virtual ~KeyInputFocusManager();
110 * Callback for the key event when no actor in the stage has gained the key input focus
111 * @param[in] event The KeyEvent event.
113 void OnKeyEvent(const KeyEvent& event);
116 * Signal handler called when a focused Actor is removed from Stage.
117 * @param[in] actor The actor removed from stage.
119 void OnFocusActorStageDisconnection( Dali::Actor actor );
124 KeyInputFocusManager(const KeyInputFocusManager&);
126 KeyInputFocusManager& operator=(const KeyInputFocusManager& rhs);
130 // The key input focus change signal
131 Toolkit::KeyInputFocusManager::KeyInputFocusChangedSignalV2 mKeyInputFocusChangedSignalV2;
133 // The un-handled key event signal
134 Toolkit::KeyInputFocusManager::UnhandledKeyEventSignalV2 mUnhandledKeyEventSignalV2;
136 // Keyboard events are sent to the current focus actor, which will be the actor on the top of the focus actors stack.
137 ActorQueue mFocusActorsQueue;
139 SlotDelegate< KeyInputFocusManager > mSlotDelegate;
142 } // namespace Internal
144 inline Internal::KeyInputFocusManager& GetImpl(Dali::Toolkit::KeyInputFocusManager& obj)
146 DALI_ASSERT_ALWAYS(obj);
148 Dali::BaseObject& handle = obj.GetBaseObject();
150 return static_cast<Internal::KeyInputFocusManager&>(handle);
153 inline const Internal::KeyInputFocusManager& GetImpl(const Dali::Toolkit::KeyInputFocusManager& obj)
155 DALI_ASSERT_ALWAYS(obj);
157 const Dali::BaseObject& handle = obj.GetBaseObject();
159 return static_cast<const Internal::KeyInputFocusManager&>(handle);
162 } // namespace Toolkit
166 #endif // __DALI_TOOLKIT_INTERNAL_KEYINPUT_FOCUS_MANAGER_H__