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 #include <FBaseErrors.h>
20 #include <FBaseSysLog.h>
21 #include "FUiCtrl_ISplitPanelEventListener.h"
22 #include "FUiCtrl_SplitPanelEvent.h"
23 #include "FUiCtrl_SplitPanel.h"
26 using namespace Tizen::Base;
27 using namespace Tizen::Base::Runtime;
29 namespace Tizen { namespace Ui { namespace Controls
33 * @class _SplitPanelEventArg
34 * @brief This class is used as the argument to action event listener.
36 * This class is used as the argument to splitpanel event listener. When an splitpanel event is generated
37 * (such as when a splitpanel is pressed) the SplitPanelEvent calls SplitPanelEventListener's OnActionPerformed
38 * with an instance of this class as an argument.
40 * From this class, one can find out, the (event) source object and the action ID.
42 class _OSP_EXPORT_ _SplitPanelEventArg
49 * This is the default class constructor.
53 _SplitPanelEventArg(_SplitPanelEventStatus status);
56 * This is the class destructor.
59 virtual ~_SplitPanelEventArg(void);
65 * This method returns the status which the event initially occurred.
67 * @return See the comment above.
69 _SplitPanelEventStatus GetStatus(void) const;
77 _SplitPanelEventStatus __status;
80 _SplitPanelEventArg::_SplitPanelEventArg(_SplitPanelEventStatus status)
86 _SplitPanelEventArg::~_SplitPanelEventArg(void)
91 _SplitPanelEventStatus
92 _SplitPanelEventArg::GetStatus(void) const
97 _SplitPanelEvent::_SplitPanelEvent(const _SplitPanel& source)
100 result r = _Event::Initialize();
109 _SplitPanelEvent::~_SplitPanelEvent(void)
115 _SplitPanelEvent::CreateInstanceN(const _SplitPanel& source)
117 _SplitPanelEvent* pSplitPanelEvent = new (std::nothrow) _SplitPanelEvent(source);
118 SysTryReturn(NID_UI_CTRL, pSplitPanelEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
120 if (IsFailed(GetLastResult()))
125 return pSplitPanelEvent;
128 delete pSplitPanelEvent;
133 _SplitPanelEvent::GetSource(void) const
139 _SplitPanelEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
141 // cast to _IActionEventListener
142 _ISplitPanelEventListener* pSplitPanelListner = dynamic_cast <_ISplitPanelEventListener*>(&listener);
143 SysTryReturnVoidResult(NID_UI_CTRL, pSplitPanelListner != null, E_INVALID_ARG, "[E_INVALID_ARG] The invalid listener was given.\n");
145 // cast to _SplitPanelEventArg
146 const _SplitPanelEventArg* pArg = dynamic_cast <const _SplitPanelEventArg*>(&arg);
147 SysTryReturnVoidResult(NID_UI_CTRL, pArg != null, E_INVALID_ARG, "[E_INVALID_ARG] The invalid Event Argument was given.\n");
149 _SplitPanel* pSource = null;
150 pSource = const_cast <_SplitPanel*>(__pSource);
151 SysTryReturnVoidResult(NID_UI_CTRL, pSource != null, E_INVALID_ARG, "[E_INVALID_ARG] The invalid Event Argument was given.\n");
153 // call cursor change event listener method
154 _SplitPanelEventStatus status= pArg->GetStatus();
156 if (status == _SPLIT_PANEL_EVENT_DIVIDER_POSITION_CHANGE)
158 pSplitPanelListner->OnDividerPositionChanged(*pSource, pSource->GetDividerPosition());
162 pSplitPanelListner->OnDividerDoublePressed(*pSource);
167 _SplitPanelEvent::CreateSplitPanelEventArgN(_SplitPanelEventStatus status)
169 _SplitPanelEventArg* pEventArg = new (std::nothrow) _SplitPanelEventArg(status);
170 SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
175 }}} // Tizen::Ui::Controls