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_PublicAdjustmentEvent.cpp
20 * @brief This is the implementation for the _AdjustmentEvent class.
22 * This file contains the implementation of _AdjustmentEvent class. @n
26 #include <FBaseSysLog.h>
27 #include <FBaseErrors.h>
28 #include <FUiIAdjustmentEventListener.h>
29 #include "FUiCtrl_PublicAdjustmentEvent.h"
31 using namespace Tizen::Ui;
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Runtime;
35 namespace Tizen { namespace Ui { namespace Controls
38 class _OSP_EXPORT_ _PublicAdjustmentEventArg
44 _PublicAdjustmentEventArg(int adjustment);
45 virtual ~_PublicAdjustmentEventArg(void);
49 int GetAdjustment(void) const;
55 }; // _PublicAdjustmentEventArg
57 _PublicAdjustmentEventArg::_PublicAdjustmentEventArg(int adjustment)
58 : __adjustment(adjustment)
62 _PublicAdjustmentEventArg::~_PublicAdjustmentEventArg(void)
67 _PublicAdjustmentEventArg::GetAdjustment(void) const
73 _PublicAdjustmentEvent::_PublicAdjustmentEvent(const Control& source)
76 result r = _Event::Initialize();
85 _PublicAdjustmentEvent::~_PublicAdjustmentEvent(void)
89 _PublicAdjustmentEvent*
90 _PublicAdjustmentEvent::CreateInstanceN(const Control& source)
92 _PublicAdjustmentEvent* pPublicAdjustmentEvent = new (std::nothrow) _PublicAdjustmentEvent(source);
93 SysTryReturn(NID_UI_CTRL, pPublicAdjustmentEvent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
95 if (IsFailed(GetLastResult()))
100 return pPublicAdjustmentEvent;
103 delete pPublicAdjustmentEvent;
104 pPublicAdjustmentEvent = null;
110 _PublicAdjustmentEvent::GetSource(void) const
116 _PublicAdjustmentEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
118 // cast to IAdjustmentEventListener
119 IAdjustmentEventListener* pAdjustmentListener = dynamic_cast <IAdjustmentEventListener*>(&listener);
120 SysTryReturnVoidResult(NID_UI_CTRL, pAdjustmentListener != null, E_INVALID_ARG,
121 "[E_INVALID_ARG] The invalid listener was given.");
123 // cast to _PublicAdjustmentEventArg
124 const _PublicAdjustmentEventArg* pAdjustmentEventArg = dynamic_cast <const _PublicAdjustmentEventArg*>(&arg);
125 SysTryReturnVoidResult(NID_UI_CTRL, pAdjustmentEventArg != null, E_INVALID_ARG,
126 "[E_INVALID_ARG] The invalid Event Argument was given.");
128 // call cursor change event listener method
129 pAdjustmentListener->OnAdjustmentValueChanged(*__pSource, pAdjustmentEventArg->GetAdjustment());
130 SetLastResult(E_SUCCESS);
135 _PublicAdjustmentEvent::CreateAdjustmentEventArgN(int adjustment)
137 _PublicAdjustmentEventArg* pEventArg = new (std::nothrow) _PublicAdjustmentEventArg(adjustment);
138 SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
143 }}} // Tizen::Ui::Controls