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.
18 * @file FUiCtrl_PublicScrollPanelEvent.cpp
19 * @brief This is the implementation for the _PublicScrollPanelEvent class.
25 #include <FBaseErrors.h>
26 #include <FUiIScrollPanelEventListener.h>
27 #include <FBaseSysLog.h>
28 #include "FUiCtrl_PublicScrollPanelEvent.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Runtime;
35 namespace Tizen { namespace Ui { namespace Controls
39 * @class _PublicScrollPanelEventArg
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 _OSP_EXPORT_ _PublicScrollPanelEventArg
49 : public Tizen::Base::Runtime::IEventArg
50 , public Tizen::Base::Object
55 * This is the default class constructor.
58 _PublicScrollPanelEventArg(ScrollPanelStatus status);
61 * This is the class destructor.
64 virtual ~_PublicScrollPanelEventArg(void);
69 ScrollPanelStatus GetStatus(void) const;
76 ScrollPanelStatus __status;
77 }; // _PublicScrollPanelEventArg
79 ////////////////////////////////////////////////////////////////////////////////
80 /// _PublicScrollPanelEventArg class Lifecycle
82 _PublicScrollPanelEventArg::_PublicScrollPanelEventArg(ScrollPanelStatus status)
88 _PublicScrollPanelEventArg::~_PublicScrollPanelEventArg(void)
94 _PublicScrollPanelEventArg::GetStatus(void) const
99 ////////////////////////////////////////////////////////////////////////////////
100 /// _PublicScrollPanelEvent class Lifecycle
101 _PublicScrollPanelEvent::_PublicScrollPanelEvent(const Tizen::Ui::Control& source)
104 result r = _Event::Initialize();
113 _PublicScrollPanelEvent::~_PublicScrollPanelEvent(void)
118 _PublicScrollPanelEvent*
119 _PublicScrollPanelEvent::CreateInstanceN(const Tizen::Ui::Control& source)
121 _PublicScrollPanelEvent* pPublicScrollPanelEvent = new (std::nothrow) _PublicScrollPanelEvent(source);
122 SysTryReturn(NID_UI_CTRL, pPublicScrollPanelEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
124 return pPublicScrollPanelEvent;
129 const Tizen::Ui::Control*
130 _PublicScrollPanelEvent::GetSource(void) const
138 _PublicScrollPanelEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
140 IScrollPanelEventListener* pScrollPanelEventListener = dynamic_cast <IScrollPanelEventListener*>(&listener);
141 SysTryReturnVoidResult(NID_UI_CTRL, pScrollPanelEventListener != null, E_INVALID_ARG, "The Invalid listener is given.\n");
143 const _PublicScrollPanelEventArg* pScrollPanelEventArg = dynamic_cast <const _PublicScrollPanelEventArg*>(&arg);
144 SysTryReturnVoidResult(NID_UI_CTRL, pScrollPanelEventArg != null, E_INVALID_ARG, "The Invalid Event Argument is given.\n");
146 switch (pScrollPanelEventArg->GetStatus())
148 case OVERLAY_CONTROL_CREATED:
149 pScrollPanelEventListener->OnOverlayControlCreated(*GetSource());
152 case OVERLAY_CONTROL_OPENED:
153 pScrollPanelEventListener->OnOverlayControlOpened(*GetSource());
156 case OVERLAY_CONTROL_CLOSED:
157 pScrollPanelEventListener->OnOverlayControlClosed(*GetSource());
160 case OTHER_CONTROL_SELECTED:
161 pScrollPanelEventListener->OnOtherControlSelected(*GetSource());
165 SetLastResult(E_SUCCESS);
172 _PublicScrollPanelEvent::CreateScrollPanelEventArgN(ScrollPanelStatus status)
174 _PublicScrollPanelEventArg* pEventArg = new (std::nothrow) _PublicScrollPanelEventArg(status);
175 SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
180 }}} // Tizen::Ui::Controls