9dfdda81d2888eaafebb48a8a5efd32106adfa6b
[platform/core/uifw/lottie-player.git] / example / evasapp.h
1 /*
2  * Copyright (c) 2018 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 #ifndef EVASAPP_H
18 #define EVASAPP_H
19
20 #ifndef EFL_BETA_API_SUPPORT
21 #define EFL_BETA_API_SUPPORT
22 #endif
23
24 #ifndef EFL_EO_API_SUPPORT
25 #define EFL_EO_API_SUPPORT
26 #endif
27
28 #include <Eo.h>
29 #include <Efl.h>
30 #include <Evas.h>
31 #include <Ecore.h>
32 #include <Ecore_Evas.h>
33 #include <Ecore_Input.h>
34 #include<vector>
35 #include<string>
36
37
38 typedef void (*appCb)(void *userData, void *extra);
39 class EvasApp
40 {
41 public:
42     EvasApp(int w, int h);
43     void setup();
44     void resize(int w, int h);
45     int width() const{ return mw;}
46     int height() const{ return mh;}
47     void run();
48     Ecore_Evas * ee() const{return mEcoreEvas;}
49     Evas * evas() const {return mEvas;}
50     void addExitCb(appCb exitcb, void *data) {mExitCb = exitcb; mExitData = data;}
51     void addResizeCb(appCb resizecb, void *data) {mResizeCb = resizecb; mResizeData = data;}
52     void addKeyCb(appCb keycb, void *data) {mKeyCb = keycb; mKeyData = data;}
53     void addRenderPreCb(appCb renderPrecb, void *data) {mRenderPreCb = renderPrecb; mRenderPreData = data;}
54     void addRenderPostCb(appCb renderPostcb, void *data) {mRenderPostCb = renderPostcb; mRenderPostData = data;}
55     static std::vector<std::string> jsonFiles(const std::string &dir, bool recurse=false);
56 public:
57     int           mw;
58     int           mh;
59     Ecore_Evas   *mEcoreEvas;
60     Evas         *mEvas;
61     Evas_Object  *mBackground;
62     appCb        mResizeCb;
63     void        *mResizeData;
64     appCb        mExitCb;
65     void        *mExitData;
66     appCb        mKeyCb;
67     void        *mKeyData;
68     appCb        mRenderPreCb;
69     void        *mRenderPreData;
70     appCb        mRenderPostCb;
71     void        *mRenderPostData;
72 };
73 #endif //EVASAPP_H