Merge "[4.0] Added capture for wearable" into tizen_4.0
authortaeyoon0.lee <taeyoon0.lee@samsung.com>
Mon, 18 Dec 2017 10:34:51 +0000 (10:34 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Mon, 18 Dec 2017 10:34:51 +0000 (10:34 +0000)
26 files changed:
adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/common/adaptor.cpp
adaptors/common/file.list
adaptors/common/framework.h
adaptors/common/widget-application-impl.cpp [deleted file]
adaptors/common/widget-application-impl.h [deleted file]
adaptors/common/widget-impl.cpp [deleted file]
adaptors/common/widget-impl.h [deleted file]
adaptors/devel-api/adaptor-framework/widget-application.cpp
adaptors/devel-api/adaptor-framework/widget-application.h
adaptors/devel-api/adaptor-framework/widget-impl.cpp [new file with mode: 0644]
adaptors/devel-api/adaptor-framework/widget-impl.h [new file with mode: 0644]
adaptors/devel-api/adaptor-framework/widget.cpp
adaptors/devel-api/adaptor-framework/widget.h
adaptors/devel-api/file.list
adaptors/integration-api/adaptor.h
adaptors/public-api/dali-adaptor-version.cpp
adaptors/tizen/file.list
adaptors/tizen/framework-tizen.cpp
adaptors/tizen/widget-application-impl.cpp [new file with mode: 0644]
adaptors/tizen/widget-application-impl.h [new file with mode: 0644]
adaptors/tizen/widget-controller.cpp [new file with mode: 0644]
adaptors/tizen/widget-controller.h [new file with mode: 0644]
build/tizen/adaptor/Makefile.am
packaging/dali-adaptor.spec

index a3d7ea4..ff2479b 100644 (file)
@@ -93,8 +93,6 @@ Dali::Adaptor* Adaptor::New( Dali::Window window, Dali::Configuration::ContextLo
 
   Window& windowImpl = Dali::GetImplementation(window);
   Dali::Adaptor* adaptor = New( winId, windowImpl.GetSurface(), configuration, environmentOptions );
-
-  Internal::Adaptor::Adaptor::GetImplementation( *adaptor ).SetWindow( window );
   windowImpl.SetAdaptor(*adaptor);
   return adaptor;
 }
@@ -866,7 +864,6 @@ Adaptor::Adaptor(Any nativeWindow, Dali::Adaptor& adaptor, RenderSurface* surfac
   mTriggerEventFactory(),
   mObjectProfiler( NULL ),
   mSocketFactory(),
-  mWindow(),
   mEnvironmentOptionsOwned( environmentOptions ? false : true /* If not provided then we own the object */ ),
   mUseRemoteSurface( false )
 {
@@ -905,16 +902,6 @@ void Adaptor::SetRootLayoutDirection( std::string locale )
                                     static_cast< LayoutDirection::Type >( Internal::Adaptor::Locale::GetDirection( std::string( locale ) ) ) );
 }
 
-void Adaptor::SetWindow( Dali::Window window )
-{
-  mWindow = window;
-}
-
-Dali::Window Adaptor::GetWindow()
-{
-  return mWindow;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
index c343cc5..31c577b 100644 (file)
@@ -27,7 +27,6 @@
 #include <dali/integration-api/render-controller.h>
 
 // INTERNAL INCLUDES
-#include <window.h>
 #include <adaptor.h>
 #include <render-surface.h>
 #include <tts-player.h>
@@ -439,16 +438,6 @@ public: // Stereoscopy
    */
   float GetStereoBase() const;
 
-  /**
-   * Set Window handle.
-   */
-  void SetWindow( Dali::Window window );
-
-  /**
-   * Return Window handle.
-   */
-  Dali::Window GetWindow();
-
 public: // Signals
 
   /**
@@ -607,7 +596,6 @@ private: // Data
   TriggerEventFactory                   mTriggerEventFactory;         ///< Trigger event factory
   ObjectProfiler*                       mObjectProfiler;              ///< Tracks object lifetime for profiling
   SocketFactory                         mSocketFactory;               ///< Socket factory
-  Dali::Window                          mWindow;                      ///< Window handle
   const bool                            mEnvironmentOptionsOwned:1;   ///< Whether we own the EnvironmentOptions (and thus, need to delete it)
   bool                                  mUseRemoteSurface;            ///< whether the remoteSurface is used or not
 public:
index 165d039..c6cc3fa 100644 (file)
@@ -114,11 +114,6 @@ Any Adaptor::GetNativeWindowHandle()
   return mImpl->GetNativeWindowHandle();
 }
 
-Window Adaptor::GetWindow()
-{
-  return mImpl->GetWindow();
-}
-
 void Adaptor::ReleaseSurfaceLock()
 {
   mImpl->ReleaseSurfaceLock();
index 944b7db..37faef3 100644 (file)
@@ -59,7 +59,3 @@ adaptor_common_internal_default_profile_src_files = \
 
 adaptor_common_internal_egl_extension_src_files = \
   $(adaptor_common_dir)/gl/egl-image-extensions.cpp
-
-adaptor_internal_widget_src_files = \
-  $(adaptor_common_dir)/widget-impl.cpp \
-  $(adaptor_common_dir)/widget-application-impl.cpp
index a8b01f2..c741734 100644 (file)
@@ -54,7 +54,7 @@ public:
   {
     NORMAL,       ///< normal appFramework
     WATCH,        ///< watch appFramework
-    WIDGET,       ///< widget appFramework
+    WIDGET        ///< widget appFramework
   };
 
   /**
diff --git a/adaptors/common/widget-application-impl.cpp b/adaptors/common/widget-application-impl.cpp
deleted file mode 100644 (file)
index 86fa034..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2017 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 "widget-application-impl.h"
-
-// EXTERNAL INCLUDES
-#include <widget_base.h>
-
-// INTERNAL INCLUDES
-#include <style-monitor.h>
-#include <command-line-options.h>
-#include <common/adaptor-impl.h>
-#include <common/framework.h>
-#include <singleton-service-impl.h>
-#include <window-impl.h>
-
-namespace Dali
-{
-
-namespace TizenPlatform
-{
-class TizenPlatformAbstraction;
-}
-
-namespace Integration
-{
-class Core;
-}
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-WidgetApplicationPtr WidgetApplication::New(
-  int* argc,
-  char **argv[],
-  const std::string& stylesheet)
-{
-  WidgetApplicationPtr widgetApplication( new WidgetApplication (argc, argv, stylesheet ) );
-  return widgetApplication;
-}
-
-WidgetApplication::WidgetApplication( int* argc, char** argv[], const std::string& stylesheet )
-: mInitSignal(),
-  mTerminateSignal(),
-  mLanguageChangedSignal(),
-  mRegionChangedSignal(),
-  mLowBatterySignal(),
-  mLowMemorySignal(),
-  mFramework( NULL ),
-  mContextLossConfiguration( Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS ),
-  mCommandLineOptions( NULL ),
-  mSingletonService( SingletonService::New() ),
-  mAdaptor( NULL ),
-  mName(),
-  mStylesheet( stylesheet ),
-  mEnvironmentOptions(),
-  mSlotDelegate( this )
-{
-  // Get mName from environment options
-  mName = mEnvironmentOptions.GetWindowName();
-  if( mName.empty() && argc && ( *argc > 0 ) )
-  {
-    // Set mName from command-line args if environment option not set
-    mName = (*argv)[0];
-  }
-
-  mCommandLineOptions = new CommandLineOptions(argc, argv);
-  mFramework = new Framework( *this, argc, argv, Framework::WIDGET );
-}
-
-WidgetApplication::~WidgetApplication()
-{
-  mSingletonService.UnregisterAll();
-
-  delete mAdaptor;
-  delete mCommandLineOptions;
-  delete mFramework;
-}
-
-void WidgetApplication::CreateAdaptor()
-{
-  mAdaptor = Dali::Internal::Adaptor::Adaptor::New( mWindow, mContextLossConfiguration, &mEnvironmentOptions );
-
-  Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetUseRemoteSurface( true );
-}
-
-void WidgetApplication::MainLoop()
-{
-  // Run the application
-  mFramework->Run();
-}
-
-void WidgetApplication::Quit()
-{
-  // Actually quit the application.
-  AddIdle( MakeCallback( this, &WidgetApplication::QuitFromMainLoop ) );
-}
-
-void WidgetApplication::QuitFromMainLoop()
-{
-  mAdaptor->Stop();
-
-  mFramework->Quit();
-  // This will trigger OnTerminate(), below, after the main loop has completed.
-}
-
-void WidgetApplication::DoInit()
-{
-  mWindow = Dali::Window::New( PositionSize(), "", mEnvironmentOptions.GetWindowClassName(), 1 );
-  // Quit the application when the window is closed
-  mWindow.ShowIndicator(Dali::Window::IndicatorVisibleMode::INVISIBLE);
-  GetImplementation( mWindow ).DeleteRequestSignal().Connect( mSlotDelegate, &WidgetApplication::Quit );
-
-  CreateAdaptor();
-  // Run the adaptor
-  mAdaptor->Start();
-
-  // Check if user requires no vsyncing and set Adaptor
-  if (mCommandLineOptions->noVSyncOnRender)
-  {
-    mAdaptor->SetUseHardwareVSync(false);
-  }
-
-  Internal::Adaptor::Adaptor::GetImplementation( *mAdaptor ).SetStereoBase( mCommandLineOptions->stereoBase );
-
-  if( ! mStylesheet.empty() )
-  {
-    Dali::StyleMonitor::Get().SetTheme( mStylesheet );
-  }
-}
-
-void WidgetApplication::DoStart()
-{
-  mAdaptor->NotifySceneCreated();
-}
-
-void WidgetApplication::DoTerminate()
-{
-  if( mAdaptor )
-  {
-    // Ensure that the render-thread is not using the surface(window) after we delete it
-    mAdaptor->Stop();
-  }
-
-  mWindow.Reset();
-}
-
-void WidgetApplication::DoLanguageChange()
-{
-  mAdaptor->NotifyLanguageChanged();
-}
-
-void WidgetApplication::OnInit()
-{
-  mFramework->AddAbortCallback( MakeCallback( this, &WidgetApplication::QuitFromMainLoop ) );
-  DoInit();
-
-  Dali::WidgetApplication widgetApplication(this);
-  mInitSignal.Emit( widgetApplication );
-
-  DoStart();
-}
-
-void WidgetApplication::OnTerminate()
-{
-  Dali::WidgetApplication widgetApplication(this);
-  mTerminateSignal.Emit( widgetApplication );
-
-  DoTerminate();
-}
-
-void WidgetApplication::OnLanguageChanged()
-{
-  DoLanguageChange();
-  Dali::WidgetApplication widgetApplication(this);
-  mLanguageChangedSignal.Emit( widgetApplication );
-}
-
-void WidgetApplication::OnRegionChanged()
-{
-  Dali::WidgetApplication widgetApplication(this);
-  mRegionChangedSignal.Emit( widgetApplication );
-}
-
-void WidgetApplication::OnBatteryLow( Dali::DeviceStatus::Battery::Status status )
-{
-  Dali::WidgetApplication widgetApplication(this);
-  mLowBatterySignal.Emit( status );
-}
-
-void WidgetApplication::OnMemoryLow( Dali::DeviceStatus::Memory::Status status )
-{
-  Dali::WidgetApplication widgetApplication(this);
-  mLowMemorySignal.Emit( status );
-}
-
-bool WidgetApplication::AddIdle( CallbackBase* callback )
-{
-  return mAdaptor->AddIdle( callback );
-}
-
-Dali::Adaptor& WidgetApplication::GetAdaptor()
-{
-  return *mAdaptor;
-}
-
-std::string WidgetApplication::GetResourcePath()
-{
-  return Internal::Adaptor::Framework::GetResourcePath();
-}
-
-std::string WidgetApplication::GetRegion()
-{
-  return mFramework->GetRegion();
-}
-
-std::string WidgetApplication::GetLanguage()
-{
-  return mFramework->GetLanguage();
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
diff --git a/adaptors/common/widget-application-impl.h b/adaptors/common/widget-application-impl.h
deleted file mode 100644 (file)
index 6f53534..0000000
+++ /dev/null
@@ -1,267 +0,0 @@
-#ifndef __DALI_INTERNAL_WIDGET_APPLICATION_H__
-#define __DALI_INTERNAL_WIDGET_APPLICATION_H__
-
-/*
- * Copyright (c) 2017 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/object/base-object.h>
-#include <widget_base.h>
-#include <bundle.h>
-
-// INTERNAL INCLUDES
-#include <widget-application.h>
-#include <singleton-service.h>
-
-#include <framework.h>
-#include <window.h>
-#include <base/environment-options.h>
-
-namespace Dali
-{
-class Adaptor;
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-class CommandLineOptions;
-class EventLoop;
-
-class WidgetApplication;
-typedef IntrusivePtr<WidgetApplication> WidgetApplicationPtr;
-
-/**
- * Implementation of the WidgetApplication class.
- */
-class WidgetApplication : public BaseObject, public Framework::Observer
-{
-public:
-  typedef Dali::WidgetApplication::AppSignalType AppSignalType;
-  typedef Dali::WidgetApplication::LowBatterySignalType LowBatterySignalType;
-  typedef Dali::WidgetApplication::LowMemorySignalType LowMemorySignalType;
-
-  /**
-   * Create a new widget application
-   * @param[in]  argc         A pointer to the number of arguments
-   * @param[in]  argv         A pointer to the argument list
-   * @param[in]  stylesheet   The path to user defined theme file
-   */
-  static WidgetApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet );
-
-public:
-
-  /**
-   * @copydoc Dali::WidgetApplication::MainLoop()
-   */
-  void MainLoop();
-
-  /**
-   * @copydoc Dali::WidgetApplication::Quit()
-   */
-  void Quit();
-
-  /**
-   * @copydoc Dali::WidgetApplication::GetAdaptor();
-   */
-  Dali::Adaptor& GetAdaptor();
-
-  /**
-   * @copydoc Dali::WidgetApplication::GetResourcePath();
-   */
-  static std::string GetResourcePath();
-
-  /**
-   * @copydoc Dali::WidgetApplication::GetRegion();
-   */
-  std::string GetRegion();
-
-  /**
-   * @copydoc Dali::WidgetApplication::GetLanguage();
-   */
-  std::string GetLanguage();
-
-public: // Lifecycle functionality
-
-  /**
-   * Called when OnInit is called or the framework is initialised.
-   */
-  void DoInit();
-
-  /**
-   * Called after OnInit is called or the framework is started.
-   */
-  void DoStart();
-
-  /**
-   * Called when OnTerminate is called or the framework is terminated.
-   */
-  void DoTerminate();
-
-  /**
-   * 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
-
-  /**
-   * Called when the framework is initialised.
-   */
-  virtual void OnInit();
-
-  /**
-   * Called when the framework is terminated.
-   */
-  virtual void OnTerminate();
-
-  /**
-   * Called when the framework informs the application that the language of the device has changed.
-   */
-  virtual void OnLanguageChanged();
-
-  /**
-  * Called when the framework informs the application that the region of the device has changed.
-  */
-  virtual void OnRegionChanged();
-
-  /**
-  * Called when the framework informs the application that the battery level of the device is low.
-  */
-  virtual void OnBatteryLow( Dali::DeviceStatus::Battery::Status status );
-
-  /**
-  * Called when the framework informs the application that the memory level of the device is low.
-  */
-  virtual void OnMemoryLow( Dali::DeviceStatus::Memory::Status status );
-
-public:  // Signals
-
-  /**
-   * @copydoc Dali::WidgetApplication::InitSignal()
-   */
-   Dali::WidgetApplication::AppSignalType& InitSignal() { return mInitSignal; }
-
-  /**
-   * @copydoc Dali::WidgetApplication::TerminateSignal()
-   */
-  Dali::WidgetApplication::AppSignalType& TerminateSignal() { return mTerminateSignal; }
-
-  /**
-   * @copydoc Dali::WidgetApplication::LanguageChangedSignal()
-   */
-  Dali::WidgetApplication::AppSignalType& LanguageChangedSignal() { return mLanguageChangedSignal; }
-
-  /**
-  * @copydoc Dali::WidgetApplication::RegionChangedSignal()
-  */
-  Dali::WidgetApplication::AppSignalType& RegionChangedSignal() { return mRegionChangedSignal; }
-
-  /**
-  * @copydoc Dali::WidgetApplication::LowBatterySignal()
-  */
-  Dali::WidgetApplication::LowBatterySignalType& LowBatterySignal() { return mLowBatterySignal; }
-
-  /**
-  * @copydoc Dali::WidgetApplication::LowMemorySignal()
-  */
-  Dali::WidgetApplication::LowMemorySignalType& LowMemorySignal() { return mLowMemorySignal; }
-
-protected:
-
-  /**
-   * Private Constructor
-   * @param[in]  argc         A pointer to the number of arguments
-   * @param[in]  argv         A pointer to the argument list
-   * @param[in]  stylesheet   The path to user defined theme file
-   */
-  WidgetApplication( int* argc, char **argv[], const std::string& stylesheet );
-
-  /**
-   * Destructor
-   */
-  virtual ~WidgetApplication();
-
-  // Undefined
-  WidgetApplication(const Application&);
-  WidgetApplication& operator=(Application&);
-
-  /**
-   * Creates the adaptor
-   */
-  void CreateAdaptor();
-
-  /**
-   * Quits from the main loop
-   */
-  void QuitFromMainLoop();
-
-  /**
-   * Add idle
-   */
-  bool AddIdle( CallbackBase* callback );
-
-private:
-
-  AppSignalType                         mInitSignal;
-  AppSignalType                         mTerminateSignal;
-  AppSignalType                         mLanguageChangedSignal;
-  AppSignalType                         mRegionChangedSignal;
-  LowBatterySignalType                  mLowBatterySignal;
-  LowMemorySignalType                   mLowMemorySignal;
-
-  Framework*                            mFramework;
-
-  Dali::Configuration::ContextLoss      mContextLossConfiguration;
-  CommandLineOptions*                   mCommandLineOptions;
-
-  Dali::SingletonService                mSingletonService;
-  Dali::Adaptor*                        mAdaptor;
-  Dali::Window                          mWindow;
-  std::string                           mName;
-  std::string                           mStylesheet;
-  EnvironmentOptions                    mEnvironmentOptions;
-
-  SlotDelegate< WidgetApplication >     mSlotDelegate;
-};
-
-inline WidgetApplication& GetImplementation(Dali::WidgetApplication& widgetApplication)
-{
-  DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
-
-  BaseObject& handle = widgetApplication.GetBaseObject();
-
-  return static_cast<Internal::Adaptor::WidgetApplication&>(handle);
-}
-
-inline const WidgetApplication& GetImplementation(const Dali::WidgetApplication& widgetApplication)
-{
-  DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
-
-  const BaseObject& handle = widgetApplication.GetBaseObject();
-
-  return static_cast<const Internal::Adaptor::WidgetApplication&>(handle);
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_WIDGET_APPLICATION_H__
diff --git a/adaptors/common/widget-impl.cpp b/adaptors/common/widget-impl.cpp
deleted file mode 100644 (file)
index 239c4f1..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2014 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 "widget-impl.h"
-
-// EXTERNAL INCLUDES
-#include <system_info.h>
-#include <string.h>
-
-#include <dali/integration-api/debug.h>
-#include <dali/public-api/math/vector2.h>
-
-// INTERNAL INCLUDES
-#include <adaptor.h>
-
-namespace Dali
-{
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace
-{
-
-static bool IsWidgetFeatureEnabled()
-{
-  static bool feature = false;
-  static bool retrieved = false;
-  int ret;
-
-  if(retrieved == true)
-    return feature;
-
-  ret = system_info_get_platform_bool("http://tizen.org/feature/shell.appwidget", &feature);
-  if(ret != SYSTEM_INFO_ERROR_NONE)
-  {
-    DALI_LOG_ERROR("failed to get system info\n"); /* LCOV_EXCL_LINE */
-    return false; /* LCOV_EXCL_LINE */
-  }
-
-  retrieved = true;
-
-  return feature;
-}
-
-} // anonymous namespace
-
-Dali::Widget Widget::New( const std::string& id )
-{
-  if(!IsWidgetFeatureEnabled())
-  {
-    DALI_LOG_ERROR("not supported");
-    Dali::Widget handle(NULL);
-    return handle;
-  }
-
-  if( id.size() < 1 )
-  {
-    DALI_LOG_ERROR("class id is NULL");
-    Dali::Widget handle(NULL);
-    return handle;
-  }
-
-  WidgetPtr widget ( new Widget( id ) );
-  Dali::Widget handle( widget.Get() );
-  return handle;
-}
-
-static int OnInit(widget_base_instance_h instance_h, bundle *content, int w, int h, void *classData)
-{
-  char *id;
-  widget_base_context_get_id(instance_h, &id);
-  widget_base_class_on_create(instance_h, content, w, h);
-
-  Dali::Window window = Dali::Adaptor::Get().GetWindow();
-  Any nativeHandle = window.GetNativeHandle();
-  Ecore_Wl_Window * wlWindow = AnyCast<Ecore_Wl_Window*>( nativeHandle );
-  widget_base_context_window_bind( instance_h, id, wlWindow);
-  window.SetSize( Dali::Window::WindowSize( w, h ) );
-
-  Internal::Adaptor::Widget* widget = static_cast< Internal::Adaptor::Widget* >( classData );
-  widget->mCreateSignal.Emit( std::string(id), content, window );
-
-  return 0;
-}
-
-static int OnDestroy(widget_base_instance_h instance_h, widget_base_destroy_type_e reason, bundle *content, void *classData)
-{
-  char *id;
-  widget_base_context_get_id(instance_h, &id);
-
-  Dali::Widget::WidgetTerminateType destroyReason = Dali::Widget::WidgetTerminateType::TEMPORARY;
-
-  if(reason == WIDGET_BASE_DESTROY_TYPE_PERMANENT)
-  {
-    destroyReason = Dali::Widget::WidgetTerminateType::PERMANENT;
-  }
-
-  Internal::Adaptor::Widget* widget = static_cast< Internal::Adaptor::Widget* >( classData );
-  widget->mTerminateSignal.Emit(std::string(id), content, destroyReason );
-
-  widget_base_class_on_destroy(instance_h, reason, content);
-
-  return 0;
-}
-
-static int OnPause(widget_base_instance_h instance_h, void *classData)
-{
-  char *id;
-  widget_base_context_get_id(instance_h, &id);
-
-  widget_base_class_on_pause(instance_h);
-
-  Internal::Adaptor::Widget* widget = static_cast< Internal::Adaptor::Widget* >( classData );
-  widget->mPauseSignal.Emit(id);
-
-  return 0;
-}
-
-static int OnResume(widget_base_instance_h instance_h, void *classData)
-{
-  char *id;
-  widget_base_context_get_id(instance_h, &id);
-
-  widget_base_class_on_resume(instance_h);
-
-  Internal::Adaptor::Widget* widget = static_cast< Internal::Adaptor::Widget* >( classData );
-  widget->mResumeSignal.Emit(id);
-
-  return 0;
-}
-
-static int OnResize(widget_base_instance_h instance_h, int w, int h, void *classData)
-{
-  char *id;
-  widget_base_context_get_id(instance_h, &id);
-
-  widget_base_class_on_resize(instance_h, w, h);
-
-  Internal::Adaptor::Widget* widget = static_cast< Internal::Adaptor::Widget* >( classData );
-  Dali::Window window = Dali::Adaptor::Get().GetWindow();
-  window.SetSize( Dali::Window::WindowSize(w, h) );
-  widget->mResizeSignal.Emit(id, window);
-
-  return 0;
-}
-
-static int OnUpdate(widget_base_instance_h instance_h, bundle *content, int force, void *classData)
-{
-  char *id;
-  widget_base_context_get_id(instance_h, &id);
-
-  widget_base_class_on_update(instance_h, content, force);
-
-  Internal::Adaptor::Widget* widget = static_cast< Internal::Adaptor::Widget* >( classData );
-  widget->mUpdateSignal.Emit(id, content, force);
-
-  return 0;
-}
-
-Widget::Widget( const std::string& id )
-: mCreateSignal(),
-  mTerminateSignal(),
-  mPauseSignal(),
-  mResumeSignal(),
-  mResizeSignal(),
-  mUpdateSignal(),
-  mClassId(id),
-  mSlotDelegate(this)
-{
-  widget_base_class cls = widget_base_class_get_default();
-  cls.ops.create = OnInit;
-  cls.ops.destroy = OnDestroy;
-  cls.ops.pause = OnPause;
-  cls.ops.resume = OnResume;
-  cls.ops.resize = OnResize;
-  cls.ops.update = OnUpdate;
-
-  widget_base_class_add(cls, mClassId.c_str(), this);
-}
-
-Widget::~Widget()
-{
-}
-
-} // Adaptor
-
-} // Internal
-
-} // Dali
diff --git a/adaptors/common/widget-impl.h b/adaptors/common/widget-impl.h
deleted file mode 100644 (file)
index 05bc782..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-#ifndef __DALI_INTERNAL_WIDGET_H__
-#define __DALI_INTERNAL_WIDGET_H__
-
-/*
- * Copyright (c) 2017 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/object/base-object.h>
-#include <utility>
-#include <dali/public-api/common/vector-wrapper.h>
-#include <widget_base.h>
-
-// INTERNAL INCLUDES
-#include <widget.h>
-#include <widget-application.h>
-#include <widget-application-impl.h>
-#include <window.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-class Widget;
-typedef IntrusivePtr<Widget> WidgetPtr;
-
-/**
- * Implementation of the Application class.
- */
-class Widget : public BaseObject
-{
-public:
-  typedef Dali::Widget::WidgetCreateSignalType    WidgetCreateSignalType;
-  typedef Dali::Widget::WidgetTerminateSignalType WidgetTerminateSignalType;
-  typedef Dali::Widget::WidgetPauseSignalType     WidgetPauseSignalType;
-  typedef Dali::Widget::WidgetResumeSignalType    WidgetResumeSignalType;
-  typedef Dali::Widget::WidgetResizeSignalType    WidgetResizeSignalType;
-  typedef Dali::Widget::WidgetUpdateSignalType    WidgetUpdateSignalType;
-
-  /**
-   * Create a new Widget
-   * @param[in]  application  WidgetApplication for managing widget instance
-   * @param[in]  id           Id for widget class
-   */
-  static Dali::Widget New( const std::string& id );
-
-public:  // Signals
-
-  /**
-   * @copydoc Dali::Widget::InitSignal()
-   */
-  WidgetCreateSignalType& CreateSignal(){ return mCreateSignal; }
-
-  /**
-   * @copydoc Dali::Widget::TerminateSignal()
-   */
-  WidgetTerminateSignalType& TerminateSignal(){ return mTerminateSignal; }
-
-  /**
-   * @copydoc Dali::Widget::PauseSignal()
-   */
-  WidgetPauseSignalType& PauseSignal(){ return mPauseSignal; }
-
-  /**
-   * @copydoc Dali::Widget::ResumeSignal()
-   */
-  WidgetResumeSignalType& ResumeSignal(){ return mResumeSignal; }
-
-  /**
-   * @copydoc Dali::Widget::ResizeSignal()
-   */
-  WidgetResizeSignalType& ResizeSignal(){ return mResizeSignal; }
-
-  /**
-   * @copydoc Dali::Widget::UpdateSignal()
-   */
-  WidgetUpdateSignalType& UpdateSignal(){ return mUpdateSignal; }
-
-protected:
-
-  /**
-   * Private Constructor
-   * @param[in]  id           Id for widget class
-   */
-  Widget( const std::string& id );
-
-  /**
-   * Destructor
-   */
-  virtual ~Widget();
-
-  // Undefined
-  Widget(const Widget&);
-  Widget& operator=(Widget&);
-
-public:
-
-  WidgetCreateSignalType        mCreateSignal;
-  WidgetTerminateSignalType     mTerminateSignal;
-  WidgetPauseSignalType         mPauseSignal;
-  WidgetResumeSignalType        mResumeSignal;
-  WidgetResizeSignalType        mResizeSignal;
-  WidgetUpdateSignalType        mUpdateSignal;
-  const std::string             mClassId;
-
-private:
-  SlotDelegate< Widget >                mSlotDelegate;
-};
-
-inline Widget& GetImplementation(Dali::Widget& widget)
-{
-  DALI_ASSERT_ALWAYS(widget && "widget handle is empty");
-
-  BaseObject& handle = widget.GetBaseObject();
-
-  return static_cast<Internal::Adaptor::Widget&>(handle);
-}
-
-inline const Widget& GetImplementation(const Dali::Widget& widget)
-{
-  DALI_ASSERT_ALWAYS(widget && "widget handle is empty");
-
-  const BaseObject& handle = widget.GetBaseObject();
-
-  return static_cast<const Internal::Adaptor::Widget&>(handle);
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-#endif // __DALI_INTERNAL_WIDGET_H__
index 68cfced..dce9aed 100644 (file)
@@ -18,9 +18,6 @@
 // CLASS HEADER
 #include "widget-application.h"
 
-// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-
 // INTERNAL INCLUDES
 #include <widget-application-impl.h>
 
@@ -42,7 +39,7 @@ WidgetApplication::WidgetApplication()
 }
 
 WidgetApplication::WidgetApplication(const WidgetApplication& widgetApplication)
