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); width()47 int width() const{ return mw;} height()48 int height() const{ return mh;} 49 void run(); ee()50 Ecore_Evas * ee() const{return mEcoreEvas;} evas()51 Evas * evas() const {return mEvas;} addExitCb(appCb exitcb,void * data)52 void addExitCb(appCb exitcb, void *data) {mExitCb = exitcb; mExitData = data;} addResizeCb(appCb resizecb,void * data)53 void addResizeCb(appCb resizecb, void *data) {mResizeCb = resizecb; mResizeData = data;} addKeyCb(appCb keycb,void * data)54 void addKeyCb(appCb keycb, void *data) {mKeyCb = keycb; mKeyData = data;} addRenderPreCb(appCb renderPrecb,void * data)55 void addRenderPreCb(appCb renderPrecb, void *data) {mRenderPreCb = renderPrecb; mRenderPreData = data;} addRenderPostCb(appCb renderPostcb,void * 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{0}; 60 int mh{0}; 61 Ecore_Evas *mEcoreEvas{nullptr}; 62 Evas *mEvas{nullptr}; 63 Evas_Object *mBackground{nullptr}; 64 appCb mResizeCb{nullptr}; 65 void *mResizeData{nullptr}; 66 appCb mExitCb{nullptr}; 67 void *mExitData{nullptr}; 68 appCb mKeyCb{nullptr}; 69 void *mKeyData{nullptr}; 70 appCb mRenderPreCb{nullptr}; 71 void *mRenderPreData{nullptr}; 72 appCb mRenderPostCb{nullptr}; 73 void *mRenderPostData{nullptr}; 74 }; 75 #endif //EVASAPP_H 76