2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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_ControlManager.h
19 * @brief This is the header file for the _ControlManager class.
21 * This header file contains the declarations of the %_ControlManager class.
24 #ifndef _FUI_INTERNAL_CONTROL_MANAGER_H_
25 #define _FUI_INTERNAL_CONTROL_MANAGER_H_
27 #include <FBaseColIListT.h>
28 #include <FBaseColHashMapT.h>
29 #include <FGrp_CoordinateSystem.h>
30 #include <FSysISettingEventListener.h>
31 #include "FUi_Types.h"
33 #if defined(MULTI_WINDOW)
34 namespace Tizen { namespace Base { namespace Collection
36 template<class T> class LinkedListT;
37 }}} // Tizen::Base::Collection
40 namespace Tizen { namespace Ui
45 class _IUiEventListener;
46 class _TouchGestureDetector;
48 class _OSP_EXPORT_ _ControlManager
49 : public Tizen::System::ISettingEventListener
52 // Initialize, Access, Release
53 static void Initialize(void);
54 static void Release(void);
55 static _ControlManager* GetInstance(void);
56 static void InitInstance(void);
58 // Control Handle Management
59 _ControlHandle Register(_Control* pObject);
60 _Control* Release(const _ControlHandle& handle);
61 _Control* GetObject(const _ControlHandle& handle);
62 const _Control* GetObject(const _ControlHandle& handle) const;
63 int GetUsedHandleCount(void) const;
66 _Window* GetWindow(int index) const;
67 int GetWindowCount(void) const;
68 _Window* GetTopWindow(void) const;
69 #if defined(MULTI_WINDOW)
70 _Window* GetTopVisibleWindow(void) const;
71 _Window* GetTopVisibleWindowAt(const Tizen::Graphics::Point& point) const;
73 bool IsWindowOnTop(const _Window& window) const;
74 bool IsWindowAttached(const _Window& window) const;
75 result OpenWindow(_Window& window, bool invalidate);
76 result CloseWindow(_Window& window);
79 _ControlOrientation GetOrientation(void) const;
80 void SetOrientation(_ControlOrientation orientation);
83 _ControlRotation GetScreenRotation(void) const;
86 Tizen::Graphics::Dimension GetScreenSize(void) const;
89 result SetDefaultFont(const Tizen::Base::String& appFontName);
90 Tizen::Base::String GetDefaultFont(void);
91 bool IsDefaultFontChanged(void);
92 void SetDefaultFontChangeState(bool isDefaultFontChanged);
94 // Coordinate system info
95 bool IsCoordinateSystemLogical(void) const;
96 int GetCoordinateSystem(void) const;
97 Tizen::Graphics::_BaseScreenSize GetLogicalBaseScreenSize(void) const;
100 _Control* GetFocusedControl(void) const;
101 void SetFocusedControl(const _Control& control);
102 bool TakeFocusFromControl(const _Control& control);
105 _Control* GetTopmostTouchedControl(const Tizen::Graphics::Point& point);
106 _Window* GetCurrentFrame(void) const;
107 bool IsFrameActivated(void) const;
109 #if !defined(MULTI_WINDOW)
111 const _Control& GetRoot(void) const;
112 _Control& GetRoot(void);
116 result AddGestureDetector(const _TouchGestureDetector& gesture);
117 result RemoveGestureDetector(const _TouchGestureDetector& gesture);
118 Tizen::Base::Collection::IListT<_TouchGestureDetector*>* GetGestureDetectorList(void) const;
119 int GetGestureMaxTimeDuration(void) const;
121 // Do not use. System only.
122 void SetOrientationStatus(_ControlRotation orientationStatus);
123 void RotateScreen(_ControlRotation screenRotation);
124 void RotateScreen(const _Control& control, _ControlRotation screenRotation);
125 void OnScreenRotated(int rotation);
126 void OnWindowRotated(int rotation);
127 #if defined(MULTI_WINDOW)
128 void SetTouchedWindow(unsigned int window);
129 _Window* GetTouchedWindow(void) const;
131 result MoveWindowToTop(const _Window& window);
132 result MoveWindowToBottom(const _Window& window);
135 ~_ControlManager(void);
136 _ControlManager(void);
137 _ControlManager(const _ControlManager&);
138 _ControlManager& operator =(const _ControlManager&);
140 // Coordinate system info
141 result GetAppCoordinateSystem(bool& isCoordinateSystemLogical, int& logicalCoordinateSystemInt, Tizen::Graphics::_BaseScreenSize& logicalBaseScreenSize);
143 result AttachWindow(_Window& window);
144 result InsertWindowToBottom(_Window& window);
145 result InsertWindowAfter(const _Window& targetWindow, _Window& window);
146 result InsertWindowBefore(const _Window& targetWindow, _Window& window);
147 result DetachWindow(_Window& window);
148 void DetachAllWindows(void);
150 result MoveWindowAfter(const _Window& targetWindow, const _Window& window);
151 result MoveWindowBefore(const _Window& targetWindow, const _Window& window);
153 result ActivateWindow(_Window& window);
155 result CallOnAttachingToMainTree(_Control& control);
156 result CallOnAttachedToMainTree(_Control& control);
157 result CallOnDetachingFromMainTree(_Control& control);
159 virtual void OnSettingChanged(Tizen::Base::String& key);
162 Tizen::Base::_ObjectManagerT <_Control> __objectManager;
164 #if !defined(MULTI_WINDOW)
167 Tizen::Base::Collection::LinkedListT<_Window*>* __pWindowList;
169 bool __isCoordinateSystemLogical;
170 int __logicalCoordinateSystem;
171 Tizen::Graphics::_BaseScreenSize __logicalBaseScreenSize;
172 Tizen::Base::Collection::LinkedListT<_Window*>* __pSystemWindowList;
173 _Control* __pFocusedControl;
174 _ControlRotation __screenRotation;
175 _ControlRotation __orientationStatus;
176 _ControlOrientation __orientation;
177 #if !defined(MULTI_WINDOW)
178 _IWindow* __pWindowPi;
180 _Window* __pCurrentFrame;
181 Tizen::Base::Collection::IListT<_TouchGestureDetector*>* __pGestureList;
182 int __gestureMaxDuration;
183 #if defined(MULTI_WINDOW)
184 unsigned int __touchedWindow; // [SLP]
186 bool __isDefaultFontChanged;
187 Tizen::Base::String __defaultFontName;
188 static _ControlManager* __pInstance;
189 }; // _ControlManager
193 #endif // _FUI_INTERNAL_CONTROL_MANAGER_H_