-: BaseHandle(widgetApplication)
+: Application(widgetApplication)
 {
 }
 
@@ -55,63 +52,13 @@ WidgetApplication& WidgetApplication::operator=(const WidgetApplication& widgetA
   return *this;
 }
 
-void WidgetApplication::MainLoop()
-{
-  Internal::Adaptor::GetImplementation(*this).MainLoop();
-}
-
-void WidgetApplication::Quit()
-{
-  Internal::Adaptor::GetImplementation(*this).Quit();
-}
-
-std::string WidgetApplication::GetResourcePath()
-{
-  return Internal::Adaptor::WidgetApplication::GetResourcePath();
-}
-
-std::string WidgetApplication::GetRegion()
-{
-  return Internal::Adaptor::GetImplementation(*this).GetRegion();
-}
-
-std::string WidgetApplication::GetLanguage()
-{
-  return Internal::Adaptor::GetImplementation(*this).GetLanguage();
-}
-
-WidgetApplication::AppSignalType& WidgetApplication::InitSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).InitSignal();
-}
-
-WidgetApplication::AppSignalType& WidgetApplication::TerminateSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
-}
-
-WidgetApplication::AppSignalType& WidgetApplication::LanguageChangedSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
-}
-
-WidgetApplication::AppSignalType& WidgetApplication::RegionChangedSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
-}
-
-WidgetApplication::LowBatterySignalType& WidgetApplication::LowBatterySignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).LowBatterySignal();
-}
-
-WidgetApplication::LowMemorySignalType& WidgetApplication::LowMemorySignal()
+void WidgetApplication::RegisterWidgetCreatingFunction( const std::string& widgetName, CreateWidgetFunction createFunction )
 {
-  return Internal::Adaptor::GetImplementation(*this).LowMemorySignal();
+  Internal::Adaptor::GetImplementation(*this).RegisterWidgetCreatingFunction( widgetName, createFunction );
 }
 
 WidgetApplication::WidgetApplication(Internal::Adaptor::WidgetApplication* widgetApplication)
