ADD_SUBDIRECTORY(widget_viewer)
ADD_SUBDIRECTORY(widget_viewer_evas)
ADD_SUBDIRECTORY(widget_viewer_sdk)
+#ADD_SUBDIRECTORY(widget_viewer_dali)
ADD_DEPENDENCIES(widget_viewer_evas widget_viewer)
+#ADD_DEPENDENCIES(widget_viewer_dali widget_viewer)
ADD_DEPENDENCIES(widget_viewer_sdk widget_viewer_evas)
Name: libwidget_viewer
Summary: Library for developing the application
-Version: 1.2.1
+Version: 1.2.2
Release: 1
Group: Applications/Core Applications
License: Flora-1.1
BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(efl-extension)
+#BuildRequires: pkgconfig(dali)
+#BuildRequires: pkgconfig(dali-core)
+#BuildRequires: pkgconfig(dali-toolkit)
%if %{with wayland}
BuildRequires: pkgconfig(wayland-client)
%else
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(ecore-x)
+BuildRequires: pkgconfig(ecore)
%endif
%description
%{_libdir}/pkgconfig/widget_viewer.pc
#################################################
+## libwidget_viewer_dali
+#%package -n %{name}_dali
+#Summary: Library for developing the widget viewer dali
+#Group: Applications/Core Applications
+#License: Flora-1.1
+#
+#%description -n %{name}_dali
+#Provider APIs to develop the widget viewer Dali application.
+#
+#%package -n %{name}_dali-devel
+#Summary: Widget viewer application development library (dev) (Dali version)
+#Group: Development/Libraries
+#Requires: %{name}_dali
+#
+#%description -n %{name}_dali-devel
+#Header & package configuration files to support development of the widget viewer applications. (for Dali app)
+#
+#%post -n %{name}_dali -p /sbin/ldconfig
+#%postun -n %{name}_dali -p /sbin/ldconfig
+#
+#################################################
# libwidget_viewer_evas
%package -n %{name}_evas
Summary: Library for developing the widget viewer evas
%post -n org.tizen.widget_viewer_sdk -p /sbin/ldconfig
%postun -n org.tizen.widget_viewer_sdk -p /sbin/ldconfig
+#%files -n %{name}_dali
+#%manifest %{name}.manifest
+#%defattr(-,root,root,-)
+#%{_libdir}/%{name}_dali.so*
+#%{_datadir}/widget_viewer_dali/*
+#%{_datarootdir}/license/%{name}_dali
+#
+#%files -n %{name}_dali-devel
+#%manifest %{name}.manifest
+#%defattr(-,root,root,-)
+#%{_includedir}/widget_viewer_dali/widget_viewer_dali.h
+#%{_includedir}/widget_viewer_dali/widget_dali.h
+#%{_includedir}/widget_viewer_dali/widget_viewer_dali_generic.h
+#%{_libdir}/pkgconfig/widget_viewer_dali.pc
+
%files -n %{name}_evas
%manifest %{name}.manifest
%defattr(-,root,root,-)
#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg)
#else
extern FILE *__file_log_fp;
-#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [\e[32m%s/%s\e[0m:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
+#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [\e[32m%s/%s\e[0m:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
-#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [\e[32m%s/%s\e[0m:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
+#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [\e[32m%s/%s\e[0m:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
#endif
extern int util_check_extension(const char *filename, const char *check_ptr);
extern double util_timestamp(void);
-extern const char *util_basename(const char *name);
extern const char *util_uri_to_path(const char *uri);
extern int util_unlink(const char *filename);
*/
#define WIDGET_DEFAULT_PERIOD -1.0f
+#define WIDGET_VIEWER_CLICK_BUTTON_LEFT "clicked"
+#define WIDGET_VIEWER_CLICK_BUTTON_RIGHT "clicked,1"
+#define WIDGET_VIEWER_CLICK_BUTTON_CENTER "clicked,2"
+
/**
* @internal
* @brief Enumeration for Mouse & Key event for buffer type widget or Glance Bar.
* @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
* @retval #WIDGET_STATUS_ERROR_NONE Successfully done
*/
-extern int widget_viewer_send_click_event(widget_h handle, double x, double y);
+extern int widget_viewer_send_click_event(widget_h handle, const char *event, double x, double y);
/**
* @internal
#include <widget_cmd_list.h>
#include <widget_buffer.h>
#include <widget_conf.h>
+#include <widget_util.h>
#include <secure_socket.h>
#include "debug.h"
if (!conf_manual_sync()) {
ret = _widget_sync_widget_fb(common);
if (ret != (int)WIDGET_ERROR_NONE) {
- ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, widget_util_basename(util_uri_to_path(id)), ret);
}
} else {
ret = WIDGET_ERROR_NONE;
if (!conf_manual_sync()) {
ret = _widget_sync_widget_fb(common);
if (ret != (int)WIDGET_ERROR_NONE) {
- ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ ErrPrint("Failed to do sync FB (%s - %s) (%d)\n", pkgname, widget_util_basename(util_uri_to_path(id)), ret);
}
} else {
ret = WIDGET_ERROR_NONE;
ret = _widget_sync_gbar_fb(common);
if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, widget_util_basename(util_uri_to_path(id)));
}
}
}
switch (fb_type(_widget_get_gbar_fb(common))) {
case WIDGET_FB_TYPE_FILE:
case WIDGET_FB_TYPE_SHM:
- widget_service_destroy_lock(common->gbar.lock);
+ widget_service_destroy_lock(common->gbar.lock, 0);
common->gbar.lock = NULL;
break;
case WIDGET_FB_TYPE_PIXMAP:
if (!conf_manual_sync()) {
ret = _widget_sync_gbar_fb(common);
if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s), %d\n", pkgname, util_basename(util_uri_to_path(id)), ret);
+ ErrPrint("Failed to do sync FB (%s - %s), %d\n", pkgname, widget_util_basename(util_uri_to_path(id)), ret);
} else {
dlist_foreach(common->widget_list, l, handler) {
_widget_invoke_event_handler(handler, WIDGET_EVENT_GBAR_UPDATED);
ret = _widget_sync_widget_fb(common);
if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, widget_util_basename(util_uri_to_path(id)));
}
/* Just update the size info only. */
ret = _widget_sync_widget_fb(common);
if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, widget_util_basename(util_uri_to_path(id)));
}
break;
case WIDGET_TYPE_TEXT:
ret = _widget_sync_gbar_fb(common);
if (ret < 0) {
- ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, util_basename(util_uri_to_path(id)));
+ ErrPrint("Failed to do sync FB (%s - %s)\n", pkgname, widget_util_basename(util_uri_to_path(id)));
}
/*!
#endif
}
-const char *util_basename(const char *name)
-{
- int length;
- length = name ? strlen(name) : 0;
- if (!length) {
- return ".";
- }
-
- while (--length > 0 && name[length] != '/');
-
- return length <= 0 ? name : name + length + (name[length] == '/');
-}
-
const char *util_uri_to_path(const char *uri)
{
int len;
}
}
- DbgPrint("Send delete request\n");
+ DbgPrint("Send delete request [%s]\n", handle->common->id);
_widget_send_delete(handle, type, cb, data);
} else {
if (cb) {
return ret;
}
-EAPI int widget_viewer_send_click_event(widget_h handle, double x, double y)
+EAPI int widget_viewer_send_click_event(widget_h handle, const char *event, double x, double y)
{
struct packet *packet;
double timestamp;
return WIDGET_ERROR_INVALID_PARAMETER;
}
+ if (!event || (strcmp(event, WIDGET_VIEWER_CLICK_BUTTON_LEFT) && strcmp(event, WIDGET_VIEWER_CLICK_BUTTON_RIGHT) && strcmp(event, WIDGET_VIEWER_CLICK_BUTTON_CENTER))) {
+ ErrPrint("Unknown event: (%s)\n", event);
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
if (!handle->common->id) {
ErrPrint("Handler is not valid\n");
return WIDGET_ERROR_INVALID_PARAMETER;
timestamp = util_timestamp();
DbgPrint("CLICKED: %lf\n", timestamp);
- packet = packet_create_noack((const char *)&cmd, "sssddd", handle->common->pkgname, handle->common->id, "clicked", timestamp, x, y);
+ packet = packet_create_noack((const char *)&cmd, "sssddd", handle->common->pkgname, handle->common->id, event, timestamp, x, y);
if (!packet) {
ErrPrint("Failed to build param\n");
return WIDGET_ERROR_FAULT;
* \note
* Lock file should be deleted after all callbacks are processed.
*/
- (void)widget_service_destroy_lock(handler->common->widget.lock);
+ (void)widget_service_destroy_lock(handler->common->widget.lock, 0);
handler->common->widget.lock = NULL;
_widget_destroy_common_handle(handler->common);
}
--- /dev/null
+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")
+SET(EDJDIR "/usr/share/${PROJECT_NAME}/res/edje")
+SET(RESDIR "/usr/share/${PROJECT_NAME}/res")
+SET(IMGDIR "/usr/share/${PROJECT_NAME}/res/image")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(viewer_dali REQUIRED
+ dlog
+ widget_service
+ dali
+ dali-core
+ dali-toolkit
+)
+
+IF (X11_SUPPORT)
+pkg_check_modules(viewer_dali_extra REQUIRED
+ ecore-x
+)
+
+SET(BUILD_SOURCE
+ src/widget_viewer_dali.cpp
+ src/widget_dali.cpp
+ src/widget_dali_impl.cpp
+ src/widget_dali_list.cpp
+ src/common/widget_viewer_dali_const.cpp
+)
+ENDIF (X11_SUPPORT)
+
+FOREACH(flag ${viewer_dali_CFLAGS} ${viewer_dali_extra_CFLAGS})
+ SET(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -fvisibility=hidden -Wall -Werror -Winline -g")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/widget_viewer/include)
+
+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} ${viewer_dali_extra_LDFLAGS} "-lpthread" widget_viewer)
+
+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}/include/${PROJECT_NAME}.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_dali.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_viewer_dali_generic.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "lib${PROJECT_NAME}")
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/image DESTINATION "${RESDIR}")
+
+ADD_SUBDIRECTORY(res)
--- /dev/null
+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.
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#ifndef __WIDGET_H__
+#define __WIDGET_H__
+
+#include <widget_viewer.h>
+#include <widget_errno.h>
+
+#include "widget_viewer_dali_generic.h"
+
+using namespace Dali;
+
+namespace WidgetViewerDali
+{
+
+namespace Internal
+{
+class CWidget;
+}
+
+class CWidget : public Dali::Toolkit::Control
+{
+public:
+ typedef Signal<bool(CWidget&)> DeletedSignal;
+ typedef Signal<bool(CWidget&, TouchPoint::State, Vector2)> TouchedSignal;
+ typedef Signal<bool(CWidget&, Vector2)> TappedSignal;
+ typedef Signal<bool(CWidget&, Vector2)> LongpressedSignal;
+ typedef Signal<bool(CWidget&)> ReloadSignal;
+
+public:
+ CWidget();
+ CWidget(const CWidget& widget);
+ CWidget(Internal::CWidget&);
+ CWidget(Dali::Internal::CustomActor*);
+
+ ~CWidget();
+
+ static WidgetViewerDali::CWidget New(unsigned int id, void* handle, const char *pkgname, widget_size_type_e size, double period);
+
+ CWidget& operator=( const CWidget& widget );
+ static CWidget DownCast( BaseHandle handle );
+
+ void Initialize();
+
+ void UpdateByPixmap(unsigned int pixmap);
+
+ int GetRowLen();
+ int GetColLen();
+
+ void SetGridPosition(int row, int col);
+ void GetGridPosition(int *row, int *col);
+
+ unsigned int GetPixmap();
+ void SetPixmap(unsigned int pixmap);
+ unsigned int GetWidgetId();
+ void SetWidgetId(unsigned int id);
+
+ void SetEditMode(bool mode);
+ void SetTouchable(bool able);
+ void CancelTouchOperation();
+
+ DeletedSignal& SignalDeleted();
+ TouchedSignal& SignalTouched();
+ TappedSignal& SignalTapped();
+ LongpressedSignal& SignalLongpressed();
+ ReloadSignal& SignalReload();
+
+ std::string GetPkgName();
+ double GetPeriod();
+ void SetWidgetHandler(void* handle);
+ void* GetWidgetHandle();
+ widget_size_type_e GetSizeType();
+
+ bool IsFaulted();
+ void SetFault(bool fault);
+
+ bool OnTouch(const TouchEvent& event);
+ void OnFault();
+};
+
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#ifndef __WIDGET_IMPL_H__
+#define __WIDGET_IMPL_H__
+
+#include <widget_viewer.h>
+
+#include "widget_viewer_dali_generic.h"
+#include "widget_dali.h"
+
+using namespace Dali;
+
+namespace WidgetViewerDali
+{
+
+namespace Internal
+{
+
+class CWidget;
+typedef IntrusivePtr<CWidget> WidgetInternalPtr;
+
+class CWidget : public Dali::Toolkit::Internal::Control
+{
+public:
+ CWidget(unsigned int id, void* handle, const char *pkgname, widget_size_type_e size, double period);
+
+ CWidget(const CWidget&);
+ CWidget(Internal::CWidget&);
+
+ virtual ~CWidget();
+
+ static WidgetViewerDali::CWidget New(unsigned int id, void* handler, const char *pkgname, widget_size_type_e size, double period);
+
+ void Initialize();
+
+ void UpdateByPixmap(unsigned int pixmap);
+
+ int GetRowLen() { return mRowLen; }
+ int GetColLen() { return mColLen; }
+
+ void SetGridPosition(int row, int col);
+ void GetGridPosition(int *row, int *col);
+
+ unsigned int GetPixmap() { return mPixmap; }
+ void SetPixmap(unsigned int pixmap);
+
+ unsigned int GetWidgetId();
+ void SetWidgetId(unsigned int id);
+
+ void SetEditMode(bool mode);
+ void SetTouchable(bool able);
+ void CancelTouchOperation();
+
+ std::string GetPkgName() { return mPkgName; }
+ double GetPeriod() { return mPeriod; }
+ void SetWidgetHandler(void* handle);
+ void* GetWidgetHandle() { return mHandler; }
+ widget_size_type_e GetSizeType() { return mSize; }
+ bool IsFaulted() { return mIsFaulted; }
+ void SetFault(bool fault);
+ void OnFault();
+
+ WidgetViewerDali::CWidget::DeletedSignal& SignalDeleted() { return mSignalDeleted; }
+ WidgetViewerDali::CWidget::TouchedSignal& SignalTouched() { return mSignalTouched; };
+ WidgetViewerDali::CWidget::TappedSignal& SignalTapped() { return mSignalTapped; };
+ WidgetViewerDali::CWidget::LongpressedSignal& SignalLongpressed() { return mSignalLongpressed; };
+ WidgetViewerDali::CWidget::ReloadSignal& SignalReload() { return mSignalReload; }
+
+ bool OnTouch(const TouchEvent& event);
+
+private:
+ CWidget& operator=(const CWidget& rhs);
+
+ bool _OnDeleteButtonClicked( Dali::Toolkit::Button button );
+ bool _OnEventAreaTouchEvent(Dali::Actor actor, const TouchEvent& event);
+
+ Vector3 _GetScreenPosition();
+ void _ConnectTouchSignal(bool isConnect);
+ bool _OnLongTapTimerComplete();
+ void _OnWidgetTapped();
+
+private:
+ void* mHandler;
+ widget_size_type_e mSize;
+ unsigned int mPixmap;
+ int mRow;
+ int mCol;
+ unsigned int mRowLen;
+ unsigned int mColLen;
+ unsigned int mId;
+
+ PixmapImagePtr mPixmapImage;
+ NativeImage mBaseNativeImageData;
+ ImageActor mBaseImage;
+
+ Toolkit::TextLabel mLoadingTextLabel;
+ Toolkit::TextLabel mFaultedTextLabel;
+ Dali::Toolkit::PushButton mDeleteButton;
+
+ Actor mEventArea;
+
+ WidgetViewerDali::CWidget::DeletedSignal mSignalDeleted;
+ WidgetViewerDali::CWidget::TouchedSignal mSignalTouched;
+ WidgetViewerDali::CWidget::TappedSignal mSignalTapped;
+ WidgetViewerDali::CWidget::LongpressedSignal mSignalLongpressed;
+ WidgetViewerDali::CWidget::ReloadSignal mSignalReload;
+
+ std::string mPkgName;
+ double mPeriod;
+ bool mIsTouched;
+ bool mIsTouchable;
+ bool mIsConnectedTouchSignal;
+
+ bool mIsFaulted;
+
+ Timer mLongTapTimer;
+ Vector2 mDownPos;
+
+ bool mIsEditMode;
+ ImageActor mFaultDimBg;
+
+};
+
+}
+
+inline WidgetViewerDali::Internal::CWidget& GetImpl(WidgetViewerDali::CWidget& widget)
+{
+ DALI_ASSERT_ALWAYS(widget);
+
+ Dali::RefObject& handle = widget.GetImplementation();
+
+ return static_cast<WidgetViewerDali::Internal::CWidget&>(handle);
+}
+
+inline const WidgetViewerDali::Internal::CWidget& GetImpl(const WidgetViewerDali::CWidget& widget)
+{
+ DALI_ASSERT_ALWAYS(widget);
+
+ const Dali::RefObject& handle = widget.GetImplementation();
+
+ return static_cast<const WidgetViewerDali::Internal::CWidget&>(handle);
+}
+
+}
+
+#endif
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#ifndef __WIDGET_LIST_H__
+#define __WIDGET_LIST_H__
+
+#include <map>
+
+#include "widget_viewer_dali_generic.h"
+#include "widget_dali.h"
+
+using namespace Dali;
+
+namespace WidgetViewerDali
+{
+
+class CWidgetList
+{
+public:
+ CWidgetList();
+
+ ~CWidgetList();
+
+ int Add(void* handle, CWidget widget);
+ void Remove(void* handle);
+ CWidget GetWidget(unsigned int id);
+ unsigned int GetWidgetId(void *handle);
+ std::vector<WidgetViewerDali::CWidget> GetWidgetList(const char * pkgname);
+ void Update(void* handle, void* newHandle, CWidget widget);
+
+private:
+ std::map<void*, CWidget> m_mWidgetList;
+};
+
+}
+
+#endif
+
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#ifndef __WIDGET_VIEWER_DALI_H__
+#define __WIDGET_VIEWER_DALI_H__
+
+#include <Ecore_X.h>
+
+#include "widget_viewer_dali_generic.h"
+#include "widget_dali.h"
+
+using namespace Dali;
+
+namespace WidgetViewerDali
+{
+class CWidgetList;
+
+class CWidgetManager : public ConnectionTracker
+{
+public:
+ /*
+ * Signals
+ */
+ typedef Dali::Signal<void(WidgetViewerDali::CWidget)> WidgetAddedSignal;
+ typedef Dali::Signal<void(WidgetViewerDali::CWidget)> WidgetDeletedSignal;
+
+public:
+ CWidgetManager();
+ ~CWidgetManager();
+
+ static CWidgetManager* GetInstance();
+
+ void Initialize();
+
+ WidgetAddedSignal& GetSignalWidgetAdded() { return mSignalWidgetAdded; }
+ WidgetDeletedSignal& GetSignalWidgetDeleted() { return mSignalWidgetDeleted; }
+
+ int AddWidget(unsigned int id, const char *pkgname, const char *name, widget_size_type_e type, const char *content,
+ const char *icon, int pid, double period, int allow_duplicate);
+
+ void WidgetEventCreated(void *handler);
+ void WidgetEventUpdated(void *handler);
+ void WidgetEventDeleted(void *handler);
+ void WidgetFaulted(const char *pkgname);
+ void EventPixmapAcquired(void *handler, unsigned int pixmapId);
+
+ bool OnWidgetDeleted(WidgetViewerDali::CWidget& widget);
+ bool OnWidgetReload(WidgetViewerDali::CWidget& widget);
+
+private:
+ static CWidgetManager* m_pInstance;
+
+ WidgetAddedSignal mSignalWidgetAdded;
+ WidgetDeletedSignal mSignalWidgetDeleted;
+
+ CWidgetList* mWidgetList;
+};
+}
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#ifndef _WIDGET_VIEWER_DALI_CONST_H_
+#define _WIDGET_VIEWER_DALI_CONST_H_
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+
+#define BASE_HEIGHT CWidgetDaliConst::GetBaseHeight()
+#define BASE_WIDTH CWidgetDaliConst::GetBaseWidth()
+
+#define SCREEN_HEIGHT CWidgetDaliConst::GetScreenHeight()
+#define SCREEN_WIDTH CWidgetDaliConst::GetScreenWidth()
+
+#define SCREEN_RESOLUTION_TYPE CWidgetDaliConst::GetScreenResolutionType()
+
+#define INDICATOR_H CWidgetDaliConst::GetIndicatorHeight()
+
+#define WIDGET_LOADING_TEXT_WIDTH CWidgetDaliConst::GetWidgetLoadingTextWidth()
+#define WIDGET_LOADING_TEXT_SIZE CWidgetDaliConst::GetWidgetLoadingTextSize()
+#define WIDGET_DELETE_BUTTON_WIDTH CWidgetDaliConst::GetWidgetDeleteButtonWidth()
+#define WIDGET_DELETE_BUTTON_HEIGHT CWidgetDaliConst::GetWidgetDeleteButtonHeight()
+#define WIDGET_DELETE_BUTTON_X CWidgetDaliConst::GetWidgetDeleteButtonX()
+#define WIDGET_DELETE_BUTTON_Y CWidgetDaliConst::GetWidgetDeleteButtonY()
+#define WIDGET_DELETE_BUTTON_Z CWidgetDaliConst::GetWidgetDeleteButtonZ()
+
+#define TAPPED_BOUNDARY_WIDTH CWidgetDaliConst::GetTappedBoundaryWidth()
+#define TAPPED_BOUNDARY_HEIGHT CWidgetDaliConst::GetTappedBoundaryHeight()
+
+using namespace Dali;
+
+namespace WidgetViewerDali
+{
+class CWidgetDaliConst
+{
+public:
+ typedef enum
+ {
+ RESOLUTION_BASE_480X640 = 0, /* 3 : 4 */
+ RESOLUTION_BASE_320X480, /* 2 : 3 */
+ RESOLUTION_BASE_480X800, /* 3 : 5 */
+ RESOLUTION_BASE_540X960, /* 9 : 16 */
+ RESOLUTION_BASE_MAX
+ } ScreenResolutionType;
+
+public:
+ static void SetScreenSize(Vector2 size);
+ static const int GetBaseWidth() { return mBaseWidth; }
+ static const int GetBaseHeight() { return mBaseHeight; }
+ static const float GetScreenWidth() { return mScreenSize.width; }
+ static const float GetScreenHeight() { return mScreenSize.height; }
+ static const unsigned int GetScreenResolutionType() { return mScreenResolutionType; }
+
+ static const float GetIndicatorHeight();
+
+ static const float GetWidgetLoadingTextWidth();
+ static const float GetWidgetLoadingTextSize();
+
+ static const float GetWidgetDeleteButtonWidth();
+ static const float GetWidgetDeleteButtonHeight();
+ static const float GetWidgetDeleteButtonX();
+ static const float GetWidgetDeleteButtonY();
+ static const float GetWidgetDeleteButtonZ();
+
+ static const float GetTappedBoundaryWidth();
+ static const float GetTappedBoundaryHeight();
+
+private :
+ CWidgetDaliConst();
+ static void _SetBaseScreenSize(int width, int height);
+ static const unsigned int _GetResolutionType(int x, int y);
+
+ static const float _GetX(float xPos) { return floor(xPos * SCREEN_WIDTH / BASE_WIDTH); }
+ static const float _GetY(float yPos) { return floor(yPos * SCREEN_HEIGHT / BASE_HEIGHT); }
+ static const float _GetZ(float zPos) { return zPos * SCREEN_WIDTH / BASE_WIDTH; }
+ static const float _GetWidth(float width) { return width * SCREEN_WIDTH / BASE_WIDTH; }
+ static const float _GetHeight(float height) { return height * SCREEN_HEIGHT / BASE_HEIGHT; }
+
+ static Vector2 mScreenSize;
+ static int mBaseWidth;
+ static int mBaseHeight;
+ static unsigned int mScreenResolutionType;
+
+ static float mIndicatorHeight[RESOLUTION_BASE_MAX];
+
+ static float mWidgetLoadingTextWidth[RESOLUTION_BASE_MAX];
+ static float mWidgetLoadingTextSize[RESOLUTION_BASE_MAX];
+ static float mWidgetDeleteButtonWidth[RESOLUTION_BASE_MAX];
+ static float mWidgetDeleteButtonHeight[RESOLUTION_BASE_MAX];
+ static float mWidgetDeleteButtonX[RESOLUTION_BASE_MAX];
+ static float mWidgetDeleteButtonY[RESOLUTION_BASE_MAX];
+ static float mWidgetDeleteButtonZ[RESOLUTION_BASE_MAX];
+ static float mTappedBoundaryWidth[RESOLUTION_BASE_MAX];
+ static float mTappedBoundaryHeight[RESOLUTION_BASE_MAX];
+};
+}
+#endif /* _WIDGET_VIEWER_DALI_CONST_H_ */
+
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+ #ifndef __WIDGET_VIEWER_DALI_GENERIC_H__
+#define __WIDGET_VIEWER_DALI_GENERIC_H__
+
+#include <cstdio>
+#include <iostream>
+
+#include <list>
+#include <map>
+#include <vector>
+
+#include <dali/dali.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <dlog.h>
+
+#include <stdio.h>
+#include <libintl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#define HS_KEY_MENU "XF86Menu"
+#define HS_KEY_BACK "XF86Back"
+#define HS_KEY_HOME "XF86Home"
+#define HS_KEY_APPS "XF86Apps"
+
+#if !defined(EAPI)
+#define EAPI __attribute__((visibility("default")))
+#endif
+
+#if defined(LOG_TAG)
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "WIDGET_DALI"
+
+#if !defined(SECURE_LOGD)
+#define SECURE_LOGD LOGD
+#endif
+
+#if !defined(SECURE_LOGW)
+#define SECURE_LOGW LOGW
+#endif
+
+#if !defined(SECURE_LOGE)
+#define SECURE_LOGE LOGE
+#endif
+
+#if !defined(S_)
+#define S_(str) dgettext("sys_string", str)
+#endif
+
+#if !defined(T_)
+#define T_(str) dgettext(PKGNAME, str)
+#endif
+
+#if !defined(N_)
+#define N_(str) (str)
+#endif
+
+#if !defined(_)
+#define _(str) gettext(str)
+#endif
+
+
+#if !defined(DbgPrint)
+#define DbgPrint(format, arg...) SECURE_LOGD(format, ##arg)
+#endif
+
+#if !defined(ErrPrint)
+#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg)
+#endif
+
+#if !defined(WarnPrint)
+#define WarnPrint(format, arg...) SECURE_LOGW(format, ##arg)
+#endif
+
+#if !defined(WIDGET_VIEWER_RESDIR)
+#define WIDGET_VIEWER_RESDIR "/usr/share/widget_viewer_dali/res"
+#endif
+
+#if !defined(WIDGET_VIEWER_ICONDIR)
+#define WIDGET_VIEWER_ICONDIR WIDGET_VIEWER_RESDIR"/image"
+#endif
+
+#endif /* __WIDGET_VIEWER_DALI_GENERIC_H__ */
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#include "widget_viewer_dali_const.h"
+
+using namespace Dali;
+using namespace WidgetViewerDali;
+
+namespace WidgetViewerDali
+{
+
+const float SCREEN_RATIO[4] = { (4.0f/3.0f), (3.0f/2.0f), (5.0f/3.0f), (16.0f/9.0f) };
+const int SCREEN_RESOLUTION[4][2] = { {480, 640}, {320, 480}, {480, 800}, {540, 960} };
+
+Vector2 CWidgetDaliConst::mScreenSize = Vector2(BASE_WIDTH, BASE_HEIGHT);
+int CWidgetDaliConst::mBaseWidth = 480;
+int CWidgetDaliConst::mBaseHeight = 800;
+unsigned int CWidgetDaliConst::mScreenResolutionType = CWidgetDaliConst::RESOLUTION_BASE_480X800;
+
+/*
+ 0 : 480x640 - unsupported
+ 1 : 320x480 - unsupported
+ 2 : 480x800 - WVGA
+ 3 : 540x960 - qHD
+*/
+float CWidgetDaliConst::mIndicatorHeight[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 33.33f, 40.0f };
+float CWidgetDaliConst::mWidgetLoadingTextWidth[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 470.0f, 528.75f };
+float CWidgetDaliConst::mWidgetLoadingTextSize[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 18.0f, 21.65f };
+float CWidgetDaliConst::mWidgetDeleteButtonWidth[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 40.0f, 45.0f };
+float CWidgetDaliConst::mWidgetDeleteButtonHeight[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 40.0f, 48.0f };
+float CWidgetDaliConst::mWidgetDeleteButtonX[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 15.0f, 16.875f };
+float CWidgetDaliConst::mWidgetDeleteButtonY[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 15.0f, 18.0f };
+float CWidgetDaliConst::mWidgetDeleteButtonZ[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 3.5f, 3.9375f };
+float CWidgetDaliConst::mTappedBoundaryWidth[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 10.0f, 11.5f };
+float CWidgetDaliConst::mTappedBoundaryHeight[CWidgetDaliConst::RESOLUTION_BASE_MAX] = { 0.0f, 0.0f, 10.0f, 12.0f };
+
+CWidgetDaliConst::CWidgetDaliConst()
+{
+}
+
+void CWidgetDaliConst::SetScreenSize(Vector2 size)
+{
+ mScreenSize = size;
+
+ _SetBaseScreenSize(size.x, size.y);
+}
+
+void CWidgetDaliConst::_SetBaseScreenSize(int width, int height)
+{
+ unsigned int type = _GetResolutionType(width, height);
+
+ if( width < height )
+ {
+ mBaseWidth = SCREEN_RESOLUTION[type][0];
+ mBaseHeight = SCREEN_RESOLUTION[type][1];
+ }
+ else
+ {
+ mBaseWidth = SCREEN_RESOLUTION[type][1];
+ mBaseHeight = SCREEN_RESOLUTION[type][0];
+ }
+
+ mScreenResolutionType = type;
+}
+
+const unsigned int CWidgetDaliConst::_GetResolutionType(int x, int y)
+{
+ if(x > y)
+ return CWidgetDaliConst::_GetResolutionType(y, x);
+
+ float ratio = (float) y / (float) x;
+
+ unsigned int type=0;
+ for(type=0; type < RESOLUTION_BASE_MAX - 1; type++)
+ {
+ if( fabs(ratio - SCREEN_RATIO[type]) < fabs(ratio - SCREEN_RATIO[type+1]) )
+ break;
+ }
+
+ return type;
+}
+
+const float CWidgetDaliConst::GetIndicatorHeight()
+{
+ return _GetHeight(mIndicatorHeight[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetWidgetLoadingTextWidth()
+{
+ return _GetWidth(mWidgetLoadingTextWidth[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetWidgetLoadingTextSize()
+{
+ return _GetHeight(mWidgetLoadingTextSize[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetWidgetDeleteButtonWidth()
+{
+ return _GetWidth(mWidgetDeleteButtonWidth[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetWidgetDeleteButtonHeight()
+{
+ return _GetHeight(mWidgetDeleteButtonHeight[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetWidgetDeleteButtonX()
+{
+ return _GetX(mWidgetDeleteButtonX[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetWidgetDeleteButtonY()
+{
+ return _GetY(mWidgetDeleteButtonY[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetWidgetDeleteButtonZ()
+{
+ return _GetZ(mWidgetDeleteButtonZ[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetTappedBoundaryWidth()
+{
+ return _GetWidth(mTappedBoundaryWidth[mScreenResolutionType]);
+}
+
+const float CWidgetDaliConst::GetTappedBoundaryHeight()
+{
+ return _GetHeight(mTappedBoundaryHeight[mScreenResolutionType]);
+}
+
+}
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#include <widget_viewer.h>
+
+#include "widget_viewer_dali_generic.h"
+#include "widget_dali.h"
+#include "widget_dali_impl.h"
+#include "debug.h"
+
+using namespace Dali;
+using namespace WidgetViewerDali;
+
+namespace WidgetViewerDali
+{
+
+EAPI CWidget::CWidget()
+{
+}
+
+EAPI CWidget::CWidget(const CWidget& widget)
+: Dali::Toolkit::Control(widget)
+{
+}
+
+EAPI CWidget::CWidget(Internal::CWidget& impl)
+: Dali::Toolkit::Control(impl)
+{
+}
+
+EAPI CWidget::CWidget(Dali::Internal::CustomActor* implementation)
+: Dali::Toolkit::Control(implementation)
+{
+ VerifyCustomActorPointer<Internal::CWidget>(implementation);
+}
+
+EAPI CWidget::~CWidget()
+{
+}
+
+CWidget CWidget::New(unsigned int id, void* handle, const char *pkgname, widget_size_type_e size, double period)
+{
+ return Internal::CWidget::New(id, handle, pkgname, size, period);
+}
+
+void CWidget::Initialize()
+{
+ GetImpl(*this).Initialize();
+}
+
+EAPI CWidget& CWidget::operator=( const CWidget& widget )
+{
+ if( &widget != this )
+ {
+ Dali::Toolkit::Control::operator=( widget );
+ }
+
+ return *this;
+}
+
+EAPI CWidget CWidget::DownCast( BaseHandle handle )
+{
+ return Dali::Toolkit::Control::DownCast<CWidget, Internal::CWidget>(handle);
+}
+
+EAPI int CWidget::GetRowLen()
+{
+ return GetImpl(*this).GetRowLen();
+}
+
+EAPI int CWidget::GetColLen()
+{
+ return GetImpl(*this).GetColLen();
+}
+
+EAPI void CWidget::SetGridPosition(int row, int col)
+{
+ GetImpl(*this).SetGridPosition(row, col);
+}
+
+EAPI void CWidget::GetGridPosition(int *row, int *col)
+{
+ GetImpl(*this).GetGridPosition(row, col);
+}
+
+unsigned int CWidget::GetPixmap()
+{
+ return GetImpl(*this).GetPixmap();
+}
+
+void CWidget::SetPixmap(unsigned int pixmap)
+{
+ GetImpl(*this).SetPixmap(pixmap);
+}
+
+EAPI unsigned int CWidget::GetWidgetId()
+{
+ return GetImpl(*this).GetWidgetId();
+}
+
+void CWidget::SetWidgetId(unsigned int id)
+{
+ GetImpl(*this).SetWidgetId(id);
+}
+
+void CWidget::UpdateByPixmap(unsigned int pixmap)
+{
+ GetImpl(*this).UpdateByPixmap(pixmap);
+}
+
+EAPI void CWidget::SetEditMode(bool mode)
+{
+ GetImpl(*this).SetEditMode(mode);
+}
+
+EAPI void CWidget::SetTouchable(bool able)
+{
+ GetImpl(*this).SetTouchable(able);
+}
+
+EAPI void CWidget::CancelTouchOperation()
+{
+ GetImpl(*this).CancelTouchOperation();
+}
+
+CWidget::DeletedSignal& CWidget::SignalDeleted()
+{
+ return GetImpl(*this).SignalDeleted();
+}
+
+EAPI CWidget::TouchedSignal& CWidget::SignalTouched()
+{
+ return GetImpl(*this).SignalTouched();
+}
+
+EAPI CWidget::TappedSignal& CWidget::SignalTapped()
+{
+ return GetImpl(*this).SignalTapped();
+}
+
+EAPI CWidget::LongpressedSignal& CWidget::SignalLongpressed()
+{
+ return GetImpl(*this).SignalLongpressed();
+}
+
+CWidget::ReloadSignal& CWidget::SignalReload()
+{
+ return GetImpl(*this).SignalReload();
+}
+
+std::string CWidget::GetPkgName()
+{
+ return GetImpl(*this).GetPkgName();
+}
+
+double CWidget::GetPeriod()
+{
+ return GetImpl(*this).GetPeriod();
+}
+
+bool CWidget::IsFaulted()
+{
+ return GetImpl(*this).IsFaulted();
+}
+
+void CWidget::SetFault(bool fault)
+{
+ GetImpl(*this).SetFault(fault);
+}
+
+void CWidget::SetWidgetHandler(void* handle)
+{
+ GetImpl(*this).SetWidgetHandler(handle);
+}
+
+void* CWidget::GetWidgetHandle()
+{
+ return GetImpl(*this).GetWidgetHandle();
+}
+
+widget_size_type_e CWidget::GetSizeType()
+{
+ return GetImpl(*this).GetSizeType();
+}
+
+EAPI bool CWidget::OnTouch(const TouchEvent& event)
+{
+ return GetImpl(*this).OnTouch(event);
+}
+
+void CWidget::OnFault()
+{
+ GetImpl(*this).OnFault();
+}
+
+}
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#include <widget_viewer.h>
+#include <cmath>
+
+#include "widget_viewer_dali_generic.h"
+#include "widget_viewer_dali_const.h"
+#include "widget_dali_impl.h"
+#include "debug.h"
+
+#if defined(LOG_TAG)
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "WIDGET_DALI"
+
+using namespace Dali;
+using namespace WidgetViewerDali;
+
+namespace WidgetViewerDali
+{
+
+namespace Internal
+{
+
+EAPI CWidget::CWidget(unsigned int id, void* handle, const char *pkgname, widget_size_type_e size, double period)
+: Dali::Toolkit::Internal::Control(ControlBehaviour(REQUIRES_TOUCH_EVENTS)),
+ mHandler(handle),
+ mSize(size),
+ mPixmap(0),
+ mRowLen(1),
+ mColLen(1),
+ mId(id),
+ mPkgName(pkgname),
+ mPeriod(period),
+ mIsTouched(false),
+ mIsTouchable(true),
+ mIsConnectedTouchSignal(false),
+ mIsFaulted(false),
+ mIsEditMode(false)
+{
+}
+
+EAPI CWidget::~CWidget()
+{
+}
+
+EAPI WidgetViewerDali::CWidget CWidget::New(unsigned int id, void* handler, const char *pkgname, widget_size_type_e size, double period)
+{
+ WidgetInternalPtr pWidget(new CWidget(id, handler, pkgname, size, period));
+
+ WidgetViewerDali::CWidget handle(*pWidget);
+
+ pWidget->Initialize();
+
+ return handle;
+}
+
+void CWidget::Initialize()
+{
+ DbgPrint("%x", mSize);
+ Actor self = Self();
+
+ self.SetParentOrigin( ParentOrigin::TOP_CENTER );
+ self.SetAnchorPoint( AnchorPoint::TOP_CENTER );
+
+ mBaseImage = ImageActor::New();
+ mBaseImage.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ mBaseImage.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ Constraint constraint = Constraint::New<Vector3>( mBaseImage, Actor::Property::SIZE, EqualToConstraint() );
+ constraint.AddSource( ParentSource(Actor::Property::SIZE) );
+ constraint.Apply();
+
+ self.Add(mBaseImage);
+
+ mEventArea = Actor::New();
+
+ Constraint eventAreaConstraint = Constraint::New<Vector3>( mEventArea, Actor::Property::SIZE, EqualToConstraint() );
+ eventAreaConstraint.AddSource( ParentSource(Actor::Property::SIZE) );
+ eventAreaConstraint.Apply();
+
+ mEventArea.SetAnchorPoint(AnchorPoint::CENTER);
+ mEventArea.SetParentOrigin(ParentOrigin::CENTER);
+ mEventArea.SetPosition(0.0f, 0.0f, 0.5f);
+
+ self.Add(mEventArea);
+
+ /* supporting to operate normal and edit mode */
+ mEventArea.TouchedSignal().Connect(this, &Internal::CWidget::_OnEventAreaTouchEvent);
+ mEventArea.SetLeaveRequired(true);
+ mIsConnectedTouchSignal = true;
+
+ Vector2 resolution = Stage::GetCurrent().GetDpi();
+ mLoadingTextLabel = Toolkit::TextLabel::New(_("IDS_ST_BODY_LOADING_ING"));
+ mLoadingTextLabel.SetProperty(Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
+ mLoadingTextLabel.SetProperty(Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER");
+ mLoadingTextLabel.SetProperty(Toolkit::TextLabel::Property::POINT_SIZE, WIDGET_LOADING_TEXT_SIZE * 72.0f/resolution.y);
+ mLoadingTextLabel.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+ mLoadingTextLabel.SetParentOrigin(ParentOrigin::CENTER);
+ mLoadingTextLabel.SetAnchorPoint(AnchorPoint::CENTER);
+ mLoadingTextLabel.SetSize(WIDGET_LOADING_TEXT_WIDTH, WIDGET_LOADING_TEXT_SIZE * 3);
+ mLoadingTextLabel.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
+ mBaseImage.Add(mLoadingTextLabel);
+
+ Image iconImage;
+ mDeleteButton = Dali::Toolkit::PushButton::New();
+ iconImage = ResourceImage::New(WIDGET_VIEWER_ICONDIR"/btn_delete_nor.png");
+ mDeleteButton.SetButtonImage(iconImage);
+ iconImage = ResourceImage::New(WIDGET_VIEWER_ICONDIR"/btn_delete_press.png");
+ mDeleteButton.SetSelectedImage(iconImage);
+ mDeleteButton.SetSize(Vector2(WIDGET_DELETE_BUTTON_WIDTH, WIDGET_DELETE_BUTTON_HEIGHT));
+ mDeleteButton.SetAnchorPoint(AnchorPoint::TOP_LEFT);
+ mDeleteButton.SetParentOrigin(AnchorPoint::TOP_LEFT);
+ mDeleteButton.SetPosition(Vector3(WIDGET_DELETE_BUTTON_X, WIDGET_DELETE_BUTTON_Y, WIDGET_DELETE_BUTTON_Z));
+ mDeleteButton.SetOpacity(0.0f);
+
+ mDeleteButton.ClickedSignal().Connect( this, &Internal::CWidget::_OnDeleteButtonClicked );
+
+ mBaseImage.Add(mDeleteButton);
+
+ switch (mSize) {
+ case WIDGET_SIZE_TYPE_1x1 :
+ mRowLen = 1;
+ mColLen = 1;
+ break;
+ case WIDGET_SIZE_TYPE_2x1 :
+ mRowLen = 1;
+ mColLen = 2;
+ break;
+ case WIDGET_SIZE_TYPE_2x2 :
+ mRowLen = 2;
+ mColLen = 2;
+ break;
+ case WIDGET_SIZE_TYPE_4x1 :
+ mRowLen = 1;
+ mColLen = 4;
+ break;
+ case WIDGET_SIZE_TYPE_4x2 :
+ mRowLen = 2;
+ mColLen = 4;
+ break;
+ case WIDGET_SIZE_TYPE_4x3 :
+ mRowLen = 3;
+ mColLen = 4;
+ break;
+ case WIDGET_SIZE_TYPE_4x4 :
+ mRowLen = 4;
+ mColLen = 4;
+ break;
+ case WIDGET_SIZE_TYPE_4x5 :
+ mRowLen = 5;
+ mColLen = 4;
+ break;
+ case WIDGET_SIZE_TYPE_4x6 :
+ mRowLen = 6;
+ mColLen = 4;
+ break;
+ default:
+ mRowLen = 1;
+ mColLen = 1;
+ break;
+ }
+
+ if (!mLongTapTimer)
+ {
+ mLongTapTimer = Timer::New(1000);
+ mLongTapTimer.TickSignal().Connect(this, &Internal::CWidget::_OnLongTapTimerComplete);
+ }
+
+ DbgPrint("rowLen, colLen [%d, %d]", mRowLen, mColLen);
+}
+
+void CWidget::UpdateByPixmap(unsigned int pixmap)
+{
+ DbgPrint("Update widget by pixmap[%d]", pixmap);
+ mPixmap = pixmap;
+ mPixmapImage = PixmapImage::New(mPixmap);
+ mBaseNativeImageData = NativeImage::New(*mPixmapImage);
+
+ if(mLoadingTextLabel)
+ {
+ mBaseImage.Remove(mLoadingTextLabel);
+ mLoadingTextLabel.Reset();
+ }
+
+ if(mFaultDimBg)
+ {
+ mFaultDimBg.SetOpacity(0.0f);
+ }
+
+ mBaseImage.SetImage(mBaseNativeImageData);
+
+ mIsFaulted = false;
+}
+
+void CWidget::SetPixmap(unsigned int pixmap)
+{
+ DbgPrint("Set [%d]", pixmap);
+ mPixmap = pixmap;
+}
+
+void CWidget::SetWidgetId(unsigned int id)
+{
+ DbgPrint("Set [%d]", id);
+ mId = id;
+}
+
+unsigned int CWidget::GetWidgetId()
+{
+ DbgPrint("Get Id [%d]", mId);
+ return mId;
+}
+
+void CWidget::SetWidgetHandler(void* handle)
+{
+ mHandler = handle;
+}
+
+void CWidget::SetEditMode(bool mode)
+{
+ mIsEditMode = mode;
+ CancelTouchOperation();
+
+ mDeleteButton.SetOpacity(mode ? 1.0f : 0.0f);
+
+ _ConnectTouchSignal(!mode);
+}
+
+void CWidget::SetTouchable(bool able)
+{
+ mIsTouchable = able;
+ _ConnectTouchSignal(able);
+}
+
+void CWidget::_ConnectTouchSignal(bool isConnect)
+{
+ if(isConnect && mIsTouchable)
+ {
+ mEventArea.TouchedSignal().Connect(this, &Internal::CWidget::_OnEventAreaTouchEvent);
+ mIsConnectedTouchSignal = true;
+ }
+ else if(mIsConnectedTouchSignal)
+ {
+ mEventArea.TouchedSignal().Disconnect(this, &Internal::CWidget::_OnEventAreaTouchEvent);
+ mIsConnectedTouchSignal = false;
+ }
+}
+
+void CWidget::CancelTouchOperation()
+{
+ if (mLongTapTimer.IsRunning())
+ {
+ mLongTapTimer.Stop();
+ }
+
+ if(mIsTouched)
+ {
+ mIsTouched = false;
+
+ TouchEvent event;
+ Vector3 screenposition = _GetScreenPosition();
+ event.points.push_back( TouchPoint ( 0, Dali::TouchPoint::Leave, screenposition.x, screenposition.y ) );
+ DbgPrint("cancel x, y [%.2f, %.2f]", screenposition.x, screenposition.y);
+ _OnEventAreaTouchEvent(Self(), event);
+ }
+}
+
+bool CWidget::_OnDeleteButtonClicked( Dali::Toolkit::Button button )
+{
+ Actor self = Self();
+
+ WidgetViewerDali::CWidget handle ( GetOwner() );
+
+ mSignalDeleted.Emit(handle);
+
+ return true;
+}
+
+bool CWidget::_OnEventAreaTouchEvent(Dali::Actor actor, const TouchEvent& event)
+{
+ DbgPrint("_OnEventAreaTouchEvent!! widget id[%d]", mId);
+ WidgetViewerDali::CWidget handle ( GetOwner() );
+
+ mSignalTouched.Emit(handle, event.GetPoint(0).state, event.GetPoint(0).screen);
+
+ if(event.GetPoint(0).state == Dali::TouchPoint::Down)
+ {
+ mLongTapTimer.Start();
+ }
+
+ Actor self = Self();
+
+ struct widget_mouse_event_info info;
+
+ Vector3 screenposition = _GetScreenPosition();
+ info.x = event.GetPoint(0).screen.x - screenposition.x;
+ info.y = event.GetPoint(0).screen.y - screenposition.y;
+
+ info.ratio_w = 1.0f;
+ info.ratio_h = 1.0f;
+ info.device = 0;
+
+ if(event.GetPoint(0).state == Dali::TouchPoint::Down)
+ {
+ mIsTouched = true;
+ mLongTapTimer.Start();
+ mDownPos.x = info.x;
+ mDownPos.y = info.y;
+
+ widget_viewer_feed_mouse_event(static_cast<widget_h >(mHandler), WIDGET_MOUSE_ENTER, &info);
+ widget_viewer_feed_mouse_event(static_cast<widget_h >(mHandler), WIDGET_MOUSE_DOWN, &info);
+ }
+ else if(event.GetPoint(0).state == Dali::TouchPoint::Up)
+ {
+ if(mIsTouched)
+ {
+ float gapX = fabs(info.x - mDownPos.x);
+ float gapY = fabs(info.y - mDownPos.y);
+
+ if(gapX <= TAPPED_BOUNDARY_WIDTH && gapY <= TAPPED_BOUNDARY_HEIGHT)
+ {
+ mSignalTapped.Emit(handle, event.GetPoint(0).screen);
+ _OnWidgetTapped();
+ }
+ }
+ mIsTouched = false;
+
+ if (mLongTapTimer.IsRunning())
+ {
+ mLongTapTimer.Stop();
+ }
+
+ widget_viewer_feed_mouse_event(static_cast<widget_h >(mHandler), WIDGET_MOUSE_UP, &info);
+ widget_viewer_feed_mouse_event(static_cast<widget_h >(mHandler), WIDGET_MOUSE_LEAVE, &info);
+ }
+ else if(event.GetPoint(0).state == Dali::TouchPoint::Motion)
+ {
+ if(mIsTouched && mLongTapTimer.IsRunning())
+ {
+ float gapX = fabs(info.x - mDownPos.x);
+ float gapY = fabs(info.y - mDownPos.y);
+
+ if(gapX > TAPPED_BOUNDARY_WIDTH || gapY > TAPPED_BOUNDARY_HEIGHT)
+ {
+ mLongTapTimer.Stop();
+ }
+ }
+ widget_viewer_feed_mouse_event(static_cast<widget_h >(mHandler), WIDGET_MOUSE_MOVE, &info);
+ }
+ else if(event.GetPoint(0).state == Dali::TouchPoint::Leave || event.GetPoint(0).state == Dali::TouchPoint::Interrupted)
+ {
+ mIsTouched = false;
+
+ if (mLongTapTimer.IsRunning())
+ {
+ mLongTapTimer.Stop();
+ }
+
+ /*widget_viewer_feed_mouse_event(static_cast<widget_h >(mHandler), WIDGET_MOUSE_UP, &info);*/
+ widget_viewer_feed_mouse_event(static_cast<widget_h >(mHandler), WIDGET_MOUSE_LEAVE, &info);
+ }
+
+ return false;
+}
+
+bool CWidget::OnTouch(const TouchEvent& event)
+{
+ return _OnEventAreaTouchEvent(Self(), event);
+}
+
+void CWidget::_OnWidgetTapped()
+{
+ if(!mIsFaulted)
+ return ;
+
+ if(mFaultedTextLabel)
+ {
+ mFaultedTextLabel.SetProperty(Toolkit::TextLabel::Property::TEXT, _("IDS_ST_BODY_LOADING_ING"));
+ }
+
+ WidgetViewerDali::CWidget handle ( GetOwner() );
+ mSignalReload.Emit(handle);
+}
+
+void CWidget::SetGridPosition(int row, int col)
+{
+ mRow = row;
+ mCol = col;
+}
+
+void CWidget::GetGridPosition(int *row, int *col)
+{
+ *row = mRow;
+ *col = mCol;
+}
+
+Vector3 CWidget::_GetScreenPosition()
+{
+ Actor self = Self();
+ Vector3 position = self.GetCurrentPosition();
+ Actor actor = self.GetParent();
+
+ while(actor)
+ {
+ position += actor.GetCurrentPosition();
+
+ actor = actor.GetParent();
+
+ }
+
+ return position;
+}
+
+void CWidget::SetFault(bool fault)
+{
+ mIsFaulted = fault;
+}
+
+bool CWidget::_OnLongTapTimerComplete()
+{
+ WidgetViewerDali::CWidget handle ( GetOwner() );
+ mSignalLongpressed.Emit(handle, mDownPos);
+ return false;
+}
+
+void CWidget::OnFault()
+{
+ mIsFaulted = true;
+ if(mLoadingTextLabel)
+ {
+ mLoadingTextLabel.SetOpacity(0.0f);
+ }
+
+ if(!mFaultDimBg)
+ {
+ mFaultDimBg = Toolkit::CreateSolidColorActor(Vector4(0.3, 0.3, 0.3, 0.85));
+ mFaultDimBg.SetZ(0.1f);
+ mFaultDimBg.SetParentOrigin(ParentOrigin::CENTER);
+ mFaultDimBg.SetAnchorPoint(AnchorPoint::CENTER);
+
+ Constraint constraint = Constraint::New<Vector3>( mFaultDimBg, Actor::Property::SIZE, EqualToConstraint() );
+ constraint.AddSource( ParentSource(Actor::Property::SIZE) );
+ constraint.Apply();
+
+ mBaseImage.Add(mFaultDimBg);
+ }
+
+ if(!mFaultedTextLabel)
+ {
+ Vector2 resolution = Stage::GetCurrent().GetDpi();
+ mFaultedTextLabel = Toolkit::TextLabel::New(_("IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY"));
+ mFaultedTextLabel.SetProperty(Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER");
+ mFaultedTextLabel.SetProperty(Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER");
+ mFaultedTextLabel.SetProperty(Toolkit::TextLabel::Property::POINT_SIZE, WIDGET_LOADING_TEXT_SIZE * 72.0f/resolution.y);
+ mFaultedTextLabel.SetProperty(Toolkit::TextLabel::Property::TEXT_COLOR, Vector4(1.0f, 1.0f, 1.0f, 1.0f));
+
+ mFaultedTextLabel.SetAnchorPoint(AnchorPoint::CENTER);
+ mFaultedTextLabel.SetParentOrigin(ParentOrigin::CENTER);
+
+ mFaultedTextLabel.SetSize(WIDGET_LOADING_TEXT_WIDTH, WIDGET_LOADING_TEXT_SIZE * 3);
+ mFaultedTextLabel.SetPosition(Vector3(0.0f, 0.0f, 0.0f));
+
+ mFaultedTextLabel.SetZ(0.1f);
+
+ mFaultDimBg.Add(mFaultedTextLabel);
+ }
+ else
+ {
+ mFaultedTextLabel.SetProperty(Toolkit::TextLabel::Property::TEXT, _("IDS_HS_BODY_UNABLE_TO_LOAD_DATA_TAP_TO_RETRY"));
+ }
+
+ mFaultDimBg.SetOpacity(mIsEditMode ? 0.0f : 1.0f);
+}
+
+}
+}
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#include <string.h>
+
+#include "widget_dali_list.h"
+
+using namespace Dali;
+using namespace WidgetViewerDali;
+
+namespace WidgetViewerDali
+{
+
+CWidgetList::CWidgetList()
+{
+ m_mWidgetList.clear();
+}
+
+CWidgetList::~CWidgetList()
+{
+}
+
+int CWidgetList::Add(void* handle, CWidget widget)
+{
+ DbgPrint("size[%d]", m_mWidgetList.size());
+
+ m_mWidgetList[handle] = widget;
+
+ DbgPrint("size[%d]", m_mWidgetList.size());
+
+ return m_mWidgetList.size();
+}
+
+void CWidgetList::Remove(void* handle)
+{
+ DbgPrint("size[%d]", m_mWidgetList.size());
+
+ std::map<void*, CWidget>::iterator iter = m_mWidgetList.find(handle);
+
+ m_mWidgetList.erase(iter);
+
+ DbgPrint("size[%d]", m_mWidgetList.size());
+}
+
+CWidget CWidgetList::GetWidget(unsigned int id)
+{
+ std::map<void*, CWidget>::iterator iter;
+ for(iter = m_mWidgetList.begin(); iter!= m_mWidgetList.end(); iter++)
+ {
+ if(iter->second.GetWidgetId() == id)
+ {
+ DbgPrint("Get id[%d]", id);
+ return iter->second;
+ }
+ }
+
+ return NULL;
+}
+
+unsigned int CWidgetList::GetWidgetId(void *handle)
+{
+ std::map<void*, CWidget>::iterator iter;
+ for(iter = m_mWidgetList.begin(); iter!= m_mWidgetList.end(); iter++)
+ {
+ if(iter->first == handle)
+ {
+ return iter->second.GetWidgetId();
+ }
+ }
+
+ ErrPrint("Widget is wrong!");
+ return 0;
+}
+
+std::vector<WidgetViewerDali::CWidget> CWidgetList::GetWidgetList(const char * pkgname)
+{
+ std::vector<WidgetViewerDali::CWidget> list;
+ std::map<void*, CWidget>::iterator iter;
+ for(iter = m_mWidgetList.begin(); iter!= m_mWidgetList.end(); iter++)
+ {
+ if(!iter->second.GetPkgName().compare(pkgname))
+ {
+ list.push_back(iter->second);
+ }
+ }
+
+ return list;
+}
+
+void CWidgetList::Update(void* handle, void* newHandle, CWidget widget)
+{
+ DbgPrint("handle %p, newhandle %p", handle, newHandle);
+
+ widget.SetWidgetHandler(newHandle);
+ m_mWidgetList[newHandle] = widget;
+ Remove(handle);
+}
+
+}
+
--- /dev/null
+/*
+ * Copyright 2013 Samsung Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#include <Ecore_X.h>
+
+#include <widget_viewer.h>
+
+#include <widget_errno.h>
+
+#include "widget_viewer_dali_generic.h"
+#include "widget_viewer_dali.h"
+#include "widget_dali_list.h"
+#include "debug.h"
+
+#define WIDGET_DEFAULT_CLUSTER "user,created"
+#define WIDGET_DEFAULT_CATEGORY "default"
+
+#define FAULT_RETRY_MAX_COUNT 3
+
+ using namespace Dali;
+ using namespace WidgetViewerDali;
+
+CWidgetManager* CWidgetManager::m_pInstance = NULL;
+
+static int widget_is_exists(const char *pkgname)
+{
+ int ret=1;
+ char *widget;
+ widget = widget_service_get_widget_id(pkgname);
+ if(!widget) {
+ ret = 0;
+ }
+ free(widget);
+ return ret;
+}
+
+static int WidgetProviderWidgetEventCB(widget_h handler, widget_event_type_e event, void *data)
+{
+ CWidgetManager *pWidgeProvider = static_cast<CWidgetManager *>(data);
+
+ if(handler == NULL)
+ {
+ return EXIT_FAILURE;
+ }
+
+ if(event == WIDGET_EVENT_WIDGET_UPDATED)
+ {
+ DbgPrint("handler : %p, event : update[%d]", handler, event);
+ pWidgeProvider->WidgetEventUpdated(handler);
+ }
+ else if(event == WIDGET_EVENT_DELETED)
+ {
+ DbgPrint("handler : %p, event : deleted[%d]", handler, event);
+ pWidgeProvider->WidgetEventDeleted(handler);
+ }
+ else if(event == WIDGET_EVENT_HOLD_SCROLL)
+ {
+ DbgPrint("handler : %p, event : hold scroll[%d]", handler, event);
+ /*pWidgeProvider->WidgetEventScrollLocked(handler, false);*/
+ }
+ else if(event == WIDGET_EVENT_RELEASE_SCROLL)
+ {
+ DbgPrint("handler : %p, event : release scroll[%d]", handler, event);
+ /*pWidgeProvider->WidgetEventScrollLocked(handler, true);*/
+ }
+ else
+ {
+ DbgPrint("Not supported event : %d", event);
+ }
+
+ return EXIT_SUCCESS;
+}
+
+static void WidgetProviderWidgetActivateCB(widget_h handle, int ret, void *data)
+{
+ if(ret == 0)
+ {
+ /* Success */
+ DbgPrint("handle : %p, Activate", handle);
+ }
+ else
+ {
+ ErrPrint("Failed to widget_activate[%x]", ret);
+ }
+}
+
+static int WidgetProviderWidgetFaultCB(widget_fault_type_e event, const char *pkgname, const char *filename, const char *funcname, void *data)
+{
+ CWidgetManager *pWidgeProvider = static_cast<CWidgetManager *>(data);
+
+ if(pWidgeProvider && event == WIDGET_FAULT_DEACTIVATED)
+ {
+ DbgPrint("event[%d], pkgname[%s]", event, pkgname);
+ widget_viewer_activate_faulted_widget(pkgname, WidgetProviderWidgetActivateCB, data);
+
+ pWidgeProvider->WidgetFaulted(pkgname);
+ }
+ else if(pWidgeProvider && event == WIDGET_FAULT_PROVIDER_DISCONNECTED)
+ {
+ /*pWidgeProvider->WidgetProviderDisconnected();*/
+ }
+
+ return EXIT_SUCCESS;
+}
+
+static void WidgetProviderWidgetAddCB(widget_h handle, int ret, void *data)
+{
+ CWidgetManager *pWidgeProvider = static_cast<CWidgetManager *>(data);
+
+ if(pWidgeProvider == NULL)
+ {
+ ErrPrint("invalid add callback data");
+ return;
+ }
+
+ switch (ret) {
+ case WIDGET_ERROR_NONE:
+ DbgPrint("handle : %p, Add", handle);
+ pWidgeProvider->WidgetEventCreated(handle);
+ break;
+ case WIDGET_ERROR_ALREADY_EXIST:
+ /*ret = notification_status_message_post("Dynamic Box is already exists");
+ if(ret != NOTIFICATION_ERROR_NONE)
+ {
+ ErrPrint("Failed to make notification");
+ }
+ pWidgeProvider->WidgetEventDeleted(handle);*/
+ break;
+ case -1: /*fall through*/
+ /* Temporarly used */
+ pWidgeProvider->WidgetEventDeleted(handle);
+ break;
+ default:
+ /*ErrPrint("Failed to widget_viewer_add_widget[%d][%p]", ret, handle);
+ widgetDataProvider->WidgetEventDeleted(handle);
+
+ pWidgeProvider->WidgetAddFailed(handle, ret);*/
+ break;
+ }
+}
+
+static void WidgetProviderWidgetDeleteCB(widget_h handle, int ret, void *data)
+{
+ if(ret == 0)
+ {
+ /* Success */
+ DbgPrint("handle : %p, Delete", handle);
+ CWidgetManager *pWidgeProvider = static_cast<CWidgetManager *>(data);
+
+ pWidgeProvider->WidgetEventDeleted(handle);
+ }
+ else
+ {
+ ErrPrint("Failed to widget_viewer_delete_widget[%d]", ret);
+ }
+}
+
+static void WidgetProviderWidgetPixmapAcquiredCB(widget_h handle, int pixmapId, void *data)
+{
+ CWidgetManager *pWidgeProvider = static_cast<CWidgetManager *>(data);
+ pWidgeProvider->EventPixmapAcquired(handle, (unsigned int)pixmapId);
+}
+
+namespace WidgetViewerDali
+{
+CWidgetManager::CWidgetManager()
+{
+ widget_viewer_set_option(WIDGET_OPTION_DIRECT_UPDATE, 1);
+ /* initialize widget, (XDisplay, prevent_overwrite, event_filtering, use_thread) */
+ widget_viewer_init(ecore_x_display_get(), 1, 0.01f, 1);
+ widget_viewer_add_event_handler(WidgetProviderWidgetEventCB, this);
+ widget_viewer_add_fault_handler(WidgetProviderWidgetFaultCB, this);
+}
+
+CWidgetManager::~CWidgetManager()
+{
+ widget_viewer_remove_fault_handler(WidgetProviderWidgetFaultCB);
+ widget_viewer_remove_event_handler(WidgetProviderWidgetEventCB);
+
+ widget_viewer_fini();
+}
+
+EAPI void CWidgetManager::Initialize()
+{
+ DbgPrint("Initialize");
+ mWidgetList = new CWidgetList;
+}
+
+EAPI int CWidgetManager::AddWidget(unsigned int id, const char *pkgname, const char *name, widget_size_type_e type, const char *content,
+ const char *icon, int pid, double period, int allow_duplicate)
+{
+ if(1 == widget_is_exists(pkgname))
+ {
+ void* handle = widget_viewer_add_widget(pkgname, NULL, WIDGET_DEFAULT_CLUSTER, WIDGET_DEFAULT_CATEGORY, period, type, WidgetProviderWidgetAddCB, this);
+
+ if(handle != NULL)
+ {
+ CWidget widget = CWidget::New(id, handle, pkgname, type, period);
+ widget.SignalDeleted().Connect(this, &CWidgetManager::OnWidgetDeleted);
+ widget.SignalReload().Connect(this, &CWidgetManager::OnWidgetReload);
+ mWidgetList->Add(handle, widget);
+
+ mSignalWidgetAdded.Emit(widget);
+ }
+
+ return 0;
+ }
+
+ return -1;
+}
+
+bool CWidgetManager::OnWidgetDeleted(WidgetViewerDali::CWidget& widget)
+{
+ unsigned int id = widget.GetWidgetId();
+ DbgPrint("widget[%d] deleted", id);
+
+ if(1 == widget_is_exists(widget.GetPkgName().c_str()))
+ {
+ if(widget.GetWidgetHandle())
+ {
+ int ret = widget_viewer_delete_widget(static_cast<widget_h >(widget.GetWidgetHandle()), WIDGET_DELETE_PERMANENTLY, WidgetProviderWidgetDeleteCB, this);
+ DbgPrint("call widget_viewer_delete_widget[%d]", ret);
+ }
+ }
+ else
+ {
+ mWidgetList->Remove(widget.GetWidgetHandle());
+ }
+
+ mSignalWidgetDeleted.Emit(widget);
+
+ return true;
+}
+
+bool CWidgetManager::OnWidgetReload(WidgetViewerDali::CWidget& widget)
+{
+ unsigned int id = widget.GetWidgetId();
+ DbgPrint("widget[%d] reload", id);
+
+ if(1 == widget_is_exists(widget.GetPkgName().c_str()))
+ {
+ widget_viewer_activate_faulted_widget(widget.GetPkgName().c_str(), WidgetProviderWidgetActivateCB, this);
+
+ void* handle = widget_viewer_add_widget(widget.GetPkgName().c_str(), widget.GetPkgName().c_str(), WIDGET_DEFAULT_CLUSTER, WIDGET_DEFAULT_CATEGORY, widget.GetPeriod(), widget.GetSizeType(), WidgetProviderWidgetAddCB, this);
+
+ if(widget.GetWidgetHandle())
+ {
+ int ret = widget_viewer_delete_widget(static_cast<widget_h >(widget.GetWidgetHandle()), WIDGET_DELETE_PERMANENTLY, WidgetProviderWidgetDeleteCB, this);
+ DbgPrint("call widget_viewer_delete_widget[%d]", ret);
+ }
+
+ if(handle != NULL)
+ {
+ mWidgetList->Update(widget.GetWidgetHandle(), handle, widget);
+ }
+ }
+
+ return true;
+}
+
+void CWidgetManager::WidgetEventCreated(void *handler)
+{
+ widget_h hWidget = static_cast<widget_h >(handler);
+ widget_viewer_set_visibility(hWidget, WIDGET_SHOW);
+}
+
+void CWidgetManager::WidgetEventUpdated(void *handler)
+{
+ unsigned int id = mWidgetList->GetWidgetId(handler);
+
+ DbgPrint("WidgetEventUpdated [%d]\n", id);
+
+ if(!id)
+ {
+ ErrPrint("widget is not valid");
+ return;
+ }
+
+ CWidget widget = mWidgetList->GetWidget(id);
+
+ unsigned int resource_id =0;
+ widget_viewer_get_resource_id(static_cast<widget_h>(handler), 0, &resource_id);
+ DbgPrint("resource_id, pixmap [%d,%d]", resource_id, widget.GetPixmap());
+ if(resource_id != widget.GetPixmap())
+ {
+ if(widget_viewer_acquire_resource_id(static_cast<widget_h>(handler), 0, WidgetProviderWidgetPixmapAcquiredCB, this) < 0)
+ {
+ DbgPrint("Failed to acquire pixmap\n");
+ }
+ }
+ else
+ {
+ if(resource_id != 0)
+ {
+ widget.UpdateByPixmap(resource_id);
+ }
+ else
+ {
+ ErrPrint("Failed to get widget");
+ return;
+ }
+ }
+}
+
+void CWidgetManager::WidgetEventDeleted(void *handler)
+{
+ unsigned int id = mWidgetList->GetWidgetId(handler);
+
+ DbgPrint("WidgetEventDeleted [%p] [%d]", handler, id);
+
+ if(!id)
+ {
+ ErrPrint("widget is not valid");
+ return;
+ }
+
+ CWidget widget = mWidgetList->GetWidget(id);
+
+ if(widget.IsFaulted())
+ {
+ widget.OnFault();
+
+ if(widget.GetPixmap() != 0) {
+ widget_viewer_release_resource_id((widget_h)handler, 0, widget.GetPixmap());
+ widget.SetPixmap(0);
+ }
+ }
+ else
+ {
+ if(widget.GetPixmap() != 0) {
+ widget_viewer_release_resource_id((widget_h)handler, 0, widget.GetPixmap());
+ widget.SetPixmap(0);
+ }
+
+ mWidgetList->Remove(widget.GetWidgetHandle());
+ }
+
+}
+
+
+void CWidgetManager::WidgetFaulted(const char *pkgname)
+{
+ if(!pkgname)
+ {
+ ErrPrint("invalid pkgname");
+ return;
+ }
+
+ std::vector<CWidget> list = mWidgetList->GetWidgetList(pkgname);
+ std::vector<CWidget>::iterator iter;
+
+ if(list.empty())
+ {
+ DbgPrint("No boxes that pkgname is[%s]", pkgname);
+ }
+ else
+ {
+ for (iter = list.begin(); iter != list.end(); iter++)
+ {
+ if(iter->IsFaulted())
+ {
+ DbgPrint("Already faulted widget[%d][%s]", iter->GetWidgetId(), iter->GetPkgName().c_str());
+ }
+ else
+ {
+ DbgPrint("Set faulted widget[%d][%s]", iter->GetWidgetId(), iter->GetPkgName().c_str());
+ iter->SetFault(true);
+ }
+ }
+ }
+}
+
+void CWidgetManager::EventPixmapAcquired(void *handler, unsigned int pixmapId)
+{
+ DbgPrint("EventPixmapAcquired [%p] [%d]\n", handler, pixmapId);
+ unsigned int id = mWidgetList->GetWidgetId(handler);
+
+ if(!id)
+ {
+ ErrPrint("widget is not valid");
+ return;
+ }
+
+ CWidget widget = mWidgetList->GetWidget(id);
+
+ if(widget.GetPixmap())
+ {
+ ErrPrint("Release pixmap [%d]", widget.GetPixmap());
+ widget_viewer_release_resource_id(static_cast<widget_h>(handler), 0, widget.GetPixmap());
+ }
+
+ if(pixmapId != 0)
+ {
+ widget.UpdateByPixmap(pixmapId);
+ }
+ else
+ {
+ ErrPrint("Failed to get widget");
+ return;
+ }
+}
+
+EAPI CWidgetManager* CWidgetManager::GetInstance()
+{
+ if(m_pInstance == NULL)
+ {
+ m_pInstance = new CWidgetManager;
+ }
+
+ return m_pInstance;
+}
+
+}
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: widget_viewer_dali
+Description: Support development of the widget Viewer DALi library
+Version: @VERSION@
+Requires: widget_service widget_viewer
+Libs: -L${libdir} -lwidget_viewer_dali
+Cflags: -I${includedir}
+cppflags: -I${includedir}
*
* First of all, the Tizen Platform uses the EFL as a core UIFW.
* So this API set also based on the EFL.
+ *
+ * @section CAPI_WIDGET_VIEWER_EVAS_MODULE_FEATURE Related Features
+ * This API is related with the following feature:
+ * - http://tizen.org/feature/shell.appwidget
*/
/**
* @since_tizen 2.3.1
- * @brief Event names for smart callback of widget events. You can listen some events from widget by calling evas_object_smart_callback_add.
+ * @brief Event name for smart callback of widget events: Widget creation is aborted
* @see #widget_evas_event_info_s
* @see evas_object_smart_callback_add
*/
-#define WIDGET_SMART_SIGNAL_WIDGET_CREATE_ABORTED "widget,create,aborted" /**< Widget creation is aborted */
-#define WIDGET_SMART_SIGNAL_WIDGET_CREATED "widget,created" /**< Widget is created */
-#define WIDGET_SMART_SIGNAL_WIDGET_RESIZE_ABORTED "widget,resize,aborted" /**< Resizing widget is aborted */
-#define WIDGET_SMART_SIGNAL_WIDGET_RESIZED "widget,resized" /**< Widget is resized */
-#define WIDGET_SMART_SIGNAL_WIDGET_FAULTED "widget,faulted" /**< Widget has faulted */
-#define WIDGET_SMART_SIGNAL_UPDATED "updated" /**< Widget content is updated */
-#define WIDGET_SMART_SIGNAL_EXTRA_INFO_UPDATED "info,updated" /**< Widget extra info is updated */
-#define WIDGET_SMART_SIGNAL_PROVIDER_DISCONNECTED "provider,disconnected" /**< Provider is disconnected */
-#define WIDGET_SMART_SIGNAL_CONTROL_SCROLLER "control,scroller" /**< Control Scroller */
-#define WIDGET_SMART_SIGNAL_WIDGET_DELETED "widget,deleted" /**< Widget is deleted */
-#define WIDGET_SMART_SIGNAL_PERIOD_CHANGED "widget,period,changed" /**< Period is changed */
+#define WIDGET_SMART_SIGNAL_WIDGET_CREATE_ABORTED "widget,create,aborted"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Widget is created
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_WIDGET_CREATED "widget,created"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Resizing widget is aborted
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_WIDGET_RESIZE_ABORTED "widget,resize,aborted"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Widget is resized
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_WIDGET_RESIZED "widget,resized"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Widget has faulted
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_WIDGET_FAULTED "widget,faulted"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Widget content is updated
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_UPDATED "updated"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Widget extra info is updated
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_EXTRA_INFO_UPDATED "info,updated"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Provider is disconnected
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_PROVIDER_DISCONNECTED "provider,disconnected"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Control Scroller
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_CONTROL_SCROLLER "control,scroller"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Widget is deleted
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_WIDGET_DELETED "widget,deleted"
+
+/**
+ * @since_tizen 2.3.1
+ * @brief Event name for smart callback of widget events: Period is changed
+ * @see #widget_evas_event_info_s
+ * @see evas_object_smart_callback_add
+ */
+#define WIDGET_SMART_SIGNAL_PERIOD_CHANGED "widget,period,changed"
/**
* @since_tizen 2.3.1
*/
extern void widget_viewer_evas_cancel_click_event(Evas_Object *widget);
-/*
+/**
* @brief Hides the preview of the widget
* @remarks This function should be called right after create the widget object before resizing it
* @since_tizen 2.3.1
#define WIDGET_VIEWER_EVAS_SHARED_CONTENT 0x0002 /**< Multiple instances will share the content of one real instance */
#define WIDGET_VIEWER_EVAS_SUPPORT_GBAR 0x0004 /**< GBAR will be used */
+#define WIDGET_VIEWER_EVAS_DISABLE_SCROLLER 0x4000
+
typedef enum widget_access_result {
WIDGET_ACCESS_RESULT_DONE = 0x00,
WIDGET_ACCESS_RESULT_FIRST = 0x01,
*/
extern int widget_viewer_evas_hide_overlay(Evas_Object *widget);
+extern int widget_viewer_evas_hide_faulted_overlay_once(Evas_Object *widget);
#ifdef __cplusplus
}
#endif
#define _(str) gettext(str)
#endif
-
#if !defined(DbgPrint)
#define DbgPrint(format, arg...) SECURE_LOGD(format, ##arg)
#endif
*/
#define CLICK_REGION WIDGET_CONF_CLICK_REGION
+#if defined(__LP64__) || defined(_LP64)
+#define PTR_TYPE(a) ((long long)(a))
+#else
+#define PTR_TYPE(a) ((int)(a))
+#endif
+
static struct {
Evas_Smart_Class sc;
Evas_Smart *smart;
unsigned int render_animator:1;
unsigned int auto_render_selector:1;
unsigned int skip_acquire:1;
+ unsigned int disable_internal_scroller: 1;
- unsigned int reserved:18;
+ unsigned int reserved:17;
} field;
unsigned int mask;
} conf;
Eina_List *gbar_dirty_objects;
Eina_List *subscribed_category_list;
Eina_List *subscribed_group_list;
+ Eina_List *updated_pixmap_list;
+ Eina_List *updated_pixmap_lock_list;
int initialized;
} s_info = {
.gbar_dirty_objects = NULL,
.subscribed_category_list = NULL,
.subscribed_group_list = NULL,
+ .updated_pixmap_list = NULL,
+ .updated_pixmap_lock_list = NULL,
.initialized = 0,
};
unsigned int hide_overlay_manually:1;
- unsigned int reserved: 1;
+ /**
+ * @note
+ * Do not raise up the overlay for faulted.
+ */
+ unsigned int hide_faulted_overlay: 1;
} field; /* Do we really have the performance loss because of bit fields? */
unsigned int flags;
data->overlay_timer = NULL;
}
- if (data->stage) {
- DbgPrint("Remove Stage\n");
- evas_object_del(data->stage);
- }
-
if (data->widget_layout) {
Evas_Object *content;
DbgPrint("Remove WIDGET Layout\n");
evas_object_del(data->widget_layout);
+ } else {
+ DbgPrint("Layout is already deleted\n");
}
if (data->gbar_layout) {
}
DbgPrint("Remove GBAR Layout\n");
evas_object_del(data->gbar_layout);
+ } else {
+ DbgPrint("GBar layout is already deleted\n");
+ }
+
+ if (data->stage) {
+ DbgPrint("Remove Stage\n");
+ evas_object_del(data->stage);
+ } else {
+ DbgPrint("Stage is already deleted\n");
}
if (data->widget_fb) {
}
}
+static void gbar_layout_del_cb(void *_data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ struct widget_data *data = _data;
+ DbgPrint("GBar layout is deleted(%p - %p)\n", data->gbar_layout, obj);
+ /**
+ * @note
+ * We should not access the data->gbar_layout in this function.
+ * We can only believe the "obj" now..
+ */
+ evas_object_smart_member_del(obj);
+ evas_object_clip_unset(obj);
+ data->gbar_layout = NULL;
+}
+
static void __widget_create_gbar_cb(struct widget *handle, int ret, void *cbdata)
{
struct widget_data *data = cbdata;
widget_unref(data);
return;
}
+ evas_object_event_callback_add(data->gbar_layout, EVAS_CALLBACK_DEL, gbar_layout_del_cb, data);
if (elm_layout_file_set(data->gbar_layout, WIDGET_VIEWER_EVAS_RESOURCE_EDJ, WIDGET_VIEWER_EVAS_RESOURCE_GBAR) == EINA_FALSE) {
ErrPrint("Failed to load edje object: %s(%s)\n", WIDGET_VIEWER_EVAS_RESOURCE_EDJ, WIDGET_VIEWER_EVAS_RESOURCE_GBAR);
data = widget_unref(data);
}
} else if (data->is.field.cancel_click == CANCEL_DISABLED) {
- ret = widget_viewer_send_click_event(data->handle, minfo.x, minfo.y);
+ ret = widget_viewer_send_click_event(data->handle, WIDGET_VIEWER_CLICK_BUTTON_LEFT, minfo.x, minfo.y);
}
}
}
}
+static void widget_layout_del_cb(void *_data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ struct widget_data *data = _data;
+ DbgPrint("Layout is deleted (%p - %p)\n", data->widget_layout, obj);
+ evas_object_smart_member_del(obj);
+ evas_object_clip_unset(obj);
+ data->widget_layout = NULL;
+}
+
+static void stage_del_cb(void *_data, Evas *e, Evas_Object *obj, void *event_info)
+{
+ struct widget_data *data = _data;
+
+ DbgPrint("Stage is deleted (%p - %p)\n", data->stage, obj);
+ if (data->widget_layout) {
+ evas_object_clip_unset(data->widget_layout);
+ }
+
+ evas_object_smart_member_del(obj);
+ data->stage = NULL;
+}
+
static void __widget_data_setup(struct widget_data *data)
{
data->e = evas_object_evas_get(data->widget);
return;
}
- if (s_info.conf.field.is_scroll_x || s_info.conf.field.is_scroll_y) {
+ if (!s_info.conf.field.disable_internal_scroller && (s_info.conf.field.is_scroll_x || s_info.conf.field.is_scroll_y)) {
Evas_Object *scroller;
scroller = elm_scroller_add(data->parent);
if (scroller) {
evas_object_smart_member_add(data->widget_layout, data->widget);
evas_object_clip_set(data->widget_layout, data->stage);
+ evas_object_event_callback_add(data->widget_layout, EVAS_CALLBACK_DEL, widget_layout_del_cb, data);
+ evas_object_event_callback_add(data->stage, EVAS_CALLBACK_DEL, stage_del_cb, data);
}
static Eina_Bool renderer_cb(void *_data)
}
if (widget_viewer_get_visibility(data->handle) != WIDGET_SHOW) {
- DbgPrint("Box is not visible\n");
+ DbgPrint("Box[%s] is not visible\n", data->widget_id);
return;
}
} else {
delete_type = WIDGET_DELETE_TEMPORARY;
}
- DbgPrint("Send delete request (0x%X)\n", delete_type);
+ DbgPrint("Send delete request (0x%X) - %s\n", delete_type, data->widget_id);
if (data->is.field.created) {
if (widget_viewer_delete_widget(data->handle, delete_type, __widget_destroy_widget_cb, widget_ref(data)) < 0) {
if (!s_info.conf.field.skip_acquire) {
free(acquire_data);
}
+
+ if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) {
+ if (!eina_list_data_find(s_info.updated_pixmap_list, (void *)(PTR_TYPE(pixmap)))) {
+ s_info.updated_pixmap_list = eina_list_append(s_info.updated_pixmap_list, (void *)(PTR_TYPE(pixmap)));
+ }
+ }
}
static void __widget_update_pixmap_object(struct widget_data *data, Evas_Object *widget_content, int w, int h)
struct acquire_data *acquire_data;
if (data->widget_latest_idx == WIDGET_PRIMARY_BUFFER) {
- unsigned int resource_id;
+ unsigned int resource_id = 0u;
+
+ if (widget_viewer_get_resource_id(data->handle, 0, &resource_id) < 0) {
+ ErrPrint("Failed to get resource_id\n");
+ } else if (resource_id > 0) {
+ if (data->widget_pixmap == resource_id) {
+ if (data->widget_extra) {
+ /* Just replace the pixmap in this case, do not release old pixmap */
+ replace_pixmap(NULL, 0, widget_content, data->widget_pixmap);
+ }
+
+ update_widget_pixmap(widget_content, w, h);
- widget_viewer_get_resource_id(data->handle, 0, &resource_id);
- if (data->widget_pixmap == resource_id) {
- if (data->widget_extra) {
- /* Just replace the pixmap in this case, do not release old pixmap */
- replace_pixmap(NULL, 0, widget_content, data->widget_pixmap);
+ if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) {
+ if (!eina_list_data_find(s_info.updated_pixmap_list, (void *)(PTR_TYPE(resource_id)))) {
+ s_info.updated_pixmap_list = eina_list_append(s_info.updated_pixmap_list, (void *)(PTR_TYPE(resource_id)));
+ }
+ }
+ return;
}
- update_widget_pixmap(widget_content, w, h);
- return;
- }
+ if (s_info.conf.field.skip_acquire && resource_id != 0) {
+ struct acquire_data local_acquire_data = {
+ .data = widget_ref(data),
+ .content = widget_content,
+ .w = w,
+ .h = h,
+ };
- if (s_info.conf.field.skip_acquire && resource_id != 0) {
- struct acquire_data local_acquire_data = {
- .data = widget_ref(data),
- .content = widget_content,
- .w = w,
- .h = h,
- };
+ /**
+ * @note
+ * Resource lock will be acquired from below callback.
+ */
+ acquire_widget_pixmap_cb(data->handle, resource_id, &local_acquire_data);
+ return;
+ }
- acquire_widget_pixmap_cb(data->handle, resource_id, &local_acquire_data);
- return;
- }
+ if (data->is.field.widget_pixmap_acquire_requested) {
+ DbgPrint("Pixmap is not acquired (in-process)\n");
+ return;
+ }
- if (data->is.field.widget_pixmap_acquire_requested) {
- DbgPrint("Pixmap is not acquired\n");
- return;
- }
+ acquire_data = malloc(sizeof(*acquire_data));
+ if (!acquire_data) {
+ ErrPrint("malloc: %d\n", errno);
+ return;
+ }
- acquire_data = malloc(sizeof(*acquire_data));
- if (!acquire_data) {
- ErrPrint("malloc: %d\n", errno);
- return;
- }
+ acquire_data->data = widget_ref(data);
+ acquire_data->content = widget_content;
+ acquire_data->w = w;
+ acquire_data->h = h;
- acquire_data->data = widget_ref(data);
- acquire_data->content = widget_content;
- acquire_data->w = w;
- acquire_data->h = h;
+ ret = widget_viewer_acquire_resource_id(data->handle, 0, acquire_widget_pixmap_cb, acquire_data);
+ if (ret != WIDGET_ERROR_NONE) {
+ widget_unref(data);
+ free(acquire_data);
+ } else {
+ data->is.field.widget_pixmap_acquire_requested = 1;
+ }
- ret = widget_viewer_acquire_resource_id(data->handle, 0, acquire_widget_pixmap_cb, acquire_data);
- if (ret != WIDGET_ERROR_NONE) {
- widget_unref(data);
- free(acquire_data);
- } else {
- data->is.field.widget_pixmap_acquire_requested = 1;
+ /**
+ * @note
+ * Resource lock should be acquired from acquire_widget_pixmap_cb
+ */
}
} else {
if (!data->widget_extra) {
replace_pixmap(NULL, 0, widget_content, data->widget_extra[data->widget_latest_idx]);
update_widget_pixmap(widget_content, w, h);
+ if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) {
+ if (!eina_list_data_find(s_info.updated_pixmap_list, (void *)(PTR_TYPE(data->widget_extra[data->widget_latest_idx])))) {
+ s_info.updated_pixmap_list = eina_list_append(s_info.updated_pixmap_list, (void *)(PTR_TYPE(data->widget_extra[data->widget_latest_idx])));
+ }
+ }
}
+
}
static int widget_system_created(struct widget *handle, struct widget_data *data)
if (!data->is.field.faulted) {
data->is.field.faulted = 1;
+
+ DbgPrint("Display tap to load (%p) [%s]\n", data, data->widget_id);
+ smart_callback_call(data, WIDGET_SMART_SIGNAL_WIDGET_CREATE_ABORTED, &fault_event);
+
__widget_overlay_faulted(data);
- }
+ } else {
+ smart_callback_call(data, WIDGET_SMART_SIGNAL_WIDGET_CREATE_ABORTED, &fault_event);
- DbgPrint("Display tap to load (%p) [%s]\n", data, data->widget_id);
- smart_callback_call(data, WIDGET_SMART_SIGNAL_WIDGET_CREATE_ABORTED, &fault_event);
+ /**
+ * @note
+ * While processing the faulted smart callback, the user can request hide_faulted_overlay
+ * So we should reset it from here. in other cases, the widget_overlay_faulted function deals with this.
+ */
+ data->is.field.hide_faulted_overlay = 0;
+ }
ret = WIDGET_ERROR_FAULT;
} else {
Evas_Object *overlay;
widget_type_e widget_type;
+ if (data->is.field.hide_faulted_overlay == 1) {
+ DbgPrint("Faulted overlay is hidden by request (%s)\n", data->widget_id);
+ data->is.field.hide_faulted_overlay = 0;
+ return;
+ }
+
if (data->is.field.widget_overlay_loaded) {
__widget_overlay_disable(data, 1, 1);
}
if (!strcmp(data->widget_id, pkgname)) {
DbgPrint("Faulted: %s (%p)\n", pkgname, data);
data->is.field.faulted = 1;
- __widget_overlay_faulted(data);
+
info.error = WIDGET_ERROR_FAULT;
info.widget_app_id = data->widget_id;
info.event = WIDGET_FAULT_DEACTIVATED;
+
smart_callback_call(data, WIDGET_SMART_SIGNAL_WIDGET_FAULTED, &info);
+
+ __widget_overlay_faulted(data);
}
}
break;
if (!strcmp(data->widget_id, pkgname)) {
DbgPrint("Disconnected: %s (%p)\n", pkgname, data);
data->is.field.faulted = 1;
- __widget_overlay_faulted(data);
+
info.error = WIDGET_ERROR_FAULT;
info.widget_app_id = data->widget_id;
info.event = WIDGET_FAULT_PROVIDER_DISCONNECTED;
+
smart_callback_call(data, WIDGET_SMART_SIGNAL_PROVIDER_DISCONNECTED, &info);
+
+ __widget_overlay_faulted(data);
}
}
break;
return 0;
}
+static void evas_render_post_cb(void *data, Evas *e, void *event_info)
+{
+ widget_resource_lock_t handle;
+
+ EINA_LIST_FREE(s_info.updated_pixmap_lock_list, handle) {
+ widget_service_release_resource_lock(handle);
+ widget_service_destroy_resource_lock(handle, 0);
+ }
+}
+
+static void evas_render_pre_cb(void *data, Evas *e, void *event_info)
+{
+ widget_resource_lock_t handle;
+ void *pixmap;
+
+ EINA_LIST_FREE(s_info.updated_pixmap_list, pixmap) {
+ handle = widget_service_create_resource_lock((unsigned int)(PTR_TYPE(pixmap)), WIDGET_LOCK_READ);
+ if (handle) {
+ widget_service_acquire_resource_lock(handle);
+ s_info.updated_pixmap_lock_list = eina_list_append(s_info.updated_pixmap_lock_list, handle);
+ } else {
+ ErrPrint("Failed to create a resource lock\n");
+ }
+ }
+}
+
EAPI int widget_viewer_evas_init(Evas_Object *win)
{
int ret;
s_info.conf.field.force_to_buffer = 0;
s_info.win = win;
+ if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) {
+ Evas *e;
+ e = evas_object_evas_get(win);
+ if (e) {
+ evas_event_callback_add(e, EVAS_CALLBACK_RENDER_PRE, evas_render_pre_cb, NULL);
+ evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, evas_render_post_cb, NULL);
+ }
+ }
+
return ret;
}
}
if (s_info.initialized) {
+ if (WIDGET_CONF_ENABLE_RESOURCE_LOCK && s_info.win) {
+ Evas *e;
+ e = evas_object_evas_get(s_info.win);
+ if (e) {
+ evas_event_callback_del(e, EVAS_CALLBACK_RENDER_PRE, evas_render_pre_cb);
+ evas_event_callback_del(e, EVAS_CALLBACK_RENDER_POST, evas_render_post_cb);
+ }
+ }
+
widget_viewer_remove_event_handler(widget_event_handler);
widget_viewer_remove_fault_handler(widget_fault_handler);
widget_viewer_fini();
s_info.conf.field.skip_acquire = !!value;
DbgPrint("Turn %s skip-acquire option\n", s_info.conf.field.skip_acquire ? "on" : "off");
break;
+ case WIDGET_VIEWER_EVAS_DISABLE_SCROLLER:
+ s_info.conf.field.disable_internal_scroller = !!value;
+ DbgPrint("Turn %s internal_scroller option\n", s_info.conf.field.disable_internal_scroller ? "off" : "on");
+ break;
default:
ret = WIDGET_ERROR_INVALID_PARAMETER;
break;
return WIDGET_ERROR_NONE;
}
+/**
+ * @note
+ * This function must has to be called after the object is faulted.
+ * And this will not reset the faulted flag. it just dislable the faulted overlay if it is exists.
+ *
+ * The best usage of this function is called from smart-callback.
+ * Any faulted smart callback can call this.
+ * Then the widget_viewer_evas will check the flag to decide whether enable the faulted overlay or not.
+ */
+EAPI int widget_viewer_evas_hide_faulted_overlay_once(Evas_Object *widget)
+{
+ struct widget_data *data;
+
+ if (!is_widget_feature_enabled()) {
+ return WIDGET_ERROR_NOT_SUPPORTED;
+ }
+
+ if (!s_info.initialized) {
+ return WIDGET_ERROR_FAULT;
+ }
+
+ data = get_smart_data(widget);
+ if (!data) {
+ ErrPrint("Invalid object\n");
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ if (data->is.field.faulted == 0) {
+ ErrPrint("Object is not faulted\n");
+ return WIDGET_ERROR_INVALID_PARAMETER;
+ }
+
+ /**
+ * @note
+ * If the overlay (faulted) is already enabled,
+ * Turn it off first.
+ */
+ if (data->is.field.widget_overlay_loaded) {
+ DbgPrint("Faulted overlay is disabled\n");
+ __widget_overlay_disable(data, 1, 1);
+ }
+
+ /**
+ * This flag will be checked before enable the faulted overlay.
+ * And this will be reset'd right after ignore the faulted overlay.
+ */
+ data->is.field.hide_faulted_overlay = 1;
+ return WIDGET_ERROR_NONE;
+}
+
/* End of a file */
#define ErrPrint(format, arg...) SECURE_LOGE(format, ##arg)
#else
extern FILE *__file_log_fp;
-#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [\e[32m%s/%s\e[0m:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
+#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [\e[32m%s/%s\e[0m:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
-#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [\e[32m%s/%s\e[0m:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
+#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [\e[32m%s/%s\e[0m:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0)
#endif
org.tizen.widget_viewer_sdk syspopup::db rw---- ------
org.tizen.widget_viewer_sdk dbus rwx--- ------
org.tizen.widget_viewer_sdk pulseaudio rwxat- ------
-org.tizen.widget_viewer_sdk ail::db rw---- ------
org.tizen.widget_viewer_sdk connman r----- ------
org.tizen.widget_viewer_sdk system rwx--- ------
org.tizen.widget_viewer_sdk immvibed rw---- ------
org.tizen.widget_viewer_sdk org.tizen.clocksetting rwx--- ------
org.tizen.widget_viewer_sdk org.tizen.clocksetting::default-resources r-x--- ------
org.tizen.widget_viewer_sdk e17 r-x--- ------
-org.tizen.widget_viewer_sdk system::vconf rwx--- ------
-org.tizen.widget_viewer_sdk system::vconf_setting rw---- ------
-org.tizen.widget_viewer_sdk system::vconf_inhouse rw---- ------
-org.tizen.widget_viewer_sdk system::vconf_multimedia rw---- ------
org.tizen.widget_viewer_sdk deviced rwx--- ------
org.tizen.widget_viewer_sdk deviced::display rw---- ------
-org.tizen.widget_viewer_sdk testmode::vconf r----- ------
org.tizen.widget_viewer_sdk data-provider-master::db rw---- ------
-org.tizen.widget_viewer_sdk data-provider-master::share rwxat- ------
org.tizen.widget_viewer_sdk data-provider-master::data r-x--- ------
org.tizen.widget_viewer_sdk data-provider-master::client rw---- ------
org.tizen.widget_viewer_sdk data-provider-master rw---- ------
system org.tizen.widget_viewer_sdk -w---- ------
org.tizen.data-provider-slave org.tizen.widget_viewer_sdk rwx--- ------
org.tizen.widget_viewer_sdk system::homedir rwx--- ------
+org.tizen.widget_viewer_sdk tizen::vconf::setting::admin r----l ------
#include <widget_service.h>
#include <widget_service_internal.h>
#include <widget_conf.h>
+#include <widget_util.h>
#include <widget_viewer_evas.h>
#include <vconf.h>
#include <bundle.h>
#define LAZY_WATCH_TIME 3.0f
#define CR 13
#define LF 10
+#if !defined(VCONFKEY_WMS_CLOCKS_SET_IDLE)
+#define VCONFKEY_WMS_CLOCKS_SET_IDLE "db/wms/clocks_set_idle"
+#endif
static struct info {
int w;