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.
19 * @file FUiCtrl_UiScrollEvent.cpp
20 * @brief This is the implementation for the _UiScrollEvent class.
23 #include <FBaseErrors.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_UiScrollEvent.h"
26 #include "FUiCtrl_UiScrollEventArg.h"
27 #include "FUiCtrl_IScrollEventListener.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Runtime;
32 namespace Tizen { namespace Ui { namespace Controls
35 ////////////////////////////////////////////////////////////////////////////////
36 /// _UiScrollEvent class Lifecycle
38 _UiScrollEvent::_UiScrollEvent(void)
44 _UiScrollEvent::~_UiScrollEvent(void)
50 _UiScrollEvent::Construct(const Tizen::Ui::_Control& source)
53 result r = _Event::Initialize();
54 SysTryReturn(NID_UI, (r == E_SUCCESS), r, r, "[%s] Propagating.", GetErrorMessage(r));
57 __pSource = const_cast <_Control*>(&source);
62 ////////////////////////////////////////////////////////////////////////////////
63 /// __WindowEvent class Accessor
66 _UiScrollEvent::GetSource(void) const
72 ////////////////////////////////////////////////////////////////////////////////
73 /// _UiScrollEvent class Operation
76 _UiScrollEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
78 _IScrollEventListener* pScrollEventListener = dynamic_cast <_IScrollEventListener*>(&listener);
79 SysTryReturnVoidResult(NID_UI_CTRL, (pScrollEventListener != null), E_INVALID_ARG, "The invalid listener was given.");
82 const _UiScrollEventArg* pArg = dynamic_cast <const _UiScrollEventArg*>(&arg);
83 SysTryReturnVoidResult(NID_UI_CTRL, (pArg != null), E_INVALID_ARG, "The invalid Event Argument was given.");
85 switch (pArg->GetEventType())
87 case SCROLL_EVENT_ON_SCROLL_STOPPED:
88 pScrollEventListener->OnScrollStopped(*pArg->GetSource());
90 case SCROLL_EVENT_ON_SCROLL_POSITION_CHANGED:
91 pScrollEventListener->OnScrollPositionChanged(*pArg->GetSource(), pArg->GetScrollPosition());
93 case SCROLL_EVENT_ON_SCROLL_END_REACHED:
94 pScrollEventListener->OnScrollEndReached(*pArg->GetSource(), pArg->GetScrollType());
97 SysTryReturnVoidResult(NID_UI_CTRL, false, E_INVALID_ARG, "The invalid Event Argument was given.");
102 }}} // Tizen::Ui::Controls