Fix dump image
[framework/osp/shell.git] / src / FShell_AppWidgetLayer.h
1 //
2 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://floralicense.org/license/
9 //
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.
15 //
16 /**
17  * @file                FShell_AppWidgetLayer.h
18  * @brief               This is the header file for the _AppWidgetLayer class.
19  *
20  * This header file contains the declarations of the %_AppWidgetLayer class.
21  */
22 #ifndef _FSHELL_INTERNAL_APPWIDGET_LAYER_H_
23 #define _FSHELL_INTERNAL_APPWIDGET_LAYER_H_
24
25 #include <unique_ptr.h>
26 #include <Ecore_Evas.h>
27 #include <FBaseString.h>
28 #include "FUiAnim_EflLayer.h"
29 #include "FShell_IAppWidgetTouchEventListener.h"
30
31 namespace Tizen { namespace Ui
32 {
33 class _Window;
34 }} // Tizen::Ui
35
36 namespace Tizen { namespace Shell
37 {
38
39 class _AppWidgetBuffer;
40
41 /**
42  * @class _AppWidgetLayer
43  * @brief
44  * @since 2.1
45  */
46 class _AppWidgetLayer
47         : public Tizen::Ui::Animations::_EflLayer
48         , public Tizen::Shell::_IAppWidgetTouchEventListener
49 {
50 public:
51         _AppWidgetLayer(const Tizen::Base::String& providerId, const Tizen::Graphics::FloatDimension& size);
52         virtual ~_AppWidgetLayer(void);
53
54         virtual result OnConstructed(void);
55
56         result SetProviderId(const Tizen::Base::String& providerId);
57         Tizen::Base::String GetProviderId(void) const;
58         int GetPixmapId(void) const;
59         void SetLayerBounds(const Tizen::Graphics::FloatRectangle& bounds);
60         void* AllocCanvas(int size);
61         void FreeCanvas(void* pCanvas);
62         int EventHandler(int eventType, double timestamp, double x, double y);
63         result SyncPixmap(const Tizen::Graphics::FloatDimension& size);
64         void OnRendered(void);
65         void OnNativeCanvasPreRendered(void);
66         void OnNativeCanvasPostRendered(void);
67
68         virtual result RegisterTouchEventListener(void);
69         virtual int AcquirePixmap(void);
70         virtual result Sync(const Tizen::Graphics::FloatDimension& size);
71         virtual void ReleasePixmap(void);
72         virtual int OnTouchEventRecevied(int eventType, double timestamp, double x, double y);
73
74 private:
75         _AppWidgetLayer(const _AppWidgetLayer& rhs);
76         _AppWidgetLayer& operator =(const _AppWidgetLayer& rhs);
77         virtual void Flush(void);
78
79 protected:
80         bool __isReleased;
81         Tizen::Graphics::FloatDimension __size;
82         std::unique_ptr<_AppWidgetBuffer> __pAppWidgetBuffer;
83
84 private:
85         struct _EcoreEvasDeleter
86         {
87                 void operator()(Ecore_Evas* pEcoreEvas)
88                 {
89                         ecore_evas_free(pEcoreEvas);
90                 }
91         };
92
93         struct _EvasObjectDeleter
94         {
95                 void operator()(Evas_Object* pEvasObject)
96                 {
97                         evas_object_del(pEvasObject);
98                 }
99         };
100
101         std::unique_ptr<Ecore_Evas, _EcoreEvasDeleter> __pEcoreEvas;
102         std::unique_ptr<Evas_Object, _EvasObjectDeleter> __pEvasObject;
103         Tizen::Base::String __providerId;
104         void* __pRenderBuffer;
105         void* __pTempBuffer;
106         int __bufferSize;
107         int __pixmapId;
108 };
109
110 }} // Tizen::Shell
111
112 #endif // _FSHELL_INTERNAL_APPWIDGET_LAYER_H_