homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmainwindow.cpp
changeset 51 4785f57bf3d4
child 60 30f14686fb04
child 62 341166945d65
equal deleted inserted replaced
46:23b5d6a29cce 51:4785f57bf3d4
       
     1 /*
       
     2  * Copyright (c) 2009 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: Menu view.
       
    15  *
       
    16  */
       
    17 
       
    18 #include <HbMainWindow>
       
    19 #include <HbView>
       
    20 #include <HbInstance>
       
    21 #include "hsmainwindow.h"
       
    22 #include "hsmenuview.h"
       
    23 
       
    24 /*!
       
    25  Constructor
       
    26  */
       
    27 HsMainWindow::HsMainWindow()
       
    28 {
       
    29 }
       
    30 
       
    31 /*!
       
    32  Destructor
       
    33  */
       
    34 HsMainWindow::~HsMainWindow()
       
    35 {
       
    36 }
       
    37 
       
    38 /*!
       
    39  Add the \menuView to first instance of HbMainWindow registered in HbInstance.
       
    40  \param view View to be added to HbMainWindow.
       
    41 */
       
    42 void HsMainWindow::setCurrentView(const HsMenuView &menuView)
       
    43 {
       
    44     HbMainWindow *const hbW(
       
    45         HbInstance::instance()->allMainWindows().value(0));
       
    46 
       
    47     HbView *const view = menuView.view();
       
    48     
       
    49     if (!hbW->views().contains(view)) {
       
    50         hbW->addView(view);
       
    51     }
       
    52     if (hbW->currentView() && !hbW->currentView()->isContentFullScreen()) {
       
    53         // quick trick to know if we are not comming from IDLE
       
    54         hbW->setCurrentView(view, true, Hb::ViewSwitchUseAltEvent);
       
    55     } else {
       
    56         hbW->setCurrentView(view);
       
    57     }    
       
    58 }
       
    59