VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h@ 50823

Last change on this file since 50823 was 50823, checked in by vboxsync, 11 years ago

FE/Qt: Revert r92847 because it's not good enough.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * UIMachineWindow class declaration
5 */
6
7/*
8 * Copyright (C) 2010-2013 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 __UIMachineWindow_h__
20#define __UIMachineWindow_h__
21
22/* Qt includes: */
23#include <QMainWindow>
24
25/* GUI includes: */
26#include "QIWithRetranslateUI.h"
27#include "UIDefs.h"
28
29/* COM includes: */
30#include "COMEnums.h"
31#include "CMachine.h"
32
33/* Forward declarations: */
34class QGridLayout;
35class QSpacerItem;
36class QCloseEvent;
37class CSession;
38class UISession;
39class UIMachineLogic;
40class UIMachineView;
41
42/* Machine-window interface: */
43class UIMachineWindow : public QIWithRetranslateUI2<QMainWindow>
44{
45 Q_OBJECT;
46
47public:
48
49 /* Factory functions to create/destroy machine-window: */
50 static UIMachineWindow* create(UIMachineLogic *pMachineLogic, ulong uScreenId = 0);
51 static void destroy(UIMachineWindow *pWhichWindow);
52
53 /* Prepare/cleanup machine-window: */
54 void prepare();
55 void cleanup();
56
57 /* Public getters: */
58 ulong screenId() const { return m_uScreenId; }
59 UIMachineView* machineView() const { return m_pMachineView; }
60 UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
61 UISession* uisession() const;
62 CSession& session() const;
63 CMachine machine() const;
64
65 /** Adjusts machine-window size to correspond current guest screen size.
66 * @param fAdjustPosition determines whether is it necessary to adjust position too.
67 * @note Reimplemented in sub-classes. Base implementation does nothing. */
68 virtual void normalizeGeometry(bool fAdjustPosition) { Q_UNUSED(fAdjustPosition); }
69
70#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
71 /* Virtual caller for base class setMask: */
72 virtual void setMask(const QRegion &region);
73#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
74
75protected slots:
76
77 /* Session event-handlers: */
78 virtual void sltMachineStateChanged();
79
80protected:
81
82 /* Constructor: */
83 UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId);
84
85 /* Show stuff: */
86 virtual void showInNecessaryMode() = 0;
87
88 /* Translate stuff: */
89 void retranslateUi();
90
91 /* Event handlers: */
92#ifdef Q_WS_X11
93 bool x11Event(XEvent *pEvent);
94#endif /* Q_WS_X11 */
95 void closeEvent(QCloseEvent *pEvent);
96
97#ifdef Q_WS_MAC
98 /** Mac OS X: Handles native notifications.
99 * @param strNativeNotificationName Native notification name. */
100 virtual void handleNativeNotification(const QString & /* strNativeNotificationName */) {}
101#endif /* Q_WS_MAC */
102
103 /* Prepare helpers: */
104 virtual void prepareSessionConnections();
105 virtual void prepareMainLayout();
106 virtual void prepareMenu() {}
107 virtual void prepareStatusBar() {}
108 virtual void prepareMachineView();
109 virtual void prepareVisualState() {}
110 virtual void prepareHandlers();
111 virtual void loadSettings() {}
112
113 /* Cleanup helpers: */
114 virtual void saveSettings() {}
115 virtual void cleanupHandlers();
116 virtual void cleanupVisualState() {}
117 virtual void cleanupMachineView();
118 virtual void cleanupStatusBar() {}
119 virtual void cleanupMenu() {}
120 virtual void cleanupMainLayout() {}
121 virtual void cleanupSessionConnections() {}
122
123 /* Update stuff: */
124 virtual void updateAppearanceOf(int iElement);
125#ifdef VBOX_WITH_DEBUGGER_GUI
126 void updateDbgWindows();
127#endif /* VBOX_WITH_DEBUGGER_GUI */
128
129 /* Helpers: */
130 const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
131 static Qt::WindowFlags windowFlags(UIVisualStateType visualStateType);
132 static Qt::Alignment viewAlignment(UIVisualStateType visualStateType);
133
134#ifdef Q_WS_MAC
135 /** Mac OS X: Handles native notifications.
136 * @param strNativeNotificationName Native notification name.
137 * @param pWidget Widget, notification related to. */
138 static void handleNativeNotification(const QString &strNativeNotificationName, QWidget *pWidget);
139#endif /* Q_WS_MAC */
140
141 /* Variables: */
142 UIMachineLogic *m_pMachineLogic;
143 UIMachineView *m_pMachineView;
144 QString m_strWindowTitlePrefix;
145 ulong m_uScreenId;
146 QGridLayout *m_pMainLayout;
147 QSpacerItem *m_pTopSpacer;
148 QSpacerItem *m_pBottomSpacer;
149 QSpacerItem *m_pLeftSpacer;
150 QSpacerItem *m_pRightSpacer;
151
152 /* Friend classes: */
153 friend class UIMachineLogic;
154 friend class UIMachineLogicFullscreen;
155 friend class UIMachineLogicSeamless;
156};
157
158#endif // __UIMachineWindow_h__
159
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