-: BaseHandle(widgetApplication)
+: Application(widgetApplication)
 {
 }
 
index 696deb6..5c861f5 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __DALI_WIDGET_APPLICATION_H__
-#define __DALI_WIDGET_APPLICATION_H__
+#ifndef DALI_WIDGET_APPLICATION_H
+#define DALI_WIDGET_APPLICATION_H
 
 /*
  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  */
 
-// EXTERNAL INCLUDES
-#include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/signals/dali-signal.h>
-#include <dali/public-api/signals/callback.h>
-#include <bundle.h>
-
-// INTERNAL INCLUDES
-#ifdef DALI_ADAPTOR_COMPILATION  // full path doesn't exist until adaptor is installed so we have to use relative
-#include <device-status.h>
-#else
-#include <dali/public-api/adaptor-framework/device-status.h>
-#endif
-
 // INTERNAL INCLUDES
+#include <public-api/adaptor-framework/application.h>
 
 namespace Dali
 {
 
 namespace Internal DALI_INTERNAL
 {
+
 namespace Adaptor
 {
 class WidgetApplication;
 }
+
 }
 
-class Window;
+class Widget;
 
 /**
  * @brief An WidgetApplication class object should be created by every widget application
@@ -61,26 +51,30 @@ class Window;
  * WidgetApplications should follow the example below:
  *
  * @code
+ *
+ * //Widget header which
+ * #include <my-widget.h>
+ *
  * class ExampleController: public ConnectionTracker
  * {
  * public:
- *   ExampleController( WidgetApplication& widgetApplication )
- *   : mWidgetApplication( widgetApplication )
+ *   ExampleController( Application& application )
+ *   : mWidgetApplication( application )
  *   {
- *     mWidgetApplication.InitSignal().Connect( this, &ExampleController::Create );
+ *     mApplication.InitSignal().Connect( this, &ExampleController::Create );
  *   }
  *
- *   void Create( WidgetApplication& widgetApplication )
+ *   static Widget CreateWidgetFunction(const std::string& widgetName)
  *   {
- *     Widget widget = Widget::New( WIDGET_ID );
- *     widget.CreateSignal( this, &ExampleController::WidgetCreate );
+ *     MyWidget widget = MyWidget::New();
+ *     return widget;
  *   }
  *
- *   void WidgetCreate( const std::string& id, bundle* content, Window window )
+ *   void Create( Application& application )
  *   {
- *     // Do Dali components...
+ *     mApplication.RegisterWidgetCreatingFunction( "myWidget", &ExampleController::CreateWidgetFunction );
  *   }
- *  ...
+ *
  * private:
  *   WidgetApplication& mWidgetApplication;
  * };
@@ -100,21 +94,24 @@ class Window;
  * app.ResumeSignal().Connect(&app, &MyWidgetApplication::Resume);
  * @endcode
  *
- * @SINCE_1_2.62
+ * @SINCE_1_3_5
  */
-class DALI_IMPORT_API WidgetApplication : public BaseHandle
+class DALI_IMPORT_API WidgetApplication : public Application
 {
 public:
 
-  typedef Signal< void (WidgetApplication&) > AppSignalType;                   ///< Widget application lifecycle signal and system signal callback type
-  typedef Signal< void (DeviceStatus::Battery::Status) > LowBatterySignalType; ///< Widget application device signal type
-  typedef Signal< void (DeviceStatus::Memory::Status) > LowMemorySignalType;   ///< Widget application device signal type
+  /**
+   * @brief This is the typedef for Widget creator.
+   * @SINCE_1_3_5
+   */
+  typedef Widget(*CreateWidgetFunction)(const std::string&);
 
 public:
 
   /**
    * @brief This is the constructor for WidgetApplications with a name.
    *
+   * @SINCE_1_3_5
    * @param[in,out]  argc        A pointer to the number of arguments
    * @param[in,out]  argv        A pointer to the argument list
    * @param[in]      stylesheet  The path to user defined theme file
@@ -125,18 +122,22 @@ public:
 
   /**
    * @brief The default constructor.
-   *
+   * @SINCE_1_3_5
    */
   WidgetApplication();
 
   /**
    * @brief Copy Constructor.
+   *
+   * @SINCE_1_3_5
    * @param[in] WidgetApplication Handle to an object
    */
   WidgetApplication( const WidgetApplication& widgetApplication );
 
   /**
    * @brief Assignment operator.
+   *
+   * @SINCE_1_3_5
    * @param[in] WidgetApplication Handle to an object
    * @return A reference to this
    */
@@ -144,79 +145,18 @@ public:
 
  /**
    * @brief Destructor
-   *
+   * @SINCE_1_3_5
    */
   ~WidgetApplication();
 
   /**
-   * @brief This starts the application.
-   */
-  void MainLoop();
-
-  /**
-   * @brief This quits the application.  Tizen applications should use Lower to improve re-start performance unless they need to Quit completely.
-   */
-  void Quit();
-
-  /**
-   * @brief Get path application resources are stored at
-   * @return the full path of the resources
-   */
-  static std::string GetResourcePath();
-
-  /**
-   * @brief this is used to get region information from device.
-   *
-   * @return region information
-   */
-  std::string GetRegion();
-
-  /**
-   * @brief this is used to get language information from device.
+   * @brief Register create function for widget.
    *
-   * @return language information
+   * @SINCE_1_3_5
+   * @param[in] widgetName  Name of widget
+   * @param[in] createFunction     Function pointer for widget creation.
    */
-  std::string GetLanguage();
-
-public:  // Signals
-
-  /**
-   * @brief The user should connect to this signal to determine when they should initialize
-   * their application.
-   * @return The signal to connect to
-   */
-  AppSignalType& InitSignal();
-
-  /**
-   * @brief The user should connect to this signal to determine when they should terminate
-   * their application.
-   * @return The signal to connect to
-   */
-  AppSignalType& TerminateSignal();
-
-  /**
-   * @brief This signal is emitted when the language is changed on the device.
-   * @return The signal to connect to
-   */
-  AppSignalType& LanguageChangedSignal();
-
-  /**
-  * @brief This signal is emitted when the region of the device is changed.
-  * @return The signal to connect to
-  */
-  AppSignalType& RegionChangedSignal();
-
-  /**
-  * @brief This signal is emitted when the battery level of the device is low.
-  * @return The signal to connect to
-  */
-  LowBatterySignalType& LowBatterySignal();
-
-  /**
-  * @brief This signal is emitted when the memory level of the device is low.
-  * @return The signal to connect to
-  */
-  LowMemorySignalType& LowMemorySignal();
+  void RegisterWidgetCreatingFunction( const std::string& widgetName, CreateWidgetFunction createFunction );
 
 public: // Not intended for application developers
   /// @cond internal
@@ -229,4 +169,4 @@ public: // Not intended for application developers
 
 } // namespace Dali
 
-#endif // ___DALI_WIDGET_APPLICATION_H__
+#endif // DALI_WIDGET_APPLICATION_H
diff --git a/adaptors/devel-api/adaptor-framework/widget-impl.cpp b/adaptors/devel-api/adaptor-framework/widget-impl.cpp
new file mode 100644 (file)
index 0000000..72e00d0
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2017 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 "widget-impl.h"
+
+// INTERNAL INCLUDES
+#include <window.h>
+#include <widget-controller.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+WidgetPtr Widget::New()
+{
+  return new Widget();
+}
+
+Widget::Widget()
+: mImpl( nullptr )
+{
+}
+
+Widget::~Widget()
+{
+  if( mImpl != nullptr )
+  {
+    delete mImpl;
+  }
+}
+
+void Widget::OnCreate( const std::string& contentInfo, Dali::Window window )
+{
+}
+
+void Widget::OnTerminate( const std::string& contentInfo, Dali::Widget::Termination type )
+{
+}
+
+void Widget::OnPause()
+{
+}
+
+void Widget::OnResume()
+{
+}
+
+void Widget::OnResize( Dali::Window window )
+{
+}
+
+void Widget::OnUpdate( const std::string& contentInfo, int force )
+{
+}
+
+void Widget::SignalConnected( SlotObserver* slotObserver, CallbackBase* callback )
+{
+  mImpl->SignalConnected( slotObserver, callback );
+}
+
+void Widget::SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback )
+{
+  mImpl->SignalDisconnected( slotObserver, callback );
+}
+
+void Widget::SetContentInfo( const std::string& contentInfo )
+{
+  if( mImpl != nullptr )
+  {
+    mImpl->SetContentInfo( contentInfo );
+  }
+}
+
+void Widget::SetImpl( Impl* impl )
+{
+  mImpl = impl;
+}
+
+Internal::Adaptor::Widget& GetImplementation(Dali::Widget& widget)
+{
+  DALI_ASSERT_ALWAYS(widget && "widget handle is empty");
+
+  BaseObject& handle = widget.GetBaseObject();
+
+  return static_cast<Internal::Adaptor::Widget&>(handle);
+}
+
+const Internal::Adaptor::Widget& GetImplementation(const Dali::Widget& widget)
+{
+  const BaseObject& handle = widget.GetBaseObject();
+
+  return static_cast<const Internal::Adaptor::Widget&>(handle);
+}
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
diff --git a/adaptors/devel-api/adaptor-framework/widget-impl.h b/adaptors/devel-api/adaptor-framework/widget-impl.h
new file mode 100644 (file)
index 0000000..b592c38
--- /dev/null
@@ -0,0 +1,199 @@
+#ifndef DALI_INTERNAL_WIDGET_H
+#define DALI_INTERNAL_WIDGET_H
+
+/*
+ * Copyright (c) 2017 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/object/base-object.h>
+#include <dali/public-api/signals/connection-tracker-interface.h>
+
+// INTERNAL INCLUDES
+#include "widget.h"
+
+namespace Dali
+{
+class Window;
+
+/**
+ * @addtogroup dali_adaptor_framework
+ * @{
+ */
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class Widget;
+typedef IntrusivePtr<Widget> WidgetPtr;
+
+/**
+ * @brief This is the internal base class of custom widget.
+ *
+ * It will provides several widget instance lifecycle virtual functions
+ * which the user can override.
+ *
+ * User should override OnCreate function and create scene for custom widget.
+ *
+ * Plus, Implements ConnectionTrackerInterface so that signals (typically connected to member functions) will
+ * be disconnected automatically when the control is destroyed.
+ *
+ * @SINCE_1_3_5
+ */
+class DALI_IMPORT_API Widget : public BaseObject, public ConnectionTrackerInterface
+{
+public:
+
+  /**
+   * @brief Creates a new WidgetImpl instance.
+   *
+   * @SINCE_1_3_5
+   * @return A handle to the WidgetImpl instance
+   */
+  static WidgetPtr New();
+
+  /**
+   * @brief The user should override this function to determine when they create widget.
+   *
+   * @SINCE_1_3_5
+   * @param[in] contentInfo Information from WidgetView for creating. It contains previous status of widget which is sent by SetContentInfo before.
+   * @param[in] window Window handle for widget
+   */
+  virtual void OnCreate( const std::string& contentInfo, Dali::Window window );
+
+  /**
+   * @brief The user should override this function to determine when they terminate widget.
+   *
+   * @SINCE_1_3_5
+   * @param[in] contentInfo Data from WidgetView for deleting
+   * @param[in] type Termination type. When user delete widget view, termination type is PERMANENT.
+   */
+  virtual void OnTerminate( const std::string& contentInfo, Dali::Widget::Termination type );
+
+  /**
+   * @brief The user should override this function to determine when they pause widget.
+   * @SINCE_1_3_5
+   */
+  virtual void OnPause();
+
+  /**
+   * @brief The user should override this function to determine when they resume widget.
+   * @SINCE_1_3_5
+   */
+  virtual void OnResume();
+
+  /**
+   * @brief The user should override this function to determine when they resize widget.
+   *
+   * @SINCE_1_3_5
+   * @param[in] window Window handle for widget
+   */
+  virtual void OnResize( Dali::Window window );
+
+  /**
+   * @brief The user should override this function to determine when they update widget.
+   *
+   * @SINCE_1_3_5
+   * @param[in] contentInfo Data from WidgetView for updating
+   * @param[in] force Although the widget is paused, if it is true, the widget can be updated
+   */
+  virtual void OnUpdate( const std::string& contentInfo, int force );
+
+  // From ConnectionTrackerInterface
+
+  /**
+   * @copydoc ConnectionTrackerInterface::SignalConnected
+   */
+  virtual void SignalConnected( SlotObserver* slotObserver, CallbackBase* callback );
+
+  /**
+   * @copydoc ConnectionTrackerInterface::SignalDisconnected
+   */
+  virtual void SignalDisconnected( SlotObserver* slotObserver, CallbackBase* callback );
+
+  /**
+   * @brief Set content info to WidgetView.
+   *
+   * @SINCE_1_3_5
+   * @param[in] contentInfo Content info is kind of context information which contains current status of widget.
+   */
+  void SetContentInfo( const std::string& contentInfo );
+
+protected:
+
+  /**
+   * @brief WidgetImpl constructor
+   */
+  Widget();
+
+  /**
+   * @brief Virtual destructor
+   */
+  virtual ~Widget();
+
+  /// @cond internal
+public:
+  class Impl; // Class declaration is public so we can internally add devel API's to the WidgetImpl
+
+  /*
+   * Set pointer of WidgetImpl Internal.
+   * @SINCE_1_3_5
+   */
+  void SetImpl( Widget::Impl* impl );
+
+private:
+  Impl* mImpl;
+
+  // Undefined
+  DALI_INTERNAL Widget(const Widget&);
+  DALI_INTERNAL Widget& operator=(Widget&);
+  /// @endcond
+
+};
+
+/**
+ * @brief Gets implementation from the handle.
+ *
+ * @SINCE_1_3_5
+ * @param handle
+ * @return Implementation
+ * @pre handle is initialized and points to a widget
+ */
+DALI_IMPORT_API Internal::Adaptor::Widget& GetImplementation( Dali::Widget& widget );
+
+/**
+ * @brief Gets implementation from the handle.
+ *
+ * @SINCE_1_3_5
+ * @param handle
+ * @return Implementation
+ * @pre Handle is initialized and points to a widget.
+ */
+DALI_IMPORT_API const Internal::Adaptor::Widget& GetImplementation( const Dali::Widget& widget );
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+/**
+ * @}
+ */
+
+} // namespace Dali
+#endif // DALI_INTERNAL_WIDGET_H
index 26f07a8..2afa42c 100644 (file)
 // CLASS HEADER
 #include "widget.h"
 
-// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-
 // INTERNAL INCLUDES
 #include <widget-impl.h>
 
 namespace Dali
 {
 
-Widget Widget::New( const std::string& id)
+Widget Widget::New()
 {
-  return Internal::Adaptor::Widget::New( id );
+  Internal::Adaptor::WidgetPtr internal = Internal::Adaptor::Widget::New();
+  return Widget(internal.Get());
 }
 
 Widget::~Widget()
@@ -54,36 +52,6 @@ Widget& Widget::operator=(const Widget& widget)
   return *this;
 }
 
-Widget::WidgetCreateSignalType& Widget::CreateSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).CreateSignal();
-}
-
-Widget::WidgetTerminateSignalType& Widget::TerminateSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).TerminateSignal();
-}
-
-Widget::WidgetPauseSignalType& Widget::PauseSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).PauseSignal();
-}
-
-Widget::WidgetResumeSignalType& Widget::ResumeSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ResumeSignal();
-}
-
-Widget::WidgetResizeSignalType& Widget::ResizeSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
-}
-
-Widget::WidgetUpdateSignalType& Widget::UpdateSignal()
-{
-  return Internal::Adaptor::GetImplementation(*this).UpdateSignal();
-}
-
 Widget::Widget(Internal::Adaptor::Widget* widget)
 : BaseHandle(widget)
 {
index be23dc3..ee92574 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef __DALI_WIDGET_H__
-#define __DALI_WIDGET_H__
+#ifndef DALI_WIDGET_H
+#define DALI_WIDGET_H
 
 /*
  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
 
 // EXTERNAL INCLUDES
 #include <dali/public-api/object/base-handle.h>
-#include <dali/public-api/signals/dali-signal.h>
-#include <bundle.h>
 
 namespace Dali
 {
-/**
+
+  /**
  * @addtogroup dali_adaptor_framework
  * @{
  */
 
-namespace Internal DALI_INTERNAL
+namespace Internal
 {
 
 namespace Adaptor
@@ -43,96 +42,50 @@ class Widget;
 class Window;
 
 /**
- * @brief Widget object should be created by WidgetApplication.
- *
- * The WidgetApplication class emits several widget instance lifecycle signals
- * which the user can connect to.
- * The user should connect to the CreateSignal of the Widget and
- * create the Dali Widget object in the connected callback.
- *
- * Widget should follow the example below:
- *
- * @code
- * class ExampleController: public ConnectionTracker
- * {
- * public:
- *   ExampleController( WidgetApplication& widgetApplication )
- *   : mWidgetApplication( widgetApplication )
- *   {
- *     mWidgetApplication.InitSignal().Connect( this, &ExampleController::Create );
- *   }
- *
- *   void Create( WidgetApplication& widgetApplication )
- *   {
- *     Widget widget = Widget::New( WIDGET_ID );
- *     widget.CreateSignal( this, &ExampleController::WidgetCreate );
- *   }
- *
- *   void WidgetCreate( const std::string& id, bundle* content, Window window )
- *   {
- *     // Do Dali components...
- *   }
- *  ...
- * private:
- *   WidgetApplication& mWidgetApplication;
- * };
+ * @brief Widget class is the base class for custom widget.
  *
- * int main (int argc, char **argv)
- * {
- *   WidgetApplication app = WidgetApplication::New(&argc, &argv);
- *   ExampleController example( app );
- *   app.MainLoop();
- * }
+ * To make own Widget, user should inherit this class and its impl class.
  *
- * @SINCE_1_2.62
+ * @SINCE_1_3_5
  */
 class DALI_IMPORT_API Widget : public BaseHandle
 {
 public:
 
   /**
-   * @brief Enumeration for terminate type of widget instance.
-   * @SINCE_1_2.62
+   * @brief Enumeration class for termination type of widget instance.
+   * @SINCE_1_3_5
    */
-  typedef enum
+  enum class Termination
   {
-    PERMANENT, //< User deleted this widget from the viewer @SINCE_1_2.62
-    TEMPORARY, //< Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) @SINCE_1_2.62
-  } WidgetTerminateType;
-
-  typedef Signal< void (const std::string&, bundle*, Window) > WidgetCreateSignalType;                  ///< Widget lifecycle signal type @SINCE_1_2.62
-  typedef Signal< void (const std::string&, bundle*, WidgetTerminateType) > WidgetTerminateSignalType;  ///< Widget lifecycle signal type @SINCE_1_2.62
-  typedef Signal< void (const std::string&) > WidgetPauseSignalType;                                    ///< Widget lifecycle signal type @SINCE_1_2.62
-  typedef Signal< void (const std::string&) > WidgetResumeSignalType;                                   ///< Widget lifecycle signal type @SINCE_1_2.62
-  typedef Signal< void (const std::string&, Window) > WidgetResizeSignalType;                           ///< Widget lifecycle signal type @SINCE_1_2.62
-  typedef Signal< void (const std::string&, bundle*, int) > WidgetUpdateSignalType;                     ///< Widget lifecycle signal type @SINCE_1_2.62
+    PERMANENT, //< User deleted this widget from the viewer @SINCE_1_3_5
+    TEMPORARY, //< Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) @SINCE_1_3_5
+  };
 
 public:
 
   /**
    * @brief This is the constructor for Widget.
-   * @SINCE_1_2.62
-   * @param[in]  id  Id for widget class
+   * @SINCE_1_3_5
    * @return A handle to the Widget
    */
-  static Widget New( const std::string& id );
+  static Widget New();
 
   /**
    * @brief The default constructor.
-   *
    */
   Widget();
 
   /**
    * @brief Copy Constructor.
-   * @SINCE_1_2.62
+   * @SINCE_1_3_5
    * @param[in] Widget Handle to an object
    */
   Widget( const Widget& widget );
 
   /**
    * @brief Assignment operator.
-   * @SINCE_1_2.62
+   * @SINCE_1_3_5
    * @param[in] Widget Handle to an object
    * @return A reference to this
    */
@@ -140,61 +93,12 @@ public:
 
   /**
    * @brief Destructor
-   * @SINCE_1_2.62
+   * @SINCE_1_3_5
    */
   ~Widget();
 
-public:  // Signals
-
-  /**
-   * @brief The user should connect to this signal to determine when they create widget.
-   * @SINCE_1_2.62
-   * @return The signal to connect to
-   */
-  WidgetCreateSignalType& CreateSignal();
-
-  /**
-   * @brief The user should connect to this signal to determine when they terminate widget.
-   * @SINCE_1_2.62
-   * @return The signal to connect to
-   */
-  WidgetTerminateSignalType& TerminateSignal();
-
-  /**
-   * @brief The user should connect to this signal to determine when they pause widget.
-   * @SINCE_1_2.62
-   * @return The signal to connect to
-   */
-  WidgetPauseSignalType& PauseSignal();
-
-  /**
-   * @brief The user should connect to this signal to determine when they resume widget.
-   * @SINCE_1_2.62
-   * @return The signal to connect to
-   */
-  WidgetResumeSignalType& ResumeSignal();
-
-  /**
-   * @brief The user should connect to this signal to determine when they resize widget.
-   * @SINCE_1_2.62
-   * @return The signal to connect to
-   */
-  WidgetResizeSignalType& ResizeSignal();
-
-  /**
-   * @brief The user should connect to this signal to determine when they update widget.
-   * @SINCE_1_2.62
-   * @return The signal to connect to
-   */
-  WidgetUpdateSignalType& UpdateSignal();
-
 public: // Not intended for application developers
-  /// @cond internal
-  /**
-   * @brief Internal constructor.
-   */
-  explicit DALI_INTERNAL Widget(Internal::Adaptor::Widget* widget);
-  /// @endcond
+  explicit Widget(Internal::Adaptor::Widget* widget);
 };
 
 /**
@@ -202,4 +106,4 @@ public: // Not intended for application developers
  */
 } // namespace Dali
 
