1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Stray PointerUp Event Filter. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <osn/osnnew.h> |
|
19 #include <alf/alfevent.h> |
|
20 #include <alf/alfenv.h> |
|
21 #include <alf/alfwidgetevents.h> |
|
22 #include <alf/ialfscrollbarmodel.h> |
|
23 #include <alf/alfwidgetcontrol.h> |
|
24 |
|
25 #include "alfwidgetcontroleventfilter.h" |
|
26 |
|
27 enum EventfilterEvent |
|
28 { |
|
29 EEventStrayPointerUp=57423 |
|
30 }; |
|
31 //namespace Alf |
|
32 namespace Alf |
|
33 { |
|
34 AlfWidgetControlEventFilter::AlfWidgetControlEventFilter() |
|
35 { |
|
36 mButtonDown = false; |
|
37 } |
|
38 |
|
39 AlfWidgetControlEventFilter::~AlfWidgetControlEventFilter() |
|
40 { |
|
41 } |
|
42 |
|
43 IAlfWidgetEventHandler::AlfEventHandlerType AlfWidgetControlEventFilter |
|
44 ::eventHandlerType() |
|
45 { |
|
46 return IAlfWidgetEventHandler::ELogicalEventHandler; |
|
47 } |
|
48 |
|
49 IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase AlfWidgetControlEventFilter |
|
50 ::eventExecutionPhase() |
|
51 { |
|
52 return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; |
|
53 } |
|
54 |
|
55 bool AlfWidgetControlEventFilter::accept( |
|
56 CAlfWidgetControl& /*aControl*/, |
|
57 const TAlfEvent& /*aEvent */) const |
|
58 { |
|
59 return false; |
|
60 } |
|
61 |
|
62 AlfEventStatus AlfWidgetControlEventFilter::offerEvent( |
|
63 CAlfWidgetControl& aControl, |
|
64 const TAlfEvent& aEvent ) |
|
65 { |
|
66 if(aEvent.IsPointerEvent()) |
|
67 { |
|
68 if (aEvent.PointerEvent().iType == TPointerEvent::EButton1Down) |
|
69 { |
|
70 // Recieved PointerDown |
|
71 mButtonDown = true; |
|
72 } |
|
73 else if (aEvent.PointerUp()) |
|
74 { |
|
75 if(!mButtonDown) |
|
76 { |
|
77 // Recieved a stray pointerUp |
|
78 aControl.Env().Send(TAlfCustomEventCommand(EEventStrayPointerUp)); |
|
79 } |
|
80 mButtonDown = false; |
|
81 } |
|
82 } |
|
83 else if(aEvent.IsCustomEvent()) |
|
84 { |
|
85 if(aEvent.CustomParameter() == EEventStrayPointerUp) |
|
86 { |
|
87 if(mButtonDown) |
|
88 { |
|
89 mButtonDown = false; |
|
90 TAlfEvent customevent(EEventMissedPointerUp); |
|
91 aControl.handleEvent(customevent); |
|
92 } |
|
93 } |
|
94 } |
|
95 return EEventNotHandled; |
|
96 } |
|
97 |
|
98 void AlfWidgetControlEventFilter::setActiveStates( unsigned int /*aStates*/ ) |
|
99 { |
|
100 } |
|
101 IAlfInterfaceBase* AlfWidgetControlEventFilter::makeInterface ( const IfId& /*aType*/ ) |
|
102 { |
|
103 return NULL; |
|
104 } |
|
105 |
|
106 }// namespace Alf |
|
107 |
|