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_SliderEvent.cpp
19 * @brief This is the implementation for the _SliderEvent class.
21 * This file contains the implementation of _SliderEvent class. @n
25 #include <FBaseSysLog.h>
26 #include <FBaseErrors.h>
27 #include "FUiCtrl_ISliderEventListener.h"
28 #include "FUiCtrl_SliderEvent.h"
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Runtime;
33 namespace Tizen { namespace Ui { namespace Controls
36 class _OSP_EXPORT_ _SliderEventArg
42 _SliderEventArg(int value);
43 virtual ~_SliderEventArg(void);
47 int GetValue(void) const;
55 _SliderEventArg::_SliderEventArg(int value)
60 _SliderEventArg::~_SliderEventArg(void)
65 _SliderEventArg::GetValue(void) const
71 _SliderEvent::_SliderEvent(const _Slider& source)
74 result r = _Event::Initialize();
79 __pSource = const_cast <_Slider*>(&source);
83 _SliderEvent::~_SliderEvent(void)
88 _SliderEvent::CreateInstanceN(const _Slider& source)
90 _SliderEvent* pSliderEvent = new (std::nothrow) _SliderEvent(source);
91 SysTryReturn(NID_UI_CTRL, pSliderEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
93 if (IsFailed(GetLastResult()))
108 _SliderEvent::GetSource(void) const
114 _SliderEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
116 // cast to ISliderEventListener
117 _ISliderEventListener* pSliderListener = dynamic_cast <_ISliderEventListener*>(&listener);
118 SysTryReturnVoidResult(NID_UI_CTRL, pSliderListener != null, E_INVALID_ARG,
119 "[E_INVALID_ARG] Invalid argument(s) is used. The _ISliderEventListener is null");
121 // cast to _SliderEventArg
122 const _SliderEventArg* pSliderEventArg = dynamic_cast <const _SliderEventArg*>(&arg);
123 SysTryReturnVoidResult(NID_UI_CTRL, pSliderEventArg != null, E_INVALID_ARG,
124 "[E_INVALID_ARG] Invalid argument(s) is used. The _SliderEventArg is null");
126 // call cursor change event listener method
127 pSliderListener->OnSliderBarMoved(*__pSource, pSliderEventArg->GetValue());
128 SetLastResult(E_SUCCESS);
133 _SliderEvent::CreateSliderEventArgN(int value)
135 _SliderEventArg* pEventArg = new (std::nothrow) _SliderEventArg(value);
136 SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
141 }}} // Tizen::Ui::Controls