-#endif // ___DALI_WIDGET_H__
+#endif // DALI_WIDGET_H
index 451e3bf..3a33fd0 100644 (file)
@@ -71,8 +71,11 @@ devel_api_adaptor_framework_header_files = \
 
 adaptor_widget_src_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/widget.cpp \
+  $(adaptor_devel_api_dir)/adaptor-framework/widget-impl.cpp \
   $(adaptor_devel_api_dir)/adaptor-framework/widget-application.cpp
 
 adaptor_widget_header_files = \
   $(adaptor_devel_api_dir)/adaptor-framework/widget.h \
+  $(adaptor_devel_api_dir)/adaptor-framework/widget-impl.h \
   $(adaptor_devel_api_dir)/adaptor-framework/widget-application.h
+
index 26d24e4..9e87551 100644 (file)
@@ -229,13 +229,6 @@ public:
   Any GetNativeWindowHandle();
 
   /**
-   * @brief Gets Window handle
-   *
-   * @return Window handle
-   */
-  Window GetWindow();
-
-  /**
    * @brief Release any locks the surface may hold.
    *
    * For example, after compositing an offscreen surface, use this method to allow
index 5929101..11390cd 100755 (executable)
@@ -28,7 +28,7 @@ namespace Dali
 
 const unsigned int ADAPTOR_MAJOR_VERSION = 1;
 const unsigned int ADAPTOR_MINOR_VERSION = 2;
-const unsigned int ADAPTOR_MICRO_VERSION = 73;
+const unsigned int ADAPTOR_MICRO_VERSION = 74;
 const char * const ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 2d447ed..3b8ee99 100644 (file)
@@ -21,6 +21,10 @@ adaptor_tizen_internal_native_image_src_files = \
   $(adaptor_tizen_dir)/native-render-surface-factory-tizen.cpp \
   $(adaptor_tizen_dir)/native-image-source-impl-tizen.cpp
 
+adaptor_tizen_internal_widget_src_files = \
+  $(adaptor_tizen_dir)/widget-application-impl.cpp \
+  $(adaptor_tizen_dir)/widget-controller.cpp
+
 public_api_adaptor_tizen_header_files = \
   $(adaptor_tizen_dir)/key-grab.h
 
index d9c7724..9628bdd 100644 (file)
@@ -46,7 +46,6 @@
 // INTERNAL INCLUDES
 #include <callback-manager.h>
 
-#include <dlog.h>
 namespace Dali
 {
 
@@ -69,13 +68,15 @@ bool IsWidgetFeatureEnabled()
   int ret;
 
   if(retrieved == true)
+  {
     return feature;
+  }
 
   ret = system_info_get_platform_bool("http://tizen.org/feature/shell.appwidget", &feature);
   if(ret != SYSTEM_INFO_ERROR_NONE)
   {
-    DALI_LOG_ERROR("failed to get system info"); /* LCOV_EXCL_LINE */
-    return false; /* LCOV_EXCL_LINE */
+    DALI_LOG_ERROR("failed to get system info");
+    return false;
   }
 
   retrieved = true;
