2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FShell_AppWidgetView.cpp
19 * @brief This is the implementation file for the _AppWidgetView class.
24 #include <livebox-service.h>
25 #include <FBaseColLinkedListT.h>
26 #include <FBaseSysLog.h>
27 #include <FBaseString.h>
28 #include <FGrpBitmap.h>
29 #include <FGrpCanvas.h>
30 #include <FGrpDimension.h>
31 #include <FGrpPoint.h>
32 #include <FGrpRectangle.h>
33 #include <FUiAnimVisualElementPropertyAnimation.h>
34 #include <FBase_StringConverter.h>
35 #include <FGrp_BitmapImpl.h>
36 #include <FMedia_ImageDecoder.h>
37 #include <FUi_TouchFlickGestureDetector.h>
38 #include <FUi_ResourceManager.h>
39 #include <FUi_CoordinateSystemUtils.h>
40 #include <FUiAnim_EflNode.h>
41 #include <FUiAnim_VisualElementImpl.h>
42 #include <FUiAnim_VisualElementSurfaceImpl.h>
43 #include <FUiCtrl_Frame.h>
44 #include "FShell_IAppWidgetViewEventListener.h"
45 #include "FShell_AppWidgetManagerImpl.h"
46 #include "FShell_AppWidgetView.h"
47 #include "FShell_AppWidgetViewPresenter.h"
48 #include "FShell_AppWidgetPopupView.h"
49 #include "FShell_AppWidgetViewManager.h"
52 using namespace Tizen::App;
53 using namespace Tizen::Base;
54 using namespace Tizen::Base::Collection;
55 using namespace Tizen::Graphics;
56 using namespace Tizen::Ui;
57 using namespace Tizen::Ui::Controls;
58 using namespace Tizen::Ui::Animations;
59 using namespace Tizen::Media;
61 namespace Tizen { namespace Shell
64 const int ANIMATION_DURATION = 200;
65 const wchar_t* CLICK_ANIMATION = L"Click";
66 const wchar_t* FLICK_ANIMATION = L"Flick";
68 _AppWidgetView::_AppWidgetView(void)
69 : __pAppWidgetViewPresenter(new (std::nothrow) _AppWidgetViewPresenter(*this))
71 , __pAppWidgetViewManager(null)
72 , __resizeFromRemote(false)
75 , __pAppWidgetViewEventListenerList(new (std::nothrow) LinkedListT<_IAppWidgetViewEventListener*>)
77 __pAppWidgetViewManager = _AppWidgetViewManager::GetInstance();
78 SysTryReturnVoidResult(NID_UI_CTRL, __pAppWidgetViewManager, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
81 _AppWidgetView::~_AppWidgetView(void)
83 __pAppWidgetViewManager->RemoveAppWidgetView(this);
85 if (__pAppWidgetPopupView)
87 __pAppWidgetPopupView->RemoveAppWidgetPopupEventListener(*this);
90 if (__pTouchFlickGestureDetector)
92 RemoveGestureDetector(*__pTouchFlickGestureDetector);
97 _AppWidgetView::CreateAppWidgetViewN(void)
99 unique_ptr<_AppWidgetView> pAppWidgetView(new (std::nothrow) _AppWidgetView());
100 SysTryReturn(NID_UI_CTRL, pAppWidgetView, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
102 result r = GetLastResult();
103 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
105 pAppWidgetView->AcquireHandle();
107 SetLastResult(E_SUCCESS);
109 return pAppWidgetView.release();
113 _AppWidgetView::Initialize(const AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const String& userInfo)
115 SysLog(NID_UI_CTRL, "appId [%ls]", appId.GetPointer());
116 SysLog(NID_UI_CTRL, "providerName [%ls]", providerName.GetPointer());
117 SysLog(NID_UI_CTRL, "[%d %d %d %d]", rect.x, rect.y, rect.width, rect.height);
118 SysLog(NID_UI_CTRL, "userInfo [%ls]", userInfo.GetPointer());
120 result r = SetBounds(rect);
121 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
123 r = __pAppWidgetViewPresenter->Initialize(appId, providerName);
124 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
129 unique_ptr<ByteBuffer> pByteBuffer(_ImageDecoder::DecodeToBufferN(__pAppWidgetViewPresenter->GetAppIconPath(), MEDIA_PIXEL_FORMAT_BGRA8888, width, height));
130 unique_ptr<Bitmap> pBitmap(_BitmapImpl::GetNonScaledBitmapN(*pByteBuffer.get(), Dimension(width, height), BITMAP_PIXEL_FORMAT_ARGB8888));
132 __pAppIconBitmap = move(pBitmap);
134 __pAppWidget = __pAppWidgetViewManager->AddAppWidgetView(this, userInfo);
136 SysTryReturn(NID_UI_CTRL, __pAppWidget, r, r, "[%s] Propagating.", GetErrorMessage(r));
138 if (!IsTouchEventEnabled())
140 unique_ptr<_TouchFlickGestureDetector> pTouchFlickGestureDetector(new (std::nothrow) _TouchFlickGestureDetector());
141 SysTryReturn(NID_UI_CTRL, pTouchFlickGestureDetector, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
143 pTouchFlickGestureDetector->SetDelayTouchEventEnabled(true);
144 pTouchFlickGestureDetector->SetCancelTouchEventOnSuccessEnabled(true);
146 r = AddGestureDetector(*pTouchFlickGestureDetector.get());
147 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
149 r = pTouchFlickGestureDetector->AddGestureListener(*this);
150 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
152 __pTouchFlickGestureDetector = move(pTouchFlickGestureDetector);
155 Bitmap* pResourceBitmap = null;
157 r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_UP, BITMAP_PIXEL_FORMAT_ARGB8888, pResourceBitmap);
158 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
160 std::unique_ptr<Bitmap> pArrowUpBitmap(pResourceBitmap);
162 r = GET_BITMAP_CONFIG_N(LIVEBOX::POPUP_BG_ARROW_DOWN, BITMAP_PIXEL_FORMAT_ARGB8888, pResourceBitmap);
163 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
165 __pArrowUpBitmap = move(pArrowUpBitmap);
166 __pArrowDownBitmap.reset(pResourceBitmap);
171 AppWidgetProviderInfo*
172 _AppWidgetView::GetAppWidgetProviderInfoN(void) const
174 AppWidgetProviderInfo* pProviderInfo = _AppWidgetManagerImpl::GetInstance()->GetAppWidgetProviderInfoN(GetAppId(), GetProviderName());
175 result r = GetLastResult();
176 SysTryReturn(NID_UI_CTRL, pProviderInfo, null, r, "[%s] Propagating.", GetErrorMessage(r));
178 return pProviderInfo;
182 _AppWidgetView::AddAppWidgetViewEventListener(_IAppWidgetViewEventListener& listener)
184 bool exist = __pAppWidgetViewEventListenerList->Contains(&listener);
185 SysTryReturn(NID_UI_CTRL, exist == false, E_OBJ_ALREADY_EXIST, E_OBJ_ALREADY_EXIST, "[%s] Propagating.", GetErrorMessage(E_OBJ_ALREADY_EXIST));
187 __pAppWidgetViewEventListenerList->Add(&listener);
193 _AppWidgetView::RemoveAppWidgetViewEventListener(_IAppWidgetViewEventListener& listener)
195 result r = __pAppWidgetViewEventListenerList->Remove(&listener);
196 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] Propagating.", GetErrorMessage(E_OBJ_NOT_FOUND));
202 _AppWidgetView::GetAppWidgetPopup(void) const
204 return __pAppWidgetPopupView.get();
208 _AppWidgetView::GetAppId(void) const
210 return __pAppWidgetViewPresenter->GetAppId();
214 _AppWidgetView::GetAppWidgetId(void) const
216 return __pAppWidgetViewPresenter->GetAppWidgetId();
220 _AppWidgetView::GetProviderName(void) const
222 return __pAppWidgetViewPresenter->GetProviderName();
226 _AppWidgetView::GetAppIconBitmap(void) const
228 return __pAppIconBitmap.get();
232 _AppWidgetView::GetBitmap(void) const
234 return __pBitmap.get();
238 _AppWidgetView::IsUpdated(void) const
244 _AppWidgetView::GetAnchorSize(void) const
246 Bitmap* pArrowBitmap = null;
250 GetRemainingSpace(lower, upper);
254 pArrowBitmap = __pArrowDownBitmap.get();
258 pArrowBitmap = __pArrowUpBitmap.get();
261 return FloatDimension(pArrowBitmap->GetWidth(), pArrowBitmap->GetHeight());
265 _AppWidgetView::CallProviderRemoved(void)
267 unique_ptr<IEnumeratorT<_IAppWidgetViewEventListener*> > pEnumerator(__pAppWidgetViewEventListenerList->GetEnumeratorN());
270 while (pEnumerator->MoveNext() == E_SUCCESS)
272 _IAppWidgetViewEventListener* pListener = null;
273 pEnumerator->GetCurrent(pListener);
277 pListener->OnAppWidgetProviderRemoved(*this);
284 _AppWidgetView::GetNativeAppWidget(void) const
290 _AppWidgetView::OpenAppWidgetPopup(void)
292 result r = E_SUCCESS;
294 const _Control* pParent = GetParent();
296 SysTryReturn(NID_UI_CTRL, pParent, r, r, "[%s] Propagating.", GetErrorMessage(r));
298 FloatDimension size = __pAppWidgetViewManager->GetAppWidgetPopupSize(__pAppWidget);
299 FloatRectangle popupBounds(0, 0, size.width, size.height);
300 FloatRectangle bounds = GetBoundsF();
301 FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
306 FloatDimension anchorSize = GetAnchorSize();
307 GetRemainingSpace(lower, upper);
311 popupBounds.y = absoluteBounds.y - size.height + anchorSize.height;
315 popupBounds.y = absoluteBounds.y + absoluteBounds.height - anchorSize.height;
318 SysLog(NID_UI_CTRL, "[%d %d]", popupBounds.y, size.height);
320 if (!__pAppWidgetPopupView)
322 unique_ptr<_AppWidgetPopupView> pAppWidgetPopupView(_AppWidgetPopupView::CreateAppWidgetPopupN(*this));
324 SysTryReturn(NID_UI_CTRL, pAppWidgetPopupView, r, r, "[%s] Propagating.", GetErrorMessage(r));
326 r = pAppWidgetPopupView->Initialize(popupBounds);
327 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
329 r = pAppWidgetPopupView->AddAppWidgetPopupEventListener(*this);
330 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
332 __pAppWidgetPopupView = move(pAppWidgetPopupView);
335 __pAppWidgetPopupView->SetOwner(this);
337 r = __pAppWidgetPopupView->Open();
338 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
344 _AppWidgetView::GetTouchPostion(const FloatPoint& point, double& x, double& y) const
346 FloatRectangle bounds = GetBoundsF();
348 x = static_cast<double>(point.x) / static_cast<double>(bounds.width);
349 y = static_cast<double>(point.y) / static_cast<double>(bounds.height);
353 _AppWidgetView::PlayClickAnimation(void)
355 VisualElementPropertyAnimation animation;
356 animation.SetPropertyName(L"transform.scale.xy");
357 animation.SetEndValue(Variant(FloatPoint(0.8f, 0.8f)));
358 animation.SetDuration(ANIMATION_DURATION);
359 animation.SetAutoReverseEnabled(true);
361 _VisualElement* pVisualElement = GetVisualElement();
362 result r = GetLastResult();
363 SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, r, "[%s] Propagating.", GetErrorMessage(r));
365 pVisualElement->AddAnimation(CLICK_ANIMATION, animation);
369 _AppWidgetView::PlayFlickAnimation(void)
371 const int DISTANCE = 30;
373 _VisualElement* pVisualElement = GetVisualElement();
374 result r = GetLastResult();
375 SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, r, "[%s] Propagating.", GetErrorMessage(r));
377 FloatRectangle startBounds(pVisualElement->GetBounds());
378 FloatRectangle endBounds(startBounds);
379 endBounds.y = startBounds.y + DISTANCE;
381 VisualElementPropertyAnimation animation;
382 animation.SetPropertyName(L"bounds");
383 animation.SetStartValue(Variant(startBounds));
384 animation.SetEndValue(Variant(endBounds));
385 animation.SetDuration(ANIMATION_DURATION);
386 animation.SetAutoReverseEnabled(true);
387 animation.SetVisualElementAnimationStatusEventListener(this);
389 pVisualElement->AddAnimation(FLICK_ANIMATION, animation);
393 _AppWidgetView::GetRemainingSpace(int& lower, int& upper) const
395 const _Control* pParent = GetParent();
396 result r = GetLastResult();
397 SysTryReturnVoidResult(NID_UI_CTRL, pParent, r, "[%s] Propagating.", GetErrorMessage(r));
399 FloatRectangle parentClientBounds = pParent->GetClientBoundsF();
400 FloatRectangle viewBounds = GetBoundsF();
402 lower = viewBounds.y;
403 upper = parentClientBounds.height - viewBounds.y - viewBounds.height;
405 SysLog(NID_UI_CTRL, "[%d %d]", lower, upper);
409 _AppWidgetView::IsTouchEventEnabled(void) const
411 unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(GetAppId()));
412 int ret = livebox_service_mouse_event(pAppId.get());
418 _AppWidgetView::IsTouchEffectEnabled(void) const
420 unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(GetAppId()));
421 int ret = livebox_service_touch_effect(pAppId.get());
427 _AppWidgetView::OnAttachedToMainTree(void)
429 result r = E_SUCCESS;
431 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
434 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
437 pFrame->AddFrameEventListener(*this);
440 __pAppWidgetViewManager->AddFrameEventListener();
447 _AppWidgetView::OnDetachingFromMainTree(void)
449 result r = E_SUCCESS;
451 _Window* pWindow = _ControlManager::GetInstance()->GetCurrentFrame();
454 _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
457 pFrame->RemoveFrameEventListener(*this);
465 _AppWidgetView::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
470 _AppWidgetView::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
475 _AppWidgetView::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
480 _AppWidgetView::OnFlickGestureDetected(_TouchFlickGestureDetector& gesture)
482 _FlickDirection direction = gesture.GetDirection();
483 if (direction == _FLICK_DIRECTION_DOWN)
485 PlayFlickAnimation();
486 OpenAppWidgetPopup();
493 _AppWidgetView::OnFlickGestureCanceled(_TouchFlickGestureDetector& gesture)
499 _AppWidgetView::OnBoundsChanged(void)
501 FloatDimension size(GetSizeF());
503 if (!__resizeFromRemote)
505 __pAppWidgetViewManager->SetAppWidgetSize(*this, size);
511 _AppWidgetView::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
513 int type = livebox_lb_type(__pAppWidget);
514 if (((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP)) && IsTouchEventEnabled())
519 Point position = _CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition());
520 GetTouchPostion(FloatPoint(static_cast<float>(position.x), static_cast<float>(position.y)), x, y);
522 livebox_content_event(__pAppWidget, LB_MOUSE_DOWN, x, y);
529 _AppWidgetView::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
531 FloatRectangle clientBounds(GetClientBoundsF());
532 Point position(_CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition()));
533 FloatPoint floatPosition(static_cast<float>(position.x), static_cast<float>(position.y));
535 if (clientBounds.Contains(floatPosition) && IsTouchEffectEnabled())
537 PlayClickAnimation();
542 GetTouchPostion(floatPosition, x, y);
544 int type = livebox_lb_type(__pAppWidget);
545 if (((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP)) && IsTouchEventEnabled())
547 livebox_content_event(__pAppWidget, LB_MOUSE_UP, x, y);
550 livebox_click(__pAppWidget, x, y);
556 _AppWidgetView::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
558 int type = livebox_lb_type(__pAppWidget);
559 if (((type == LB_TYPE_BUFFER) || (type == LB_TYPE_PIXMAP)) && IsTouchEventEnabled())
564 Point position = _CoordinateSystemUtils::ConvertToInteger(touchInfo.GetCurrentPosition());
565 GetTouchPostion(FloatPoint(static_cast<float>(position.x), static_cast<float>(position.y)), x, y);
567 livebox_content_event(__pAppWidget, LB_MOUSE_MOVE, x, y);
574 _AppWidgetView::OnAppWidgetPopupViewOpened(void)
579 _AppWidgetView::OnAppWidgetPopupViewClosed(void)
581 __pAppWidgetPopupView.reset(null);
585 _AppWidgetView::OnDraw(void)
587 __pAppWidgetViewPresenter->Draw();
591 _AppWidgetView::OnFrameActivated(const Tizen::Ui::Controls::_Frame& source)
595 livebox_set_visibility(__pAppWidget, LB_SHOW);
600 _AppWidgetView::OnFrameDeactivated(const Tizen::Ui::Controls::_Frame& source)
604 livebox_set_visibility(__pAppWidget, LB_HIDE_WITH_PAUSE);
609 _AppWidgetView::OnFrameMinimized(const Tizen::Ui::Controls::_Frame& source)
614 _AppWidgetView::OnFrameRestored(const Tizen::Ui::Controls::_Frame& source)
619 _AppWidgetView::OnAppWidgetUpdated(const Bitmap& bitmap, const FloatDimension& size)
621 __resizeFromRemote = true;
623 __resizeFromRemote = false;
626 __pBitmap.reset(const_cast<Bitmap*>(&bitmap));
632 _AppWidgetView::OnAppWidgetUpdated(int pixmap)
639 ecore_x_pixmap_geometry_get(pixmap, &x, &y, &width, &height);
640 SysTryReturnVoidResult(NID_UI_CTRL, (width > 0) && (height > 0), E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [0x%x %d %d].", pixmap, width , height);
642 if (__pixmap != pixmap )
644 SetBackgroundColor(Color(0, 0, 0, 0));
646 _VisualElement* pVisualElement = GetVisualElement();
647 SysTryReturnVoidResult(NID_UI_CTRL, pVisualElement, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
649 _EflNode* pEflNode = dynamic_cast<_EflNode*>(pVisualElement->GetNativeNode());
650 SysTryReturnVoidResult(NID_UI_CTRL, pEflNode, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
652 Evas_Object* pSmartObject = (Evas_Object*)pEflNode->GetGroupContainer();
653 SysTryReturnVoidResult(NID_UI_CTRL, pSmartObject, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
655 Evas* pEvas = evas_object_evas_get(pSmartObject);
656 SysTryReturnVoidResult(NID_UI_CTRL, pEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
658 __pPixmapObject.reset(evas_object_image_filled_add(pEvas));
659 SysTryReturnVoidResult(NID_UI_CTRL, __pPixmapObject, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
661 pEflNode->AddNativeSmartObject(*pVisualElement, __pPixmapObject.get());
663 evas_object_image_size_set(__pPixmapObject.get(), width, height);
664 evas_object_image_colorspace_set(__pPixmapObject.get(), EVAS_COLORSPACE_ARGB8888);
665 evas_object_image_alpha_set(__pPixmapObject.get(), EINA_TRUE);
666 evas_object_raise(__pPixmapObject.get());
668 FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
670 evas_object_move(__pPixmapObject.get(), absoluteBounds.x, absoluteBounds.y);
671 evas_object_show(__pPixmapObject.get());
673 Evas_Native_Surface surface;
675 surface.version = EVAS_NATIVE_SURFACE_VERSION;
676 surface.type = EVAS_NATIVE_SURFACE_X11;
677 surface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
678 surface.data.x11.pixmap = pixmap;
680 evas_object_image_native_surface_set(__pPixmapObject.get(), &surface);
682 __pixmapDamage.reset(ecore_x_damage_new(pixmap, ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES));
683 SysTryReturnVoidResult(NID_UI_CTRL, __pixmapDamage.get() != 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
685 __pPixmapEventHandler.reset(ecore_event_handler_add(ECORE_X_EVENT_DAMAGE_NOTIFY, OnPixmapDamaged, (void*)this));
686 SysTryReturnVoidResult(NID_UI_CTRL, __pPixmapEventHandler, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
688 SysLog(NID_UI_CTRL, "[0x%x][%d %d]", surface.data.x11.pixmap, absoluteBounds.x, absoluteBounds.y);
691 SysLog(NID_UI_CTRL, "[%d %d %d %d]", x, y, width, height);
693 evas_object_image_size_set(__pPixmapObject.get(), width, height);
694 evas_object_image_pixels_dirty_set(__pPixmapObject.get(), EINA_TRUE);
695 evas_object_image_fill_set(__pPixmapObject.get(), 0, 0, width, height);
696 evas_object_image_data_update_add(__pPixmapObject.get(), 0, 0, width, height);
697 evas_object_resize(__pPixmapObject.get(), width, height);
699 __resizeFromRemote = true;
700 SetSize(FloatDimension(static_cast<float>(width), static_cast<float>(height)));
701 __resizeFromRemote = false;
708 _AppWidgetView::OnPixmapDamaged(void* pData, int type, void* pEvent)
710 _AppWidgetView* pAppWidgetView = static_cast<_AppWidgetView*>(pData);
711 SysTryReturn(NID_UI_CTRL, pAppWidgetView != null, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[[E_INVALID_ARG] The argument is invalid.");
713 Ecore_X_Event_Damage* pDamageEvent = static_cast<Ecore_X_Event_Damage*>(pEvent);
714 SysTryReturn(NID_UI_CTRL, pDamageEvent != null, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
716 int pixmap = pAppWidgetView->__pixmap;
717 SysTryReturn(NID_UI_CTRL, pDamageEvent->drawable == pixmap, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [%d %d].", pDamageEvent->drawable, pixmap);
724 ecore_x_pixmap_geometry_get(pixmap, &x, &y, &width, &height);
725 SysTryReturn(NID_UI_CTRL, (width > 0) && (height > 0), ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid [0x%x %d %d].", pixmap, width , height);
727 Evas_Object* pPixmapObject = pAppWidgetView->__pPixmapObject.get();
728 SysTryReturn(NID_UI_CTRL, pPixmapObject, ECORE_CALLBACK_PASS_ON, E_INVALID_ARG, "[E_INVALID_ARG] The argument is invalid.");
730 evas_object_image_pixels_dirty_set(pPixmapObject, EINA_TRUE);
731 evas_object_image_fill_set(pPixmapObject, 0, 0, width, height);
732 evas_object_image_data_update_add(pPixmapObject, 0, 0, width, height);
734 SysLog(NID_UI_CTRL, "[%d %d %d]", pixmap, width, height);
736 return ECORE_CALLBACK_DONE;