VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/QIStateIndicator.h@ 7220

Last change on this file since 7220 was 7220, checked in by vboxsync, 17 years ago

Compile VirtualBox with qt4 on linux.

  • 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 * innotek Qt extensions: QIStateIndicator class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2007 innotek GmbH
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#include <q3frame.h>
23#include <qpixmap.h>
24
25#include <q3intdict.h>
26//Added by qt3to4:
27#include <QMouseEvent>
28#include <QContextMenuEvent>
29
30class QIStateIndicator : public Q3Frame
31{
32 Q_OBJECT
33
34public:
35
36 QIStateIndicator (int aState,
37 QWidget *aParent, const char *aName = 0,
38 Qt::WFlags aFlags = 0);
39
40 virtual QSize sizeHint() const;
41
42 int state () const { return mState; }
43
44 QPixmap stateIcon (int aState) const;
45 void setStateIcon (int aState, const QPixmap &aPixmap);
46
47public slots:
48
49 void setState (int aState);
50 void setState (bool aState) { setState ((int) aState); }
51
52signals:
53
54 void mouseDoubleClicked (QIStateIndicator *aIndicator,
55 QMouseEvent *aEv);
56 void contextMenuRequested (QIStateIndicator *aIndicator,
57 QContextMenuEvent *aEv);
58
59protected:
60
61 virtual void drawContents (QPainter *aPainter);
62
63#ifdef Q_WS_MAC
64 virtual void mousePressEvent (QMouseEvent *aEv);
65#endif
66 virtual void mouseDoubleClickEvent (QMouseEvent *aEv);
67 virtual void contextMenuEvent (QContextMenuEvent *aEv);
68
69private:
70
71 int mState;
72 QSize mSize;
73
74 struct Icon
75 {
76 Icon (const QPixmap &aPixmap)
77 : pixmap (aPixmap)
78 , bgPixmap (NULL) {}
79
80 QPixmap pixmap;
81 QPixmap cached;
82 QColor bgColor;
83 const QPixmap *bgPixmap;
84 QPoint bgOff;
85 };
86
87 Q3IntDict <Icon> mStateIcons;
88};
89
90#endif // __QIStateIndicator_h__
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette