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_PublicColorChangeEvent.cpp
20 * @brief This is the implementation for the _PublicColorChangeEvent class.
22 * This file contains the implementation of _PublicColorChangeEvent class. @n
26 #include <FBaseSysLog.h>
27 #include <FBaseErrors.h>
28 #include <FGrpColor.h>
29 #include <FUiIColorChangeEventListener.h>
30 #include "FUiCtrl_PublicColorChangeEvent.h"
32 using namespace Tizen::Base;
33 using namespace Tizen::Base::Runtime;
34 using namespace Tizen::Graphics;
35 using namespace Tizen::Ui;
37 namespace Tizen { namespace Ui { namespace Controls
40 class _OSP_EXPORT_ _PublicColorChangeEventArg
41 : public Tizen::Base::Runtime::IEventArg
42 , public Tizen::Base::Object
45 _PublicColorChangeEventArg(const Color& color)
50 virtual ~_PublicColorChangeEventArg(void)
54 const Tizen::Graphics::Color GetColor(void) const
61 }; // _PublicColorChangeEventArg
63 _PublicColorChangeEvent::_PublicColorChangeEvent(const Control& source)
66 result r = _Event::Initialize();
75 _PublicColorChangeEvent::~_PublicColorChangeEvent(void)
80 _PublicColorChangeEvent::GetSource(void) const
86 _PublicColorChangeEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
88 IColorChangeEventListener* pColorChangeListener = dynamic_cast <IColorChangeEventListener*>(&listener);
89 SysTryReturnVoidResult(NID_UI_CTRL, (pColorChangeListener != null), E_INVALID_ARG,
90 "[E_INVALID_ARG] The event argument is invalid type.\n.");
92 const _PublicColorChangeEventArg* pArg = dynamic_cast <const _PublicColorChangeEventArg*>(&arg);
93 SysTryReturnVoidResult(NID_UI_CTRL, (pArg != null), E_INVALID_ARG,
94 "[E_INVALID_ARG] The event argument is invalid type.\n.");
96 pColorChangeListener->OnColorChanged(*__pSource, Color(pArg->GetColor()));
101 _PublicColorChangeEvent*
102 _PublicColorChangeEvent::CreateInstanceN(const Control& source)
104 _PublicColorChangeEvent* pCoreColorChangeEvent = new (std::nothrow) _PublicColorChangeEvent(source);
105 SysTryReturn(NID_UI_CTRL, (pCoreColorChangeEvent != null), null, E_OUT_OF_MEMORY,
106 "[E_OUT_OF_MEMORY] Memory allocation failed.");
108 if (IsFailed(GetLastResult()))
113 return pCoreColorChangeEvent;
116 delete pCoreColorChangeEvent;
122 _PublicColorChangeEvent::CreateColorChangeEventArgN(const Color& color)
124 _PublicColorChangeEventArg* pEventArg = new (std::nothrow) _PublicColorChangeEventArg(color);
125 SysTryReturn(NID_UI_CTRL, (pEventArg != null), null, E_OUT_OF_MEMORY,
126 "[E_OUT_OF_MEMORY] Memory allocation failed.");
131 }}} // Tizen::Ui::Controls