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_ScrollPanelEvent.cpp
20 * @brief This is the implementation for the _ScrollPanelEvent class.
25 #include <FBaseErrors.h>
26 #include <FBaseSysLog.h>
28 #include "FUiCtrl_IScrollPanelEventListener.h"
29 #include "FUiCtrl_ScrollPanelEvent.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Runtime;
35 namespace Tizen { namespace Ui { namespace Controls
39 * @class _ScrollPanelEventArg
40 * @brief This class is used as the argument to change event listener.
42 * This class is used as the argument to change event listener. When an change event is generated
43 * (such as when a button is pressed) the ScrollPanelEvent calls ScrollPanelEventListener's OnTextd
44 * with an instance of this class as an argument.
46 * From this class, one can find out, the (event) source object and the change ID.
48 class _ScrollPanelEventArg
49 : public Tizen::Base::Runtime::IEventArg
50 , public Tizen::Base::Object
55 * This is the default class constructor.
58 _ScrollPanelEventArg(CoreScrollPanelStatus status);
61 * This is the class destructor.
64 virtual ~_ScrollPanelEventArg(void);
69 CoreScrollPanelStatus GetStatus(void) const;
76 CoreScrollPanelStatus __status;
77 }; // _ScrollPanelEventArg
79 ////////////////////////////////////////////////////////////////////////////////
80 /// _ScrollPanelEventArg class Lifecycle
82 _ScrollPanelEventArg::_ScrollPanelEventArg(CoreScrollPanelStatus status)
88 _ScrollPanelEventArg::~_ScrollPanelEventArg(void)
94 _ScrollPanelEventArg::GetStatus(void) const
99 ////////////////////////////////////////////////////////////////////////////////
100 /// _ScrollPanelEvent class Lifecycle
101 _ScrollPanelEvent::_ScrollPanelEvent(const Tizen::Ui::_Control& source)
104 result r = _Event::Initialize();
113 _ScrollPanelEvent::~_ScrollPanelEvent(void)
119 _ScrollPanelEvent::CreateScrollPanelEventN(const Tizen::Ui::_Control& source)
121 _ScrollPanelEvent* pCoreScrollPanelEvent = new (std::nothrow) _ScrollPanelEvent(source);
122 SysTryReturn(NID_UI_CTRL, pCoreScrollPanelEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
124 if (IsFailed(GetLastResult()))
129 return pCoreScrollPanelEvent;
132 delete pCoreScrollPanelEvent;
138 const Tizen::Ui::_Control*
139 _ScrollPanelEvent::GetSource(void) const
147 _ScrollPanelEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
149 _IScrollPanelEventListener* pScrollPanelEventListener = dynamic_cast <_IScrollPanelEventListener*>(&listener);
150 SysTryReturnVoidResult(NID_UI_CTRL, pScrollPanelEventListener != null, E_INVALID_ARG, "The Invalid listener is given.\n");
152 const _ScrollPanelEventArg* pScrollPanelEventArg = dynamic_cast <const _ScrollPanelEventArg*>(&arg);
153 SysTryReturnVoidResult(NID_UI_CTRL, pScrollPanelEventArg != null, E_INVALID_ARG, "The Invalid Event Argument is given.\n");
155 switch (pScrollPanelEventArg->GetStatus())
157 case CORE_OVERLAY_CONTROL_CREATED:
159 pScrollPanelEventListener->OnOverlayControlCreated(*GetSource());
162 case CORE_OVERLAY_CONTROL_OPENED:
163 pScrollPanelEventListener->OnOverlayControlOpened(*GetSource());
166 case CORE_OVERLAY_CONTROL_CLOSED:
167 pScrollPanelEventListener->OnOverlayControlClosed(*GetSource());
170 case CORE_OTHER_CONTROL_SELECTED:
171 pScrollPanelEventListener->OnOtherControlSelected(*GetSource());
175 SetLastResult(E_SUCCESS);
181 _ScrollPanelEvent::CreateScrollPanelEventArgN(CoreScrollPanelStatus status)
183 _ScrollPanelEventArg* pEventArg = new (std::nothrow) _ScrollPanelEventArg(status);
184 SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
189 }}} // Tizen::Ui::Controls