Dali 3D User Interface Engine
application-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_APPLICATION_H__
2 #define __DALI_INTERNAL_APPLICATION_H__
3 
4 /*
5  * Copyright (c) 2014 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
24 
25 // INTERNAL INCLUDES
26 #include <application.h>
27 #include <singleton-service.h>
28 
29 #include <framework.h>
30 #include <window-impl.h>
32 
33 namespace Dali
34 {
35 class Adaptor;
36 class Window;
37 
38 namespace Internal
39 {
40 
41 namespace Adaptor
42 {
43 class CommandLineOptions;
44 class EventLoop;
45 
47 
50 
55 {
56 public:
57 
61 
69  static ApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
70 
71 public:
72 
76  void MainLoop(Dali::Configuration::ContextLoss configuration);
77 
81  void Lower();
82 
86  void Quit();
87 
91  bool AddIdle( CallbackBase* callback );
92 
96  Dali::Adaptor& GetAdaptor();
97 
102 
106  void ReplaceWindow(PositionSize windowPosition, const std::string& name);
107 
108 public: // Stereoscopy
109 
113  void SetViewMode( ViewMode viewMode );
114 
118  ViewMode GetViewMode() const;
119 
123  void SetStereoBase( float stereoBase );
124 
128  float GetStereoBase() const;
129 
130 public: // From Framework::Observer
131 
135  virtual void OnInit();
136 
140  virtual void OnTerminate();
141 
145  virtual void OnPause();
146 
150  virtual void OnResume();
151 
156  virtual void OnAppControl(void *data);
157 
161  virtual void OnReset();
162 
166  virtual void OnLanguageChanged();
167 
171  virtual void OnRegionChanged();
172 
176  virtual void OnBatteryLow();
177 
181  virtual void OnMemoryLow();
182 
183 public:
184 
189  void OnResize(Dali::Adaptor& adaptor);
190 
191 public: // Signals
192 
197 
202 
207 
212 
217 
222 
227 
232 
237 
242 
247 
248 private:
249 
257  Application( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
258 
262  virtual ~Application();
263 
264  // Undefined
265  Application(const Application&);
267 
268 private:
272  void CreateWindow();
273 
277  void CreateAdaptor();
278 
282  void QuitFromMainLoop();
283 
284 private:
285 
297 
298  EventLoop* mEventLoop;
300 
303 
305  Dali::Adaptor* mAdaptor;
308  std::string mName;
309  std::string mStylesheet;
311 
313 };
314 
316 {
317  DALI_ASSERT_ALWAYS(application && "application handle is empty");
318 
319  BaseObject& handle = application.GetBaseObject();
320 
321  return static_cast<Internal::Adaptor::Application&>(handle);
322 }
323 
324 inline const Application& GetImplementation(const Dali::Application& application)
325 {
326  DALI_ASSERT_ALWAYS(application && "Timre handle is empty");
327 
328  const BaseObject& handle = application.GetBaseObject();
329 
330  return static_cast<const Internal::Adaptor::Application&>(handle);
331 }
332 
333 
334 } // namespace Adaptor
335 
336 } // namespace Internal
337 
338 } // namespace Dali
339 
340 #endif // __DALI_INTERNAL_APPLICATION_H__
Dali Docs Home
Read more about Dali