2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUi_FocusManagerImpl.h
19 * @brief This is the header file for the _FocusManagerImpl class.
21 * This header file contains the declarations of the _FocusManagerImpl class. @n.
23 #ifndef _FUI_INTERNAL_FOCUS_MANAGER_IMPL_H_
24 #define _FUI_INTERNAL_FOCUS_MANAGER_IMPL_H_
26 #include <FUi_IKeyEventListener.h>
27 #include <FUi_ITouchEventListener.h>
28 #include <FUiAnim_VisualElement.h>
29 #include <FBaseColIListT.h>
30 #include <FBaseObject.h>
32 namespace Tizen { namespace Ui { namespace Animations
35 }}} //Tizen::Ui::Animations
37 namespace Tizen { namespace Ui
47 FOCUS_DIRECTION_DOWNWARD,
48 FOCUS_DIRECTION_UPWARD
54 * @brief This class manages the application's current focus owned by the UI control
55 * and its ancestor Window.
58 * Use this class to query the application's current focus owner.
60 class _FocusManagerImpl
61 : public Tizen::Base::Object
62 , public Tizen::Ui::_IKeyEventListener
63 , public Tizen::Ui::_ITouchEventListener
67 * Returns the pointer to the current focus manager.
70 * @return The current focus manager instance
72 static _FocusManagerImpl* GetInstance(void);
76 * Gets the current focus owner.
79 * @return The current focus owner
80 * @remarks The method returns the current focus owner of this application.
82 _ControlImpl* GetCurrentFocusOwner(void) const;
86 * Gets the current focused Window.
89 * @return The current focused Window
90 * @remarks The method returns the application's current focus owner's ancestor
91 * Window or Window that is currently focused.
93 _WindowImpl* GetCurrentFocusedWindow(void) const;
95 static void Initialize(void);
97 static void ReleaseInstance(void);
98 bool IsFocusModeStateEnabled(void) const;
102 * This is the default constructor for this class.
106 _FocusManagerImpl(void);
110 * This is the destructor for this class.
114 virtual ~_FocusManagerImpl(void);
116 _FocusManagerImpl(_FocusManagerImpl& rhs);
117 _FocusManagerImpl& operator=(_FocusManagerImpl& rhs);
119 static void InitializeInstance(void);
121 virtual bool OnKeyPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
122 virtual bool OnKeyReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
124 virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo) ;
125 virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo) ;
126 virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo) ;
127 virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
130 void StartFocusTraversal(_Control* pControl, FocusDirection focusDirection);
131 int GetNextIndex(int currentIndex, FocusDirection focusDirection, const Tizen::Base::Collection::IListT<_Control*>* pFocusControlList) const;
132 bool IsFocusable(_Control* pControl) const;
133 _Control* FindTraversalControlFromChild(_Control* pControl);
134 bool IsFocusControlListControl(_Control* pControl) const;
135 bool IsForwardDirection(void) const;
138 static _FocusManagerImpl* __pInstance;
139 Tizen::Ui::_Control* __pCurrentFocusUiControl;
141 FocusDirection __focusDirection;
142 }; // _FocusManagerImpl
146 #endif // _FUI_INTERNAL_FOCUS_MANAGER_IMPL_H_