updated licenses info.
[platform/core/uifw/lottie-player.git] / example / evasapp.h
1 /* 
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
3  * 
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  * 
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  * 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #ifndef EVASAPP_H
20 #define EVASAPP_H
21
22 #ifndef EFL_BETA_API_SUPPORT
23 #define EFL_BETA_API_SUPPORT
24 #endif
25
26 #ifndef EFL_EO_API_SUPPORT
27 #define EFL_EO_API_SUPPORT
28 #endif
29
30 #include <Eo.h>
31 #include <Efl.h>
32 #include <Evas.h>
33 #include <Ecore.h>
34 #include <Ecore_Evas.h>
35 #include <Ecore_Input.h>
36 #include<vector>
37 #include<string>
38
39
40 typedef void (*appCb)(void *userData, void *extra);
41 class EvasApp
42 {
43 public:
44     EvasApp(int w, int h);
45     void setup();
46     void resize(int w, int h);
47     int width() const{ return mw;}
48     int height() const{ return mh;}
49     void run();
50     Ecore_Evas * ee() const{return mEcoreEvas;}
51     Evas * evas() const {return mEvas;}
52     void addExitCb(appCb exitcb, void *data) {mExitCb = exitcb; mExitData = data;}
53     void addResizeCb(appCb resizecb, void *data) {mResizeCb = resizecb; mResizeData = data;}
54     void addKeyCb(appCb keycb, void *data) {mKeyCb = keycb; mKeyData = data;}
55     void addRenderPreCb(appCb renderPrecb, void *data) {mRenderPreCb = renderPrecb; mRenderPreData = data;}
56     void addRenderPostCb(appCb renderPostcb, void *data) {mRenderPostCb = renderPostcb; mRenderPostData = data;}
57     static std::vector<std::string> jsonFiles(const std::string &dir, bool recurse=false);
58 public:
59     int           mw;
60     int           mh;
61     Ecore_Evas   *mEcoreEvas;
62     Evas         *mEvas;
63     Evas_Object  *mBackground;
64     appCb        mResizeCb;
65     void        *mResizeData;
66     appCb        mExitCb;
67     void        *mExitData;
68     appCb        mKeyCb;
69     void        *mKeyData;
70     appCb        mRenderPreCb;
71     void        *mRenderPreData;
72     appCb        mRenderPostCb;
73     void        *mRenderPostData;
74 };
75 #endif //EVASAPP_H