(FrameCallback) Ensure the callback is removed if the implementation is deleted
[platform/core/uifw/dali-core.git] / dali / devel-api / common / stage-devel.h
index f54e411..05b7390 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_STAGE_DEVEL_H
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 namespace Dali
 {
 
+class FrameCallbackInterface;
+
 namespace DevelStage
 {
 
+/**
+ * @brief The DALi rendering behavior.
+ */
+enum class Rendering
+{
+  IF_REQUIRED,  ///< Default. Will only render if required to do so.
+  CONTINUOUSLY, ///< Will render continuously.
+};
+
 typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;      ///< Stage key event generated signal type
 
 /**
@@ -35,7 +46,49 @@ typedef Signal< bool (const KeyEvent&) > KeyEventGeneratedSignalType;      ///<
  * @param[in] stage The stage to emit a signal
  * @return The return is true if KeyEvent is consumed, otherwise false.
  */
-DALI_IMPORT_API KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Stage stage );
+DALI_CORE_API KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Dali::Stage stage );
+
+/**
+ * @brief Gives the user the ability to set the rendering behavior of DALi.
+ *
+ * @param[in] stage The stage
+ * @param[in] renderingBehavior The rendering behavior required.
+ *
+ * @note By default, DALi uses Rendering::IF_REQUIRED.
+ * @see Rendering
+ */
+DALI_CORE_API void SetRenderingBehavior( Dali::Stage stage, Rendering renderingBehavior );
+
+/**
+ * @brief Retrieves the rendering behavior of DALi.
+ *
+ * @param[in] stage The stage
+ * @return The rendering behavior of DALi.
+ */
+DALI_CORE_API Rendering GetRenderingBehavior( Dali::Stage stage );
+
+/*
+ * @brief The FrameCallbackInterface implementation added gets called on every frame from the update-thread.
+ *
+ * @param[in] stage The stage to set the FrameCallbackInterface implementation on
+ * @param[in] frameCallback An implementation of the FrameCallbackInterface
+ * @param[in] rootActor The root-actor in the scene that the callback applies to
+ *
+ * @note Only the rootActor and it's children will be parsed by the UpdateProxy.
+ * @note If the rootActor is destroyed, then the callback is automatically removed
+ * @see FrameCallbackInterface
+ */
+DALI_IMPORT_API void AddFrameCallback( Dali::Stage stage, FrameCallbackInterface& frameCallback, Actor rootActor );
+
+/**
+ * @brief Removes the specified FrameCallbackInterface implementation from being called on every frame.
+ *
+ * @param[in] stage The stage to clear the FrameCallbackInterface on
+ * @param[in] frameCallback The FrameCallbackInterface implementation to remove
+ *
+ * @note If the callback implementation has already been removed, then this is a no-op.
+ */
+DALI_IMPORT_API void RemoveFrameCallback( Dali::Stage stage, FrameCallbackInterface& frameCallback );
 
 } // namespace DevelStage