Merge "Size negotiation example" 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
25 /**
26  * Example app that can load both JSON and JavaScript files from command line
27  * E.g.   scripting.example my-first.js  my-first.json
28  * See dali-demo/resources/scripts for example JSON and JavaScript files
29  */
30 class Launcher: public Dali::ConnectionTracker
31 {
32 public:
33
34   /**
35    * @brief Construcctor
36    * @param application application
37    * @param layoutFileName JSON file to run
38    * @param scriptFileName JavaScript file to run
39    */
40   Launcher( Dali::Application application, std::string layoutFileName, std::string scriptFileName );
41
42   /**
43    * @brief destructor
44    */
45   ~Launcher();
46
47   /**
48    * @brief create app
49    */
50   void Create( Dali::Application& application );
51
52   /**
53    * @brief run application MainLoop
54    */
55   void MainLoop();
56
57 private:
58
59   Dali::Toolkit::Script mScript;      ///< Used to load and execute JavaScript
60   Dali::Toolkit::Builder mBuilder;    ///< Used to parse JSON
61   Dali::Application mApplication;     ///< application
62   std::string mJSONFileName;          ///< JSON filename
63   std::string mJavaScriptFileName;    ///< JavaScript filename
64 };
65
66 #endif // header