QIStateIndicator.cpp revision e64031e20c39650a7bc902a3e1aba613b9415dee
0N/A * VBox frontends: Qt GUI ("VirtualBox"): 0N/A * VirtualBox Qt extensions: QIStateIndicator class implementation 2362N/A * Copyright (C) 2006-2007 Oracle Corporation 0N/A * This file is part of VirtualBox Open Source Edition (OSE), as 0N/A * you can redistribute it and/or modify it under the terms of the GNU 0N/A * General Public License (GPL) as published by the Free Software 0N/A * Foundation, in version 2 as it comes in the "COPYING" file of the 0N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 0N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 0N/A/** @clas QIStateIndicator 0N/A * The QIStateIndicator class is a simple class that can visually indicate 0N/A * the state of some thing, as described by the state property. 0N/A * Constructs a new QIStateIndicator instance. This instance is useless 0N/A * until icons are specified for necessary states. 0N/A * the initial indicator state 0N/A// : QFrame (aParent, aName, aFlags | Qt::WStaticContents | Qt::WMouseNoMask) /* we will precompose the pixmap background using the widget bacground in * drawContents(), so try to set the correct bacground origin for the * case when a pixmap is used as a widget background. */ // setBackgroundOrigin (aParent->backgroundOrigin()); * Sets an icon for the specified state. The first icon set by this method * defines the preferred size of this indicator. All other icons will be * scaled to fit this size. * @note If this widget is constructed with the WNoAutoErase flag, then all * transparent areas of the new state icon are filled with the widget * background color or pixmap (as taken from the widget palette), to provide * flicker free state redraws in one single operation (which is useful for * indicators that frequently change their state). /* Here we just set the original pixmap. All actual work from the @note * above takes place in #drawContents(). */ * Make the left button also show the context menu to make things * simpler for users with single mouse button mice (laptops++). /* Do this for the left mouse button event only, cause in the case of the * right mouse button it could happen that the context menu event is * triggered twice. Also this isn't necessary for the middle mouse button * which would be some kind of overstated. */