Add widget_viewer_dali
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 1 Apr 2016 06:03:31 +0000 (15:03 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 1 Apr 2016 06:11:11 +0000 (15:11 +0900)
Change-Id: Ie9de7f720ed65fdc56d475a792928c71c5d6115a

12 files changed:
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
internal/widget_view/widget_view_impl.cpp [new file with mode: 0644]
internal/widget_view/widget_view_impl.h [new file with mode: 0644]
internal/widget_view_manager/widget_view_manager_impl.cpp [new file with mode: 0644]
internal/widget_view_manager/widget_view_manager_impl.h [new file with mode: 0644]
public_api/widget_view/widget_view.cpp [new file with mode: 0644]
public_api/widget_view/widget_view.h [new file with mode: 0644]
public_api/widget_view_manager/widget_view_manager.cpp [new file with mode: 0644]
public_api/widget_view_manager/widget_view_manager.h [new file with mode: 0644]
public_api/widget_viewer_dali.h [new file with mode: 0644]
widget_viewer_dali.pc.in [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a014ff1
--- /dev/null
@@ -0,0 +1,70 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(widget_viewer_dali CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(EXEC_PREFIX "\${prefix}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR 1)
+SET(VERSION "${VERSION_MAJOR}.0.0")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(viewer_dali REQUIRED
+       dlog
+       widget_service
+       pkgmgr-info
+       capi-system-info
+       dali-adaptor
+       dali-toolkit
+       pepper-dali
+)
+
+SET(BUILD_SOURCE
+       public_api/widget_view/widget_view.cpp
+       public_api/widget_view_manager/widget_view_manager.cpp
+       internal/widget_view/widget_view_impl.cpp
+       internal/widget_view_manager/widget_view_manager_impl.cpp
+)
+
+FOREACH(flag ${viewer_dali_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror -Winline -g")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_C_FLAGS_RELEASE "-O2")
+
+SET(LOCAL_PUBLIC_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/public_api)
+
+ADD_DEFINITIONS("-DPKGNAME=\"${PROJECT_NAME}\"")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${viewer_dali_LDFLAGS} "-lpthread")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/public_api/${PROJECT_NAME}.h DESTINATION include/${PROJECT_NAME})
+
+FILE(GLOB LOCAL_WIDGE_VIEW_HEADER_LIST RELATIVE "${LOCAL_PUBLIC_HEADER_DIR}" "${LOCAL_PUBLIC_HEADER_DIR}/widget_view/*.h")
+FOREACH(flag ${LOCAL_WIDGE_VIEW_HEADER_LIST})
+        INSTALL(FILES ${LOCAL_PUBLIC_HEADER_DIR}/${flag} DESTINATION include/${PROJECT_NAME}/public_api/widget_view)
+ENDFOREACH(flag)
+
+FILE(GLOB LOCAL_WIDGE_VIEW_MANAGER_HEADER_LIST RELATIVE "${LOCAL_PUBLIC_HEADER_DIR}" "${LOCAL_PUBLIC_HEADER_DIR}/widget_view_manager/*.h")
+FOREACH(flag ${LOCAL_WIDGE_VIEW_MANAGER_HEADER_LIST})
+        INSTALL(FILES ${LOCAL_PUBLIC_HEADER_DIR}/${flag} DESTINATION include/${PROJECT_NAME}/public_api/widget_view_manager)
+ENDFOREACH(flag)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..571fe79
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Flora License
+
+Version 1.1, April, 2013
+
+http://floralicense.org/license/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and
+all other entities that control, are controlled by, or are
+under common control with that entity. For the purposes of
+this definition, "control" means (i) the power, direct or indirect,
+to cause the direction or management of such entity,
+whether by contract or otherwise, or (ii) ownership of fifty percent (50%)
+or more of the outstanding shares, or (iii) beneficial ownership of
+such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation source,
+and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form,
+made available under the License, as indicated by a copyright notice
+that is included in or attached to the work (an example is provided
+in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form,
+that is based on (or derived from) the Work and for which the editorial
+revisions, annotations, elaborations, or other modifications represent,
+as a whole, an original work of authorship. For the purposes of this License,
+Derivative Works shall not include works that remain separable from,
+or merely link (or bind by name) to the interfaces of, the Work and
+Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original
+version of the Work and any modifications or additions to that Work or
+Derivative Works thereof, that is intentionally submitted to Licensor
+for inclusion in the Work by the copyright owner or by an individual or
+Legal Entity authorized to submit on behalf of the copyright owner.
+For the purposes of this definition, "submitted" means any form of
+electronic, verbal, or written communication sent to the Licensor or
+its representatives, including but not limited to communication on
+electronic mailing lists, source code control systems, and issue
+tracking systems that are managed by, or on behalf of, the Licensor
+for the purpose of discussing and improving the Work, but excluding
+communication that is conspicuously marked or otherwise designated
+in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+"Tizen Certified Platform" shall mean a software platform that complies
+with the standards set forth in the Tizen Compliance Specification
+and passes the Tizen Compliance Tests as defined from time to time
+by the Tizen Technical Steering Group and certified by the Tizen
+Association or its designated agent.
+
+2. Grant of Copyright License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License.  Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work
+solely as incorporated into a Tizen Certified Platform, where such
+license applies only to those patent claims licensable by such
+Contributor that are necessarily infringed by their Contribution(s)
+alone or by combination of their Contribution(s) with the Work solely
+as incorporated into a Tizen Certified Platform to which such
+Contribution(s) was submitted. If You institute patent litigation
+against any entity (including a cross-claim or counterclaim
+in a lawsuit) alleging that the Work or a Contribution incorporated
+within the Work constitutes direct or contributory patent infringement,
+then any patent licenses granted to You under this License for that
+Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.  You may reproduce and distribute copies of the
+Work or Derivative Works thereof pursuant to the copyright license
+above, in any medium, with or without modifications, and in Source or
+Object form, provided that You meet the following conditions:
+
+  1. You must give any other recipients of the Work or Derivative Works
+     a copy of this License; and
+  2. You must cause any modified files to carry prominent notices stating
+     that You changed the files; and
+  3. You must retain, in the Source form of any Derivative Works that
+     You distribute, all copyright, patent, trademark, and attribution
+     notices from the Source form of the Work, excluding those notices
+     that do not pertain to any part of the Derivative Works; and
+  4. If the Work includes a "NOTICE" text file as part of its distribution,
+     then any Derivative Works that You distribute must include a readable
+     copy of the attribution notices contained within such NOTICE file,
+     excluding those notices that do not pertain to any part of
+     the Derivative Works, in at least one of the following places:
+     within a NOTICE text file distributed as part of the Derivative Works;
+     within the Source form or documentation, if provided along with the
+     Derivative Works; or, within a display generated by the Derivative Works,
+     if and wherever such third-party notices normally appear.
+     The contents of the NOTICE file are for informational purposes only
+     and do not modify the License. You may add Your own attribution notices 
+     within Derivative Works that You distribute, alongside or as an addendum 
+     to the NOTICE text from the Work, provided that such additional attribution 
+     notices cannot be construed as modifying the License. You may add Your own
+     copyright statement to Your modifications and may provide additional or
+     different license terms and conditions for use, reproduction, or
+     distribution of Your modifications, or for any such Derivative Works
+     as a whole, provided Your use, reproduction, and distribution of
+     the Work otherwise complies with the conditions stated in this License
+     and your own copyright statement or terms and conditions do not conflict
+     the conditions stated in the License including section 3.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks.  This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Flora License to your work
+
+To apply the Flora License to your work, attach the following
+boilerplate notice, with the fields enclosed by brackets "[]"
+replaced with your own identifying information. (Don't include
+the brackets!) The text should be enclosed in the appropriate
+comment syntax for the file format. We also recommend that a
+file or class name and description of purpose be included on the
+same "printed page" as the copyright notice for easier
+identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Flora License, Version 1.1 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://floralicense.org/license/
+
+   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.
+
diff --git a/internal/widget_view/widget_view_impl.cpp b/internal/widget_view/widget_view_impl.cpp
new file mode 100644 (file)
index 0000000..e00e6b9
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2016 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 <internal/widget_view/widget_view_impl.h>
+
+// INTERNAL INCLUDES
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <string.h>
+#include <widget_service.h>
+#include <widget_instance.h>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gWidgetViewLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_WIDGET_VIEW" );
+#endif
+
+} // unnamed namespace
+
+Dali::WidgetView::WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+{
+  // Create the implementation, temporarily owned on stack
+  IntrusivePtr< WidgetView > internalWidgetView = new WidgetView( widgetId, contentInfo, width, height, period );
+
+  // Pass ownership to CustomActor
+  Dali::WidgetView::WidgetView widgetView( *internalWidgetView );
+
+  // Second-phase init of the implementation
+  // This can only be done after the CustomActor connection has been made...
+  internalWidgetView->Initialize();
+
+  return widgetView;
+}
+
+WidgetView::WidgetView()
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+  mWidgetId(),
+  mInstanceId(),
+  mContentInfo(),
+  mTitle(),
+  mBundle( NULL ),
+  mWidth( 0 ),
+  mHeight( 0 ),
+  mPid( 0 ),
+  mPeriod( 0.0 ),
+  mPermanentDelete( true )
+{
+}
+
+WidgetView::WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS ) ),
+  mWidgetId( widgetId ),
+  mInstanceId(),
+  mContentInfo( contentInfo ),
+  mTitle(),
+  mBundle( NULL ),
+  mWidth( width ),
+  mHeight( height ),
+  mPid( 0 ),
+  mPeriod( period ),
+  mPermanentDelete( true )
+{
+}
+
+WidgetView::~WidgetView()
+{
+  if( !mWidgetId.empty() && !mInstanceId.empty() )
+  {
+    widget_instance_terminate( mWidgetId.c_str(), mInstanceId.c_str() );
+
+    if( mPermanentDelete )
+    {
+      widget_instance_destroy( mWidgetId.c_str(), mInstanceId.c_str() );
+    }
+  }
+
+  if( mBundle )
+  {
+    bundle_free( mBundle );
+  }
+}
+
+const std::string& WidgetView::GetWidgetId() const
+{
+  return mWidgetId;
+}
+
+const std::string& WidgetView::GetInstanceId() const
+{
+  return mInstanceId;
+}
+
+const std::string& WidgetView::GetContentInfo() const
+{
+  return mContentInfo;
+}
+
+const std::string& WidgetView::GetTitle() const
+{
+  return mTitle;
+}
+
+double WidgetView::GetPeriod() const
+{
+  return mPeriod;
+}
+
+void WidgetView::ActivateFaultedWidget()
+{
+  if( mPid < 0 )
+  {
+    // launch widget again
+    mPid = widget_instance_launch( mWidgetId.c_str(), mInstanceId.c_str(), mBundle, mWidth, mHeight );
+    if( mPid < 0)
+    {
+      DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ActivateFaultedWidget: widget_instance_launch is failed. [%s]\n", mWidgetId.c_str() );
+      return;
+    }
+
+    DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::ActivateFaultedWidget: widget_instance_launch is called. [%s, mPid = %d]\n", mWidgetId.c_str(), mPid );
+  }
+}
+
+bool WidgetView::IsWidgetFaulted()
+{
+  return mPid < 0 ? true : false;
+}
+
+void WidgetView::SetPermanentDelete( bool permanentDelete )
+{
+  mPermanentDelete = permanentDelete;
+}
+
+void WidgetView::AddObjectView( Pepper::ObjectView objectView )
+{
+  mObjectView = objectView;
+
+  mObjectView.SetParentOrigin( ParentOrigin::CENTER );
+  mObjectView.SetAnchorPoint( AnchorPoint::CENTER );
+
+  Self().Add( mObjectView );
+  Self().SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS );
+
+  mTitle = mObjectView.GetTitle();
+
+  // Emit signal
+  Dali::WidgetView::WidgetView handle( GetOwner() );
+  mWidgetAddedSignal.Emit( handle );
+}
+
+void WidgetView::RemoveObjectView()
+{
+  // Emit signal
+  Dali::WidgetView::WidgetView handle( GetOwner() );
+  mWidgetDeletedSignal.Emit( handle );
+
+  mObjectView.Reset();
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetAddedSignal()
+{
+  return mWidgetAddedSignal;
+}
+
+Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetView::WidgetDeletedSignal()
+{
+  return mWidgetDeletedSignal;
+}
+
+void WidgetView::OnInitialize()
+{
+  char* instanceId = NULL;
+
+  if( !mContentInfo.empty() )
+  {
+    DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: decode bundle\n" );
+
+    mBundle = bundle_decode( reinterpret_cast< const bundle_raw* >( mContentInfo.c_str() ), mContentInfo.length() );
+    if( !mBundle )
+    {
+      DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: Invalid bundle data.\n" );
+      return;
+    }
+
+    bundle_get_str( mBundle, WIDGET_K_INSTANCE, &instanceId );
+  }
+
+  if( !instanceId )
+  {
+    int ret = widget_instance_create( mWidgetId.c_str(), &instanceId );
+    if( ret < 0 || !instanceId )
+    {
+      DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_create is failed [%s].\n", mWidgetId.c_str() );
+      return;
+    }
+
+    DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_create is called. [widget id = %s, instance id = %s]\n",
+                   mWidgetId.c_str(), instanceId );
+  }
+
+  mInstanceId = instanceId;
+
+  // launch widget
+  mPid = widget_instance_launch( mWidgetId.c_str(), instanceId, mBundle, mWidth, mHeight );
+  if( mPid < 0)
+  {
+    DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is failed. [%s]\n", mWidgetId.c_str() );
+    return;
+  }
+
+  DALI_LOG_INFO( gWidgetViewLogging, Debug::Verbose, "WidgetView::OnInitialize: widget_instance_launch is called. [%s, mPid = %d]\n", mWidgetId.c_str(), mPid );
+}
+
+} // namespace Internal
+
+} // namespace WidgetView
+
+} // namespace Dali
diff --git a/internal/widget_view/widget_view_impl.h b/internal/widget_view/widget_view_impl.h
new file mode 100644 (file)
index 0000000..3e33b9b
--- /dev/null
@@ -0,0 +1,176 @@
+#ifndef __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_H__
+#define __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_H__
+
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <public_api/widget_view/widget_view.h>
+
+// EXTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <pepper-dali/public-api/object-view/object-view.h>
+#include <bundle.h>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+namespace Internal
+{
+
+class WidgetView : public Toolkit::Internal::Control
+{
+public:
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::New
+   */
+  static Dali::WidgetView::WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::GetWidgetId
+   */
+  const std::string& GetWidgetId() const;
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::GetInstanceId
+   */
+  const std::string& GetInstanceId() const;
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::GetContentInfo
+   */
+  const std::string& GetContentInfo() const;
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::GetTitle
+   */
+  const std::string& GetTitle() const;
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::GetPeriod
+   */
+  double GetPeriod() const;
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::ActivateFaultedWidget
+   */
+  void ActivateFaultedWidget();
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::IsWidgetFaulted
+   */
+  bool IsWidgetFaulted();
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetView::SetPermanentDelete
+   */
+  void SetPermanentDelete( bool permanentDelete );
+
+  void AddObjectView( Pepper::ObjectView objectView );
+  void RemoveObjectView();
+
+public: //Signals
+
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetAddedSignal();
+  Dali::WidgetView::WidgetView::WidgetViewSignalType& WidgetDeletedSignal();
+
+protected:
+
+  /**
+   * Construct a new WidgetView.
+   */
+  WidgetView();
+
+  /**
+   * Construct a new WidgetView.
+   */
+  WidgetView( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~WidgetView();
+
+private: // From Control
+
+  /**
+   * @copydoc Toolkit::Control::OnInitialize()
+   */
+  virtual void OnInitialize();
+
+private:
+
+  // Undefined
+  WidgetView( const WidgetView& );
+
+  // Undefined
+  WidgetView& operator= ( const WidgetView& );
+
+private:
+
+  Pepper::ObjectView mObjectView;
+
+  std::string mWidgetId;
+  std::string mInstanceId;
+  std::string mContentInfo;
+  std::string mTitle;
+
+  bundle* mBundle;
+
+  int mWidth;
+  int mHeight;
+  int mPid;
+  double mPeriod;
+
+  bool mPermanentDelete;
+
+  // Signals
+  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetAddedSignal;
+  Dali::WidgetView::WidgetView::WidgetViewSignalType mWidgetDeletedSignal;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::WidgetView& GetImplementation( WidgetView& widgetView )
+{
+  DALI_ASSERT_ALWAYS( widgetView );
+
+  Dali::RefObject& handle = widgetView.GetImplementation();
+
+  return static_cast<Internal::WidgetView&>( handle );
+}
+
+inline const Internal::WidgetView& GetImplementation( const WidgetView& widgetView )
+{
+  DALI_ASSERT_ALWAYS( widgetView );
+
+  const Dali::RefObject& handle = widgetView.GetImplementation();
+
+  return static_cast<const Internal::WidgetView&>( handle );
+}
+
+} // namespace WidgetView
+
+} // namespace Dali
+
+#endif // __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_H__
diff --git a/internal/widget_view_manager/widget_view_manager_impl.cpp b/internal/widget_view_manager/widget_view_manager_impl.cpp
new file mode 100644 (file)
index 0000000..2071f84
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2016 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 <internal/widget_view_manager/widget_view_manager_impl.h>
+
+// INTERNAL INCLUDES
+#include <internal/widget_view/widget_view_impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <system_info.h>
+#include <widget_errno.h>
+#include <widget_instance.h>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Integration::Log::Filter* gWidgetViewManagerLogging  = Integration::Log::Filter::New( Debug::Verbose, false, "LOG_WIDGET_VIEW_MANAGER" );
+#endif
+
+static inline 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 )
+  {
+    return false;
+  }
+
+  retrieved = true;
+
+  return feature;
+}
+
+} // unnamed namespace
+
+WidgetViewManagerPtr WidgetViewManager::New( Application application, const std::string& name )
+{
+  WidgetViewManagerPtr impl = new WidgetViewManager();
+
+  // Second-phase init of the implementation
+  if( impl->Initialize( application, name ) != WIDGET_ERROR_NONE )
+  {
+    DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::New: Fail to create WidgetViewManager.\n" );
+    return NULL;
+  }
+
+  return impl;
+}
+
+WidgetViewManager::WidgetViewManager()
+{
+}
+
+WidgetViewManager::~WidgetViewManager()
+{
+  widget_instance_fini();
+}
+
+int WidgetViewManager::Initialize( Application application, const std::string& name )
+{
+  if( !IsWidgetFeatureEnabled() )
+  {
+    DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::Initialize: Widget feature is not enabled.\n" );
+    return WIDGET_ERROR_NOT_SUPPORTED;
+  }
+
+  // create compositor
+  mCompositor = Pepper::Compositor::New( application, name );
+
+  mCompositor.ObjectViewAddedSignal().Connect( this, &WidgetViewManager::OnObjectViewAdded );
+  mCompositor.ObjectViewDeletedSignal().Connect( this, &WidgetViewManager::OnObjectViewDeleted );
+
+  // init widget service
+  widget_instance_init( name.c_str() );
+
+  DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::Initialize: success.\n" );
+
+  return WIDGET_ERROR_NONE;
+}
+
+Dali::WidgetView::WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+{
+  // Add a new widget view
+  Dali::WidgetView::WidgetView widgetView = Dali::WidgetView::WidgetView::New( widgetId, contentInfo, width, height, period );
+
+  std::string instanceId = widgetView.GetInstanceId();
+
+  if( !instanceId.empty() )
+  {
+    // Add to map
+    mWidgetViewContainer.insert( std::pair<std::string, Dali::WidgetView::WidgetView>( instanceId, widgetView ) );
+  }
+
+  DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::AddWidget: success [%s]\n", widgetId.c_str() );
+
+  return widgetView;
+}
+
+void WidgetViewManager::OnObjectViewAdded( Pepper::Compositor compositor, Pepper::ObjectView objectView )
+{
+  std::string appId = objectView.GetAppId();  // widget instance id
+
+  if( mWidgetViewContainer.size() > 0)
+  {
+    WidgetViewIter iter = mWidgetViewContainer.find( appId );
+    if( iter != mWidgetViewContainer.end() )
+    {
+      Dali::WidgetView::WidgetView widgetView = iter->second;
+
+      Dali::WidgetView::GetImplementation( widgetView ).AddObjectView( objectView );
+    }
+  }
+
+  DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::OnObjectViewAdded: ObjectView is added!\n" );
+}
+
+void WidgetViewManager::OnObjectViewDeleted( Pepper::Compositor compositor, Pepper::ObjectView objectView )
+{
+  std::string appId = objectView.GetAppId();  // widget instance id
+
+  // Remove from map
+  if( mWidgetViewContainer.size() > 0)
+  {
+    WidgetViewIter iter = mWidgetViewContainer.find( appId );
+    if( iter != mWidgetViewContainer.end() )
+    {
+      Dali::WidgetView::WidgetView widgetView = iter->second;
+
+      Dali::WidgetView::GetImplementation( widgetView ).RemoveObjectView();
+
+      mWidgetViewContainer.erase( iter );
+    }
+  }
+
+  DALI_LOG_INFO( gWidgetViewManagerLogging, Debug::Verbose, "WidgetViewManager::OnObjectViewDeleted: ObjectView is deleted!\n" );
+}
+
+} // namespace Internal
+
+} // namespace WidgetView
+
+} // namespace Dali
diff --git a/internal/widget_view_manager/widget_view_manager_impl.h b/internal/widget_view_manager/widget_view_manager_impl.h
new file mode 100644 (file)
index 0000000..9dfad85
--- /dev/null
@@ -0,0 +1,119 @@
+#ifndef __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_MANAGER_H__
+#define __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_MANAGER_H__
+
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <public_api/widget_view_manager/widget_view_manager.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+#include <pepper-dali/public-api/compositor/compositor.h>
+#include <map>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+namespace Internal
+{
+
+class WidgetViewManager;
+typedef IntrusivePtr<WidgetViewManager> WidgetViewManagerPtr;
+
+class WidgetViewManager : public BaseObject, public ConnectionTracker
+{
+public:
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetViewManager::New()
+   */
+  static WidgetViewManagerPtr New( Application application, const std::string& name );
+
+  /**
+   * @copydoc Dali::WidgetView::WidgetViewManager::AddWidget()
+   */
+  Dali::WidgetView::WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+
+private:
+
+  /**
+   * Construct a new WidgetViewManager.
+   */
+  WidgetViewManager();
+
+  /**
+   * A reference counted object may only be deleted by calling Unreference()
+   */
+  virtual ~WidgetViewManager();
+
+  /**
+   * Initialize the WidgetViewManager
+   */
+  int Initialize( Application application, const std::string& name );
+
+  void OnObjectViewAdded( Pepper::Compositor compositor, Pepper::ObjectView objectView );
+  void OnObjectViewDeleted( Pepper::Compositor compositor, Pepper::ObjectView objectView );
+
+private:
+
+  // Undefined
+  WidgetViewManager( const WidgetViewManager& );
+
+  // Undefined
+  WidgetViewManager& operator= ( const WidgetViewManager& );
+
+private:
+
+  Pepper::Compositor mCompositor;
+
+  typedef std::map<std::string, Dali::WidgetView::WidgetView> WidgetViewContainer;
+  typedef WidgetViewContainer::iterator WidgetViewIter;
+
+  WidgetViewContainer mWidgetViewContainer;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::WidgetViewManager& GetImplementation( WidgetViewManager& obj )
+{
+  DALI_ASSERT_ALWAYS( obj );
+
+  Dali::BaseObject& handle = obj.GetBaseObject();
+
+  return static_cast<Internal::WidgetViewManager&>( handle );
+}
+
+inline const Internal::WidgetViewManager& GetImplementation( const WidgetViewManager& obj )
+{
+  DALI_ASSERT_ALWAYS( obj );
+
+  const Dali::BaseObject& handle = obj.GetBaseObject();
+
+  return static_cast<const Internal::WidgetViewManager&>( handle );
+}
+
+} // namespace WidgetView
+
+} // namespace Dali
+
+#endif // __DALI_WIDGET_VIEW_INTERNAL_WIDGET_VIEW_MANAGER_H__
diff --git a/public_api/widget_view/widget_view.cpp b/public_api/widget_view/widget_view.cpp
new file mode 100644 (file)
index 0000000..b52ee3f
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2016 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 <public_api/widget_view/widget_view.h>
+
+// INTERNAL INCLUDES
+#include <internal/widget_view/widget_view_impl.h>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+WidgetView WidgetView::New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+{
+  return Internal::WidgetView::New( widgetId, contentInfo, width, height, period );
+}
+
+WidgetView WidgetView::DownCast( BaseHandle handle )
+{
+  return Toolkit::Control::DownCast<WidgetView, Internal::WidgetView>( handle );
+}
+
+WidgetView::WidgetView()
+{
+}
+
+WidgetView::WidgetView( const WidgetView& handle )
+: Toolkit::Control( handle )
+{
+}
+
+WidgetView& WidgetView::operator=( const WidgetView& handle )
+{
+  if( &handle != this )
+  {
+    Control::operator=( handle );
+  }
+  return *this;
+}
+
+WidgetView::~WidgetView()
+{
+}
+
+const std::string& WidgetView::GetWidgetId() const
+{
+  return Dali::WidgetView::GetImplementation( *this ).GetWidgetId();
+}
+
+const std::string& WidgetView::GetInstanceId() const
+{
+  return Dali::WidgetView::GetImplementation( *this ).GetInstanceId();
+}
+
+const std::string& WidgetView::GetContentInfo() const
+{
+  return Dali::WidgetView::GetImplementation( *this ).GetContentInfo();
+}
+
+const std::string& WidgetView::GetTitle() const
+{
+  return Dali::WidgetView::GetImplementation( *this ).GetTitle();
+}
+
+double WidgetView::GetPeriod() const
+{
+  return Dali::WidgetView::GetImplementation( *this ).GetPeriod();
+}
+
+void WidgetView::ActivateFaultedWidget()
+{
+  return Dali::WidgetView::GetImplementation( *this ).ActivateFaultedWidget();
+}
+
+bool WidgetView::IsWidgetFaulted()
+{
+  return Dali::WidgetView::GetImplementation( *this ).IsWidgetFaulted();
+}
+
+void WidgetView::SetPermanentDelete( bool permanentDelete )
+{
+  return Dali::WidgetView::GetImplementation( *this ).SetPermanentDelete( permanentDelete );
+}
+
+WidgetView::WidgetViewSignalType& WidgetView::WidgetAddedSignal()
+{
+  return Dali::WidgetView::GetImplementation(*this).WidgetAddedSignal();
+}
+
+WidgetView::WidgetViewSignalType& WidgetView::WidgetDeletedSignal()
+{
+  return Dali::WidgetView::GetImplementation(*this).WidgetDeletedSignal();
+}
+
+WidgetView::WidgetView( Internal::WidgetView& implementation )
+: Control( implementation )
+{
+}
+
+WidgetView::WidgetView( Dali::Internal::CustomActor* internal )
+: Control( internal )
+{
+  VerifyCustomActorPointer<Internal::WidgetView>( internal );
+}
+
+} // namespace WidgetView
+
+} // namespace Dali
diff --git a/public_api/widget_view/widget_view.h b/public_api/widget_view/widget_view.h
new file mode 100644 (file)
index 0000000..4583173
--- /dev/null
@@ -0,0 +1,220 @@
+#ifndef __DALI_WIDGET_VIEW_WIDGET_VIEW_H__
+#define __DALI_WIDGET_VIEW_WIDGET_VIEW_H__
+
+/*
+ * Copyright (c) 2016 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-toolkit/public-api/controls/control.h>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+namespace Internal DALI_INTERNAL
+{
+class WidgetView;
+}
+
+/**
+ * @addtogroup dali_widget_view
+ * @{
+ */
+
+/**
+ * @brief WidgetView is a class for displaying the widget image and controlling the widget.
+ * Input events that WidgetView gets are delivered to the widget.
+ *
+ * @since_tizen 3.0
+ */
+class DALI_IMPORT_API WidgetView : public Toolkit::Control
+{
+public:
+
+  /**
+   * @brief Create widget view.
+   *
+   * @since_tizen 3.0
+   * @param[in] widgetId The widget id.
+   * @param[in] contentInfo Contents that will be given to the widget instance.
+   * @param[in] width The widget width.
+   * @param[in] height The widget height.
+   * @param[in] period The period of updating contents of the widget.
+   * @return A handle to WidgetView.
+   */
+  static WidgetView New( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+
+  /**
+   * @brief Downcast a handle to WidgetView handle.
+   *
+   * If the BaseHandle points is a WidgetView the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a WidgetView or an empty handle
+   */
+  static WidgetView DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an empty handle.
+   * @since_tizen 3.0
+   */
+  WidgetView();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  WidgetView( const WidgetView& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  WidgetView& operator=( const WidgetView& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~WidgetView();
+
+  /**
+   * @brief Get the id of the widget.
+   *
+   * @since_tizen 3.0
+   * @return The widget id on success, otherwise an empty string.
+   */
+  const std::string& GetWidgetId() const;
+
+  /**
+   * @brief Get the instance id of the widget.
+   *
+   * @since_tizen 3.0
+   * @return The instance id on success, otherwise an empty string.
+   */
+  const std::string& GetInstanceId() const;
+
+  /**
+   * @brief Get the content string of the widget.
+   * This string can be used for creating contents of widget again after reboot a device or recovered from crash(abnormal status).
+   *
+   * @since_tizen 3.0
+   * @return The content string to be recognize content of the widget or an empty string if there is no specific content string.
+   */
+  const std::string& GetContentInfo() const;
+
+  /**
+   * @brief Get the summarized string of the widget content for accessibility.
+   * If the accessibility feature is turned on, a viewer can use this text to describe the widget.
+   *
+   * @since_tizen 3.0
+   * @return The title string to be used for summarizing the widget or an empty string if there is no summarized text for content of given widget.
+   */
+  const std::string& GetTitle() const;
+
+  /**
+   * @brief Get the update period of the widget.
+   *
+   * @since_tizen 3.0
+   * @return The update period of the widget.
+   */
+  double GetPeriod() const;
+
+  /**
+   * @brief Activate a widget in faulted state.
+   * A widget in faulted state MUST be activated before adding the widget.
+   *
+   * @since_tizen 3.0
+   * @privlevel public
+   * @privilege %http://tizen.org/privilege/widget.viewer
+   */
+  void ActivateFaultedWidget();
+
+  /**
+   * @brief Check whether the widget is faulted.
+   *
+   * @since_tizen 3.0
+   * @return true for faulted state, otherwise false.
+   */
+  bool IsWidgetFaulted();
+
+  /**
+   * @brief Set the deletion mode.
+   *
+   * @since_tizen 3.0
+   * @param[in] permanentDelete Pass true if you want to delete this widget instance permanently, or pass false if you want to keep it and it will be re-created soon.
+   */
+  void SetPermanentDelete( bool permanentDelete );
+
+public: //Signals
+
+  typedef Signal< void ( WidgetView ) > WidgetViewSignalType;   ///< WidgetView signal type @since_tizen 3.0
+
+  /**
+   * @brief This signal is emitted when the widget is added.
+   *
+   * @since_tizen 3.0
+   * @return The signal to connect to.
+   */
+  WidgetViewSignalType& WidgetAddedSignal();
+
+  /**
+   * @brief This signal is emitted when the widget is deleted.
+   *
+   * @since_tizen 3.0
+   * @return The signal to connect to.
+   */
+  WidgetViewSignalType& WidgetDeletedSignal();
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the WidgetView::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The WidgetView implementation.
+   */
+  DALI_INTERNAL WidgetView( Internal::WidgetView& implementation );
+
+  /**
+   * @brief Allows the creation of this control from an Internal::CustomActor pointer.
+   *
+   * @since_tizen 3.0
+   * @param[in] internal A pointer to the internal CustomActor.
+   */
+  DALI_INTERNAL WidgetView( Dali::Internal::CustomActor* internal );
+};
+
+/**
+ * @}
+ */
+} // namespace WidgetView
+
+} // namespace Dali
+
+#endif // __DALI_WIDGET_VIEW_WIDGET_VIEW_H__
diff --git a/public_api/widget_view_manager/widget_view_manager.cpp b/public_api/widget_view_manager/widget_view_manager.cpp
new file mode 100644 (file)
index 0000000..f06b4c8
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016 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 <public_api/widget_view_manager/widget_view_manager.h>
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <internal/widget_view_manager/widget_view_manager_impl.h>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+WidgetViewManager WidgetViewManager::New( Application application, const std::string& name )
+{
+  Internal::WidgetViewManagerPtr internal = Internal::WidgetViewManager::New( application, name );
+
+  return WidgetViewManager( internal.Get() );
+}
+
+WidgetViewManager WidgetViewManager::DownCast( BaseHandle handle )
+{
+  return WidgetViewManager( dynamic_cast< Internal::WidgetViewManager* >( handle.GetObjectPtr() ) );
+}
+
+WidgetViewManager::WidgetViewManager()
+{
+}
+
+WidgetViewManager::WidgetViewManager( const WidgetViewManager& handle )
+: BaseHandle(handle)
+{
+}
+
+WidgetViewManager& WidgetViewManager::operator=( const WidgetViewManager& handle )
+{
+  BaseHandle::operator=(handle);
+  return *this;
+}
+
+WidgetViewManager::~WidgetViewManager()
+{
+}
+
+WidgetViewManager::WidgetViewManager( Internal::WidgetViewManager* implementation )
+: BaseHandle( implementation )
+{
+}
+
+WidgetView WidgetViewManager::AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period )
+{
+  return GetImplementation(*this).AddWidget( widgetId, contentInfo, width, height, period );
+}
+
+} // namespace WidgetView
+
+} // namespace Dali
diff --git a/public_api/widget_view_manager/widget_view_manager.h b/public_api/widget_view_manager/widget_view_manager.h
new file mode 100644 (file)
index 0000000..9157863
--- /dev/null
@@ -0,0 +1,142 @@
+#ifndef __DALI_WIDGET_VIEW_WIDGET_VIEW_MANAGER_H__
+#define __DALI_WIDGET_VIEW_WIDGET_VIEW_MANAGER_H__
+
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <public_api/widget_view/widget_view.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/adaptor-framework/application.h>
+
+namespace Dali
+{
+
+namespace WidgetView
+{
+
+namespace Internal DALI_INTERNAL
+{
+class WidgetViewManager;
+}
+
+/**
+ * @addtogroup dali_widget_view
+ * @{
+ */
+
+/**
+ * @brief WidgetViewManager manages addition of WidgetView controls.
+ *
+ * This class provides the functionality of adding the widget views and controlling the widgets.
+ *
+ * @since_tizen 3.0
+ */
+class DALI_IMPORT_API WidgetViewManager : public BaseHandle
+{
+public:
+
+  /**
+   * @brief Create widget view manager.
+   *
+   * @since_tizen 3.0
+   * @param[in] application Application class for the widget view manager.
+   * @param[in] name Widget view manager name. It is used for socket name internally.
+   * @return A handle to WidgetViewManager.
+   */
+  static WidgetViewManager New( Application application, const std::string& name );
+
+  /**
+   * @brief Downcast a handle to WidgetViewManager handle.
+   *
+   * If the BaseHandle points is a WidgetViewManager the downcast returns a valid handle.
+   * If not the returned handle is left empty.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle Handle to an object
+   * @return handle to a WidgetViewManager or an empty handle
+   */
+  static WidgetViewManager DownCast( BaseHandle handle );
+
+  /**
+   * @brief Creates an WidgetViewManager handle.
+   *
+   * Calling member functions with an uninitialised handle is not allowed.
+   * @since_tizen 3.0
+   */
+  WidgetViewManager();
+
+  /**
+   * @brief Copy constructor.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   */
+  WidgetViewManager( const WidgetViewManager& handle );
+
+  /**
+   * @brief Assignment operator.
+   *
+   * @since_tizen 3.0
+   * @param[in] handle The handle to copy from.
+   * @return A reference to this.
+   */
+  WidgetViewManager& operator=( const WidgetViewManager& handle );
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @since_tizen 3.0
+   */
+  ~WidgetViewManager();
+
+  /**
+   * @brief Creates a new widget view object
+   *
+   * @since_tizen 3.0
+   * @param[in] widgetId The widget id.
+   * @param[in] contentInfo Contents that will be given to the widget instance.
+   * @param[in] width The widget width.
+   * @param[in] height The widget height.
+   * @param[in] period The period of updating contents of the widget.
+   * @return A handle to WidgetView.
+   */
+  WidgetView AddWidget( const std::string& widgetId, const std::string& contentInfo, int width, int height, double period );
+
+public: // Not intended for application developers
+
+  /**
+   * @brief Creates a handle using the WidgetView::Internal implementation.
+   *
+   * @since_tizen 3.0
+   * @param[in] implementation The WidgetViewManager implementation.
+   */
+  explicit DALI_INTERNAL WidgetViewManager( Internal::WidgetViewManager* implementation );
+};
+
+/**
+ * @}
+ */
+
+} // namespace WidgetView
+
+} // namespace Dali
+
+#endif // __DALI_WIDGET_VIEW_WIDGET_VIEW_MANAGER_H__
diff --git a/public_api/widget_viewer_dali.h b/public_api/widget_viewer_dali.h
new file mode 100644 (file)
index 0000000..6ded6ec
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef __WIDGET_VIEWER_DALI_H__
+#define __WIDGET_VIEWER_DALI_H__
+
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+#include <widget_viewer_dali/public_api/widget_view/widget_view.h>
+#include <widget_viewer_dali/public_api/widget_view_manager/widget_view_manager.h>
+
+#endif  // __WIDGET_VIEWER_DALI_H__
diff --git a/widget_viewer_dali.pc.in b/widget_viewer_dali.pc.in
new file mode 100644 (file)
index 0000000..64db29a
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: widget_viewer_dali
+Description: Support development of the widget Viewer DALi Frontend library
+Version: @VERSION@
+Requires: widget_service
+Libs: -L${libdir} -lwidget_viewer_dali
+Cflags: -I${includedir}
+cppflags: -I${includedir}