dali-adaptor internal folder refactoring
[platform/core/uifw/dali-adaptor.git] / dali / internal / adaptor / tizen-wayland / tizen-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 <dali/public-api/watch/watch-application.h>
23 #include <dali/internal/adaptor/common/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 enum WatchApplicationState
39 {
40   UNINITIALIZED,
41   INITIALIZED,
42   PAUSED,
43   RESUMED = INITIALIZED,
44   TERMINATED
45 };
46
47 /**
48  * Implementation of the WatchApplication class.
49  */
50 class WatchApplication : public Application
51 {
52 public:
53   typedef Dali::WatchApplication::WatchTimeSignal WatchTimeSignal;
54   typedef Dali::WatchApplication::WatchBoolSignal WatchBoolSignal;
55
56   /**
57    * Create a new watch
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   static WatchApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
64
65   /**
66    * Private Constructor
67    * @param[in]  argc        A pointer to the number of arguments
68    * @param[in]  argv        A pointer to the argument list
69    * @param[in]  stylesheet  The path to user defined theme file
70    * @param[in]  windowMode  A member of Dali::Watch::WINDOW_MODE
71    */
72   WatchApplication( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
73
74   /**
75    * Destructor
76    */
77   virtual ~WatchApplication();
78
79   /**
80    * Called when the framework is initialised.
81    */
82   virtual void OnInit();
83
84   /**
85    * Called when the framework is terminated.
86    */
87   virtual void OnTerminate();
88
89   /**
90    * Called when the framework is paused.
91    */
92   virtual void OnPause();
93
94   /**
95    * Called when the framework resumes from a paused state.
96    */
97   virtual void OnResume();
98
99   /**
100    * Called every second
101    */
102   void OnTimeTick(WatchTime& time);
103
104   /**
105    * Called every second in ambient mode
106    */
107   void OnAmbientTick(WatchTime& time);
108
109   /**
110    * Called when the device enters or exits ambient mode
111    */
112   void OnAmbientChanged(bool ambient);
113
114 private:
115
116   // @brief Undefined copy constructor.
117   WatchApplication( const WatchApplication& );
118
119   // @brief Undefined assignment operator.
120   WatchApplication& operator=( const WatchApplication& );
121
122 public:
123
124   // Signals
125   WatchTimeSignal                        mTickSignal;
126   WatchTimeSignal                        mAmbientTickSignal;
127   WatchBoolSignal                        mAmbientChangeSignal;
128
129 private:
130   WatchApplicationState                  mState;
131 };
132
133 inline WatchApplication& GetImplementation(Dali::WatchApplication& watch)
134 {
135   DALI_ASSERT_ALWAYS(watch && "watch handle is empty");
136
137   BaseObject& handle = watch.GetBaseObject();
138
139   return static_cast<Internal::Adaptor::WatchApplication&>(handle);
140 }
141
142 inline const WatchApplication& GetImplementation(const Dali::WatchApplication& watch)
143 {
144   DALI_ASSERT_ALWAYS(watch && "Time handle is empty");
145
146   const BaseObject& handle = watch.GetBaseObject();
147
148   return static_cast<const Internal::Adaptor::WatchApplication&>(handle);
149 }
150
151
152 } // namespace Adaptor
153
154 } // namespace Internal
155
156 } // namespace Dali
157
158 #endif // __DALI_INTERNAL_WATCH_APPLICATION_H__