UIPopupStackViewport.cpp revision d34409ad02ea0d28e08a6c4b089a412fdb3b4c9c
/* $Id$ */
/** @file
* VBox Qt GUI - UIPopupStackViewport class implementation.
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* GUI includes: */
#include "UIPopupStackViewport.h"
#include "UIPopupPane.h"
/* Other VBox includes: */
: m_iLayoutMargin(1)
, m_iLayoutSpacing(1)
{
}
{
/* Is there already popup-pane with the same ID? */
}
{
/* Make sure there is no such popup-pane already: */
{
AssertMsgFailed(("Popup-pane already exists!"));
return;
}
/* Create new popup-pane: */
/* Attach popup-pane connection: */
connect(this, SIGNAL(sigProposePopupPaneWidth(int)), pPopupPane, SLOT(sltHandleProposalForWidth(int)));
/* Show popup-pane: */
pPopupPane->show();
}
{
/* Make sure there is such popup-pane already: */
{
AssertMsgFailed(("Popup-pane doesn't exists!"));
return;
}
/* Get existing popup-pane: */
/* Update message and details: */
}
{
/* Make sure there is such popup-pane already: */
{
AssertMsgFailed(("Popup-pane doesn't exists!"));
return;
}
/* Get existing popup-pane: */
/* Recall popup-pane: */
pPopupPane->recall();
}
{
/* Subtract layout margins: */
/* Propagate resulting width to popups: */
}
{
/* Update size-hint: */
/* Layout content: */
/* Notify parent popup-stack: */
}
{
/* Make sure the sender is the popup-pane: */
if (!pPopupPane)
{
AssertMsgFailed(("Should be called by popup-pane only!"));
return;
}
/* Make sure the popup-pane still exists: */
if (strPopupPaneID.isNull())
{
AssertMsgFailed(("Popup-pane already destroyed!"));
return;
}
/* Notify listeners about popup-pane removal: */
/* Delete popup-pane asyncronously.
* To avoid issues with events which already posted: */
/* Notify listeners about popup-pane removed: */
/* Adjust geometry: */
/* Make sure this stack still contains popup-panes: */
return;
/* Notify listeners about popup-stack: */
}
void UIPopupStackViewport::updateSizeHint()
{
/* Calculate minimum width-hint: */
int iMinimumWidthHint = 0;
{
/* Take into account all the panes: */
/* And two margins finally: */
}
/* Calculate minimum height-hint: */
int iMinimumHeightHint = 0;
{
/* Take into account all the panes: */
/* Take into account all the spacings, if any: */
/* And two margins finally: */
}
/* Compose minimum size-hint: */
}
void UIPopupStackViewport::layoutContent()
{
/* Get attributes: */
int iX = m_iLayoutMargin;
int iY = m_iLayoutMargin;
/* Layout every pane we have: */
{
/* Get pane attributes: */
/* Adjust geometry for the pane: */
pPane->layoutContent();
/* Increment placeholder: */
}
}