diff -r 4ea6f81c838a -r 0e9bb658ef58 widgetmodel/alfwidgetmodel/src/alfwidgetcontroleventfilter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgetmodel/alfwidgetmodel/src/alfwidgetcontroleventfilter.cpp Wed Sep 01 12:23:18 2010 +0100 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Stray PointerUp Event Filter. +* +*/ + +#include +#include +#include +#include +#include +#include + +#include "alfwidgetcontroleventfilter.h" + +enum EventfilterEvent + { + EEventStrayPointerUp=57423 + }; +//namespace Alf +namespace Alf +{ +AlfWidgetControlEventFilter::AlfWidgetControlEventFilter() + { + mButtonDown = false; + } + +AlfWidgetControlEventFilter::~AlfWidgetControlEventFilter() + { + } + +IAlfWidgetEventHandler::AlfEventHandlerType AlfWidgetControlEventFilter + ::eventHandlerType() + { + return IAlfWidgetEventHandler::ELogicalEventHandler; + } + +IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase AlfWidgetControlEventFilter + ::eventExecutionPhase() + { + return IAlfWidgetEventHandler::ETunnellingPhaseEventHandler; + } + +bool AlfWidgetControlEventFilter::accept( + CAlfWidgetControl& /*aControl*/, + const TAlfEvent& /*aEvent */) const + { + return false; + } + +AlfEventStatus AlfWidgetControlEventFilter::offerEvent( + CAlfWidgetControl& aControl, + const TAlfEvent& aEvent ) + { + if(aEvent.IsPointerEvent()) + { + if (aEvent.PointerEvent().iType == TPointerEvent::EButton1Down) + { + // Recieved PointerDown + mButtonDown = true; + } + else if (aEvent.PointerUp()) + { + if(!mButtonDown) + { + // Recieved a stray pointerUp + aControl.Env().Send(TAlfCustomEventCommand(EEventStrayPointerUp)); + } + mButtonDown = false; + } + } + else if(aEvent.IsCustomEvent()) + { + if(aEvent.CustomParameter() == EEventStrayPointerUp) + { + if(mButtonDown) + { + mButtonDown = false; + TAlfEvent customevent(EEventMissedPointerUp); + aControl.handleEvent(customevent); + } + } + } + return EEventNotHandled; + } + +void AlfWidgetControlEventFilter::setActiveStates( unsigned int /*aStates*/ ) + { + } +IAlfInterfaceBase* AlfWidgetControlEventFilter::makeInterface ( const IfId& /*aType*/ ) + { + return NULL; + } + +}// namespace Alf +