Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_GalleryRendererNotifier.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 #include <FBaseErrors.h>
18 #include <FBaseRtIEventListener.h>
19 #include <FBaseSysLog.h>
20 #include "FUiCtrl_GalleryRendererNotifier.h"
21 #include "FUiCtrl_GalleryRendererNotification.h"
22 #include "FUiCtrl_IGalleryRendererNotiListener.h"
23
24
25 using namespace Tizen::Base::Runtime;
26
27 namespace Tizen { namespace Ui { namespace Controls {
28
29 _GalleryRendererNotifier::_GalleryRendererNotifier(void)
30 {
31         // Do nothing
32 }
33
34 _GalleryRendererNotifier::~_GalleryRendererNotifier(void)
35 {
36         // Do nothing
37 }
38
39 void
40 _GalleryRendererNotifier::FireImpl(IEventListener& listener, const IEventArg& arg)
41 {
42         _IGalleryRendererNotiListener* pRendererNotiListener = dynamic_cast<_IGalleryRendererNotiListener*>(&listener);
43         SysTryReturnVoidResult(NID_UI_CTRL, pRendererNotiListener != null, E_INVALID_ARG, "[E_INVALID_ARG] IEventListener is invalid listener.");
44
45         const _GalleryRendererNotification& rendererNotification = static_cast<const _GalleryRendererNotification&>(arg);
46
47         switch (rendererNotification.GetNotificationType())
48         {
49         case GALLERY_RENDERER_NOTI_TRANSITION_CANCEL:
50                 pRendererNotiListener->OnTransitionCancel();
51                 break;
52         case GALLERY_RENDERER_NOTI_TRANSITION_COMPLETED:
53                 pRendererNotiListener->OnTransitionCompleted();
54                 break;
55         case GALLERY_RENDERER_NOTI_CANVAS_ANIMATION_CANCEL:
56                 pRendererNotiListener->OnCanvasAnimationCancel();
57                 break;
58         case GALLERY_RENDERER_NOTI_CANVAS_ANIMATION_COMPLETED:
59                 pRendererNotiListener->OnCanvasAnimationCompleted();
60                 break;
61         case GALLERY_RENDERER_NOTI_CANVAS_ANIMATION_STARTED:
62                 pRendererNotiListener->OnCanvasAnimationStarted();
63                 break;
64         default:
65                 SysTryReturnVoidResult(NID_UI_CTRL, false, E_INVALID_ARG, "[E_INVALID_ARG] The notification type is invalid.");
66                 break;
67         }
68 }
69
70 }}} // Tizen::Ui::Controls