@@ -548,7 +549,6 @@ struct Framework::Impl
 
   static int WidgetAppCreate( void *data )
   {
-    dlog_print(DLOG_ERROR,"DALI","WidgetAppCreate!\n");
     widget_base_on_create();
     return static_cast<int>( static_cast<Framework*>(data)->Create() );
   }
diff --git a/adaptors/tizen/widget-application-impl.cpp b/adaptors/tizen/widget-application-impl.cpp
new file mode 100644 (file)
index 0000000..db403e3
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2017 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 "widget-application-impl.h"
+
+// INTERNAL INCLUDE
+#include <widget.h>
+#include <widget-impl.h>
+#include <widget-controller.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+int OnInstanceInit(widget_base_instance_h instanceHandle, bundle *content, int w, int h, void *classData)
+{
+  char *id;
+  widget_base_context_get_id(instanceHandle, &id);
+
+  widget_base_class_on_create(instanceHandle, content, w, h);
+
+  Dali::Internal::Adaptor::WidgetApplication* application = static_cast<Dali::Internal::Adaptor::WidgetApplication*>(classData);
+
+  // After DALi can support multi window, this part should be changed.
+  Dali::Window window = application->GetWindow();
+  window.ShowIndicator(Dali::Window::INVISIBLE);
+  Any nativeHandle = window.GetNativeHandle();
+  Ecore_Wl_Window * wlWindow = AnyCast<Ecore_Wl_Window*>( nativeHandle );
+  widget_base_context_window_bind( instanceHandle, id, wlWindow );
+  window.SetSize( Dali::Window::WindowSize( w, h ) );
+
+  Dali::Internal::Adaptor::WidgetApplication::CreateWidgetFunctionPair pair = application->GetWidgetCreatingFunctionPair(std::string(id));
+  Dali::WidgetApplication::CreateWidgetFunction createFunction = pair.second;
+
+  Dali::Widget widgetInstance = createFunction( pair.first );
+  application->AddWidget( instanceHandle, widgetInstance );
+
+  Dali::Internal::Adaptor::Widget::Impl *widgetImpl = new Dali::Internal::Adaptor::Widget::Impl(instanceHandle);
+  Internal::Adaptor::GetImplementation(widgetInstance).SetImpl( widgetImpl );
+
+  std::string encodedContentString = "";
+
+  if( bundle_get_count( content ) )
+  {
+    bundle_raw *bundleRaw;
+    int len;
+    bundle_encode(content, &bundleRaw, &len);
+    char* encodedContent = reinterpret_cast< char* >( bundleRaw );
+    encodedContentString = std::string( encodedContent );
+    free(bundleRaw);
+  }
+
+  Internal::Adaptor::GetImplementation(widgetInstance).OnCreate( encodedContentString, window );
+
+  return 0;
+}
+
+int OnInstanceDestroy(widget_base_instance_h instanceHandle, widget_base_destroy_type_e reason, bundle *content, void *classData)
+{
+  Dali::Internal::Adaptor::WidgetApplication* application = static_cast<Dali::Internal::Adaptor::WidgetApplication*>(classData);
+
+  // Get Dali::Widget instance.
+  Dali::Widget widgetInstance = application->GetWidget( instanceHandle );
+
+  Dali::Widget::Termination destroyReason = Dali::Widget::Termination::TEMPORARY;
+
+  if(reason == WIDGET_BASE_DESTROY_TYPE_PERMANENT)
+  {
+    destroyReason = Dali::Widget::Termination::PERMANENT;
+  }
+
+  std::string encodedContentString = "";
+
+  if( bundle_get_count( content ) )
+  {
+    bundle_raw *bundleRaw;
+    int len;
+    bundle_encode(content, &bundleRaw, &len);
+    char* encodedContent = reinterpret_cast< char* >( bundleRaw );
+    encodedContentString = std::string(encodedContent);
+    free(bundleRaw);
+  }
+
+  Internal::Adaptor::GetImplementation(widgetInstance).OnTerminate( encodedContentString, destroyReason );
+
+  widget_base_class_on_destroy(instanceHandle, reason, content);
+
+  application->DeleteWidget( instanceHandle );
+
+  return 0;
+}
+
+int OnInstancePause(widget_base_instance_h instanceHandle, void *classData)
+{
+  widget_base_class_on_pause(instanceHandle);
+
+  Dali::Internal::Adaptor::WidgetApplication* application = static_cast<Dali::Internal::Adaptor::WidgetApplication*>(classData);
+
+  // Get Dali::Widget instance.
+  Dali::Widget widgetInstance = application->GetWidget( instanceHandle );
+
+  Internal::Adaptor::GetImplementation(widgetInstance).OnPause();
+
+  return 0;
+}
+
+int OnInstanceResume(widget_base_instance_h instanceHandle, void *classData)
+{
+  widget_base_class_on_resume(instanceHandle);
+
+  Dali::Internal::Adaptor::WidgetApplication* application = static_cast<Dali::Internal::Adaptor::WidgetApplication*>(classData);
+
+  // Get Dali::Widget instance.
+  Dali::Widget widgetInstance = application->GetWidget( instanceHandle );
+
+  Internal::Adaptor::GetImplementation(widgetInstance).OnResume();
+
+  return 0;
+}
+
+int OnInstanceResize(widget_base_instance_h instanceHandle, int w, int h, void *classData)
+{
+  widget_base_class_on_resize(instanceHandle, w, h);
+
+  Dali::Internal::Adaptor::WidgetApplication* application = static_cast<Dali::Internal::Adaptor::WidgetApplication*>(classData);
+
+  // Get Dali::Widget instance.
+  Dali::Widget widgetInstance = application->GetWidget( instanceHandle );
+
+  Dali::Window window = application->GetWindow();
+  window.SetSize( Dali::Window::WindowSize(w, h) );
+  Internal::Adaptor::GetImplementation(widgetInstance).OnResize(window);
+
+  return 0;
+}
+
+int OnInstanceUpdate(widget_base_instance_h instanceHandle, bundle *content, int force, void *classData)
+{
+  widget_base_class_on_update(instanceHandle, content, force);
+
+  Dali::Internal::Adaptor::WidgetApplication* application = static_cast<Dali::Internal::Adaptor::WidgetApplication*>(classData);
+
+  // Get Dali::Widget instance.
+  Dali::Widget widgetInstance = application->GetWidget( instanceHandle );
+
+  std::string encodedContentString = "";
+
+  if( bundle_get_count( content ) )
+  {
+    bundle_raw *bundleRaw;
+    int len;
+    bundle_encode(content, &bundleRaw, &len);
+    char* encodedContent = reinterpret_cast< char* >( bundleRaw );
+    encodedContentString = std::string(encodedContent);
+    free(bundleRaw);
+  }
+
+  Internal::Adaptor::GetImplementation(widgetInstance).OnUpdate( encodedContentString, force );
+
+  return 0;
+}
+
+} // anonymous namespace
+
+namespace Adaptor
+{
+
+WidgetApplicationPtr WidgetApplication::New(
+  int* argc,
+  char **argv[],
+  const std::string& stylesheet)
+{
+  WidgetApplicationPtr widgetApplication( new WidgetApplication (argc, argv, stylesheet ) );
+  return widgetApplication;
+}
+
+WidgetApplication::WidgetApplication( int* argc, char** argv[], const std::string& stylesheet )
+:Application(argc, argv, stylesheet, Dali::WidgetApplication::OPAQUE, PositionSize(), Framework::WIDGET)
+{
+}
+
+WidgetApplication::~WidgetApplication()
+{
+}
+
+
+void WidgetApplication::RegisterWidgetCreatingFunction( const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction )
+{
+  AddWidgetCreatingFunctionPair( CreateWidgetFunctionPair(widgetName, createFunction) );
+
+  // Register widget class to widget framework
+  widget_base_class cls = widget_base_class_get_default();
+  cls.ops.create = OnInstanceInit;
+  cls.ops.destroy = OnInstanceDestroy;
+  cls.ops.pause = OnInstancePause;
+  cls.ops.resume = OnInstanceResume;
+  cls.ops.resize = OnInstanceResize;
+  cls.ops.update = OnInstanceUpdate;
+
+  widget_base_class_add(cls, widgetName.c_str(), this);
+}
+
+void WidgetApplication::AddWidgetCreatingFunctionPair( CreateWidgetFunctionPair pair )
+{
+  mCreateWidgetFunctionContainer.push_back( pair );
+}
+
+WidgetApplication::CreateWidgetFunctionPair WidgetApplication::GetWidgetCreatingFunctionPair( const std::string& widgetName )
+{
+  for( CreateWidgetFunctionContainer::const_iterator iter = mCreateWidgetFunctionContainer.begin(); iter != mCreateWidgetFunctionContainer.end(); ++iter )
+  {
+    if( widgetName.find((*iter).first) != std::string::npos  )
+    {
+      return *iter;
+    }
+  }
+
+  return CreateWidgetFunctionPair( "", NULL );
+}
+
+void WidgetApplication::AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget )
+{
+  mWidgetInstanceContainer.push_back( WidgetInstancePair(widgetBaseInstance, widget) );
+}
+
+Dali::Widget WidgetApplication::GetWidget( widget_base_instance_h widgetBaseInstance )
+{
+  for( WidgetInstanceContainer::const_iterator iter = mWidgetInstanceContainer.begin(); iter != mWidgetInstanceContainer.end(); ++iter )
+  {
+    if( (*iter).first == widgetBaseInstance  )
+    {
+      return (*iter).second;
+    }
+  }
+  return Dali::Widget();
+}
+
+void WidgetApplication::DeleteWidget( widget_base_instance_h widgetBaseInstance )
+{
+  for( WidgetInstanceContainer::const_iterator iter = mWidgetInstanceContainer.begin(); iter != mWidgetInstanceContainer.end(); ++iter )
+  {
+    if( (*iter).first == widgetBaseInstance  )
+    {
+      mWidgetInstanceContainer.erase(iter);
+      break;
+    }
+  }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/adaptors/tizen/widget-application-impl.h b/adaptors/tizen/widget-application-impl.h
new file mode 100644 (file)
index 0000000..1c33993
--- /dev/null
@@ -0,0 +1,144 @@
+#ifndef DALI_INTERNAL_WIDGET_APPLICATION_H
+#define DALI_INTERNAL_WIDGET_APPLICATION_H
+
+/*
+ * Copyright (c) 2017 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 <widget_base.h>
+
+// INTERNAL INCLUDES
+#include <application-impl.h>
+#include <widget-application.h>
+
+namespace Dali
+{
+class Widget;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class WidgetApplication;
+typedef IntrusivePtr<WidgetApplication> WidgetApplicationPtr;
+
+/**
+ * Implementation of the WidgetApplication class.
+ */
+class WidgetApplication : public Application
+{
+public:
+
+  typedef std::pair<const std::string, Dali::WidgetApplication::CreateWidgetFunction >  CreateWidgetFunctionPair;
+  typedef std::vector< CreateWidgetFunctionPair >   CreateWidgetFunctionContainer;
+
+  /**
+   * Create a new widget application
+   * @param[in]  argc         A pointer to the number of arguments
+   * @param[in]  argv         A pointer to the argument list
+   * @param[in]  stylesheet   The path to user defined theme file
+   */
+  static WidgetApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet );
+
+public:
+
+  /**
+   * @copydoc Dali::WidgetApplication::RegisterWidgetCreator()
+   */
+  void RegisterWidgetCreatingFunction( const std::string& widgetName, Dali::WidgetApplication::CreateWidgetFunction createFunction );
+
+  /**
+   * Add widget name - CreateWidgetFunction pair to container.
+   */
+  void AddWidgetCreatingFunctionPair( CreateWidgetFunctionPair pair );
+
+  /**
+   * Find and get CreateWidgetFunctionPair in container by widget name.
+   */
+  CreateWidgetFunctionPair GetWidgetCreatingFunctionPair( const std::string& widgetName );
+
+  /**
+   * Add widget_base_instance_h - Widget instance pair to container.
+   */
+  void AddWidget( widget_base_instance_h widgetBaseInstance, Dali::Widget widget );
+
+  /**
+   * Find and get Widget instance in container by widget_base_instance_h.
+   */
+  Dali::Widget GetWidget( widget_base_instance_h widgetBaseInstance );
+
+  /**
+   * Delete widget_base_instance_h - Widget instance pair in container.
+   */
+  void DeleteWidget( widget_base_instance_h widgetBaseInstance );
+
+protected:
+
+  /**
+   * Private Constructor
+   * @param[in]  argc         A pointer to the number of arguments
+   * @param[in]  argv         A pointer to the argument list
+   * @param[in]  stylesheet   The path to user defined theme file
+   */
+  WidgetApplication( int* argc, char **argv[], const std::string& stylesheet );
+
+  /**
+   * Destructor
+   */
+  virtual ~WidgetApplication();
+
+  // Undefined
+  WidgetApplication(const Application&);
+  WidgetApplication& operator=(Application&);
+
+private:
+
+  typedef std::pair< widget_base_instance_h, Dali::Widget > WidgetInstancePair;
+  typedef std::vector< WidgetInstancePair >                 WidgetInstanceContainer;
+
+  CreateWidgetFunctionContainer  mCreateWidgetFunctionContainer;
+  WidgetInstanceContainer        mWidgetInstanceContainer;
+
+};
+
+inline WidgetApplication& GetImplementation(Dali::WidgetApplication& widgetApplication)
+{
+  DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
+
+  BaseObject& handle = widgetApplication.GetBaseObject();
+
+  return static_cast<Internal::Adaptor::WidgetApplication&>(handle);
+}
+
+inline const WidgetApplication& GetImplementation(const Dali::WidgetApplication& widgetApplication)
+{
+  DALI_ASSERT_ALWAYS(widgetApplication && "widget application handle is empty");
+
+  const BaseObject& handle = widgetApplication.GetBaseObject();
+
+  return static_cast<const Internal::Adaptor::WidgetApplication&>(handle);
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WIDGET_APPLICATION_H
diff --git a/adaptors/tizen/widget-controller.cpp b/adaptors/tizen/widget-controller.cpp
new file mode 100644 (file)
index 0000000..dce7f64
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 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 "widget-controller.h"
+
+// EXTERNAL INCLUDES
+#include <bundle.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+Widget::Impl::Impl( widget_base_instance_h instanceHandle )
+: mInstanceHandle( instanceHandle )
+{
+}
+
+Widget::Impl::~Impl()
+{
+}
+
+void Widget::Impl::SetContentInfo( const std::string& contentInfo )
+{
+  bundle *contentBundle;
+  bundle_raw *contentBundleRaw = reinterpret_cast< bundle_raw* >( const_cast<char*>(contentInfo.c_str()) );
+  int len = contentInfo.length();
+  contentBundle = bundle_decode(contentBundleRaw, len);
+
+  widget_base_context_set_content_info( mInstanceHandle, contentBundle );
+
+  bundle_free( contentBundle );
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
diff --git a/adaptors/tizen/widget-controller.h b/adaptors/tizen/widget-controller.h
new file mode 100644 (file)
index 0000000..3a6a485
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_WIDGET_CONTROLLER_H
+#define DALI_WIDGET_CONTROLLER_H
+
+/*
+ * Copyright (c) 2017 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/signals/connection-tracker.h>
+
+// INTERNAL INCLUDES
+#include <widget_base.h>
+#include <widget-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * @brief Holds the Implementation for the internal WidgetImpl class
+ */
+class Widget::Impl : public ConnectionTracker
+{
+public:
+
+  /**
+   * Constructor
+   */
+  Impl( widget_base_instance_h instanceHandle );
+
+  /**
+   * Destructor
+   */
+  ~Impl();
+
+public:
+
+  /**
+   * Set content information to widget framework
+   */
+  void SetContentInfo( const std::string& contentInfo );
+
+private:
+
+  widget_base_instance_h mInstanceHandle;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_WIDGET_CONTROLLER_H
index 14ea0e9..d310fd8 100644 (file)
@@ -90,6 +90,7 @@ include ../../../adaptors/public-api/file.list
 adaptor_devel_api_dir = ../../../adaptors/devel-api
 include ../../../adaptors/devel-api/file.list
 
+
 # Static libraries
 static_libraries_libunibreak_src_dir = ../../../text/dali/internal/libunibreak
 include ../../../text/dali/internal/libunibreak/file.list
@@ -258,7 +259,7 @@ endif # IVI_PROFILE
 if USE_APPFW
 if USE_APPFW_EFL_BASE
 else
-adaptor_internal_src_files += $(adaptor_internal_widget_src_files)
+adaptor_internal_src_files += $(adaptor_tizen_internal_widget_src_files)
 endif
 endif
 
index c1bee87..1d215a3 100755 (executable)
@@ -19,7 +19,7 @@
 
 Name:       dali-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    1.2.73
+Version:    1.2.74
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT
@@ -120,9 +120,9 @@ BuildRequires:  pkgconfig(utilX)
 BuildRequires:  pkgconfig(capi-appfw-application)
 BuildRequires:  pkgconfig(elementary)
 %else
-BuildRequires:  pkgconfig(bundle)
 BuildRequires:  pkgconfig(appcore-ui)
 BuildRequires:  pkgconfig(appcore-widget-base)
+BuildRequires:  pkgconfig(bundle)
 BuildRequires:  pkgconfig(capi-appfw-app-common)
 BuildRequires:  pkgconfig(capi-appfw-app-control)
 BuildRequires:  pkgconfig(ecore-imf)