[Tizen] Create Widget Application
[platform/core/uifw/dali-adaptor.git] / adaptors / widget / widget-application.h
1 #ifndef __DALI_WIDGET_APPLICATION_H__
2 #define __DALI_WIDGET_APPLICATION_H__
3
4 /*
5  * Copyright (c) 2017 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/public-api/object/base-handle.h>
23 #include <dali/public-api/signals/dali-signal.h>
24 #include <dali/public-api/signals/callback.h>
25
26 namespace Dali
27 {
28
29 namespace Internal DALI_INTERNAL
30 {
31 namespace Adaptor
32 {
33 class WidgetApplication;
34 }
35 }
36
37 class Window;
38
39 class DALI_IMPORT_API WidgetApplication : public BaseHandle
40 {
41 public:
42
43   typedef Signal< void (WidgetApplication&) > AppSignalType;  ///< Application lifecycle signal and system signal callback type
44
45 public:
46
47   /**
48    * @brief This is the constructor for WidgetApplications with a name.
49    *
50    * @param[in,out]  argc        A pointer to the number of arguments
51    * @param[in,out]  argv        A pointer to the argument list
52    * @param[in]      stylesheet  The path to user defined theme file
53    * @return A handle to the WidgetApplication
54    * @note If the stylesheet is not specified, then the library's default stylesheet will not be overridden.
55    */
56   static WidgetApplication New( int* argc, char **argv[], const std::string& stylesheet );
57
58   /**
59    * @brief The default constructor.
60    *
61    */
62   WidgetApplication();
63
64   /**
65    * @brief Copy Constructor.
66    * @param[in] WidgetApplication Handle to an object
67    */
68   WidgetApplication( const WidgetApplication& widgetApplication );
69
70   /**
71    * @brief Assignment operator.
72    * @param[in] WidgetApplication Handle to an object
73    * @return A reference to this
74    */
75   WidgetApplication& operator=( const WidgetApplication& widgetApplication );
76
77  /**
78    * @brief Destructor
79    *
80    */
81   ~WidgetApplication();
82
83   /**
84    * @brief This starts the application.
85    */
86   void MainLoop();
87
88   /**
89    * @brief This quits the application.  Tizen applications should use Lower to improve re-start performance unless they need to Quit completely.
90    */
91   void Quit();
92
93   /**
94    * @brief Get window.
95    * @return the window for widget instance.
96    */
97   Window GetWindow();
98
99   /**
100    * @brief Get path application resources are stored at
101    * @return the full path of the resources
102    */
103
104   static std::string GetResourcePath();
105
106 public:  // Signals
107
108   /**
109    * @brief The user should connect to this signal to determine when they should initialize
110    * their application.
111    * @return The signal to connect to
112    */
113   AppSignalType& InitSignal();
114
115   /**
116    * @brief The user should connect to this signal to determine when they should terminate
117    * their application.
118    * @return The signal to connect to
119    */
120   AppSignalType& TerminateSignal();
121
122   /**
123    * @brief This signal is emitted when the language is changed on the device.
124    * @return The signal to connect to
125    */
126   AppSignalType& LanguageChangedSignal();
127
128   /**
129   * @brief This signal is emitted when the region of the device is changed.
130   * @return The signal to connect to
131   */
132   AppSignalType& RegionChangedSignal();
133
134   /**
135   * @brief This signal is emitted when the battery level of the device is low.
136   * @return The signal to connect to
137   */
138   AppSignalType& BatteryLowSignal();
139
140   /**
141   * @brief This signal is emitted when the memory level of the device is low.
142   * @return The signal to connect to
143   */
144   AppSignalType& MemoryLowSignal();
145
146 public: // Not intended for application developers
147   /// @cond internal
148   /**
149    * @brief Internal constructor.
150    */
151   explicit DALI_INTERNAL WidgetApplication(Internal::Adaptor::WidgetApplication* widgetApplication);
152   /// @endcond
153 };
154
155 } // namespace Dali
156
157 #endif // ___DALI_WIDGET_APPLICATION_H__