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 <FUiCtrlIGalleryEventListener.h>
18 #include <FBaseSysLog.h>
19 #include "FUiCtrl_GalleryImplEvent.h"
20 #include "FUiCtrl_GalleryImplEventArg.h"
22 using namespace Tizen::Base::Runtime;
24 namespace Tizen { namespace Ui { namespace Controls {
26 _GalleryImplEvent::_GalleryImplEvent(void)
32 _GalleryImplEvent::~_GalleryImplEvent(void)
38 _GalleryImplEvent::Construct(Gallery* pSource)
46 _GalleryImplEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
48 IGalleryEventListener* pGalleryEventListener = dynamic_cast<IGalleryEventListener*>(&listener);
49 SysTryReturnVoidResult(NID_UI_CTRL, pGalleryEventListener != null, E_INVALID_ARG,
50 "[E_INVALID_ARG] pListener is invalid listener type.");
52 const _GalleryImplEventArg& galleryArg = static_cast<const _GalleryImplEventArg&>(arg);
54 switch (galleryArg.GetEventType())
56 case GALLERY_EVENT_CURRENT_ITEM_CHANGED:
57 pGalleryEventListener->OnGalleryCurrentItemChanged(*__pSource, galleryArg.GetArg1());
59 case GALLERY_EVENT_ITEM_CLICKED:
60 pGalleryEventListener->OnGalleryItemClicked(*__pSource, galleryArg.GetArg1());
62 case GALLERY_EVENT_SLIDE_SHOW_STARTED:
63 pGalleryEventListener->OnGallerySlideShowStarted(*__pSource);
65 case GALLERY_EVENT_SLIDE_SHOW_STOPPED:
66 pGalleryEventListener->OnGallerySlideShowStopped(*__pSource);
69 SysTryReturnVoidResult(NID_UI_CTRL, false, E_INVALID_ARG, "[E_INVALIDE_ARG] The event type is invalid type.");
74 }}} // Tizen::Ui::Controls