This patch is for refining dali application to support tizen c# application. 18/90518/3
authorxb.teng <xb.teng@samsung.com>
Fri, 30 Sep 2016 10:03:42 +0000 (18:03 +0800)
committerxb.teng <xb.teng@samsung.com>
Mon, 10 Oct 2016 10:14:18 +0000 (18:14 +0800)
Change-Id: I648d5590c4c22537795a50499f86b0b268265b08
Signed-off-by: xb.teng <xb.teng@samsung.com>
adaptors/common/application-impl.cpp [changed mode: 0644->0755]
adaptors/common/application-impl.h [changed mode: 0644->0755]
adaptors/devel-api/adaptor-framework/application-extensions.cpp [new file with mode: 0755]
adaptors/devel-api/adaptor-framework/application-extensions.h [new file with mode: 0755]
adaptors/devel-api/file.list [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 3cfb156..1be56dd
@@ -166,17 +166,15 @@ void Application::QuitFromMainLoop()
   // This will trigger OnTerminate(), below, after the main loop has completed.
 }
 
-void Application::OnInit()
+void Application::DoInit()
 {
-  mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
-
   CreateWindow();
   CreateAdaptor();
 
   // Run the adaptor
   mAdaptor->Start();
 
-  // Check if user requires no vsyncing and set on X11 Adaptor
+  // Check if user requires no vsyncing and set Adaptor
   if (mCommandLineOptions->noVSyncOnRender)
   {
     mAdaptor->SetUseHardwareVSync(false);
@@ -198,6 +196,41 @@ void Application::OnInit()
     Dali::StyleMonitor::Get().SetTheme( mStylesheet );
   }
 
+  mAdaptor->NotifySceneCreated();
+}
+
+void Application::DoTerminate()
+{
+  if( mAdaptor )
+  {
+    // Ensure that the render-thread is not using the surface(window) after we delete it
+    mAdaptor->Stop();
+  }
+
+  mWindow.Reset();
+}
+
+void Application::DoPause()
+{
+  mAdaptor->Pause();
+}
+
+void Application::DoResume()
+{
+  mAdaptor->Resume();
+}
+
+void Application::DoLanguageChange()
+{
+  mAdaptor->NotifyLanguageChanged();
+}
+
+void Application::OnInit()
+{
+  mFramework->AddAbortCallback( MakeCallback( this, &Application::QuitFromMainLoop ) );
+
+  DoInit();
+
   // Wire up the LifecycleController
   Dali::LifecycleController lifecycleController = Dali::LifecycleController::Get();
 
@@ -211,8 +244,6 @@ void Application::OnInit()
 
   Dali::Application application(this);
   mInitSignal.Emit( application );
-
-  mAdaptor->NotifySceneCreated();
 }
 
 void Application::OnTerminate()
@@ -223,18 +254,12 @@ void Application::OnTerminate()
   Dali::Application application(this);
   mTerminateSignal.Emit( application );
 
-  if( mAdaptor )
-  {
-    // Ensure that the render-thread is not using the surface(window) after we delete it
-    mAdaptor->Stop();
-  }
-
-  mWindow.Reset();
+  DoTerminate();
 }
 
 void Application::OnPause()
 {
-  mAdaptor->Pause();
+  DoPause();
   Dali::Application application(this);
   mPauseSignal.Emit( application );
 }
@@ -245,7 +270,7 @@ void Application::OnResume()
   // This ensures we do not just redraw the last frame before pausing if that's not required
   Dali::Application application(this);
   mResumeSignal.Emit( application );
-  mAdaptor->Resume();
+  DoResume();
 }
 
 void Application::OnReset()
@@ -266,7 +291,7 @@ void Application::OnAppControl(void *data)
 
 void Application::OnLanguageChanged()
 {
-  mAdaptor->NotifyLanguageChanged();
+  DoLanguageChange();
   Dali::Application application(this);
   mLanguageChangedSignal.Emit( application );
 }
old mode 100644 (file)
new mode 100755 (executable)
index 506496f..b76ead8
@@ -133,6 +133,33 @@ public: // Stereoscopy
    */
   float GetStereoBase() const;
 
