stateproviders/ftustateprovider/inc/ftuwizardactivatedstate.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:24:41 +0300
changeset 2 66c26770985f
parent 0 c464cd7e2753
child 7 446dc0e90e84
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
* 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:  
*
*/


#ifndef FTU_STATES_WIZARDACTIVATEDSTATE_H
#define FTU_STATES_WIZARDACTIVATEDSTATE_H

#include <QState>
#include <QAbstractItemModel>
#include "ftutest_global.h"

FTU_TEST_CLASS(FtuStateProviderTest)

class QGraphicsWidget;
class HbMainWindow;
class HbLabel;
class HbStackedWidget;
class HbView;
class HbDocumentLoader;
class HbAction;
class HbGridView;
class QGraphicsLinearLayout;
class FtuContentService;
class FtuWizard;
class HbMenu;
 
/** @ingroup group_ftustateprovider
 * @brief The state handles wizard activation and interaction.
 *
 * @see StateMachine
 *
 * @lib ?library
 * @since S60 ?S60_version
 */
class FtuWizardActivatedState : public QState
{
    Q_OBJECT
public: 
    /*
     * The plugin's display mode enumeration.
     * FullScreen means menustrip is not shown.
     * PartialScreen means menustrip is shown.
     */
    enum PluginDisplayMode{FullScreen, PartialScreen};
    
public:

    /**
     * Constructor.
     * @since S60 ?S60_version.     
     * @param aParent Owner.
     */
    FtuWizardActivatedState(QState *aParent = 0);

    /**
     * Destructor.
     * @since S60 ?S60_version.
     */
	virtual ~FtuWizardActivatedState();
	
protected:

    /**
     * @copydoc QState::onEntry()
     */
    void onEntry(QEvent *event);
    
    /**
     * @copydoc QState::onExit()
     */
    void onExit(QEvent *event);

private:
    
    /**
     * Returns content service object.
     * @return The content service pointer.
     * @since S60 ?S60_version.
     */
    FtuContentService *content() const;
    
    /**
     * Returns the main window handle.
     * @since S60 ?S60_version.
     * @return The pointer to the main window.
     */
    HbMainWindow* mainWindow();
    
    /**
     * Creates the menustrip.
     * @since S60 ?S60_version.
     */   
    void constructGrid();

    /**
     * Connects signals and slots for active wizard.
     * @since S60 ?S60_version.
     */  
    void setActiveWizardConnections();
        
    /**
     * Calculates the wizard's geometry.
     * @since S60 ?S60_version.
     * @return The calculated rect.
     */       
    QRectF calculateWizardGeometry();
    
public slots:
    
    /**
     * Signalled when back action is triggerd from toolbaar.
     * @since S60 ?S60_version.
     */
    void handleBackEvent();
    
    /**
     * @copydoc FtuWizard::onViewChanged
     */
    void changeWizardView(FtuWizard *caller, QGraphicsWidget* viewWidget);
    
    /**
      * @copydoc FtuWizard::fullScreenModeRequested
      */
    void enableFullScreenMode(FtuWizard *caller);
     
    /**
      * @copydoc FtuWizard::partialScreenModeRequested
      */
    void enablePartialScreenMode(FtuWizard *caller);
    
    /**
     * @copydoc FtuWizard::onInfoTextUpdated
     */
    void updateInfoText(FtuWizard *caller, QString text);
    
    /**
     * Handles the item selection from grid.
     * @param index The activated item.
     * @sice S60 ?S60_version.
     */
    void activateWizard(const QModelIndex index);
    
    /**
     * Called when the wizards wants to show/udpate the view options menu.
     * @since S60 ?S60_version.
     * @param caller the Wizard which wants to update/set the options menu
     * @param optionsmenu pointer to the HbMenu instance describing the menu to be show
     */   
    void updateMainMenu(FtuWizard *, HbMenu * );

signals:
        
    /**
     * Emitted when the menu state is to be activated.
     * @since S60 ?S60_version.
     */
    void backEventTriggered();  
 
private:

    /**
     * HbMainWindow instance.
     */
    HbMainWindow*           mMainWindow;
    
    /**
     * HbDocumentLoader instance.
     */
    HbDocumentLoader*       mDocumentLoader;

    /**
     * Plugin view instance.
     */
    HbView*                 mPluginView;
    
    /**
     * Pointer to the activated wizard. Not owned.
     */
    FtuWizard*              mActiveWizard;    
   
    /**
     * Info text label.
     */
    HbLabel*                mPluginTitleLabel;

    /**
     * Wizard widget area.
     */
    HbStackedWidget*        mWizardStackedWidget;

    /**
     * Back action overriding the app exit functionality.
     */
    HbAction*               mBackAction;
    
    /**
     * The menustrip component.
     */     
    HbGridView*             mMenustrip;
    
    /**
     * Plugin's previously activated view.
     */
    QGraphicsWidget*        mPreviousView;

    /**
     * Plugin's currently activated view.
     */
    QGraphicsWidget*        mCurrentView;

    /**
     * The Plugin's display mode.
     */
    PluginDisplayMode       mPluginDisplayMode;
    
    FTU_TEST_FRIEND_CLASS(FtuStateProviderTest)    
};

#endif //FTU_STATES_WizardActivatedState_H