The license change version 1.0 to version 1.1
[platform/framework/web/web-provider.git] / src / Core / Buffer / PdRenderBuffer.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
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    PdRenderBuffer.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef PD_RENDER_BUFFER_H
21 #define PD_RENDER_BUFFER_H
22
23 #include <string>
24 #include <provider_buffer.h>
25 #include "IRenderBuffer.h"
26 #include "RenderBuffer.h"
27
28 #define EXPORT_CLASS    __attribute__ ((visibility("default"))
29
30 class EXPORT_CLASS PdRenderBuffer: public RenderBuffer {
31     public:
32         enum TouchType {
33             TOUCH_EVENT_UNRECOGNIZED = -1,
34             TOUCH_EVENT_MOVE = 0,
35             TOUCH_EVENT_DOWN,
36             TOUCH_EVENT_UP
37         };
38
39         static IRenderBufferPtr create(
40                 std::string boxId, std::string instanceId, 
41                 int width, int height) 
42         {
43             return IRenderBufferPtr(new PdRenderBuffer(boxId, instanceId, width, height));
44         }
45         ~PdRenderBuffer();
46
47     private:
48         void didHandleTouchEvent(
49                 TouchType type, double timestamp, double x, double y);
50
51         // RenderBuffer Implementation
52         int getWidth() { return m_width; };
53         int getHeight() { return m_height; };
54         void setWidth(int width) { m_width = width; };
55         void setHeight(int height) { m_height = height; };
56         BufferInfoPtr acquireBuffer();
57         void updateBuffer();
58
59         // touch callback
60         static int handleTouchEventCallback(
61                 BufferInfoPtr bufferInfo,
62                 buffer_event event,
63                 double timestamp,
64                 double x,
65                 double y,
66                 void* data);
67
68         PdRenderBuffer(
69                 std::string boxId, std::string instanceId, 
70                 int width, int height);
71
72         // members
73         std::string m_boxId;
74         std::string m_instanceId;
75         int m_width;
76         int m_height;
77 };
78
79 #endif // PD_RENDER_BUFFER_H