QIAdvancedToolBar.cpp revision d34409ad02ea0d28e08a6c4b089a412fdb3b4c9c
/* $Id$ */
/** @file
* VBox Qt GUI - QIAdvancedToolBar class implementation.
*/
/*
* Copyright (C) 2012 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.
*/
/* Qt includes: */
#include <QHBoxLayout>
#include <QAction>
#include <QToolButton>
/* GUI includes: */
#include "QIAdvancedToolBar.h"
/* More configurable tool-button for QIAdvancedToolBar: */
class QIAdvancedToolButton : public QToolButton
{
public:
/* Constructor: */
/* Size-hint: */
{
/* Make the button a little bit taller: */
}
/* Set the button to ignore mouse-press events if checked: */
void setIgnoreMousePressIfChecked(bool fIgnore)
{
}
private:
/* Mouse-press event reimplementation: */
{
/* Ignore event if button is in 'checked' state: */
if (m_fIgnoreMousePressIfChecked & isChecked())
return;
/* Call to base-class: */
}
/* Variables: */
};
, m_pMainLayout(0)
, m_fButtonUnique(false)
{
/* Create main-layout: */
m_pMainLayout = new QHBoxLayout(this);
#if defined (Q_WS_WIN)
m_pMainLayout->setContentsMargins(0, 0, 0, 0);
#else
m_pMainLayout->setContentsMargins(0, 0, 0, 0);
#endif
}
{
/* Add action: */
/* Set passed attributes: */
/* Create tool-button: */
/* Return added action position: */
}
{
/* Add action: */
/* Set passed attributes: */
/* Create tool-button: */
/* Return added action position: */
}
{
}
{
}
{
/* Make sure passed index feats the bounds: */
return;
/* Get corresponding action: */
/* Make sure other actions are unchecked: */
pAction->setChecked(false);
/* Make sure required action is checked: */
if (!pRequiredAction->isChecked())
pRequiredAction->setChecked(true);
}
{
/* Make sure passed index feats the bounds: */
return;
/* Get corresponding action: */
}
{
/* Remember tool-button style: */
/* Propagate it to all the currently existing buttons: */
}
{
/* Remember tool-button 'unique' flag: */
/* Propagate it to all the currently existing buttons: */
}
{
/* If every button is unique: */
if (m_fButtonUnique)
{
/* Uncheck all the other actions: */
{
if (pAction != pTriggeredAction)
pAction->setChecked(false);
}
}
/* Notify listeners: */
}
{
/* Check if sender is valid: */
if (!pSender)
return;
/* Determine corresponding action: */
/* Notify listeners: */
}
{
/* Add tool-button: */
/* Initialize tool-button: */
}
#include "QIAdvancedToolBar.moc"