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