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_PublicSplitPanelEvent.cpp
19 * @brief This is the implementation for the _PublicSplitPanelEvent class.
25 #include <FBaseErrors.h>
26 #include <FBaseRtIEventListener.h>
27 #include <FUiCtrlSplitPanel.h>
28 #include <FBaseSysLog.h>
29 #include "FUiCtrl_PublicSplitPanelEvent.h"
30 #include "FUiCtrl_SplitPanelImpl.h"
34 using namespace Tizen::Base;
35 using namespace Tizen::Base::Runtime;
37 namespace Tizen { namespace Ui { namespace Controls
41 * @class _PublicSplitPanelEventArg
42 * @brief This class is used as the argument to change event listener.
44 * This class is used as the argument to change event listener. When an change event is generated
45 * (such as when a button is pressed) the SplitPanelEvent calls SplitPanelEventListener's OnTextd
46 * with an instance of this class as an argument.
48 * From this class, one can find out, the (event) source object and the change ID.
50 class _OSP_EXPORT_ _PublicSplitPanelEventArg
51 : public Tizen::Base::Runtime::IEventArg
52 , public Tizen::Base::Object
57 * This is the default class constructor.
61 _PublicSplitPanelEventArg(SplitPanelEventStatus status);
64 * This is the class destructor.
67 virtual ~_PublicSplitPanelEventArg(void);
72 SplitPanelEventStatus GetStatus(void) const;
79 SplitPanelEventStatus __status;
80 }; // _PublicSplitPanelEventArg
82 ////////////////////////////////////////////////////////////////////////////////
83 /// _PublicSplitPanelEventArg class Lifecycle
85 _PublicSplitPanelEventArg::_PublicSplitPanelEventArg(SplitPanelEventStatus status)
91 _PublicSplitPanelEventArg::~_PublicSplitPanelEventArg(void)
97 _PublicSplitPanelEventArg::GetStatus(void) const
102 ////////////////////////////////////////////////////////////////////////////////
103 /// _PublicSplitPanelEvent class Lifecycle
104 _PublicSplitPanelEvent::_PublicSplitPanelEvent(const SplitPanel& source)
107 //result r = Event::Construct();
108 result r = _Event::Initialize();
117 _PublicSplitPanelEvent::~_PublicSplitPanelEvent(void)
122 _PublicSplitPanelEvent*
123 _PublicSplitPanelEvent::CreateInstanceN(const SplitPanel& source)
125 _PublicSplitPanelEvent* pPublicSplitPanelEvent = new (std::nothrow) _PublicSplitPanelEvent(source);
126 SysTryReturn(NID_UI_CTRL, pPublicSplitPanelEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
128 return pPublicSplitPanelEvent;
134 _PublicSplitPanelEvent::GetSource(void) const
142 _PublicSplitPanelEvent::FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg)
144 // cast to IActionEventListener
145 ISplitPanelEventListener* pSplitPanelEventListener = dynamic_cast <ISplitPanelEventListener*>(&listener);
146 SysTryReturnVoidResult(NID_UI_CTRL, pSplitPanelEventListener != null, E_INVALID_ARG, "[E_INVALID_ARG] The invalid listener was given.");
148 // cast to _PublicSplitPanelEventArg
149 const _PublicSplitPanelEventArg* pArg = dynamic_cast <const _PublicSplitPanelEventArg*>(&arg);
150 SysTryReturnVoidResult(NID_UI_CTRL, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The invalid Event Argument was given.");
152 SplitPanel* pSource = null;
153 pSource = const_cast <SplitPanel*>(__pSource);
155 // call cursor change event listener method
156 SplitPanelEventStatus status = pArg->GetStatus();
157 if (status == SPLIT_PANEL_EVENT_DIVIDER_POSITION_CHANGE)
159 pSplitPanelEventListener->OnDividerPositionChanged(*pSource, pSource->GetDividerPosition());
163 pSplitPanelEventListener->OnDividerDoublePressed(*pSource);
168 _PublicSplitPanelEvent::CreateSplitPanelEventArgN(SplitPanelEventStatus status)
170 _PublicSplitPanelEventArg* pEventArg = new (std::nothrow) _PublicSplitPanelEventArg(status);
171 SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
176 }}} // Tizen::Ui::Controls