VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIStateIndicator.h@ 35740

Last change on this file since 35740 was 28800, checked in by vboxsync, 14 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VirtualBox Qt extensions: QIStateIndicator class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2007 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __QIStateIndicator_h__
20#define __QIStateIndicator_h__
21
22/* Qt includes */
23#include <QFrame>
24#include <QHash>
25
26class QIStateIndicator : public QFrame
27{
28 Q_OBJECT;
29
30public:
31
32 QIStateIndicator (QWidget *pParent = 0);
33 QIStateIndicator (int aState);
34 ~QIStateIndicator();
35
36 virtual QSize sizeHint() const;
37
38 int state () const { return mState; }
39
40 QPixmap stateIcon (int aState) const;
41 void setStateIcon (int aState, const QPixmap &aPixmap);
42
43 virtual void updateAppearance() {}
44
45public slots:
46
47 virtual void setState (int aState);
48 virtual void setState (bool aState) { setState ((int) aState); }
49
50signals:
51
52 void mouseDoubleClicked (QIStateIndicator *aIndicator,
53 QMouseEvent *aEv);
54 void contextMenuRequested (QIStateIndicator *aIndicator,
55 QContextMenuEvent *aEv);
56
57protected:
58
59 virtual void paintEvent (QPaintEvent *aEv);
60 virtual void drawContents (QPainter *aPainter);
61
62#ifdef Q_WS_MAC
63 virtual void mousePressEvent (QMouseEvent *aEv);
64#endif
65 virtual void mouseDoubleClickEvent (QMouseEvent *aEv);
66 virtual void contextMenuEvent (QContextMenuEvent *aEv);
67
68private:
69
70 int mState;
71 QSize mSize;
72
73 struct Icon
74 {
75 Icon (const QPixmap &aPixmap)
76 : pixmap (aPixmap)
77 , bgPixmap (NULL) {}
78
79 QPixmap pixmap;
80 QPixmap cached;
81 QColor bgColor;
82 const QPixmap *bgPixmap;
83 QPoint bgOff;
84 };
85
86 QHash <int, Icon *> mStateIcons;
87};
88
89#endif // __QIStateIndicator_h__
90
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use