Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-demo.git] / examples / scripting / launcher.h
1 #ifndef DALI_APP_H
2 #define DALI_APP_H
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/dali.h>
23 #include <dali-toolkit/dali-toolkit.h>
24 #include <dali-toolkit/devel-api/scripting/script.h>
25 #include <dali-toolkit/devel-api/builder/builder.h>
26
27 /**
28  * Example app that can load both JSON and JavaScript files from command line
29  * E.g.   scripting.example my-first.js  my-first.json
30  * See dali-demo/resources/scripts for example JSON and JavaScript files
31  */
32 class Launcher: public Dali::ConnectionTracker
33 {
34 public:
35
36   /**
37    * @brief Construcctor
38    * @param application application
39    * @param layoutFileName JSON file to run
40    * @param scriptFileName JavaScript file to run
41    */
42   Launcher( Dali::Application application, std::string layoutFileName, std::string scriptFileName );
43
44   /**
45    * @brief destructor
46    */
47   ~Launcher();
48
49   /**
50    * @brief create app
51    */
52   void Create( Dali::Application& application );
53
54   /**
55    * @brief run application MainLoop
56    */
57   void MainLoop();
58
59 private:
60
61   Dali::Toolkit::Script mScript;      ///< Used to load and execute JavaScript
62   Dali::Toolkit::Builder mBuilder;    ///< Used to parse JSON
63   Dali::Application mApplication;     ///< application
64   std::string mJSONFileName;          ///< JSON filename
65   std::string mJavaScriptFileName;    ///< JavaScript filename
66 };
67
68 #endif // header