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