2 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 * @file FShell_AppWidgetViewManager.h
18 * @brief This is the header file for the _AppWidgetViewManager class.
20 * This header file contains the declarations of the %_AppWidgetViewManager class.
22 #ifndef _FSHELL_INTERNAL_APPWIDGET_VIEW_MANAGER_H_
23 #define _FSHELL_INTERNAL_APPWIDGET_VIEW_MANAGER_H_
25 #include <unique_ptr.h>
26 #include <FGrpBitmapCommon.h>
27 #include <FMediaImageTypes.h>
31 namespace Tizen { namespace Base
36 namespace Tizen { namespace Base { namespace Collection
38 template<class KeyType, class ValueType> class HashMapT;
41 namespace Tizen { namespace Graphics
45 class _ICoordinateSystemTransformer;
48 namespace Tizen { namespace Shell
51 class _AppWidgetBuffer;
54 * @class _AppWidgetViewManager
58 class _AppWidgetViewManager
61 static _AppWidgetViewManager* GetInstance(void);
62 livebox* AddAppWidgetView(_AppWidgetView* pAppWidgetView, const Tizen::Base::String& userInfo);
63 void RemoveAppWidgetView(_AppWidgetView* pAppWidgetView);
64 _AppWidgetView* GetAppWidgetView(livebox* pAppWidget) const;
65 Tizen::Graphics::FloatDimension GetAppWidgetSize(livebox* pAppWidget) const;
66 Tizen::Graphics::FloatDimension GetAppWidgetPopupSize(livebox* pAppWidget) const;
67 void SetAppWidgetSize(const _AppWidgetView& appwidgetView, const Tizen::Graphics::FloatDimension& size);
68 void AddFrameEventListener(void);
69 int GetAppWidgetSizeType(const Tizen::Graphics::FloatDimension& size) const;
72 _AppWidgetViewManager(void);
73 ~_AppWidgetViewManager(void);
74 _AppWidgetViewManager(const _AppWidgetViewManager& rhs);
75 _AppWidgetViewManager& operator =(const _AppWidgetViewManager& rhs);
77 Tizen::Media::MediaPixelFormat GetPixelFormat(Tizen::Graphics::BitmapPixelFormat format) const;
78 Tizen::Graphics::Bitmap* GetBitmapN(const Tizen::Base::String& fileName) const;
79 Tizen::Graphics::Bitmap* GetBitmapN(void* pBuffer, const Tizen::Graphics::FloatDimension& size) const;
80 bool IsGlMode(void) const;
81 void DumpBuffer(unsigned int pixmap, const char* pName);
83 void OnAppWidgetCreated(livebox* pAppWidget);
84 void OnAppWidgetUpdated(livebox* pAppWidget);
85 void OnAppWidgetDeleted(livebox* pAppWidget);
86 void OnAppWidgetPinUpChanged(livebox* pAppWidget);
87 void OnAppWidgetPopupUpdated(livebox* pAppWidget);
89 static int OnAppWidgetEventReceived(livebox* pAppWidget, livebox_event_type eventType, void* pData);
90 static int OnAppWidgetFaultReceived(livebox_fault_type faultType, const char* pAppId, const char* pFilename, const char *pFuncName, void* pData);
91 static void OnAppWidgetActivated(livebox* pAppWidget, int ret, void* pData);
92 static void OnAppWidgetAdded(livebox* pAppWidget, int ret, void* pData);
93 static void OnAppWidgetDeleted(livebox *pAppWidget, int ret, void* pData);
94 static void OnAppWidgetResized(livebox* pAppWidget, int ret, void* pData);
96 class _FrameEventListener
97 : public Tizen::Ui::Controls::_IFrameEventListener
100 virtual void OnFrameActivated(const Tizen::Ui::Controls::_Frame& source);
101 virtual void OnFrameDeactivated(const Tizen::Ui::Controls::_Frame& source);
102 virtual void OnFrameMinimized(const Tizen::Ui::Controls::_Frame& source);
103 virtual void OnFrameRestored(const Tizen::Ui::Controls::_Frame& source);
107 struct _EventHandlerDeleter
113 livebox_unset_event_handler(OnAppWidgetEventReceived);
117 struct _FaultEventHandlerDeleter
123 livebox_unset_fault_handler(OnAppWidgetFaultReceived);
127 std::unique_ptr<Tizen::Base::Collection::HashMapT<livebox*, _AppWidgetView*> > __pViewMap;
128 std::unique_ptr<Tizen::Graphics::_ICoordinateSystemTransformer> __pCoordinateTransformer;
129 std::unique_ptr<int, _EventHandlerDeleter> __eventHandler;
130 std::unique_ptr<int, _FaultEventHandlerDeleter> __faultEventHandler;
131 std::unique_ptr<_FrameEventListener> __pFrameEventListener;
133 std::unique_ptr<_AppWidgetBuffer> __pAppWidgetBuffer;
138 #endif // _FSHELL_INTERNAL_APPWIDGET_VIEW_MANAGER_H_