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.
19 * @file FUiCtrl_SliderEvent.cpp
20 * @brief This is the implementation for the _SliderEvent class.
22 * This file contains the implementation of _SliderEvent class. @n
26 #include <FBaseSysLog.h>
27 #include <FBaseErrors.h>
28 #include "FUiCtrl_ISliderEventListener.h"
29 #include "FUiCtrl_SliderEvent.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Runtime;
34 namespace Tizen { namespace Ui { namespace Controls
37 class _OSP_EXPORT_ _SliderEventArg
43 _SliderEventArg(int value);
44 virtual ~_SliderEventArg(void);
48 int GetValue(void) const;
56 _SliderEventArg::_SliderEventArg(int value)
61 _SliderEventArg::~_SliderEventArg(void)
66 _SliderEventArg::GetValue(void) const
72 _SliderEvent::_SliderEvent(const _Slider& source)
75 result r = _Event::Initialize();
80 __pSource = const_cast <_Slider*>(&source);
84 _SliderEvent::~_SliderEvent(void)
89 _SliderEvent::CreateInstanceN(const _Slider& source)
91 _SliderEvent* pSliderEvent = new (std::nothrow) _SliderEvent(source);
92 SysTryReturn(NID_UI_CTRL, pSliderEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
94 if (IsFailed(GetLastResult()))
109 _SliderEvent::GetSource(void) const
115 _SliderEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
117 // cast to ISliderEventListener
118 _ISliderEventListener* pSliderListener = dynamic_cast <_ISliderEventListener*>(&listener);
119 SysTryReturnVoidResult(NID_UI_CTRL, pSliderListener != null, E_INVALID_ARG,
120 "[E_INVALID_ARG] Invalid argument(s) is used. The _ISliderEventListener is null");
122 // cast to _SliderEventArg
123 const _SliderEventArg* pSliderEventArg = dynamic_cast <const _SliderEventArg*>(&arg);
124 SysTryReturnVoidResult(NID_UI_CTRL, pSliderEventArg != null, E_INVALID_ARG,
125 "[E_INVALID_ARG] Invalid argument(s) is used. The _SliderEventArg is null");
127 // call cursor change event listener method
128 pSliderListener->OnSliderBarMoved(*__pSource, pSliderEventArg->GetValue());
129 SetLastResult(E_SUCCESS);
134 _SliderEvent::CreateSliderEventArgN(int value)
136 _SliderEventArg* pEventArg = new (std::nothrow) _SliderEventArg(value);
137 SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
142 }}} // Tizen::Ui::Controls