cb08a8e517a38b4c7f4c11533523821781d7097f
[platform/framework/web/web-provider.git] / src / Core / Box.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Flora License, Version 1.0 (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    Box.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef BOX_H
21 #define BOX_H
22
23 #include <memory>
24 #include <Ecore.h>
25 #include <Plugin/IBoxPluginFactory.h>
26 #include "Buffer/IRenderBuffer.h"
27 #include "View/IRenderView.h"
28 #include "Util/ITimer.h"
29 #include "BoxData.h"
30 #include "IBoxState.h"
31 #include "IBoxContext.h"
32 #include "IBox.h"
33 #include "Box.h"
34
35 class Box: public IBox, public IBoxContext {
36     public:
37         static IBoxPtr create(
38                 BoxInfoPtr boxInfo, 
39                 IBoxPluginFactoryPtr factory,  
40                 EwkContextPtr ewkContext)
41         { 
42             return IBoxPtr(new Box(boxInfo, factory, ewkContext)); 
43         };
44         // IBox
45         bool show();
46         bool hide();
47         bool resize(int width, int height);
48         bool resume();
49         bool pause();
50         bool openPd(int width, int height, double x, double y);
51         bool closePd();
52         bool update();
53         bool changePeriod(float period);
54         ~Box();
55
56     private:
57         RenderInfoPtr makeRenderInfo(const std::string& renderType) const;
58
59         // IBoxContext
60         void setState(IBoxStatePtr state);
61
62         // static callbacks
63         static Eina_Bool updateCallback(void* data);
64
65         // constructor
66         explicit Box(
67                 BoxInfoPtr boxInfo, 
68                 IBoxPluginFactoryPtr factory, 
69                 EwkContextPtr ewkContext);
70
71         BoxInfoPtr m_boxInfo;
72         IBoxPluginFactoryPtr m_factory;
73         IRenderBufferPtr m_boxBuffer;
74         IRenderBufferPtr m_pdBuffer;
75         IRenderViewPtr m_view;
76         ITimerPtr m_updateTimer;
77         //IBoxStatePtr m_state;
78
79         friend class BoxSchemeHandler;
80 };
81
82 #endif //BOX_H
83