homescreenapp/hsutils/src/hsmenueventtransition.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 27 May 2010 12:46:08 +0300
changeset 51 4785f57bf3d4
parent 39 4e8ebe173323
permissions -rw-r--r--
Revision: 201019 Kit: 2010121

/*
* Copyright (c) 2009 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:  Menu Event Transition.
*
*/

#include <QState>
#include "hsmenueventtransition.h"


/*!
    \class HsMenuEventTransition
    \ingroup group_hsutils
    \brief Transition that happens when specifc event occurs.

    \sa HsMenuEvent
*/

/*!
    Constructor
    \param aOperation Menu event specific type.
    \param aSourceState Source state.
    \param aTargetState Target state.
*/
HsMenuEventTransition::HsMenuEventTransition(
    HsMenuEvent::OperationType aOperation, QState *aSourceState, QState *aTargetState) :
    QEventTransition(aSourceState),
    mOperation(aOperation)
{
    setTargetState(aTargetState);
}

/*!
    Reimplements method from QEventTransition. Calls the base class method
    passing \a event. Also stores \a event properties in the transition.
    \param event Event to test.
    \return \a true if \a event is going to trigger the transition.
*/
bool HsMenuEventTransition::eventTest(QEvent *event)
{
    if (event->type() == HsMenuEvent::eventType()) {
        HsMenuEvent *me = static_cast<HsMenuEvent *>(event);
        bool result = me->operation() == mOperation;

        return result;
    } else {
        return false;
    }
}