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_PublicColorChangeEvent.cpp
19 * @brief This is the implementation for the _PublicColorChangeEvent class.
21 * This file contains the implementation of _PublicColorChangeEvent class. @n
25 #include <FBaseSysLog.h>
26 #include <FBaseErrors.h>
27 #include <FGrpColor.h>
28 #include <FUiIColorChangeEventListener.h>
29 #include "FUiCtrl_PublicColorChangeEvent.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Runtime;
33 using namespace Tizen::Graphics;
34 using namespace Tizen::Ui;
36 namespace Tizen { namespace Ui { namespace Controls
39 class _OSP_EXPORT_ _PublicColorChangeEventArg
40 : public Tizen::Base::Runtime::IEventArg
41 , public Tizen::Base::Object
44 _PublicColorChangeEventArg(const Color& color)
49 virtual ~_PublicColorChangeEventArg(void)
53 const Tizen::Graphics::Color GetColor(void) const
60 }; // _PublicColorChangeEventArg
62 _PublicColorChangeEvent::_PublicColorChangeEvent(const Control& source)
65 result r = _Event::Initialize();
74 _PublicColorChangeEvent::~_PublicColorChangeEvent(void)
79 _PublicColorChangeEvent::GetSource(void) const
85 _PublicColorChangeEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
87 IColorChangeEventListener* pColorChangeListener = dynamic_cast <IColorChangeEventListener*>(&listener);
88 SysTryReturnVoidResult(NID_UI_CTRL, (pColorChangeListener != null), E_INVALID_ARG,
89 "[E_INVALID_ARG] The event argument is invalid type.\n.");
91 const _PublicColorChangeEventArg* pArg = dynamic_cast <const _PublicColorChangeEventArg*>(&arg);
92 SysTryReturnVoidResult(NID_UI_CTRL, (pArg != null), E_INVALID_ARG,
93 "[E_INVALID_ARG] The event argument is invalid type.\n.");
95 pColorChangeListener->OnColorChanged(*__pSource, Color(pArg->GetColor()));
100 _PublicColorChangeEvent*
101 _PublicColorChangeEvent::CreateInstanceN(const Control& source)
103 _PublicColorChangeEvent* pCoreColorChangeEvent = new (std::nothrow) _PublicColorChangeEvent(source);
104 SysTryReturn(NID_UI_CTRL, (pCoreColorChangeEvent != null), null, E_OUT_OF_MEMORY,
105 "[E_OUT_OF_MEMORY] Memory allocation failed.");
107 if (IsFailed(GetLastResult()))
112 return pCoreColorChangeEvent;
115 delete pCoreColorChangeEvent;
121 _PublicColorChangeEvent::CreateColorChangeEventArgN(const Color& color)
123 _PublicColorChangeEventArg* pEventArg = new (std::nothrow) _PublicColorChangeEventArg(color);
124 SysTryReturn(NID_UI_CTRL, (pEventArg != null), null, E_OUT_OF_MEMORY,
125 "[E_OUT_OF_MEMORY] Memory allocation failed.");
130 }}} // Tizen::Ui::Controls