[3.0] Fix blending issue
[platform/core/uifw/dali-adaptor.git] / adaptors / wearable / watch / watch-application.h
1 #ifndef __DALI_WATCH_APPLICATION_H__
2 #define __DALI_WATCH_APPLICATION_H__
3
4 /*
5  * Copyright (c) 2016 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 <string>
23 #include <dali/public-api/object/base-handle.h>
24 #include <dali/public-api/signals/callback.h>
25
26 // INTERNAL INCLUDES
27 #include <public-api/adaptor-framework/application.h>
28 #include "watch-time.h"
29
30 namespace Dali
31 {
32 /**
33  * @addtogroup dali_adaptor_framework
34  * @{
35  */
36 namespace Internal DALI_INTERNAL
37 {
38 namespace Adaptor
39 {
40 class WatchApplication;
41 }
42 }
43
44 /**
45  * @brief A WatchApplication class object should be created by every watch application
46  * that wishes to use Dali.
47  *
48  * It provides a means for initialising the resources required by the Dali::Core.
49  * Like Application class, the WatchApplication class manages Tizen watch application life cycle.
50  *
51  * The WatchApplication class emits additional signals which are availalble only in the watch application
52  * (TimeTick, AmbientTick, AmbientChanged)
53  *
54  * This feature is supported in wearable applications only.
55  *
56  * WatchApplication should follow the example below:
57  *
58  * @code
59  * class ExampleController: public ConnectionTracker
60  * {
61  * public:
62  *   ExampleController( WatchApplication& application )
63  *   : mApplication( application )
64  *   {
65  *     mApplication.InitSignal().Connect( this, &ExampleController::Create );
66  *   }
67  *
68  *   void Create( Application& application )
69  *   {
70  *     // Create Dali components...
71  *   }
72  *  ...
73  * private:
74  *   WatchApplication&  mApplication;
75  * };
76  *
77  * int DALI_EXPORT_API main (int argc, char **argv)
78  * {
79  *   WatchApplication app = WatchApplication::New(&argc, &argv);
80  *   ExampleController example( app );
81  *   app.MainLoop();
82  * }
83  * @endcode
84  *
85  * If required, you can also connect class member functions to a signal:
86  *
87  * @code
88  * MyApplication app;
89  * app.ResumeSignal().Connect(&app, &MyApplication::Resume);
90  * @endcode
91  *
92  * When the above options are found, they are stripped from argv, and argc is updated appropriately.
93  * @SINCE_1_1.37
94  */
95
96 class DALI_IMPORT_API WatchApplication : public Application
97 {
98 public:
99   typedef Signal< void (Application&, const WatchTime &) > WatchTimeSignal; ///< Watch pointer signal callback type @SINCE_1_1.37
100   typedef Signal< void (Application&, bool) > WatchBoolSignal; ///< Watch bool signal callback type @SINCE_1_1.37
101
102 public:
103
104   /**
105    * @brief This is the constructor for applications without an argument list.
106    * @SINCE_1_1.37
107    */
108   static WatchApplication New();
109
110   /**
111    * @brief This is the constructor for applications.
112    *
113    * @SINCE_1_1.37
114    * @param[in,out]  argc        A pointer to the number of arguments
115    * @param[in,out]  argv        A pointer the the argument list
116    */
117   static WatchApplication New( int* argc, char **argv[] );
118
119   /**
120    * @brief This is the constructor for applications with a name
121    *
122    * @SINCE_1_1.37
123    * @param[in,out]  argc        A pointer to the number of arguments
124    * @param[in,out]  argv        A pointer the the argument list
125    * @param[in]      stylesheet  The path to user defined theme file
126    */
127   static WatchApplication New( int* argc, char **argv[], const std::string& stylesheet );
128
129   /**
130    * @brief Construct an empty handle
131    * @SINCE_1_1.37
132    */
133   WatchApplication();
134
135   /**
136    * @brief Copy Constructor
137    * @SINCE_1_1.37
138    */
139   WatchApplication( const WatchApplication& implementation );
140
141   /**
142    * @brief Assignment operator
143    * @SINCE_1_1.37
144    */
145   WatchApplication& operator=( const WatchApplication& applicaton );
146
147   /**
148    * @brief Destructor
149    *
150    * This is non-virtual since derived Handle types must not contain data or virtual methods.
151    * @SINCE_1_1.37
152    */
153   ~WatchApplication();
154
155 public:
156   /**
157    * @brief This signal is emitted at every second
158    * A callback of the following type may be connected:
159    * @code
160    *   void YourCallbackName(Application& application, WatchTimeSignal &time);
161    * @endcode
162    * time(watch time handle) will not be available after returning this callback. It will be freed by the framework.
163    * @SINCE_1_1.37
164    */
165   WatchTimeSignal& TimeTickSignal();
166
167   /**
168    * @brief This signal is emitted at each minute in ambient mode
169    * A callback of the following type may be connected:
170    * @code
171    *   void YourCallbackName(Application& application, WatchTimeSignal &time);
172    * @endcode
173    * time(watch time handle) will not be available after returning this callback. It will be freed by the framework.
174    * @SINCE_1_1.37
175    * @remarks http://tizen.org/privilege/alarm.set privilege is needed to receive ambient ticks at each minute.
176    * The AmbientTickSignal() will be ignored if your app doesn't have the privilege
177    */
178   WatchTimeSignal& AmbientTickSignal();
179
180   /**
181    * @brief This signal is emitted when the device enters or exits ambient mode
182    * A callback of the following type may be connected:
183    * @code
184    *   void YourCallbackName(Application& application, bool ambient);
185    * @endcode
186    * ambient_mode If true the device enters the ambient mode, otherwise false
187    * @SINCE_1_1.37
188    */
189   WatchBoolSignal& AmbientChangedSignal();
190
191 public: // Not intended for application developers
192   /**
193    * @internal
194    * @brief Internal constructor
195    * @SINCE_1_1.37
196    */
197   explicit DALI_INTERNAL WatchApplication(Internal::Adaptor::WatchApplication* implementation);
198 };
199
200 /**
201  * @}
202  */
203 } // namespace Dali
204
205 #endif // __DALI_WATCH_APPLICATION_H__