VBoxToolBar.h revision 1035d562455d7d1564221cb500873d6d394c029c
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* VBoxToolBar class declaration & implementation
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___VBoxToolBar_h___
#define ___VBoxToolBar_h___
#ifdef Q_WS_MAC
# include "VBoxUtils.h"
#endif
/* Qt includes */
#include <QToolBar>
#include <QMainWindow>
/* Note: This styles are available on _all_ platforms. */
#include <QCleanlooksStyle>
#include <QWindowsStyle>
/**
* The VBoxToolBar class is a simple QToolBar reimplementation to disable
* its built-in context menu and add some default behavior we need.
*/
{
{
setFloatable (false);
setMovable (false);
if (layout())
layout()->setContentsMargins (0, 0, 0, 0);;
/* Remove that ugly frame panel around the toolbar. */
/* I'm not sure if we should do this generally on linux for that mass
* of KDE styles. But maybe some of them are based on CleanLooks so
* they are looking ok also. */
if (!style)
/* Check for cleanlooks style */
if (!style)
/* Check for windows style */
if (style)
setStyleSheet ("QToolBar { border: 0px none black; }");
}
void setMacToolbar ()
{
#ifdef Q_WS_MAC
if (mMainWindow)
{
# ifdef QT_MAC_USE_COCOA
/** @todo Carbon -> Cocoa */
# else /* !QT_MAC_USE_COCOA */
# endif /* !QT_MAC_USE_COCOA */
}
#endif /* Q_WS_MAC */
}
#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
{
if (eclass == kEventClassMouse)
{
GetEventParameter (aEvent, kEventParamWindowPartCode, typeWindowPartCode, NULL, sizeof (WindowPartCode), NULL, &partCode);
if (partCode == 15 ||
partCode == 4)
{
EventMouseButton button = 0;
GetEventParameter (aEvent, kEventParamMouseButton, typeMouseButton, NULL, sizeof (button), NULL, &button);
if (button != kEventMouseButtonPrimary)
return noErr;
}
}
}
#endif /* Q_WS_MAC && !QT_MAC_USE_COCOA */
void setShowToolBarButton (bool aShow)
{
#ifdef Q_WS_MAC
#else /* Q_WS_MAC */
#endif /* !Q_WS_MAC */
}
void setUsesTextLabel (bool enable)
{
if (!enable)
if (mMainWindow)
else
}
};
#endif // !___VBoxToolBar_h___