VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMListBox.h@ 959

Last change on this file since 959 was 382, checked in by vboxsync, 18 years ago

export to OSE again

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxVMListBox, VBoxVMListBoxItem class declarations
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung 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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
21 */
22
23#ifndef __VBoxVMListBox_h__
24#define __VBoxVMListBox_h__
25
26#include "COMDefs.h"
27
28#include "VBoxSelectorWnd.h"
29#include "VBoxGlobal.h"
30
31#include <qlistbox.h>
32#include <qfont.h>
33#include <qdatetime.h>
34
35struct QUuid;
36class QColorGroup;
37
38class VBoxVMListBoxTip;
39class VBoxVMListBoxItem;
40
41/**
42 *
43 * The VBoxVMListBox class is a visual representation of the list of
44 * existing VMs in the VBox GUI.
45 *
46 * Every item in the list box is an instance of the VBoxVMListBoxItem
47 * class.
48 */
49class VBoxVMListBox : public QListBox
50{
51public:
52
53 VBoxVMListBox (QWidget *aParent = 0, const char *aName = NULL,
54 WFlags aFlags = 0);
55
56 virtual ~VBoxVMListBox();
57
58 QFont nameFont() const { return mNameFont; }
59
60 QFont stateFont (CEnums::SessionState aS) const
61 {
62 return aS == CEnums::SessionClosed ? font() : mStateBusyFont;
63 }
64
65 int margin() const { return mMargin; }
66
67 void refresh();
68 void refresh (const QUuid &aID);
69
70 VBoxVMListBoxItem *item (const QUuid &aID);
71
72 const QColorGroup &activeColorGroup() const;
73
74protected:
75
76 virtual void focusInEvent (QFocusEvent *aE);
77 virtual void focusOutEvent (QFocusEvent *aE);
78
79private:
80
81 CVirtualBox mVBox;
82 QFont mNameFont;
83 QFont mStateBusyFont;
84 int mMargin;
85
86 VBoxVMListBoxTip *mToolTip;
87 bool mGaveFocusToPopup;
88};
89
90/**
91 *
92 * The VBoxVMListBoxItem class is a visual representation of the virtual
93 * machine in the VBoxVMListBox widget.
94 *
95 * It holds a CMachine instance (passed to the constructor) to
96 * get an access to various VM data.
97 */
98class VBoxVMListBoxItem : public QListBoxItem
99{
100public:
101
102 VBoxVMListBoxItem (VBoxVMListBox *aLB, const CMachine &aM);
103 virtual ~VBoxVMListBoxItem();
104
105 QString text() const { return mName; }
106
107 VBoxVMListBox *vmListBox() const
108 {
109 return static_cast <VBoxVMListBox *> (listBox());
110 }
111
112 CMachine machine() const { return mMachine; }
113 void setMachine (const CMachine &aM);
114
115 QUuid id() const { return mId; }
116
117 void recache();
118
119 QString toolTipText() const;
120
121 int height (const QListBox *) const;
122 int width (const QListBox *) const;
123
124 bool accessible() const { return mAccessible; }
125 const CVirtualBoxErrorInfo &accessError() const { return mAccessError; }
126
127protected:
128
129 void paint (QPainter *aP);
130
131private:
132
133 CMachine mMachine;
134
135 /* cached machine data (to minimize server requests) */
136
137 QUuid mId;
138 QString mSettingsFile;
139
140 bool mAccessible;
141 CVirtualBoxErrorInfo mAccessError;
142
143 QString mName;
144 CEnums::MachineState mState;
145 QDateTime mLastStateChange;
146 CEnums::SessionState mSessionState;
147 QString mOSType;
148};
149
150#endif // __VBoxVMListItem_h__
Note: See TracBrowser for help on using the repository browser.

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