2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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.
17 #include <FBaseErrors.h>
18 #include <FBaseRtTimer.h>
19 #include <FBaseSysLog.h>
21 #include "FUi_ResourceManager.h"
22 #include "FUiCtrl_Gallery.h"
23 #include "FUiCtrl_GalleryPresenter.h"
24 #include "FUiCtrl_GalleryModel.h"
25 #include "FUiCtrl_GalleryItem.h"
26 #include "FUiCtrl_GalleryItemProvider.h"
27 #include "FUiCtrl_GalleryCoreEvent.h"
28 #include "FUiCtrl_GalleryCoreEventArg.h"
29 #include "FUiCtrl_GalleryImageReader.h"
30 #include "FUiCtrl_GalleryViewEventHandler.h"
31 #include "FUiCtrl_IGalleryCoreEventListener.h"
32 #include "FUiCtrl_IGalleryRenderer.h"
33 #include "FUiCtrl_GalleryBitmap.h"
34 #include "FUiCtrl_GalleryViewEvent.h"
35 #include "FUiAnim_VisualElement.h"
38 using namespace Tizen::Base;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Ui;
42 namespace Tizen { namespace Ui { namespace Controls {
47 const int DEFAULT_ITEM_SPACING = 30;
49 const int DEFAULT_ANIMATION_DURATION = 3000;
50 const int MIN_ANIMATION_DURATION = 300;
51 const int MAX_ANIMATION_DURATION = 20000;
52 const int DEFAULT_VIEW_DURATION = 10;
53 const int MIN_VIEW_DURATION = 10;
54 const int FIRST_SLIDE_SHOW_DURATION = 1;
56 const int PARTIAL_CANVAS = 0;
57 } // unnamed namespace
59 IMPLEMENT_PROPERTY(_GalleryPresenter);
61 _GalleryPresenter::_GalleryPresenter(_IGalleryRenderer& galleryRenderer)
62 : __galleryRenderer(galleryRenderer)
63 , __pGalleryViewEventHandler(null)
64 , __pGalleryCoreEvent(null)
65 , __pGalleryItemProvider(null)
66 , __pGalleryModel(null)
67 , __pGalleryImageReader(null)
68 , __pEmptyGalleryImage(null)
70 , __slideShowAnimationDuration(DEFAULT_ANIMATION_DURATION)
71 , __slideShowViewDuration(DEFAULT_VIEW_DURATION)
72 , __gallerySlideShowType(GALLERY_SLIDESHOW_DISSOLVE)
73 , __currentItemIndex(NO_CURRENT_IMAGE)
74 , __slideShowRepeat(false)
75 , __slideShowStarted(false)
76 , __zoomingEnabled(true)
77 , __pSlideShowTimer(null)
78 , __slideShowPlayCount(0)
79 , __itemSpacing(DEFAULT_ITEM_SPACING)
80 , __pItemToCanvas(null)
81 , __fittingType(GALLERY_FITTING_TYPE_FIT)
82 , __verticalAlignment(GALLERY_VERTICAL_ALIGN_MIDDLE)
83 , __horizontalAlignment(GALLERY_HORIZONTAL_ALIGN_CENTER)
85 , __emptyFontStyle(FONT_STYLE_PLAIN)
86 , __pGalleryView(null)
88 AddPropertyChangeEventListener(*this);
91 _GalleryPresenter::~_GalleryPresenter(void)
93 delete __pGalleryViewEventHandler;
94 delete __pGalleryImageReader;
95 delete __pGalleryModel;
96 delete __pGalleryItemProvider;
97 delete __pGalleryCoreEvent;
98 delete __pEmptyGalleryImage;
99 delete[] __pItemToCanvas;
100 delete __pSlideShowTimer;
101 __pSlideShowTimer = null;
105 _GalleryPresenter::CreateGalleryPresenterN(_IGalleryRenderer& galleryRenderer,
106 _GalleryItemProviderAdaptorImpl* pGalleryItemProviderAdaptor, _Gallery* pGalleryView)
108 _GalleryPresenter* pPresenter = new (std::nothrow) _GalleryPresenter(galleryRenderer);
109 SysTryReturn(NID_UI_CTRL, pPresenter != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
111 result r = pPresenter->Construct(pGalleryItemProviderAdaptor, pGalleryView);
112 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
114 SetLastResult(E_SUCCESS);
124 _GalleryPresenter::Construct(_GalleryItemProviderAdaptorImpl* pGalleryItemProviderAdaptor, _Gallery* pGalleryView)
126 SetLastResult(E_SUCCESS);
128 result r = E_SUCCESS;
130 __pGalleryCoreEvent = new (std::nothrow) _GalleryCoreEvent();
131 SysTryCatch(NID_UI_CTRL, __pGalleryCoreEvent != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
133 __pGalleryItemProvider = new (std::nothrow) _GalleryItemProvider(*__pGalleryCoreEvent, pGalleryItemProviderAdaptor);
134 SysTryCatch(NID_UI_CTRL, __pGalleryItemProvider != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
136 __pGalleryModel = _GalleryModel::CreateGalleryModelN(*__pGalleryItemProvider);
137 SysTryCatch(NID_UI_CTRL, __pGalleryModel != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
139 __pGalleryImageReader = new (std::nothrow) _GalleryImageReader(*__pGalleryModel);
140 SysTryCatch(NID_UI_CTRL, __pGalleryImageReader != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
142 __pItemToCanvas = new(std::nothrow) int[MAX_CANVAS_COUNT];
143 SysTryCatch(NID_UI_CTRL, __pItemToCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
144 memset(__pItemToCanvas, -1, sizeof(int) * MAX_CANVAS_COUNT);
146 r = __galleryRenderer.SetCanvasMaxCount(MAX_CANVAS_COUNT);
147 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
149 r = __galleryRenderer.EnableEmptyView();
150 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
152 GET_STRING_CONFIG(IDS_COM_BODY_NO_IMAGES, __emptyText);
153 r = __galleryRenderer.SetEmptyText(__emptyText);
154 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
156 __pGalleryViewEventHandler = new (std::nothrow) _GalleryViewEventHandler(*this, __galleryRenderer, *__pGalleryImageReader);
157 SysTryCatch(NID_UI_CTRL, __pGalleryViewEventHandler != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
159 r = __pGalleryViewEventHandler->Construct();
160 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
162 SetFontStyle(FONT_STYLE_PLAIN);
165 __pGalleryView = pGalleryView;
170 delete __pGalleryViewEventHandler;
171 delete __pGalleryImageReader;
172 delete __pGalleryModel;
173 delete __pGalleryItemProvider;
174 delete __pGalleryCoreEvent;
175 delete[] __pItemToCanvas;
181 _GalleryPresenter::GetCurrentItemIndex(void) const
183 return __currentItemIndex;
187 _GalleryPresenter::SetCurrentItemIndex(int index, bool eventFire)
189 SysTryReturn(NID_UI_CTRL, index < __pGalleryModel->GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
190 "[E_OUT_OF_RANGE] The argument(%d) is out of range.", index);
192 if (__currentItemIndex != NO_CURRENT_IMAGE && __currentItemIndex != index)
194 __currentItemIndex = index;
195 if (eventFire == true)
202 __currentItemIndex = index;
205 __pGalleryViewEventHandler->SetZoomFlag(false);
211 _GalleryPresenter::SetCurrentItem(int index)
213 SysTryReturn(NID_UI_CTRL, index >=0 && index < __pGalleryModel->GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
214 "[E_OUT_OF_RANGE] The argument(%d) is out of range.", index);
216 int oldCurrentCanvasIndex = 0;
217 result r = E_SUCCESS;
219 if (index == __currentItemIndex)
224 if (__currentItemIndex != NO_CURRENT_IMAGE)
226 oldCurrentCanvasIndex = SearchCanvasIndex(__currentItemIndex);
227 SysTryReturn(NID_UI_CTRL, oldCurrentCanvasIndex != NOT_EXIST_CANVAS, E_SYSTEM, E_SYSTEM,
228 "[E_SYSTEM] The canvas of %d item is not exist.", oldCurrentCanvasIndex);
230 if (__currentItemIndex > index)
232 FloatRectangle rect = __galleryRenderer.GetViewRect();
234 r = __galleryRenderer.SetCanvasBounds(oldCurrentCanvasIndex, rect);
236 else if (__currentItemIndex < index)
238 FloatRectangle rect = __galleryRenderer.GetViewRect();
239 rect.x = -rect.width;
240 r = __galleryRenderer.SetCanvasBounds(oldCurrentCanvasIndex, rect);
243 r = __galleryRenderer.SetCanvasVisibility(oldCurrentCanvasIndex, false);
244 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
247 int newCurrentCanvasIndex = SearchCanvasIndex(index);
248 if (newCurrentCanvasIndex == NOT_EXIST_CANVAS)
250 r = SetCanvasImage(index);
251 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
252 newCurrentCanvasIndex = SearchCanvasIndex(index);
254 r = __galleryRenderer.SetCanvasBounds(newCurrentCanvasIndex, __galleryRenderer.GetViewRect());
255 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
257 r = __galleryRenderer.SetCanvasVisibility(newCurrentCanvasIndex, true);
258 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
260 r = SetCurrentItemIndex(index);
261 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
268 result resultValue = __galleryRenderer.SetCanvasVisibility(oldCurrentCanvasIndex, true);
269 if (resultValue != E_SUCCESS)
271 SysLog(NID_UI_CTRL, "[%s] Failed to setting of canvas visibility.", GetErrorMessage(resultValue));
278 _GalleryPresenter::GetItemCount(void) const
280 return __pGalleryModel->GetItemCount();
284 _GalleryPresenter::SetItemSpacing(int spacing)
286 __itemSpacing = spacing;
289 _GalleryPresenter::GetItemSpacing(void) const
291 return __itemSpacing;
294 _GallerySlideShowType
295 _GalleryPresenter::GetSlideShowType(void) const
297 return __gallerySlideShowType;
301 _GalleryPresenter::SetSlideShowType(_GallerySlideShowType slideShowType)
303 SysTryReturn(NID_UI_CTRL, slideShowType >= GALLERY_SLIDESHOW_DISSOLVE && slideShowType <= GALLERY_SLIDESHOW_PAGE,
304 E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The animation argument(%d) is out of range", slideShowType);
306 __gallerySlideShowType = slideShowType;
312 _GalleryPresenter::GetSlideShowAnimationDuration(void) const
314 Variant variant = GetProperty("slideShowAnimationDuration");
315 return variant.ToInt();
319 _GalleryPresenter::SetSlideShowAnimationDuration(int duration)
321 SysTryReturn(NID_UI_CTRL, duration >= MIN_ANIMATION_DURATION && duration <= MAX_ANIMATION_DURATION,
322 E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The argument(%d) is out of range.", duration);
324 return SetProperty("slideShowAnimationDuration", Variant(duration));
328 _GalleryPresenter::GetSlideShowViewDuration(void) const
330 Variant variant = GetProperty("slideShowViewDuration");
331 return variant.ToInt();
335 _GalleryPresenter::SetSlideShowViewDuration(int duration)
337 SysTryReturn(NID_UI_CTRL, duration >= MIN_VIEW_DURATION, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
338 "[E_OUT_OF_RANGE] The argument(%d) is out of range.", duration);
340 return SetProperty("slideShowViewDuration", Variant(duration));
344 _GalleryPresenter::StartSlideShow(bool repeat)
346 SysTryReturn(NID_UI_CTRL, __pSlideShowTimer == null, E_INVALID_OPERATION, E_INVALID_OPERATION,
347 "[E_INVALID_OPERATION] Slide show is already started");
349 if (GetItemCount() == 0)
354 __slideShowRepeat = repeat;
355 __slideShowPlayCount = GetItemCount() - 1;
357 result r = StartSlideShowTimer(GetSlideShowViewDuration());
358 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
360 _GalleryCoreEventArg* pArg = new(std::nothrow) _GalleryCoreEventArg(GALLERY_CORE_EVENT_SLIDE_SHOW_STARTED);
361 __pGalleryCoreEvent->Fire(*pArg);
367 _GalleryPresenter::StopSlideShow(void)
369 SysTryReturn(NID_UI_CTRL, __pSlideShowTimer != null, E_INVALID_OPERATION, E_INVALID_OPERATION,
370 "[E_INVALID_OPERATION] Slide show is already stopped");
372 StopSlideShowTimer();
373 __galleryRenderer.StopAllCanvasAnimation();
375 result r = __pGalleryViewEventHandler->SetVisibleCanvas();
376 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
378 _GalleryCoreEventArg* pArg = new(std::nothrow) _GalleryCoreEventArg(GALLERY_CORE_EVENT_SLIDE_SHOW_STOPPED);
379 __pGalleryCoreEvent->Fire(*pArg);
381 r = __galleryRenderer.RefreshView();
382 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
388 _GalleryPresenter::GetTextOfEmptyGallery(void) const
390 Variant variant = GetProperty("textOfEmptyGallery");
391 return variant.ToString();
395 _GalleryPresenter::SetTextOfEmptyGallery(const String& text)
397 result r = __galleryRenderer.SetEmptyText(text);
398 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
400 return SetProperty("textOfEmptyGallery", Variant(text));
404 _GalleryPresenter::SetBitmapOfEmptyGallery(const _GalleryBitmap* pBitmap)
406 result r = __galleryRenderer.SetEmptyImage(pBitmap);
407 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
409 __pEmptyGalleryImage = const_cast <_GalleryBitmap*>(pBitmap);
415 _GalleryPresenter::IsSlideShowStarted(void) const
417 return __pSlideShowTimer != null ? true : false;
421 _GalleryPresenter::SetZoomingEnabled(bool enable)
423 return SetProperty("zoomingEnabled", Variant(enable));
427 _GalleryPresenter::IsZoomingEnabled(void) const
429 Variant variant = GetProperty("zoomingEnabled");
431 return variant.ToBool();
435 _GalleryPresenter::PostEvent(_GalleryViewEvent& event)
437 bool slideShowStarted = false;
438 if (__pSlideShowTimer != null && event.GetEventType() != GALLERY_VIEW_EVENT_BOUNDS_CHANGED)
440 result r = StopSlideShow();
441 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
442 slideShowStarted = true;
445 if (GetItemCount() == 0)
447 if (event.GetEventType() == GALLERY_VIEW_EVENT_BOUNDS_CHANGED)
449 return OnBoundsChanged();
451 //SetLastResult(E_SUCCESS);
455 switch (event.GetEventType())
457 case GALLERY_VIEW_EVENT_TOUCH_PRESSED:
459 if (slideShowStarted == true)
461 result r = __pGalleryViewEventHandler->SetVisibleCanvas();
462 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
465 return __pGalleryViewEventHandler->OnTouchPressed(*(event.GetEventInfo()));
468 case GALLERY_VIEW_EVENT_TOUCH_RELEASED:
469 return __pGalleryViewEventHandler->OnTouchReleased(*(event.GetEventInfo()));
471 case GALLERY_VIEW_EVENT_TOUCH_DOUBLE_PRESSED:
472 __galleryRenderer.SetCanvasVisibility(PARTIAL_CANVAS, false);
473 return __pGalleryViewEventHandler->OnTouchDoublePressed(*(event.GetEventInfo()));
475 case GALLERY_VIEW_EVENT_TOUCH_MOVED:
476 __galleryRenderer.SetCanvasVisibility(PARTIAL_CANVAS, false);
477 return __pGalleryViewEventHandler->OnTouchMoved(*(event.GetEventInfo()));
479 case GALLERY_VIEW_EVENT_TOUCH_PINCH_ZOOM:
480 return __pGalleryViewEventHandler->OnTouchPinchZoom(*(event.GetEventInfo()));
482 case GALLERY_VIEW_EVENT_TOUCH_FLICK:
483 //__galleryRenderer.SetCanvasVisibility(PARTIAL_CANVAS, false);
484 return __pGalleryViewEventHandler->OnTouchFlicked(*(event.GetEventInfo()));
486 case GALLERY_VIEW_EVENT_BOUNDS_CHANGED:
487 return OnBoundsChanged();
490 SysTryReturn(NID_UI_CTRL, false, false, E_INVALID_ARG,
491 "[E_INVALID_ARG] The event type(%d) is invalid type", event.GetEventType());
494 //SetLastResult(E_SUCCESS);
499 _GalleryPresenter::OnBoundsChanged(void)
502 result r = E_SUCCESS;
504 if (__pSlideShowTimer != null && GetSlideShowType() == GALLERY_SLIDESHOW_PAGE)
506 int slideShowPlayCount = __slideShowPlayCount;
507 bool slideShowRepeat = __slideShowRepeat;
508 __galleryRenderer.StopAllCanvasAnimation();
509 __slideShowPlayCount = slideShowPlayCount;
510 __slideShowRepeat = slideShowRepeat;
511 r = StartSlideShowTimer(GetSlideShowViewDuration());
512 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
515 r = __galleryRenderer.InitializeCanvasBounds();
516 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
518 if (GetItemCount() > 0)
520 for (int canvasIndex = PARTIAL_CANVAS + 1; canvasIndex < MAX_CANVAS_COUNT; canvasIndex++)
522 itemIndex = __pItemToCanvas[canvasIndex];
523 if (itemIndex != NOT_EXIST_CANVAS)
525 r = __galleryRenderer.SetCanvasImage(canvasIndex, __pGalleryImageReader->GetItemImage(itemIndex)
526 , __verticalAlignment, __horizontalAlignment, __fittingType);
527 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
533 r = __galleryRenderer.EnableEmptyView();
534 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
535 SetLastResult(E_SUCCESS);
539 int currentItemIndex = GetCurrentItemIndex();
540 int currentCanvasIndex = SearchCanvasIndex(currentItemIndex);
541 int nextItemIndex = GetCurrentItemIndex() + 1;
542 if (nextItemIndex >= GetItemCount())
546 int nextCanvasIndex = SearchCanvasIndex(nextItemIndex);
548 r = __galleryRenderer.SetCanvasShowState(currentCanvasIndex, true);
549 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
551 if (__pSlideShowTimer != null && __slideShowStarted == true)
553 r = __galleryRenderer.SetCanvasShowState(nextCanvasIndex, true);
554 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
558 __galleryRenderer.GalleryBoundsChanged(currentCanvasIndex);
559 FloatRectangle canvasBounds = __galleryRenderer.GetCanvasBounds(currentCanvasIndex);
560 FloatRectangle imageBounds = __galleryRenderer.GetCanvasImageBounds(currentCanvasIndex);
561 __pGalleryViewEventHandler->CorrectCanvasPosition(canvasBounds, imageBounds);
562 r = __galleryRenderer.SetCanvasBounds(currentCanvasIndex, canvasBounds);
563 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
565 __pGalleryViewEventHandler->ResetTouch();
567 r = __pGalleryViewEventHandler->AlignCanvas(false);
568 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
571 SetLastResult(E_SUCCESS);
577 _GalleryPresenter::OnDraw(void)
579 result r = E_SUCCESS;
581 if (GetItemCount() > 0 && GetCurrentItemIndex() == NO_CURRENT_IMAGE)
583 r = SetCurrentItem(0);
584 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
587 r = __galleryRenderer.Draw();
588 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
590 SetLastResult(E_SUCCESS);
594 _GalleryPresenter::SetCoreEventListener(const _IGalleryCoreEventListener& coreEventListener)
596 return __pGalleryCoreEvent->AddListener(coreEventListener);
600 _GalleryPresenter::RemoveCoreEventListener(const _IGalleryCoreEventListener& coreEventListener)
602 return __pGalleryCoreEvent->RemoveListener(coreEventListener);
606 _GalleryPresenter::ClickedItem(void)
608 _GalleryCoreEventArg* pArg = new(std::nothrow) _GalleryCoreEventArg(GALLERY_CORE_EVENT_ITEM_CLICKED, __currentItemIndex);
609 return __pGalleryCoreEvent->Fire(*pArg);
613 _GalleryPresenter::ChangedItem(void)
615 if (__currentItemIndex == NO_CURRENT_IMAGE)
620 __pGalleryView->ResizeGalleryAccessibilityElement();
622 _GalleryCoreEventArg* pArg = new(std::nothrow) _GalleryCoreEventArg(GALLERY_CORE_EVENT_CURRENT_ITEM_CHANGED, __currentItemIndex);
623 return __pGalleryCoreEvent->Fire(*pArg);
627 _GalleryPresenter::RequestToLoadItem(int itemIndex)
629 result r = __pGalleryModel->RequestToLoadItem(itemIndex);
630 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
631 SortItemToCanvasIndex(itemIndex, true);
633 if (GetItemCount() == 1)
635 r = __galleryRenderer.DisableEmptyView();
636 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
638 r = SetCurrentItem(itemIndex);
639 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
642 r = __galleryRenderer.RefreshView();
643 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
649 _GalleryPresenter::RequestToUnloadItem(int itemIndex)
651 result r = E_SUCCESS;
653 int canvasIndex = SearchCanvasIndex(itemIndex);
654 if (canvasIndex != NOT_EXIST_CANVAS)
656 __galleryRenderer.SetCanvasVisibility(canvasIndex, false);
657 __pItemToCanvas[canvasIndex] = NOT_USED_CANVAS;
660 if (GetItemCount() == 1)
662 r = SetCurrentItemIndex(NO_CURRENT_IMAGE);
663 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
665 r = __galleryRenderer.EnableEmptyView();
666 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
670 if (itemIndex == __currentItemIndex)
672 __pGalleryImageReader->ResetLoadedPartialImageIndex();
673 r = __galleryRenderer.SetCanvasVisibility(PARTIAL_CANVAS, false);
674 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
676 __pGalleryViewEventHandler->SetZoomFlag(false);
678 int canvasIndex = NOT_EXIST_CANVAS;
679 if (itemIndex == GetItemCount() - 1)
681 r = SetCanvasImage(itemIndex - 1);
682 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
684 canvasIndex = SearchCanvasIndex(itemIndex - 1);
685 SysTryReturn(NID_UI_CTRL, canvasIndex != NOT_EXIST_CANVAS, E_SYSTEM, E_SYSTEM,
686 "[E_SYSTEM] Failed to search canvas");
687 __currentItemIndex--;
691 r = SetCanvasImage(itemIndex + 1);
692 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
694 canvasIndex = SearchCanvasIndex(itemIndex + 1);
695 SysTryReturn(NID_UI_CTRL, canvasIndex != NOT_EXIST_CANVAS, E_SYSTEM, E_SYSTEM,
696 "[E_SYSTEM] Failed to search canvas");
699 r = __galleryRenderer.SetCanvasVisibility(canvasIndex, true);
700 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
702 r = __galleryRenderer.SetCanvasBounds(canvasIndex, __galleryRenderer.GetViewRect());
703 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
705 if(ChangedItem() == false)
708 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
711 else if (itemIndex < __currentItemIndex)
713 __currentItemIndex--;
717 r = __pGalleryModel->RequestToUnloadItem(itemIndex);
718 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
720 SortItemToCanvasIndex(itemIndex, false);
722 r = __galleryRenderer.RefreshView();
723 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
729 _GalleryPresenter::RequestToUnloadAllItems(void)
731 result r = __pGalleryModel->RequestToUnloadAllItems();
732 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
734 for (int i = 0; i < MAX_CANVAS_COUNT; i++)
736 __pItemToCanvas[i] = NOT_USED_CANVAS;
739 r = SetCurrentItemIndex(NO_CURRENT_IMAGE);
740 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
742 r = __galleryRenderer.EnableEmptyView();
743 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
745 //r = __galleryRenderer.RefreshView();
746 //SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
752 _GalleryPresenter::RequestToUpdateItem(int itemIndex)
754 result r = __pGalleryModel->RequestToUpdateItem(itemIndex);
755 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
757 int canvasIndex = SearchCanvasIndex(itemIndex);
758 if (itemIndex == GetCurrentItemIndex())
760 _GalleryBitmap* pImage = __pGalleryImageReader->GetItemImage(itemIndex);
762 SysTryReturn(NID_UI_CTRL, pImage != null, r, r, "[%s] Propagating.", GetErrorMessage(r));
764 r = __galleryRenderer.SetCanvasImage(canvasIndex, (const _GalleryBitmap*)pImage
765 , __verticalAlignment, __horizontalAlignment, __fittingType);
766 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
768 __galleryRenderer.GalleryBoundsChanged(canvasIndex);
769 FloatRectangle canvasBounds = __galleryRenderer.GetCanvasBounds(canvasIndex);
770 FloatRectangle imageBounds = __galleryRenderer.GetCanvasImageBounds(canvasIndex);
771 __pGalleryViewEventHandler->CorrectCanvasPosition(canvasBounds, imageBounds);
772 r = __galleryRenderer.SetCanvasBounds(canvasIndex, canvasBounds);
773 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
775 r = __pGalleryViewEventHandler->AlignCanvas(false);
776 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, true, r, "[%s] Propagating.", GetErrorMessage(r));
778 else if (canvasIndex != NOT_EXIST_CANVAS)
780 __pItemToCanvas[canvasIndex] = NOT_USED_CANVAS;
783 r = __galleryRenderer.RefreshView();
784 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
790 _GalleryPresenter::RequestToUpdateAllItems(void)
792 result r = __pGalleryModel->RequestToUpdateAllItems();
793 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
795 r = __galleryRenderer.ResetAllCanvas();
796 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
798 for (int i = 0; i < MAX_CANVAS_COUNT; i++)
800 __pItemToCanvas[i] = NOT_USED_CANVAS;
803 int itemCount = GetItemCount();
806 r = __galleryRenderer.DisableEmptyView();
807 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
809 if (GetCurrentItemIndex() != NO_CURRENT_IMAGE)
811 r = SetCanvasImage(GetCurrentItemIndex());
812 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
814 r = __galleryRenderer.SetCanvasVisibility(SearchCanvasIndex(GetCurrentItemIndex()), true);
815 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
819 r = SetCurrentItem(0);
820 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
822 r = __galleryRenderer.SetCanvasVisibility(SearchCanvasIndex(0), true);
823 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
828 r = __galleryRenderer.EnableEmptyView();
829 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
836 _GalleryPresenter::RequestToUpdateItemCount(void)
838 __pGalleryModel->UpdateItemCount();
844 _GalleryPresenter::OnTimerExpired(Runtime::Timer& timer)
846 result r = E_SUCCESS;
847 if (&timer == __pSlideShowTimer)
850 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
852 SetLastResult(E_SUCCESS);
856 _GalleryPresenter::OnTransitionCancel(void)
858 __slideShowStarted = false;
859 int endItemIndex = __currentItemIndex + 1;
860 if (GetItemCount() > 0)
862 endItemIndex = endItemIndex % GetItemCount();
869 result r = SetCurrentItemIndex(endItemIndex);
870 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
872 StopSlideShowTimer();
876 _GalleryPresenter::OnTransitionCompleted(void)
878 int endItemIndex = __currentItemIndex + 1;
879 if (GetItemCount() > 0)
881 endItemIndex = endItemIndex % GetItemCount();
888 result r = SetCurrentItemIndex(endItemIndex);
889 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
891 __slideShowStarted = false;
892 if (__slideShowPlayCount > 0 || __slideShowRepeat == true)
894 StartSlideShowTimer(GetSlideShowViewDuration());
899 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating", GetErrorMessage(r));
902 SetLastResult(E_SUCCESS);
906 _GalleryPresenter::OnCanvasAnimationCancel(void)
908 __slideShowStarted = false;
912 _GalleryPresenter::OnCanvasAnimationCompleted(void)
914 __slideShowStarted = false;
918 _GalleryPresenter::OnCanvasAnimationStarted(void)
920 __slideShowStarted = true;
924 _GalleryPresenter::SetCanvasImage(int itemIndex)
926 SysTryReturn(NID_UI_CTRL, itemIndex >= 0, E_INVALID_ARG, E_INVALID_ARG,
927 "[E_INVALID_ARG] The argument(%d) is negative value.", itemIndex);
928 SysTryReturn(NID_UI_CTRL, itemIndex >=0 && itemIndex < __pGalleryModel->GetItemCount(),
929 E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The argument(%d) is out of range.", itemIndex);
931 if (SearchCanvasIndex(itemIndex) != NOT_EXIST_CANVAS)
936 int emptyCanvasIndex = GetEmptyCanvasIndex();
937 if (emptyCanvasIndex == NOT_EXIST_CANVAS)
939 emptyCanvasIndex = ClearCanvasIndex(__currentItemIndex);
942 _GalleryBitmap* pImage = __pGalleryImageReader->GetItemImage(itemIndex);
943 result r = GetLastResult();
944 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
946 __pItemToCanvas[emptyCanvasIndex] = itemIndex;
947 r = __galleryRenderer.SetCanvasImage(emptyCanvasIndex, (const _GalleryBitmap*)pImage
948 , __verticalAlignment, __horizontalAlignment, __fittingType);
949 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
951 FloatRectangle bounds = __galleryRenderer.GetViewRect();
952 r = __galleryRenderer.SetCanvasBounds(emptyCanvasIndex, bounds);
953 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
955 r = __galleryRenderer.SetCanvasVisibility(emptyCanvasIndex, false);
956 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
962 _GalleryPresenter::SetPartialCanvasImage(void)
964 SysTryReturn(NID_UI_CTRL, __currentItemIndex >= 0, E_INVALID_ARG, E_INVALID_ARG,
965 "[E_INVALID_ARG] The argument(%d) is negative value.", __currentItemIndex);
967 _GalleryItem* pGalleryItem = __pGalleryModel->GetItem(__currentItemIndex);
968 if (pGalleryItem->GetGalleryItemFilePath() == L"")
973 int currentCanvasIndex = SearchCanvasIndex(__currentItemIndex);
975 FloatRectangle canvasBounds = __galleryRenderer.GetCanvasBounds(currentCanvasIndex);
976 FloatRectangle imageBounds = __galleryRenderer.GetCanvasImageBounds(currentCanvasIndex);
977 FloatRectangle viewBounds = __galleryRenderer.GetViewRect();
979 if (imageBounds.width < viewBounds.width)
981 imageBounds.x -= (viewBounds.width - imageBounds.width) / 2;
984 if (imageBounds.height < viewBounds.height)
986 imageBounds.y -= (viewBounds.height - imageBounds.height) / 2;
989 canvasBounds.x = _Abs(-canvasBounds.x - imageBounds.x);
990 canvasBounds.y = _Abs(-canvasBounds.y - imageBounds.y);
991 canvasBounds.width = viewBounds.width < imageBounds.width ? viewBounds.width : imageBounds.width;
992 canvasBounds.height = viewBounds.height < imageBounds.height ? viewBounds.height : imageBounds.height;
994 FloatDimension size(imageBounds.width, imageBounds.height);
996 _GalleryBitmap* pImage = __pGalleryImageReader->GetPartialImageFromFileN(__currentItemIndex, canvasBounds, size);
997 SysTryReturn(NID_UI_CTRL, pImage != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
999 __pItemToCanvas[PARTIAL_CANVAS] = __currentItemIndex;
1000 result r = __galleryRenderer.SetCanvasImage(PARTIAL_CANVAS, (const _GalleryBitmap*)pImage
1001 , GALLERY_VERTICAL_ALIGN_MIDDLE, GALLERY_HORIZONTAL_ALIGN_CENTER, __fittingType);
1002 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1004 r = __galleryRenderer.SetCanvasBounds(PARTIAL_CANVAS, viewBounds);
1005 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1007 r = __galleryRenderer.SetCanvasVisibility(PARTIAL_CANVAS, true);
1008 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1020 _GalleryPresenter::SearchCanvasIndex(int itemIndex)
1022 if (itemIndex == NO_CURRENT_IMAGE)
1024 return NOT_EXIST_CANVAS;
1027 for (int i = 1; i < MAX_CANVAS_COUNT; i++)
1029 if (__pItemToCanvas[i] == itemIndex)
1035 return NOT_EXIST_CANVAS;
1039 _GalleryPresenter::GetEmptyCanvasIndex(void) const
1041 for (int i = 1; i < MAX_CANVAS_COUNT; i++)
1043 if (__pItemToCanvas[i] == NOT_USED_CANVAS)
1048 return NOT_EXIST_CANVAS;
1052 _GalleryPresenter::SetCanvasIndex(int canvasIndex, int itemIndex)
1054 SysTryReturn(NID_UI_CTRL, canvasIndex >= 0, E_INVALID_ARG, E_INVALID_ARG,
1055 "[E_INVALID_ARG] The argument(%d) is negative value.", canvasIndex);
1056 SysTryReturn(NID_UI_CTRL, canvasIndex > 0 && canvasIndex < MAX_CANVAS_COUNT, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1057 "[E_OUT_OF_RANGE] The canvas index(%d) is out of range", canvasIndex);
1058 SysTryReturn(NID_UI_CTRL, itemIndex >= 0, E_INVALID_ARG, E_INVALID_ARG,
1059 "[E_INVALID_ARG] The argument(%d) is negative value.", itemIndex);
1060 SysTryReturn(NID_UI_CTRL, itemIndex >=0 && itemIndex < __pGalleryModel->GetItemCount(), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
1061 "[E_OUT_OF_RANGE] The argument(%d) is out of range.", itemIndex);
1063 if (__pItemToCanvas[canvasIndex] == NOT_USED_CANVAS)
1065 __pItemToCanvas[canvasIndex] = itemIndex;
1069 SysTryReturn(NID_UI_CTRL, false, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The canvas index(%d) is used.", canvasIndex);
1076 _GalleryPresenter::ClearCanvasIndex(int currentItemIndex)
1078 SysTryReturn(NID_UI_CTRL, currentItemIndex >= 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The argument(%d) is negative value.", currentItemIndex);
1080 int clearCanvasIndex = 1;
1081 int maxAbsValue = 0;
1084 for (int i = 1; i < MAX_CANVAS_COUNT; i++)
1086 absValue = _Abs(currentItemIndex - __pItemToCanvas[i]);
1087 if (absValue > maxAbsValue)
1089 maxAbsValue = absValue;
1090 clearCanvasIndex = i;
1093 __pItemToCanvas[clearCanvasIndex] = NOT_USED_CANVAS;
1095 SetLastResult(E_SUCCESS);
1096 return clearCanvasIndex;
1100 _GalleryPresenter::SortItemToCanvasIndex(int itemIndex, bool add)
1104 for (int i = 0; i < MAX_CANVAS_COUNT; i++)
1106 if (__pItemToCanvas[i] >= itemIndex)
1108 __pItemToCanvas[i]++;
1114 for (int i = 0; i < MAX_CANVAS_COUNT; i++)
1116 if (__pItemToCanvas[i] > itemIndex)
1118 __pItemToCanvas[i]--;
1125 _GalleryPresenter::StartSlideShowTimer(int duration)
1127 result r = E_SUCCESS;
1128 if (__pSlideShowTimer != null)
1130 delete __pSlideShowTimer;
1131 __pSlideShowTimer = null;
1134 __pSlideShowTimer = new(std::nothrow) Runtime::Timer();
1135 SysTryCatch(NID_UI_CTRL, __pSlideShowTimer != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1137 r = __pSlideShowTimer->Construct(*this);
1138 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1140 __pSlideShowTimer->Start(duration);
1141 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
1146 delete __pSlideShowTimer;
1147 __pSlideShowTimer = null;
1149 return GetLastResult();
1153 _GalleryPresenter::StopSlideShowTimer(void)
1155 delete __pSlideShowTimer;
1156 __pSlideShowTimer = null;
1158 __slideShowRepeat = false;
1159 __slideShowPlayCount = 0;
1163 _GalleryPresenter::PlaySlideShow(void)
1165 int startCanvasIndex = SearchCanvasIndex(__currentItemIndex);
1166 SysTryReturn(NID_UI_CTRL, startCanvasIndex != NOT_EXIST_CANVAS, E_SYSTEM, E_SYSTEM,
1167 "[E_SYSTEM] The current item not exist.");
1169 int endItemIndex = __currentItemIndex + 1;
1170 if (endItemIndex >= GetItemCount())
1175 result r = __galleryRenderer.SetCanvasVisibility(PARTIAL_CANVAS, false);
1176 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1178 r = __galleryRenderer.SetCanvasVisibility(startCanvasIndex, true);
1179 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1181 int endCanvasIndex = SearchCanvasIndex(endItemIndex);
1182 if (endCanvasIndex == NOT_EXIST_CANVAS)
1184 r = SetCanvasImage(endItemIndex);
1185 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1186 endCanvasIndex = SearchCanvasIndex(endItemIndex);
1189 _GalleryTransitionType transition = static_cast<_GalleryTransitionType>(GetSlideShowType());
1190 _GalleryAnimationTiming animation = {__slideShowAnimationDuration, GALLERY_ANIMATION_TIMING_FUNC_EASEOUT};
1191 r = __galleryRenderer.SetCanvasVisibility(endCanvasIndex, true);
1192 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1194 r = __galleryRenderer.RunCanvasTransition(startCanvasIndex, endCanvasIndex, transition, &animation);
1195 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1197 if (__slideShowRepeat == false)
1199 __slideShowPlayCount--;
1202 r = __galleryRenderer.RefreshView();
1203 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
1210 _GalleryPresenter::GetPropertySlideShowViewDuration(void) const
1212 return Variant(__slideShowViewDuration);
1216 _GalleryPresenter::SetPropertySlideShowViewDuration(const Variant& variant)
1218 __slideShowViewDuration = variant.ToInt();
1224 _GalleryPresenter::GetPropertySlideShowAnimationDuration(void) const
1226 return Variant(__slideShowAnimationDuration);
1230 _GalleryPresenter::SetPropertySlideShowAnimationDuration(const Variant& variant)
1232 __slideShowAnimationDuration = variant.ToInt();
1238 _GalleryPresenter::GetPropertyTextOfEmptyGallery(void) const
1240 return Variant(__emptyText);
1244 _GalleryPresenter::SetPropertyTextOfEmptyGallery(const Variant& variant)
1246 __emptyText = variant.ToString();
1252 _GalleryPresenter::GetPropertyZoomingEnabled(void) const
1254 return Variant(__zoomingEnabled);
1258 _GalleryPresenter::SetPropertyZoomingEnabled(const Variant& variant)
1260 __zoomingEnabled = variant.ToBool();
1266 _GalleryPresenter::OnPropertyChanging(_PropertyBase& source, const String& name,
1267 const Variant& oldProperty, const Variant& newProperty)
1272 _GalleryPresenter::OnPropertyChanged(_PropertyBase& source, const String& name,
1273 const Variant& oldProperty, const Variant& newProperty)
1278 _GalleryPresenter::SetFontSize(int size)
1280 __emptyFontSize = size;
1284 _GalleryPresenter::GetFontSize(void) const
1286 return __emptyFontSize;
1290 _GalleryPresenter::SetFontStyle(FontStyle style)
1292 __emptyFontStyle = style;
1296 _GalleryPresenter::GetFontStyle(void) const
1298 return __emptyFontStyle;
1302 _GalleryPresenter::OnFontInfoRequested(unsigned long& style, int& size)
1304 style = GetFontStyle();
1305 size = GetFontSize();
1309 _GalleryPresenter::OnFontChanged(void)
1311 if (GetItemCount() == 0)
1313 result r = __galleryRenderer.EnableEmptyView();
1314 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
1318 }}} // Tizen::Ui::Controls