The license change version 1.0 to version 1.1
[platform/framework/web/web-provider.git] / src / Core / Buffer / BoxRenderBuffer.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    BoxRenderBuffer.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef BOX_RENDER_BUFFER_H
21 #define BOX_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 BoxRenderBuffer: 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 BoxRenderBuffer(
44                         boxId, instanceId, width, height));
45
46         }
47         ~BoxRenderBuffer();
48
49     protected:
50         // this function may be overriden by derived class
51         virtual void didHandleTouchEvent(
52                 TouchType type, double timestamp, double x, double y);
53
54         BoxRenderBuffer(
55                 std::string boxId, std::string instanceId, 
56                 int width, int height);
57
58     private:
59         // RenderBuffer Implementation
60         int getWidth() { return m_width; };
61         int getHeight() { return m_height; };
62         void setWidth(int width) { m_width = width; };
63         void setHeight(int height) { m_height = height; };
64         BufferInfoPtr acquireBuffer();
65         void updateBuffer();
66
67         // touch callback
68         static int handleTouchEventCallback(
69                 BufferInfoPtr bufferInfo,
70                 buffer_event event,
71                 double timestamp,
72                 double x,
73                 double y,
74                 void* data);
75
76         // members
77         std::string m_boxId;
78         std::string m_instanceId;
79         int m_width;
80         int m_height;
81 };
82
83 #endif // BOX_RENDER_BUFFER_H