homescreenapp/stateplugins/hsapplibrarystateplugin/src/hsmainwindow.cpp
author hgs
Fri, 09 Jul 2010 14:36:01 +0300
changeset 63 52b0f64eeb51
parent 62 341166945d65
child 69 87476091b3f5
permissions -rw-r--r--
201027

/*
 * 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 view.
 *
 */

#include <HbMainWindow>
#include <HbView>
#include <HbInstance>
#include "hsmainwindow.h"
#include "hsmenuview.h"


/*!
 Constructor
 */



/*
 * A word about HsMainWindow class.
 * This is not an utility class. It was designed to isolate HbMainWindow connected code, so
 * it can be substitued in MT for application library. Unfortunately it seems to be the best
 * way to cope with HbMainWindow problem in MT.  
 */


HsMainWindow::HsMainWindow() 
{
}

/*!
 Destructor
 */
HsMainWindow::~HsMainWindow()
{
}

/*!
 Add the \menuView to first instance of HbMainWindow registered in HbInstance.
 \param view View to be added to HbMainWindow.
*/
void HsMainWindow::setCurrentView(const HsMenuView &menuView)
{
    HbMainWindow *const hbW(
        HbInstance::instance()->allMainWindows().value(0));

    HbView *const view = menuView.view();
    
    if (!hbW->views().contains(view)) {
        hbW->addView(view);
    }
    hbW->setCurrentView(view);
}