#include <new>
#include <livebox.h>
+#include <livebox-service.h>
#include <FBaseColLinkedListT.h>
#include <FBaseSysLog.h>
#include <FBaseString.h>
#include <FGrpPoint.h>
#include <FGrpRectangle.h>
#include <FUiAnimVisualElementPropertyAnimation.h>
+#include <FBase_StringConverter.h>
#include <FGrp_BitmapImpl.h>
#include <FMedia_ImageDecoder.h>
#include "FUi_TouchFlickGestureDetector.h"
__pAppIconBitmap = move(pBitmap);
- unique_ptr<_TouchFlickGestureDetector> pTouchFlickGestureDetector(new (std::nothrow) _TouchFlickGestureDetector());
- SysTryReturn(NID_UI_CTRL, pTouchFlickGestureDetector, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+ __pAppWidget = __pAppWidgetViewManager->AddAppWidgetView(this, userInfo);
+ r = GetLastResult();
+ SysTryReturn(NID_UI_CTRL, __pAppWidget, r, r, "[%s] Propagating.", GetErrorMessage(r));
- pTouchFlickGestureDetector->SetDelayTouchEventEnabled(true);
- pTouchFlickGestureDetector->SetCancelTouchEventOnSuccessEnabled(true);
+ if (livebox_has_pd(__pAppWidget))
+ {
+ unique_ptr<_TouchFlickGestureDetector> pTouchFlickGestureDetector(new (std::nothrow) _TouchFlickGestureDetector());
+ SysTryReturn(NID_UI_CTRL, pTouchFlickGestureDetector, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
- r = AddGestureDetector(*pTouchFlickGestureDetector.get());
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ pTouchFlickGestureDetector->SetDelayTouchEventEnabled(true);
+ pTouchFlickGestureDetector->SetCancelTouchEventOnSuccessEnabled(true);
- r = pTouchFlickGestureDetector->AddGestureListener(*this);
- SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ r = AddGestureDetector(*pTouchFlickGestureDetector.get());
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- __pTouchFlickGestureDetector = move(pTouchFlickGestureDetector);
+ r = pTouchFlickGestureDetector->AddGestureListener(*this);
+ SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- __pAppWidget = __pAppWidgetViewManager->AddAppWidgetView(this, userInfo);
- r = GetLastResult();
- SysTryReturn(NID_UI_CTRL, __pAppWidget, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ __pTouchFlickGestureDetector = move(pTouchFlickGestureDetector);
+ }
Bitmap* pResourceBitmap = null;
SysLog(NID_UI_CTRL, "[%d %d]", lower, upper);
}
+bool
+_AppWidgetView::IsTouchEventEnabled(void) const
+{
+ unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(GetAppId()));
+ int ret = livebox_service_mouse_event(pAppId.get());
+
+ return ( ret == 1 );
+}
+
+bool
+_AppWidgetView::IsTouchEffectEnabled(void) const
+{
+ unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(GetAppId()));
+ int ret = livebox_service_touch_effect(pAppId.get());
+
+ return ( ret == 1 );
+}
+
result
_AppWidgetView::OnAttachedToMainTree(void)
{
_AppWidgetView::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
{
int type = livebox_lb_type(__pAppWidget);
- if ((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP))
+ if (((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP)) && IsTouchEventEnabled())
{
double x = 0.0;
double y = 0.0;
Point position(_CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition()));
FloatPoint floatPosition(static_cast<float>(position.x), static_cast<float>(position.y));
- if (clientBounds.Contains(floatPosition))
+ if (clientBounds.Contains(floatPosition) && IsTouchEffectEnabled())
{
PlayClickAnimation();
}
GetTouchPostion(floatPosition, x, y);
int type = livebox_lb_type(__pAppWidget);
- if ((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP))
+ if (((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP)) && IsTouchEventEnabled())
{
livebox_content_event(__pAppWidget, LB_MOUSE_UP, x, y);
}
_AppWidgetView::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
{
int type = livebox_lb_type(__pAppWidget);
- if ((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP))
+ if (((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP)) && IsTouchEventEnabled())
{
double x = 0.0;
double y = 0.0;