Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / FUi_DragDropEvent.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file                FUi_DragDropEvent.cpp
19  * @brief               This is the implementation file for _DragDropEvent class
20  * @since               2.0
21  *
22  * This file contains the implementation of %_DragDropEvent class.
23  *
24  */
25
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"
32
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Runtime;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Ui;
37
38 namespace Tizen { namespace Ui
39 {
40 _DragDropEvent::_DragDropEvent()
41         : __pSource(null)
42 {
43         // NOTHING
44 }
45
46 _DragDropEvent::~_DragDropEvent()
47 {
48         // NOTHING
49 }
50
51
52 result
53 _DragDropEvent::Construct(const Control& source)
54 {
55         result r = E_SUCCESS;
56         r = _Event::Initialize();
57
58         // set event source
59         if (r == E_SUCCESS)
60         {
61                 __pSource = const_cast <Control*>(&source);
62         }
63
64         return (r);
65
66 }
67
68
69
70 bool
71 _DragDropEvent::Filter(const Tizen::Base::Runtime::IEventArg& eventArg)
72 {
73         return false;
74 }
75
76 result
77 _DragDropEvent::AddListener(const Tizen::Base::Runtime::IEventListener& listener,
78                                                         const Tizen::Base::Runtime::_EventDispatcher* pEventDispatcher)
79 {
80         result r = E_SUCCESS;
81         return r;
82 }
83
84 result
85 _DragDropEvent::Wait(void)
86 {
87         result r = E_SUCCESS;
88         return r;
89 }
90
91 result
92 _DragDropEvent::FireImpl(IEventListener* pListener, const IEventArg& arg)
93 {
94         SysTryReturnResult(NID_UI, pListener, E_INVALID_ARG, "The Invalid argument is given.");
95
96         IDragDropEventListener* pDragDropListener = dynamic_cast <IDragDropEventListener*>(pListener);
97         SysTryReturnResult(NID_UI, pDragDropListener, E_INVALID_ARG, "The Invalid argument is given.");
98
99         const _DragDropEventArg* pArg = dynamic_cast <const _DragDropEventArg*>(&arg);
100         SysTryReturnResult(NID_UI, pArg, E_INVALID_ARG, "The invalid Event Argument is given.");
101
102         switch (pArg->GetDragDropStatus())
103         {
104         case DRAG_DROP_INDICATED:
105                 break;
106
107         case DRAG_DROP_PRESSED:
108                 break;
109
110         case DRAG_DROP_LONG_PRESSED:
111                 break;
112
113         case DRAG_DROP_RELEASED:
114                 break;
115
116         case DRAG_DROP_MOVED:
117                 break;
118
119         case DRAG_DROP_DOUBLE_PRESSED:
120                 break;
121
122         case DRAG_DROP_FOCUS_IN:
123                 break;
124
125         case DRAG_DROP_FOCUS_OUT:
126                 break;
127
128         case DRAG_DROP_FLICKED:
129                 break;
130
131         case DRAG_DROP_FLICK_HELD:
132                 break;
133
134         case DRAG_DROP_DRAGGED:
135                 pDragDropListener->OnTouchDragged(*pArg->GetSource(), pArg->GetStartPosition(), pArg->GetCurrentPosition());
136                 break;
137
138         case DRAG_DROP_DROPPED:
139                 pDragDropListener->OnTouchDropped(*pArg->GetSource(), pArg->GetStartPosition(), pArg->GetCurrentPosition());
140                 break;
141
142         default:
143                 return E_SYSTEM;
144         }
145         return E_SUCCESS;
146 }
147
148 const Tizen::Ui::Control*
149 _DragDropEvent::GetSource(void) const
150 {
151         return (__pSource);
152 }
153
154 };
155 };    // Tizen::Ui