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_PublicSliderEvent.cpp
19 * @brief This is the implementation for the _PublicSliderEvent class.
21 * This file contains the implementation of _PublicSliderEvent class. @n
25 #include <FBaseSysLog.h>
26 #include <FBaseErrors.h>
27 #include <FUiCtrlISliderEventListener.h>
28 #include "FUiCtrl_PublicSliderEvent.h"
30 using namespace Tizen::Ui;
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Runtime;
34 namespace Tizen { namespace Ui { namespace Controls
37 class _OSP_EXPORT_ _PublicSliderEventArg
43 _PublicSliderEventArg(int value);
44 virtual ~_PublicSliderEventArg(void);
48 int GetValue(void) const;
54 }; // _PublicSliderEventArg
56 _PublicSliderEventArg::_PublicSliderEventArg(int value)
61 _PublicSliderEventArg::~_PublicSliderEventArg(void)
66 _PublicSliderEventArg::GetValue(void) const
72 _PublicSliderEvent::_PublicSliderEvent(const Controls::Slider& source)
75 result r = _Event::Initialize();
80 __pSource = const_cast <Slider*>(&source);
84 _PublicSliderEvent::~_PublicSliderEvent(void)
89 _PublicSliderEvent::CreateInstanceN(const Controls::Slider& source)
91 _PublicSliderEvent* pPublicSliderEvent = new (std::nothrow) _PublicSliderEvent(source);
92 SysTryReturn(NID_UI_CTRL, pPublicSliderEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
94 if (IsFailed(GetLastResult()))
99 return pPublicSliderEvent;
102 delete pPublicSliderEvent;
103 pPublicSliderEvent = null;
108 const Controls::Slider*
109 _PublicSliderEvent::GetSource(void) const
115 _PublicSliderEvent::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] The invalid listener was given.");
122 // cast to _PublicSliderEventArg
123 const _PublicSliderEventArg* pSliderEventArg = dynamic_cast <const _PublicSliderEventArg*>(&arg);
124 SysTryReturnVoidResult(NID_UI_CTRL, pSliderEventArg != null, E_INVALID_ARG,
125 "[E_INVALID_ARG] The invalid Event Argument was given.");
127 // call cursor change event listener method
128 pSliderListener->OnSliderBarMoved(*__pSource, pSliderEventArg->GetValue());
129 SetLastResult(E_SUCCESS);
134 _PublicSliderEvent::CreateSliderEventArgN(int value)
136 _PublicSliderEventArg* pEventArg = new (std::nothrow) _PublicSliderEventArg(value);
137 SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
142 }}} // Tizen::Ui::Controls