Dali 3D User Interface Engine
stage-impl.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_STAGE_H__
2 #define __DALI_INTERNAL_STAGE_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 // INTERNAL INCLUDES
38 
39 namespace Dali
40 {
41 
42 struct Vector2;
43 
44 namespace Integration
45 {
46 class SystemOverlay;
47 }
48 
49 namespace Internal
50 {
51 
52 namespace SceneGraph
53 {
54 class UpdateManager;
55 }
56 
57 class AnimationPlaylist;
58 class PropertyNotificationManager;
59 class Layer;
60 class LayerList;
61 class SystemOverlay;
62 class CameraActor;
63 class RenderTaskList;
64 
69 {
70 public:
71 
79  static StagePtr New( AnimationPlaylist& playlist,
80  PropertyNotificationManager& propertyNotificationManager,
81  SceneGraph::UpdateManager& updateManager,
82  NotificationManager& notificationManager );
83 
87  void Initialize();
88 
92  void Uninitialize();
93 
98  static StagePtr GetCurrent();
99 
103  static bool IsInstalled();
104 
109 
114  Layer& GetRootActor();
115 
121 
127 
128  // Root actor accessors
129 
133  void Add( Actor& actor );
134 
138  void Remove( Actor& actor );
139 
145  void SetSize( float width, float height );
146 
153  Vector2 GetSize() const;
154 
159 
164 
169  virtual Actor& GetDefaultRootActor();
170 
176 
177  // Layers
178 
182  unsigned int GetLayerCount() const;
183 
187  Dali::Layer GetLayer( unsigned int depth ) const;
188 
192  Dali::Layer GetRootLayer() const;
193 
199 
200  // System-level overlay actors
201 
206 
212 
213  // Stereoscopy
214 
218  void SetViewMode( ViewMode viewMode );
219 
223  ViewMode GetViewMode() const;
224 
228  void SetStereoBase( float stereoBase );
229 
233  float GetStereoBase() const;
234 
235  // Keyboard stuff
236 
242  void SetKeyboardFocusActor( Actor* actor );
243 
248  Actor* GetKeyboardFocusActor() const;
249 
254  void RemoveActorFromKeyFocus( Actor* actor );
255 
256  // Misc
257 
261  void SetBackgroundColor(Vector4 color);
262 
266  Vector4 GetBackgroundColor() const;
267 
271  Vector2 GetDpi() const;
272 
277  void SetDpi( Vector2 dpi );
278 
280  {
281  return mNotificationManager;
282  }
283 
287  void KeepRendering( float durationSeconds );
288 
293  void EmitKeyEventSignal(const KeyEvent& event);
294 
301 
306  void EmitTouchedSignal( const TouchEvent& touch );
307 
312  void EmitWheelEventSignal( const WheelEvent& event );
313 
317  void EmitSceneCreatedSignal();
318 
323 
328 
333 
338 
343 
348 
353 
363  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
364 
365 private: // Implementation of ContextNotificationInterface:
366 
370  virtual void NotifyContextLost();
371 
375  virtual void NotifyContextRegained();
376 
377 public: // Implementation of EventThreadServices
378 
382  virtual void RegisterObject( BaseObject* object);
383 
387  virtual void UnregisterObject( BaseObject* object);
388 
393 
397  virtual unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene );
398 
402  virtual BufferIndex GetEventBufferIndex() const;
403 
404 private:
405 
409  Stage( AnimationPlaylist& playlist,
410  PropertyNotificationManager& propertyNotificationManager,
411  SceneGraph::UpdateManager& updateManager,
412  NotificationManager& notificationManager );
413 
417  virtual ~Stage();
418 
419 private:
420 
421  // For 'Fire and forget' animation support
423 
425 
427 
429 
430  // The Actual size of the stage.
432 
433  // Cached for public GetBackgroundColor()
435 
437 
438  // Ordered list of currently on-stage layers
440 
442 
444  float mStereoBase;
445 
447 
448  // The object registry
450 
451  // The list of render-tasks
453 
458 
460 
461  // The key event signal
463 
464  // The event processing finished signal
466 
467  // The touched signal
469 
470  // The wheel event signal
472 
475 
477 };
478 
479 } // namespace Internal
480 
481 // Helpers for public-api forwarding methods
482 
484 {
485  DALI_ASSERT_ALWAYS( stage && "Stage handle is empty" );
486 
487  BaseObject& handle = stage.GetBaseObject();
488 
489  return static_cast<Internal::Stage&>(handle);
490 }
491 
492 inline const Internal::Stage& GetImplementation(const Dali::Stage& stage)
493 {
494  DALI_ASSERT_ALWAYS( stage && "Stage handle is empty" );
495 
496  const BaseObject& handle = stage.GetBaseObject();
497 
498  return static_cast<const Internal::Stage&>(handle);
499 }
500 
501 } // namespace Dali
502 
503 #endif // __DALI_INTERNAL_STAGE_H__
Dali Docs Home
Read more about Dali