+public: // Lifecycle functionality
+
+  /**
+   * Called when OnInit is called or the framework is initialised.
+   */
+  void DoInit();
+
+  /**
+   * Called when OnTerminate is called or the framework is terminated.
+   */
+  void DoTerminate();
+
+  /**
+   * Called when OnPause is called or the framework is paused.
+   */
+  void DoPause();
+
+  /**
+   * Called when OnResume is called or the framework resumes from a paused state.
+   */
+  void DoResume();
+
+  /**
+   * Called when OnLanguageChanged is called or the framework informs the application that the language of the device has changed.
+   */
+  void DoLanguageChange();
+
 public: // From Framework::Observer
 
   /**
diff --git a/adaptors/devel-api/adaptor-framework/application-extensions.cpp b/adaptors/devel-api/adaptor-framework/application-extensions.cpp
new file mode 100755 (executable)
index 0000000..582e659
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "application-extensions.h"
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <application-impl.h>
+#include <application.h>
+
+namespace Dali
+{
+
+ApplicationExtensions::ApplicationExtensions()
+{
+}
+
+ApplicationExtensions::ApplicationExtensions(Dali::Application* application)
+: mApplication( application )
+{
+}
+
+ApplicationExtensions::~ApplicationExtensions()
+{
+}
+
+void ApplicationExtensions::Init()
+{
+  Internal::Adaptor::GetImplementation(*mApplication).DoInit();
+}
+
+void ApplicationExtensions::Terminate()
+{
+  Internal::Adaptor::GetImplementation(*mApplication).DoTerminate();
+}
+
+void ApplicationExtensions::Pause()
+{
+  Internal::Adaptor::GetImplementation(*mApplication).DoPause();
+}
+
+void ApplicationExtensions::Resume()
+{
+  Internal::Adaptor::GetImplementation(*mApplication).DoResume();
+}
+
+void ApplicationExtensions::LanguageChange()
+{
+  Internal::Adaptor::GetImplementation(*mApplication).DoLanguageChange();
+}
+} // namespace Dali
diff --git a/adaptors/devel-api/adaptor-framework/application-extensions.h b/adaptors/devel-api/adaptor-framework/application-extensions.h
new file mode 100755 (executable)
index 0000000..bee9629
--- /dev/null
@@ -0,0 +1,94 @@
+#ifndef __DALI_APPLICATION_EXTENSIONS_H__
+#define __DALI_APPLICATION_EXTENSIONS_H__
+
+/*
+ * Copyright (c) 2015 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+
+namespace Dali
+{
+class Application;
+
+/**
+ * @brief An Application extension class object should be created by DaliApplication.
+ *
+ * It provides some extension methods to DaliApplication.
+ *
+ */
+class DALI_IMPORT_API ApplicationExtensions
+{
+public:
+
+ /**
+   * @brief The default constructor.
+   *
+   */
+  ApplicationExtensions();
+
+ /**
+   * @brief The constructor accept an instance of Dali::Application.
+   *
+   * This can be initialized by new keyword.
+   */
+  ApplicationExtensions(Dali::Application* application);
+
+ /**
+   * @brief Destructor
+   *
+   */
+  ~ApplicationExtensions();
+
+
+ /**
+   * @brief Called wwhen the framework is initialised.
+   * @SINCE_1_2.7
+   */
+  void Init();
+
+ /**
+   * @brief Called when the framework is terminated.
+   * @SINCE_1_2.7
+   */
+  void Terminate();
+
+ /**
+   * @brief Called when the framework is paused.
+   * @SINCE_1_2.7
+   */
+  void Pause();
+
+ /**
+   * @brief Called when the framework resumes from a paused state.
+   * @SINCE_1_2.7
+   */
+  void Resume();
+
+ /**
+   * @brief Called when the framework informs the application that the language of the device has changed.
+   * @SINCE_1_2.7
+   */
+  void LanguageChange();
+
+private:
+  Dali::Application* mApplication;
+};
+
+} // namespace Dali
+
+#endif // ___DALI_APPLICATION_EXTENSIONS_H__
old mode 100644 (file)
new mode 100755 (executable)
index 533fdc6..0e1a84a
@@ -1,5 +1,6 @@
 devel_api_src_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/accessibility-adaptor.cpp \
+  $(adaptor_devel_api_dir)/adaptor-framework/application-extensions.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/bitmap-loader.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/bitmap-saver.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/clipboard.cpp \
@@ -28,6 +29,7 @@ devel_api_adaptor_framework_header_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/accessibility-adaptor.h \
   $(adaptor_devel_api_dir)/adaptor-framework/accessibility-action-handler.h \
   $(adaptor_devel_api_dir)/adaptor-framework/accessibility-gesture-handler.h \
+  $(adaptor_devel_api_dir)/adaptor-framework/application-extensions.h \
   $(adaptor_devel_api_dir)/adaptor-framework/bitmap-loader.h \
   $(adaptor_devel_api_dir)/adaptor-framework/bitmap-saver.h \
   $(adaptor_devel_api_dir)/adaptor-framework/clipboard-event-notifier.h \