6617805ae0b08a493ca71b0bf6963b7d753578e1
[platform/core/uifw/dali-adaptor.git] / adaptors / wearable / watch-application-impl.h
1 #ifndef __DALI_INTERNAL_WATCH_APPLICATION_H__
2 #define __DALI_INTERNAL_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 // INTERNAL INCLUDES
22 #include <wearable/watch/watch-application.h>
23 #include <application-impl.h>
24
25 namespace Dali
26 {
27 class Adaptor;
28
29 namespace Internal
30 {
31
32 namespace Adaptor
33 {
34
35 class WatchApplication;
36 typedef IntrusivePtr<WatchApplication> WatchApplicationPtr;
37
38 /**
39  * Implementation of the WatchApplication class.
40  */
41 class WatchApplication : public Application
42 {
43 public:
44   typedef Dali::WatchApplication::WatchTimeSignal WatchTimeSignal;
45   typedef Dali::WatchApplication::WatchBoolSignal WatchBoolSignal;
46
47   /**
48    * Create a new watch
49    * @param[in]  argc        A pointer to the number of arguments
50    * @param[in]  argv        A pointer to the argument list
51    * @param[in]  stylesheet  The path to user defined theme file
52    * @param[in]  windowMode  A member of Dali::Watch::WINDOW_MODE
53    */
54   static WatchApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
55
56   /**
57    * Private Constructor
58    * @param[in]  argc        A pointer to the number of arguments
59    * @param[in]  argv        A pointer to the argument list
60    * @param[in]  stylesheet  The path to user defined theme file
61    * @param[in]  windowMode  A member of Dali::Watch::WINDOW_MODE
62    */
63   WatchApplication( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
64
65   /**
66    * Destructor
67    */
68   virtual ~WatchApplication();
69
70   /**
71    * Called every second
72    */
73   void OnTimeTick(WatchTime& time);
74
75   /**
76    * Called every second in ambient mode
77    */
78   void OnAmbientTick(WatchTime& time);
79
80   /**
81    * Called when the device enters or exits ambient mode
82    */
83   void OnAmbientChanged(bool ambient);
84
85 private:
86
87   // @brief Undefined copy constructor.
88   WatchApplication( const WatchApplication& );
89
90   // @brief Undefined assignment operator.
91   WatchApplication& operator=( const WatchApplication& );
92
93 public:
94
95   // Signals
96   WatchTimeSignal                        mTickSignal;
97   WatchTimeSignal                        mAmbientTickSignal;
98   WatchBoolSignal                      mAmbientChangeSignal;
99 };
100
101 inline WatchApplication& GetImplementation(Dali::WatchApplication& watch)
102 {
103   DALI_ASSERT_ALWAYS(watch && "watch handle is empty");
104
105   BaseObject& handle = watch.GetBaseObject();
106
107   return static_cast<Internal::Adaptor::WatchApplication&>(handle);
108 }
109
110 inline const WatchApplication& GetImplementation(const Dali::WatchApplication& watch)
111 {
112   DALI_ASSERT_ALWAYS(watch && "Time handle is empty");
113
114   const BaseObject& handle = watch.GetBaseObject();
115
116   return static_cast<const Internal::Adaptor::WatchApplication&>(handle);
117 }
118
119
120 } // namespace Adaptor
121
122 } // namespace Internal
123
124 } // namespace Dali
125
126 #endif // __DALI_INTERNAL_WATCH_APPLICATION_H__