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 FUi_DragDropEvent.cpp
19 * @brief This is the implementation file for _DragDropEvent class
22 * This file contains the implementation of %_DragDropEvent class.
26 #include <FBaseErrors.h>
27 #include <FUiIDragDropEventListener.h>
28 #include <FUiControl.h>
29 #include <FBaseSysLog.h>
30 #include "FUi_DragDropEvent.h"
31 #include "FUi_DragDropEventArg.h"
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Runtime;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Ui;
38 namespace Tizen { namespace Ui
40 _DragDropEvent::_DragDropEvent()
46 _DragDropEvent::~_DragDropEvent()
53 _DragDropEvent::Construct(const Control& source)
56 r = _Event::Initialize();
61 __pSource = const_cast <Control*>(&source);
71 _DragDropEvent::Filter(const Tizen::Base::Runtime::IEventArg& eventArg)
77 _DragDropEvent::AddListener(const Tizen::Base::Runtime::IEventListener& listener,
78 const Tizen::Base::Runtime::_EventDispatcher* pEventDispatcher)
85 _DragDropEvent::Wait(void)
92 _DragDropEvent::FireImpl(IEventListener* pListener, const IEventArg& arg)
94 SysTryReturnResult(NID_UI, pListener, E_INVALID_ARG, "The Invalid argument is given.");
96 IDragDropEventListener* pDragDropListener = dynamic_cast <IDragDropEventListener*>(pListener);
97 SysTryReturnResult(NID_UI, pDragDropListener, E_INVALID_ARG, "The Invalid argument is given.");
99 const _DragDropEventArg* pArg = dynamic_cast <const _DragDropEventArg*>(&arg);
100 SysTryReturnResult(NID_UI, pArg, E_INVALID_ARG, "The invalid Event Argument is given.");
102 switch (pArg->GetDragDropStatus())
104 case DRAG_DROP_INDICATED:
107 case DRAG_DROP_PRESSED:
110 case DRAG_DROP_LONG_PRESSED:
113 case DRAG_DROP_RELEASED:
116 case DRAG_DROP_MOVED:
119 case DRAG_DROP_DOUBLE_PRESSED:
122 case DRAG_DROP_FOCUS_IN:
125 case DRAG_DROP_FOCUS_OUT:
128 case DRAG_DROP_FLICKED:
131 case DRAG_DROP_FLICK_HELD:
134 case DRAG_DROP_DRAGGED:
135 pDragDropListener->OnTouchDragged(*pArg->GetSource(), pArg->GetStartPosition(), pArg->GetCurrentPosition());
138 case DRAG_DROP_DROPPED:
139 pDragDropListener->OnTouchDropped(*pArg->GetSource(), pArg->GetStartPosition(), pArg->GetCurrentPosition());
148 const Tizen::Ui::Control*
149 _DragDropEvent::GetSource(void) const